summaryrefslogtreecommitdiff
path: root/dev-util/scons
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /dev-util/scons
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'dev-util/scons')
-rw-r--r--dev-util/scons/Manifest12
-rw-r--r--dev-util/scons/files/scons-4.0.0-env-passthrough.patch40
-rw-r--r--dev-util/scons/files/scons-4.0.0-respect-cc-etc-r1.patch88
-rw-r--r--dev-util/scons/scons-4.0.0.ebuild87
-rw-r--r--dev-util/scons/scons-4.0.1.ebuild87
5 files changed, 314 insertions, 0 deletions
diff --git a/dev-util/scons/Manifest b/dev-util/scons/Manifest
index b2112628d216..659c2c88f67f 100644
--- a/dev-util/scons/Manifest
+++ b/dev-util/scons/Manifest
@@ -1,5 +1,7 @@
AUX scons-3.0.1-env-passthrough.patch 1507 BLAKE2B 9e21e0b14a3b6c95e2c501b5d264915a10c4c5908de98719c9a73c37f5f7de32824dce6df32a0884c4aeb53658d05cda5dbb9c6102ecd6307c085719d4e568c2 SHA512 07fa387b9ad50cd1e92495a414973acddac8c062827858b44867ff1da0560c1493d29992fe4ac2c6de8eb37ab218967df9a6d9ffa2cb26be772324a637fadbcb
AUX scons-3.0.3-respect-cc-etc-r1.patch 3381 BLAKE2B f7003c4fc7b054dbbfe4f185876470cf04461fd1a408f44bbac2967c9e709e7f16293dcdaf2042bda811610ca65e3007dceb0f8764b7ac2ea7675e901159d097 SHA512 054037a917a8cdc57fbca940a23699bb6ba55554b4753774df7d0b5102e0468ebb770910727f96ade949e69a6db94f2ed60e84061bd3967ff2366724980eb129
+AUX scons-4.0.0-env-passthrough.patch 1472 BLAKE2B 8f44a054fdf28ca1f049cb2f85f4e344fe294abbf1112b65c4037fd57850b4f0dc3852cdbb6e86d538d1d0543ed4409b789d1e4bb0f4ea2632ff3746e7455fdc SHA512 10fee12e0e120c81d7829d65b0f69ee295c768bec7ad6d5745963b956037d6ff4ad1bc1ec2e47871e3e9352a4855932e07a3e2a9e4b69f06bec5574bfec2e50d
+AUX scons-4.0.0-respect-cc-etc-r1.patch 3241 BLAKE2B 8e9cabb597db0c1cf278169bd6010168e46fc38895d00a0b013894b2783c65c5262156ded125e080b61927e34f40ef5ed4f2852dfd341d1d42bbcc1efad7b4ab SHA512 1878dc8f28d17aecd5c61b624c135ab3d1b311ec1b92687e1f205c4913dd5f99eeea0f7758d5623e6e60470c34fc2e7ce70571593f2197c8e59fed8df1586b53
DIST scons-3.1.1-user.html 1134061 BLAKE2B de025ff73ecacec591c63b22bb3f934962a34fa16bec47a58972b97ba28f9a88254b419b4d2edeb2d920e70cf3e0c739df5357956c8586e5377afcd4125ba0a8 SHA512 bd00bcdcd01b192a42110ec65cdb906963af08f5bbc9d5e61624b5b5b1a667b115b099ce2ef71444a8998171a5544f4caecf3acec9715876d4e9e5baa581e60d
DIST scons-3.1.1-user.pdf 2564248 BLAKE2B 702e57a9646779ff1aa077aa7ae7a815d004cda08166f948ef3b893a786c7ccf13e9d1f8621640573802acd0b6a7acaaf68ebea984d5922112a30c4457740bc4 SHA512 0c0f8e93e3bddd9dc0ec661f629f2995ec9375908b3b7bf2b67c9518571cb31754d13fca46fc1182019976e5c0a417832447692ff61f5ee4613b7f56c7891594
DIST scons-3.1.1.gh.tar.gz 5528538 BLAKE2B cbb13a0ec9c5ade9b965592f012af5a3ab5253a3c30a049da499631ff58fc1201666209316d9fbcc8f0a715b194327f3cebe5a50fde01635fdb0304b8fbbb2f6 SHA512 3347a7ec5c6c7b596c0d51bb4a9654b971734736febe3834df0f40e7839e1f0578dafeae838d5ddd9f3319ac3d17b6790666fa1602c30480eba25122355179a5
@@ -8,6 +10,16 @@ DIST scons-3.1.2-user.html 1126908 BLAKE2B 38e7695b6ef1e79b3eed4455fbe84ec1587be
DIST scons-3.1.2-user.pdf 2557502 BLAKE2B 1c89d845d23c4e434c9db11d8730121f0b8dc6f2fca21dabe3e7204373cdf743d831a1835731332e39ccd7f3f49da068ba34a33a2937e9dd205e38d9c8b2b321 SHA512 9da887c157cb95f7802cb4b96080b0e56f2ad7663021b8be0839e71d473422fe9dd0dadf0ad1b067160c39511e91c6b3d9aaff8e238bb46b10a03ae89b12e169
DIST scons-3.1.2.gh.tar.gz 5534888 BLAKE2B 63e8b069cfddfed6a2ce8bcb7816b51b1881ca7a1a3e552f2eec5ecd1deae80720b0acfb711ab17067efdc9d0e4aea696e9f4eee6b374071bfc60e7bb79cc58a SHA512 b096501ea37e62f596f16b46b4022ad7979f359b10849d4c5fa17731a6c3ec34e0890374de175a8aa7539ae677777142ccf5dfae39a74696efcdbcc00e89bccf
DIST scons-3.1.2.tar.gz 668298 BLAKE2B 14251e2bab425dfc31d1d6d9325a67725dae42576d2a5c204f0ff7948aa2da5aadd3fdf03bbbccd615757520fedee5e18ca2ba13aaf07a4ddfec330db4221203 SHA512 bfc0d58d33408a03eb37c1eff166af8139078026e6b43d6274afceac889d0a6743e359e89ad9a30be5ca43aeed26fba92fa4732854750b7d53091ef3e99b3d33
+DIST scons-4.0.0-user.html 1414886 BLAKE2B 1005a79040a4e035fa667a7c2f6231300c5fcade558d373eb6af36f4a8fdfcdb9c48ca0e5ecc36add72548f4ce6b904a745cbd6275649e1a1ce0e9172843259d SHA512 d4ce7b528ae714617a20adf49c66beb478d432f33f095ffb05f30038b2295cfe658c1dab421563dfae674bd0d4c343b98058cb8decc5393883675f4c9a7cf5a6
+DIST scons-4.0.0-user.pdf 2468838 BLAKE2B 6541fbc9d8f409ccde07746cb2a6e046fe4a4b868c2b6b80401c30c9d99a27acb2a4aedba9f47ba9e4cf8ac62510bec43a9aac33cba6912b837e13baeb996353 SHA512 cc62fd88dc0dda77515328b434492f8dbc0b4f615a2f3bb4841391ded7fbc738050b2ca7308c820d55efa59c28540391bd546ecec909b1fa7df66a944bdaa8aa
+DIST scons-4.0.0.gh.tar.gz 5584060 BLAKE2B 316be6af0cf52181391ba3251315a0d7da6024a3c650c3de927ff9db041aba096a95f09a7a13f64f78e20473490eb08fb2b0da191c9c3957fad9113e2d3dab14 SHA512 8277c8ceeba5e9612e8c757b3ab736cf116f66e707f4127b1e09f21d3a71ca7fd13dde0453f73b97c168cd05d8ba97084c010f3dcc1e29bb26ebbbeae9ea8338
+DIST scons-4.0.0.tar.gz 2874600 BLAKE2B 439b4e32cb62f5b9546af771eb292a5ff36eddb23fbd169fe065d2dbc3c3916d0551a2807bf765952384e46e036fe4b6142b739b5cfe385217539e1a22daf5ff SHA512 38c8f6600bc5f4b5385eb65ff1e98e8464dcea2a1128173f883a06822eca2e250998c666418a9cbbe2c30ff26da4de3c5fdd68381e68708d93e59bea8680337c
+DIST scons-4.0.1-user.html 1415152 BLAKE2B 1a94b2ef5e076d883f2960825f055c7cc39cfd1848be797a9519bf94834cd4174d3da3274ef77f64106c1cc182c3f8cef363e3982f5c227d3a6dcbeadbc847c2 SHA512 f1165836ad80c90caa4d936ffc86c0ed20ea4c5e7854c36fee3a2c575b1c05c731d4ece9554e43292e6da30176ad9f31f31cf12f84264307c1494f79b06f43c7
+DIST scons-4.0.1-user.pdf 2468804 BLAKE2B f0af6bc6b41d972b98e955ee3ccec908aa366eabe31bd01022abe1f6d3a94dd6d7da26f71de23a6dfbcbc7bb4e439463f69bb7e8a5780c1300e3ba508b9eb314 SHA512 0d2733e2f1391083522a64117bfd35a2160d1366382f6f630b26eba36fc12ce797467d5e16efeb3b7f58aa9d853f96ae0d50fe78f59e78d24642b146bc7e565d
+DIST scons-4.0.1.gh.tar.gz 5578800 BLAKE2B f9ece5eaf1b133219f975e484beb5df726560a38969b8e8ad829781b960b438458bfcd7971333da87560c957675b2a4f8675e757fb0a4268cc4ecf72bb60d45f SHA512 f23c5dfd3c236e9f9f85b986ca64a36dbd85e9f3383cb3577e082a7dea4b83283020fbf064c2d919ab116195c6708fc11f906fcf3b0bc0533a4bc49a4f7371c6
+DIST scons-4.0.1.tar.gz 2874481 BLAKE2B 98377e62ae31d32758a93c4e04c578b88ea541cc292af63c6ca43e2948745e416ee6d757d98129ee30d0e0bbab90664889441a5bb86d4c9dfc649ca1dbef7536 SHA512 400b11323d48f04395b519dfafb6fce15a6dea92013f599dc4895b112629c0a06c7d2806755c74047d001d60087b94f39a118f512b7ee8de6214a4ffc7310468
EBUILD scons-3.1.1.ebuild 2629 BLAKE2B 9b6dd42a2a625ae6110b2ead2754e0c5d1d69128c32058913d102d545c820ef9e2ca25e2cdedc69a01a777633c32fd7aa3ec598e4d8760ec349ecb1ce9b1bae7 SHA512 309b84180a14cf7233f4879832489da56dad5236f30f9c402037b9dd2737b3983fda32c233e966ce755a75c3db6392f44a385dedeee8d21c3880f9cfb364cd57
EBUILD scons-3.1.2.ebuild 2753 BLAKE2B 5f7115fbf7d3947bd90d1d147688110e13965bbcdcfd869eb7ac7222d942bd3fefc21f90d77bc0c9bfca58afc4ff593267635d8abed69cb0ad3fcc33ee62bd36 SHA512 2e479ac016b7dbb7f7a80652121f228621e9f85780cb0a3895b0a9b610fbcd376b7482897a993abe03ebddd176a66a83dbc2d5ad4e46a7b71f83e1c9cff39165
+EBUILD scons-4.0.0.ebuild 2623 BLAKE2B 664c157b4c0f9dc13fffd17caba6db18f3e6f0440a2a584fca5695e2d2788034ae3630f3c534ae605ec001e79751ad072425e973035cef52195198e05aa8c25f SHA512 b836e5e27e1a9cfe8fa8e42d69ea9f2154ddeabca65668bf47befaff72ae46ebd0925fae55f8ae8b73a72b4397ee45b7e3677e6834caa7ed0de49f58f5b0eefa
+EBUILD scons-4.0.1.ebuild 2623 BLAKE2B 664c157b4c0f9dc13fffd17caba6db18f3e6f0440a2a584fca5695e2d2788034ae3630f3c534ae605ec001e79751ad072425e973035cef52195198e05aa8c25f SHA512 b836e5e27e1a9cfe8fa8e42d69ea9f2154ddeabca65668bf47befaff72ae46ebd0925fae55f8ae8b73a72b4397ee45b7e3677e6834caa7ed0de49f58f5b0eefa
MISC metadata.xml 704 BLAKE2B 448bfef70e4f230008c21d8e542618a52f9761295ed33f1c7385a2a678bcb29d1028792e221441f9ba61fecb34646f5ef0f04795e28b17e8d4aeacbabf8751f2 SHA512 62e5c8c23f1c67c218ff6b33c1f941ac3c258b39a5b2d799bedceb734aa5b2e29a718f90823ab5bf199e9d1eb8236aefaddcbff99c6d03f58987fb4936b10aa6
diff --git a/dev-util/scons/files/scons-4.0.0-env-passthrough.patch b/dev-util/scons/files/scons-4.0.0-env-passthrough.patch
new file mode 100644
index 000000000000..23538395e972
--- /dev/null
+++ b/dev-util/scons/files/scons-4.0.0-env-passthrough.patch
@@ -0,0 +1,40 @@
+From f2f8536be12f1d095382e7598060c1eb51eb5337 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Wed, 9 May 2018 17:04:49 +0200
+Subject: [PATCH] posix: Support GENTOO_SCONS_ENV_PASSTHROUGH=1
+
+Support GENTOO_SCONS_ENV_PASSTHROUGH=1 variable to override the default
+of wiping the environment and resetting PATH to default, and instead
+pass all variables through.
+---
+ src/SCons/Platform/posix.py | 14 +++++++++++---
+ 1 file changed, 11 insertions(+), 3 deletions(-)
+
+diff --git a/src/SCons/Platform/posix.py b/src/SCons/Platform/posix.py
+index 8db08db1..af34650c 100644
+--- a/src/SCons/Platform/posix.py
++++ b/src/SCons/Platform/posix.py
+@@ -87,9 +87,17 @@ def generate(env):
+ pspawn = piped_env_spawn
+ # Note that this means that 'escape' is no longer used
+
+- if 'ENV' not in env:
+- env['ENV'] = {}
+- env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
++ # Force pass-through of environment variables in Gentoo builds
++ if os.environ.get('GENTOO_SCONS_ENV_PASSTHROUGH', False):
++ new_env = os.environ.copy()
++ if 'ENV' in env:
++ new_env.update(env['ENV'])
++ env['ENV'] = new_env
++ else:
++ if 'ENV' not in env:
++ env['ENV'] = {}
++ env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
++
+ env['OBJPREFIX'] = ''
+ env['OBJSUFFIX'] = '.o'
+ env['SHOBJPREFIX'] = '$OBJPREFIX'
+--
+2.17.0
+
diff --git a/dev-util/scons/files/scons-4.0.0-respect-cc-etc-r1.patch b/dev-util/scons/files/scons-4.0.0-respect-cc-etc-r1.patch
new file mode 100644
index 000000000000..d187a17ae60c
--- /dev/null
+++ b/dev-util/scons/files/scons-4.0.0-respect-cc-etc-r1.patch
@@ -0,0 +1,88 @@
+From 929986e568446f54c2a99c309fbb4d05bd4af00a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 10 May 2018 08:01:08 +0200
+Subject: [PATCH] posix: Also force common toolchain vars for Gentoo
+
+---
+ src/SCons/Platform/posix.py | 20 ++++++++++++++++++++
+ src/SCons/Tool/cc.py | 3 ++-
+ src/SCons/Tool/cxx.py | 3 ++-
+ src/SCons/Tool/link.py | 3 ++-
+ 4 files changed, 26 insertions(+), 3 deletions(-)
+
+diff --git a/src/SCons/Platform/posix.py b/src/SCons/Platform/posix.py
+index 739310a1..ef7528e0 100644
+--- a/src/SCons/Platform/posix.py
++++ b/src/SCons/Platform/posix.py
+@@ -95,6 +95,26 @@ def generate(env):
+ if 'ENV' in env:
+ new_env.update(env['ENV'])
+ env['ENV'] = new_env
++
++ # Furthermore, force common compiler/linker variables as well
++ envvar_mapping = {
++ 'AR': 'AR',
++ 'AS': 'AS',
++ 'ASFLAGS': 'ASFLAGS',
++ 'CC': 'CC',
++ 'CXX': 'CXX',
++ 'CFLAGS': 'CFLAGS',
++ 'CXXFLAGS': 'CXXFLAGS',
++ 'CPPFLAGS': 'CPPFLAGS',
++ 'LDFLAGS': 'LINKFLAGS',
++ }
++
++ for envvar, toolvar in envvar_mapping.items():
++ if toolvar not in env and envvar in env['ENV']:
++ val = env['ENV'][envvar]
++ if toolvar.endswith('FLAGS'):
++ val = SCons.Util.CLVar(val)
++ env[toolvar] = val
+ else:
+ if 'ENV' not in env:
+ env['ENV'] = {}
+diff --git a/src/SCons/Tool/cc.py b/src/SCons/Tool/cc.py
+index 590ec5fd..5f9229a0 100644
+--- a/src/SCons/Tool/cc.py
++++ b/src/SCons/Tool/cc.py
+@@ -80,7 +80,8 @@ def generate(env):
+
+ if 'CC' not in env:
+ env['CC'] = env.Detect(compilers) or compilers[0]
+- env['CFLAGS'] = SCons.Util.CLVar('')
++ if 'CFLAGS' not in env:
++ env['CFLAGS'] = SCons.Util.CLVar('')
+ env['CCCOM'] = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
+ env['SHCC'] = '$CC'
+ env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS')
+diff --git a/src/SCons/Tool/cxx.py b/src/SCons/Tool/cxx.py
+index 430851c8..ca5ab563 100644
+--- a/src/SCons/Tool/cxx.py
++++ b/src/SCons/Tool/cxx.py
+@@ -74,7 +74,8 @@ def generate(env):
+
+ if 'CXX' not in env:
+ env['CXX'] = env.Detect(compilers) or compilers[0]
+- env['CXXFLAGS'] = SCons.Util.CLVar('')
++ if 'CXXFLAGS' not in env:
++ env['CXXFLAGS'] = SCons.Util.CLVar('')
+ env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
+ env['SHCXX'] = '$CXX'
+ env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
+diff --git a/src/SCons/Tool/link.py b/src/SCons/Tool/link.py
+index 5adc6ca2..a12ea8ed 100644
+--- a/src/SCons/Tool/link.py
++++ b/src/SCons/Tool/link.py
+@@ -318,7 +318,8 @@ def generate(env):
+
+ env['SMARTLINK'] = smart_link
+ env['LINK'] = "$SMARTLINK"
+- env['LINKFLAGS'] = SCons.Util.CLVar('')
++ if 'LINKFLAGS' not in env:
++ env['LINKFLAGS'] = SCons.Util.CLVar('')
+
+ # __RPATH is only set to something ($_RPATH typically) on platforms that support it.
+ env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
+--
+2.20.1
+
diff --git a/dev-util/scons/scons-4.0.0.ebuild b/dev-util/scons/scons-4.0.0.ebuild
new file mode 100644
index 000000000000..3325adc75936
--- /dev/null
+++ b/dev-util/scons/scons-4.0.0.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_USE_SETUPTOOLS=rdepend
+PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="Extensible Python-based build utility"
+HOMEPAGE="https://www.scons.org/"
+SRC_URI="
+ https://downloads.sourceforge.net/project/scons/scons/${PV}/${P}.tar.gz
+ doc? (
+ https://www.scons.org/doc/${PV}/PDF/${PN}-user.pdf -> ${P}-user.pdf
+ https://www.scons.org/doc/${PV}/HTML/${PN}-user.html -> ${P}-user.html
+ )
+ test? ( https://github.com/scons/scons/archive/${PV}.tar.gz -> ${P}.gh.tar.gz )"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ test? (
+ dev-libs/libxml2[${PYTHON_USEDEP}]
+ dev-python/lxml[${PYTHON_USEDEP}]
+ )
+"
+
+S=${WORKDIR}/${P}/src
+
+PATCHES=(
+ # support env passthrough for Gentoo ebuilds
+ "${FILESDIR}"/scons-4.0.0-env-passthrough.patch
+ # respect CC, CXX, C*FLAGS, LDFLAGS by default
+ "${FILESDIR}"/scons-4.0.0-respect-cc-etc-r1.patch
+)
+
+src_unpack() {
+ # use the git directory structure, but put pregenerated release
+ # inside src/ subdirectory to make our life easier
+ if use test; then
+ unpack "${P}.gh.tar.gz"
+ else
+ mkdir -p "${P}"/src || die
+ fi
+
+ tar -C "${P}"/src --strip-components=1 -xzf "${DISTDIR}/${P}.tar.gz" || die
+}
+
+src_prepare() {
+ # apply patches relatively to top directory
+ cd "${WORKDIR}/${P}" || die
+ distutils-r1_src_prepare
+
+ # remove half-broken, useless custom commands
+ # and fix manpage install location
+ sed -i -e '/cmdclass/,/},$/d' \
+ -e '/data_files/s:man/:share/man/:' "${S}"/setup.py || die
+}
+
+python_test() {
+ # set variable from escons() of scons-util.eclass to make env-passthrough patch work within test env
+ local -x GENTOO_SCONS_ENV_PASSTHROUGH=1
+ # unset some env variables to pass appropriate tests
+ unset AR AS ASFLAGS CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+ cd "${WORKDIR}/${P}" || die
+ "${EPYTHON}" runtest.py -a --passed \
+ -j "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" \
+ --builddir "${BUILD_DIR}/lib"
+
+ # runtest.py script returns "0" if all tests are passed
+ # and returns "2" if there are any tests with "no result"
+ # (i.e. in case if some tools are not installed or it's Windows specific tests)
+ [[ ${?} == [02] ]] || die "Tests fail with ${EPYTHON}"
+}
+
+python_install_all() {
+ distutils-r1_python_install_all
+
+ use doc && dodoc "${DISTDIR}"/${P}-user.{pdf,html}
+}
diff --git a/dev-util/scons/scons-4.0.1.ebuild b/dev-util/scons/scons-4.0.1.ebuild
new file mode 100644
index 000000000000..3325adc75936
--- /dev/null
+++ b/dev-util/scons/scons-4.0.1.ebuild
@@ -0,0 +1,87 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DISTUTILS_USE_SETUPTOOLS=rdepend
+PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_REQ_USE="threads(+)"
+
+inherit distutils-r1
+
+DESCRIPTION="Extensible Python-based build utility"
+HOMEPAGE="https://www.scons.org/"
+SRC_URI="
+ https://downloads.sourceforge.net/project/scons/scons/${PV}/${P}.tar.gz
+ doc? (
+ https://www.scons.org/doc/${PV}/PDF/${PN}-user.pdf -> ${P}-user.pdf
+ https://www.scons.org/doc/${PV}/HTML/${PN}-user.html -> ${P}-user.html
+ )
+ test? ( https://github.com/scons/scons/archive/${PV}.tar.gz -> ${P}.gh.tar.gz )"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc test"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+ test? (
+ dev-libs/libxml2[${PYTHON_USEDEP}]
+ dev-python/lxml[${PYTHON_USEDEP}]
+ )
+"
+
+S=${WORKDIR}/${P}/src
+
+PATCHES=(
+ # support env passthrough for Gentoo ebuilds
+ "${FILESDIR}"/scons-4.0.0-env-passthrough.patch
+ # respect CC, CXX, C*FLAGS, LDFLAGS by default
+ "${FILESDIR}"/scons-4.0.0-respect-cc-etc-r1.patch
+)
+
+src_unpack() {
+ # use the git directory structure, but put pregenerated release
+ # inside src/ subdirectory to make our life easier
+ if use test; then
+ unpack "${P}.gh.tar.gz"
+ else
+ mkdir -p "${P}"/src || die
+ fi
+
+ tar -C "${P}"/src --strip-components=1 -xzf "${DISTDIR}/${P}.tar.gz" || die
+}
+
+src_prepare() {
+ # apply patches relatively to top directory
+ cd "${WORKDIR}/${P}" || die
+ distutils-r1_src_prepare
+
+ # remove half-broken, useless custom commands
+ # and fix manpage install location
+ sed -i -e '/cmdclass/,/},$/d' \
+ -e '/data_files/s:man/:share/man/:' "${S}"/setup.py || die
+}
+
+python_test() {
+ # set variable from escons() of scons-util.eclass to make env-passthrough patch work within test env
+ local -x GENTOO_SCONS_ENV_PASSTHROUGH=1
+ # unset some env variables to pass appropriate tests
+ unset AR AS ASFLAGS CC CXX CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+ cd "${WORKDIR}/${P}" || die
+ "${EPYTHON}" runtest.py -a --passed \
+ -j "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" \
+ --builddir "${BUILD_DIR}/lib"
+
+ # runtest.py script returns "0" if all tests are passed
+ # and returns "2" if there are any tests with "no result"
+ # (i.e. in case if some tools are not installed or it's Windows specific tests)
+ [[ ${?} == [02] ]] || die "Tests fail with ${EPYTHON}"
+}
+
+python_install_all() {
+ distutils-r1_python_install_all
+
+ use doc && dodoc "${DISTDIR}"/${P}-user.{pdf,html}
+}