Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-util/scons/, dev-util/scons/files/
Date: Thu, 10 May 2018 14:58:21
Message-Id: 1525964284.8d84853f961adef853a34680c4659dca096fa083.mgorny@gentoo
1 commit: 8d84853f961adef853a34680c4659dca096fa083
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 10 14:58:04 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu May 10 14:58:04 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d84853f
7
8 dev-util/scons: Try to force CC/CXX/CFLAGS/... for Gentoo builds
9
10 .../scons/files/scons-3.0.1-respect-cc-etc.patch | 85 ++++++++++++++++++++++
11 dev-util/scons/scons-3.0.1-r2.ebuild | 73 +++++++++++++++++++
12 2 files changed, 158 insertions(+)
13
14 diff --git a/dev-util/scons/files/scons-3.0.1-respect-cc-etc.patch b/dev-util/scons/files/scons-3.0.1-respect-cc-etc.patch
15 new file mode 100644
16 index 00000000000..345f39ca548
17 --- /dev/null
18 +++ b/dev-util/scons/files/scons-3.0.1-respect-cc-etc.patch
19 @@ -0,0 +1,85 @@
20 +From 7dca875d157f477e05a652f4f1dd1b6903d9dc0a Mon Sep 17 00:00:00 2001
21 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
22 +Date: Thu, 10 May 2018 08:01:08 +0200
23 +Subject: [PATCH] posix: Also force common toolchain vars for Gentoo
24 +
25 +---
26 + src/engine/SCons/Platform/posix.py | 17 +++++++++++++++++
27 + src/engine/SCons/Tool/cc.py | 3 ++-
28 + src/engine/SCons/Tool/cxx.py | 3 ++-
29 + src/engine/SCons/Tool/link.py | 3 ++-
30 + 4 files changed, 23 insertions(+), 3 deletions(-)
31 +
32 +diff --git a/src/engine/SCons/Platform/posix.py b/src/engine/SCons/Platform/posix.py
33 +index af34650c..ee7f96d5 100644
34 +--- a/src/engine/SCons/Platform/posix.py
35 ++++ b/src/engine/SCons/Platform/posix.py
36 +@@ -93,6 +93,23 @@ def generate(env):
37 + if 'ENV' in env:
38 + new_env.update(env['ENV'])
39 + env['ENV'] = new_env
40 ++
41 ++ # Furthermore, force common compiler/linker variables as well
42 ++ envvar_mapping = {
43 ++ 'AR': 'AR',
44 ++ 'AS': 'AS',
45 ++ 'AS': 'ASFLAGS',
46 ++ 'CC': 'CC',
47 ++ 'CXX': 'CXX',
48 ++ 'CFLAGS': 'CFLAGS',
49 ++ 'CXXFLAGS': 'CXXFLAGS',
50 ++ 'CPPFLAGS': 'CPPFLAGS',
51 ++ 'LDFLAGS': 'LINKFLAGS',
52 ++ }
53 ++
54 ++ for envvar, toolvar in envvar_mapping.items():
55 ++ if toolvar not in env and envvar in env['ENV']:
56 ++ env[toolvar] = env['ENV'][envvar]
57 + else:
58 + if 'ENV' not in env:
59 + env['ENV'] = {}
60 +diff --git a/src/engine/SCons/Tool/cc.py b/src/engine/SCons/Tool/cc.py
61 +index 590ec5fd..5f9229a0 100644
62 +--- a/src/engine/SCons/Tool/cc.py
63 ++++ b/src/engine/SCons/Tool/cc.py
64 +@@ -80,7 +80,8 @@ def generate(env):
65 +
66 + if 'CC' not in env:
67 + env['CC'] = env.Detect(compilers) or compilers[0]
68 +- env['CFLAGS'] = SCons.Util.CLVar('')
69 ++ if 'CFLAGS' not in env:
70 ++ env['CFLAGS'] = SCons.Util.CLVar('')
71 + env['CCCOM'] = '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
72 + env['SHCC'] = '$CC'
73 + env['SHCFLAGS'] = SCons.Util.CLVar('$CFLAGS')
74 +diff --git a/src/engine/SCons/Tool/cxx.py b/src/engine/SCons/Tool/cxx.py
75 +index 430851c8..ca5ab563 100644
76 +--- a/src/engine/SCons/Tool/cxx.py
77 ++++ b/src/engine/SCons/Tool/cxx.py
78 +@@ -74,7 +74,8 @@ def generate(env):
79 +
80 + if 'CXX' not in env:
81 + env['CXX'] = env.Detect(compilers) or compilers[0]
82 +- env['CXXFLAGS'] = SCons.Util.CLVar('')
83 ++ if 'CXXFLAGS' not in env:
84 ++ env['CXXFLAGS'] = SCons.Util.CLVar('')
85 + env['CXXCOM'] = '$CXX -o $TARGET -c $CXXFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'
86 + env['SHCXX'] = '$CXX'
87 + env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS')
88 +diff --git a/src/engine/SCons/Tool/link.py b/src/engine/SCons/Tool/link.py
89 +index 07e92507..614d1779 100644
90 +--- a/src/engine/SCons/Tool/link.py
91 ++++ b/src/engine/SCons/Tool/link.py
92 +@@ -292,7 +292,8 @@ def generate(env):
93 + env.Append(SHLIBEMITTER = [shlib_emitter])
94 + env['SMARTLINK'] = smart_link
95 + env['LINK'] = "$SMARTLINK"
96 +- env['LINKFLAGS'] = SCons.Util.CLVar('')
97 ++ if 'LINKFLAGS' not in env:
98 ++ env['LINKFLAGS'] = SCons.Util.CLVar('')
99 + # __RPATH is only set to something ($_RPATH typically) on platforms that support it.
100 + env['LINKCOM'] = '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS'
101 + env['LIBDIRPREFIX']='-L'
102 +--
103 +2.17.0
104 +
105
106 diff --git a/dev-util/scons/scons-3.0.1-r2.ebuild b/dev-util/scons/scons-3.0.1-r2.ebuild
107 new file mode 100644
108 index 00000000000..78842609b21
109 --- /dev/null
110 +++ b/dev-util/scons/scons-3.0.1-r2.ebuild
111 @@ -0,0 +1,73 @@
112 +# Copyright 1999-2018 Gentoo Foundation
113 +# Distributed under the terms of the GNU General Public License v2
114 +
115 +EAPI=6
116 +PYTHON_COMPAT=( python2_7 )
117 +PYTHON_REQ_USE="threads(+)"
118 +
119 +inherit distutils-r1
120 +
121 +DESCRIPTION="Extensible Python-based build utility"
122 +HOMEPAGE="http://www.scons.org/"
123 +SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz
124 + doc? (
125 + http://www.scons.org/doc/${PV}/PDF/${PN}-user.pdf -> ${P}-user.pdf
126 + http://www.scons.org/doc/${PV}/HTML/${PN}-user.html -> ${P}-user.html
127 + )
128 + test? ( https://github.com/scons/scons/archive/${PV}.tar.gz -> ${P}.gh.tar.gz )"
129 +
130 +LICENSE="MIT"
131 +SLOT="0"
132 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
133 +IUSE="doc test"
134 +
135 +S=${WORKDIR}/${P}/src
136 +
137 +PATCHES=(
138 + # support env passthrough for Gentoo ebuilds
139 + "${FILESDIR}"/scons-3.0.1-env-passthrough.patch
140 + # respect CC, CXX, C*FLAGS, LDFLAGS by default
141 + "${FILESDIR}"/scons-3.0.1-respect-cc-etc.patch
142 +)
143 +
144 +src_unpack() {
145 + # use the git directory structure, but put pregenerated release
146 + # inside src/ subdirectory to make our life easier
147 + if use test; then
148 + unpack "${P}.gh.tar.gz"
149 + rm -r "${P}/src" || die
150 + else
151 + mkdir "${P}" || die
152 + fi
153 +
154 + cd "${P}" || die
155 + unpack "${P}.tar.gz"
156 + mv "${P}" src || die
157 +}
158 +
159 +src_prepare() {
160 + # apply patches relatively to top directory
161 + cd "${WORKDIR}/${P}" || die
162 + distutils-r1_src_prepare
163 +
164 + # remove half-broken, useless custom commands
165 + # and fix manpage install location
166 + sed -i -e '/cmdclass/,/}$/d' \
167 + -e '/data_files/s:man/:share/man/:' "${S}"/setup.py || die
168 +}
169 +
170 +python_test() {
171 + cd "${WORKDIR}/${P}" || die
172 + "${EPYTHON}" runtest.py -as \
173 + -j "$(makeopts_jobs "${MAKEOPTS}" "$(get_nproc)")" \
174 + --builddir "${BUILD_DIR}/lib" ||
175 + die "Tests fail with ${EPYTHON}"
176 +}
177 +
178 +python_install_all() {
179 + local DOCS=( {CHANGES,README,RELEASE}.txt )
180 + distutils-r1_python_install_all
181 + rm "${ED%/}/usr/bin/scons.bat" || die
182 +
183 + use doc && dodoc "${DISTDIR}"/${P}-user.{pdf,html}
184 +}