Gentoo Archives: gentoo-commits

From: "Andreas Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils-hppa64/
Date: Sun, 15 Jul 2018 12:59:19
Message-Id: 1531659511.2310cf83268b281c628ef1ecef970e63a0a81302.dilfridge@gentoo
1 commit: 2310cf83268b281c628ef1ecef970e63a0a81302
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 15 12:58:31 2018 +0000
4 Commit: Andreas Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 15 12:58:31 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2310cf83
7
8 sys-devel/binutils-hppa64: Zero-day 2.31 bump for the brave or stupid
9
10 Package-Manager: Portage-2.3.40, Repoman-2.3.9
11
12 sys-devel/binutils-hppa64/Manifest | 2 +
13 .../binutils-hppa64/binutils-hppa64-2.31.ebuild | 393 +++++++++++++++++++++
14 2 files changed, 395 insertions(+)
15
16 diff --git a/sys-devel/binutils-hppa64/Manifest b/sys-devel/binutils-hppa64/Manifest
17 index 078c5bd4d7e..a25f0b3ad7a 100644
18 --- a/sys-devel/binutils-hppa64/Manifest
19 +++ b/sys-devel/binutils-hppa64/Manifest
20 @@ -15,3 +15,5 @@ DIST binutils-2.29.tar.bz2 29073316 BLAKE2B 0eb7bbefa1ac5f4d753ca9328d339a466d4f
21 DIST binutils-2.30-patches-2.tar.xz 490272 BLAKE2B a28a5b5bb8faa33fec269f2c69d6ed0e4e7d5a9169861aa4b3c45511794e1e749c216862a8258c2029f1b40c511dcb2a0aeaecda57e75d52418f10d6f345718f SHA512 1686d5b58ee968f2000647acab2bee4c263d1c85fd43fed8c820fccfc0d7024a01211e7853cd5ce452fa90da500bc17309edf6dbc901c7fd6fc7b3e3d6f42581
22 DIST binutils-2.30-patches-3.tar.xz 548804 BLAKE2B 428a1750233ae3f019e20cb5ed1d8e6fe6455181e8f5961dbfe7b66493d1c42050f889e45c02c1fc1a84d545c9e61f81ad6ffd5afc0b1099a702ccc7637c3abe SHA512 c91e902d1d9fc2e9782df04c93173c3207c771f1c063e2ff12c9336593c954ea3f1b2474a8fc045927d72fe18f7401874059599d100c4a1fd152081f05913d03
23 DIST binutils-2.30.tar.xz 20286700 BLAKE2B 2dd5436a15a601011a1950e6082ec00082f5916fb82ce95ceab424fd8dc19f6daa7ac32a149f222ccdcc603354165cc206fde070eaa44fe2cc5e57486efc7868 SHA512 e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
24 +DIST binutils-2.31-patches-1.tar.xz 16692 BLAKE2B ee9c7b344b12073c881eaf6fa80e8cb3187add720a26b60e7ef7db9dc3eb8e6e2b83cd0afb3115c4846aa914f8957554bd010f67af34dc5ad81e676639cf361e SHA512 4004d52327babd00f946b199f71e9eca840e66c65a287730af80b5a69138fe5f946f33c13400e028088238314c644f00b858049f8923948d2e6144dc779c24c0
25 +DIST binutils-2.31.tar.xz 20445772 BLAKE2B 02d9ef7f8ea0d24682716b6890916d507762b4672a3148192afbbc1d6323b3f3970eb630ec9af5e18c60ba1d4579d49d847e571bcd8b1236c24b04c9e3815481 SHA512 3448a71c42d790569c1159c1042aa520b2d8ac8af7506fb1f2a4199dfb13b39f1c2271a5cb3a643d10c7d8a388a73f190e90503d4793a016da7893473aa1c635
26
27 diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.31.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.31.ebuild
28 new file mode 100644
29 index 00000000000..463c8b77f7d
30 --- /dev/null
31 +++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.31.ebuild
32 @@ -0,0 +1,393 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +export CTARGET=hppa64-${CHOST#*-}
39 +
40 +inherit eutils libtool flag-o-matic gnuconfig multilib versionator
41 +
42 +DESCRIPTION="Tools necessary to build programs"
43 +HOMEPAGE="https://sourceware.org/binutils/"
44 +LICENSE="GPL-3+"
45 +IUSE="+cxx doc multitarget +nls static-libs test"
46 +
47 +# Variables that can be set here:
48 +# PATCH_VER - the patchset version
49 +# Default: empty, no patching
50 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
51 +# - Default: PV
52 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
53 +# for the patchsets
54 +# Default: dilfridge :)
55 +
56 +PATCH_VER=1
57 +
58 +case ${PV} in
59 + 9999)
60 + BVER="git"
61 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
62 + inherit git-r3
63 + S=${WORKDIR}/binutils
64 + EGIT_CHECKOUT_DIR=${S}
65 + ;;
66 + *)
67 + BVER=${PV}
68 + SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.xz https://sourceware.org/pub/binutils/releases/binutils-${BVER}.tar.xz"
69 + ;;
70 +esac
71 +SLOT="${BVER}"
72 +#KEYWORDS="-* ~hppa"
73 +
74 +#
75 +# The Gentoo patchset
76 +#
77 +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${BVER}}
78 +PATCH_DEV=${PATCH_DEV:-dilfridge}
79 +
80 +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
81 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
82 +
83 +#
84 +# The cross-compile logic
85 +#
86 +export CTARGET=${CTARGET:-${CHOST}}
87 +if [[ ${CTARGET} == ${CHOST} ]] ; then
88 + if [[ ${CATEGORY} == cross-* ]] ; then
89 + export CTARGET=${CATEGORY#cross-}
90 + fi
91 +fi
92 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
93 +
94 +#
95 +# The dependencies
96 +#
97 +RDEPEND="
98 + >=sys-devel/binutils-config-3
99 + sys-libs/zlib
100 +"
101 +DEPEND="${RDEPEND}
102 + doc? ( sys-apps/texinfo )
103 + test? ( dev-util/dejagnu )
104 + nls? ( sys-devel/gettext )
105 + sys-devel/flex
106 + virtual/yacc
107 +"
108 +if is_cross ; then
109 + # The build assumes the host has libiberty and such when cross-compiling
110 + # its build tools. We should probably make binutils itself build a local
111 + # copy to use, but until then, be lazy.
112 + DEPEND+=" >=sys-libs/binutils-libs-${PV}"
113 +fi
114 +
115 +MY_BUILDDIR=${WORKDIR}/build
116 +S=${WORKDIR}/${P/-hppa64/}
117 +
118 +src_unpack() {
119 + case ${PV} in
120 + 9999)
121 + git-r3_src_unpack;
122 + ;;
123 + *)
124 + default
125 + ;;
126 + esac
127 + mkdir -p "${MY_BUILDDIR}"
128 +}
129 +
130 +src_prepare() {
131 + if [[ ! -z ${PATCH_VER} ]] ; then
132 + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
133 + eapply "${WORKDIR}/patch"/*.patch
134 + fi
135 +
136 + # This check should probably go somewhere else, like pkg_pretend.
137 + if [[ ${CTARGET} == *-uclibc* ]] ; then
138 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
139 + die "sorry, but this binutils doesn't yet support uClibc :("
140 + fi
141 + fi
142 +
143 + # Make sure our explicit libdir paths don't get clobbered. #562460
144 + sed -i \
145 + -e 's:@bfdlibdir@:@libdir@:g' \
146 + -e 's:@bfdincludedir@:@includedir@:g' \
147 + {bfd,opcodes}/Makefile.in || die
148 +
149 + # Fix locale issues if possible #122216
150 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
151 + einfo "Fixing misc issues in configure files"
152 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
153 + ebegin " Updating ${f/${S}\/}"
154 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
155 + || eerror "Please file a bug about this"
156 + eend $?
157 + done
158 + fi
159 +
160 + # Fix conflicts with newer glibc #272594
161 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
162 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
163 + fi
164 +
165 + # Apply things from PATCHES and user dirs
166 + default
167 +
168 + # Run misc portage update scripts
169 + gnuconfig_update
170 + elibtoolize --portage --no-uclibc
171 +}
172 +
173 +toolchain-binutils_bugurl() {
174 + printf "https://bugs.gentoo.org/"
175 +}
176 +toolchain-binutils_pkgversion() {
177 + printf "Gentoo ${BVER}"
178 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
179 +}
180 +
181 +src_configure() {
182 + # Setup some paths
183 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
184 + INCPATH=${LIBPATH}/include
185 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
186 + if is_cross ; then
187 + BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER}
188 + else
189 + BINPATH=/usr/${CTARGET}/binutils-bin/${BVER}
190 + fi
191 +
192 + # Make sure we filter $LINGUAS so that only ones that
193 + # actually work make it through #42033
194 + strip-linguas -u */po
195 +
196 + # Keep things sane
197 + strip-flags
198 +
199 + local x
200 + echo
201 + for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
202 + einfo "$(printf '%10s' ${x}:) ${!x}"
203 + done
204 + echo
205 +
206 + cd "${MY_BUILDDIR}"
207 + local myconf=()
208 +
209 + # enable gold (installed as ld.gold) and ld's plugin architecture
210 + if use cxx ; then
211 + myconf+=( --enable-gold )
212 + myconf+=( --enable-plugins )
213 + fi
214 +
215 + if use nls ; then
216 + myconf+=( --without-included-gettext )
217 + else
218 + myconf+=( --disable-nls )
219 + fi
220 +
221 + myconf+=( --with-system-zlib )
222 +
223 + # For bi-arch systems, enable a 64bit bfd. This matches
224 + # the bi-arch logic in toolchain.eclass. #446946
225 + # We used to do it for everyone, but it's slow on 32bit arches. #438522
226 + case $(tc-arch) in
227 + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
228 + esac
229 +
230 + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
231 +
232 + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
233 +
234 + is_cross && myconf+=(
235 + --with-sysroot="${EPREFIX}"/usr/${CTARGET}
236 + --enable-poison-system-directories
237 + )
238 +
239 + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
240 + # on everyone in alpha (for now), we'll just enable it when possible
241 + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
242 + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
243 +
244 + # mips can't do hash-style=gnu ...
245 + if [[ $(tc-arch) != mips ]] ; then
246 + myconf+=( --enable-default-hash-style=gnu )
247 + fi
248 +
249 + myconf+=(
250 + --prefix="${EPREFIX}"/usr
251 + --host=${CHOST}
252 + --target=${CTARGET}
253 + --datadir="${EPREFIX}"${DATAPATH}
254 + --datarootdir="${EPREFIX}"${DATAPATH}
255 + --infodir="${EPREFIX}"${DATAPATH}/info
256 + --mandir="${EPREFIX}"${DATAPATH}/man
257 + --bindir="${EPREFIX}"${BINPATH}
258 + --libdir="${EPREFIX}"${LIBPATH}
259 + --libexecdir="${EPREFIX}"${LIBPATH}
260 + --includedir="${EPREFIX}"${INCPATH}
261 + --enable-obsolete
262 + --enable-shared
263 + --enable-threads
264 + # Newer versions (>=2.27) offer a configure flag now.
265 + --enable-relro
266 + # Newer versions (>=2.24) make this an explicit option. #497268
267 + --enable-install-libiberty
268 + --disable-werror
269 + --with-bugurl="$(toolchain-binutils_bugurl)"
270 + --with-pkgversion="$(toolchain-binutils_pkgversion)"
271 + $(use_enable static-libs static)
272 + ${EXTRA_ECONF}
273 + # Disable modules that are in a combined binutils/gdb tree. #490566
274 + --disable-{gdb,libdecnumber,readline,sim}
275 + # Strip out broken static link flags.
276 + # https://gcc.gnu.org/PR56750
277 + --without-stage1-ldflags
278 + )
279 + echo ./configure "${myconf[@]}"
280 + "${S}"/configure "${myconf[@]}" || die
281 +
282 + # Prevent makeinfo from running if doc is unset.
283 + if ! use doc ; then
284 + sed -i \
285 + -e '/^MAKEINFO/s:=.*:= true:' \
286 + Makefile || die
287 + fi
288 +}
289 +
290 +src_compile() {
291 + cd "${MY_BUILDDIR}"
292 + emake all
293 +
294 + # only build info pages if the user wants them
295 + if use doc ; then
296 + emake info
297 + fi
298 +
299 + # we nuke the manpages when we're left with junk
300 + # (like when we bootstrap, no perl -> no manpages)
301 + find . -name '*.1' -a -size 0 -delete
302 +}
303 +
304 +src_test() {
305 + cd "${MY_BUILDDIR}"
306 + emake -k check
307 +}
308 +
309 +src_install() {
310 + local x d
311 +
312 + cd "${MY_BUILDDIR}"
313 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
314 + rm -rf "${ED}"/${LIBPATH}/bin
315 + use static-libs || find "${ED}" -name '*.la' -delete
316 +
317 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
318 + cd "${ED}"/${LIBPATH}
319 + for d in ../* ; do
320 + [[ ${d} == ../${BVER} ]] && continue
321 + mv ${d}/* . || die
322 + rmdir ${d} || die
323 + done
324 +
325 + # Now we collect everything intp the proper SLOT-ed dirs
326 + # When something is built to cross-compile, it installs into
327 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
328 + if is_cross ; then
329 + cd "${ED}"/${BINPATH}
330 + for x in * ; do
331 + mv ${x} ${x/${CTARGET}-}
332 + done
333 +
334 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
335 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
336 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
337 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
338 + fi
339 + fi
340 + insinto ${INCPATH}
341 + local libiberty_headers=(
342 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
343 + demangle.h
344 + dyn-string.h
345 + fibheap.h
346 + hashtab.h
347 + libiberty.h
348 + objalloc.h
349 + splay-tree.h
350 + )
351 + doins "${libiberty_headers[@]/#/${S}/include/}" || die
352 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
353 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
354 + rm -r "${ED}"/${LIBPATH}/lib
355 + fi
356 +
357 + # Generate an env.d entry for this binutils
358 + insinto /etc/env.d/binutils
359 + cat <<-EOF > "${T}"/env.d
360 + TARGET="${CTARGET}"
361 + VER="${BVER}"
362 + LIBPATH="${EPREFIX}${LIBPATH}"
363 + EOF
364 + newins "${T}"/env.d ${CTARGET}-${BVER}
365 +
366 + # Handle documentation
367 + if ! is_cross ; then
368 + cd "${S}"
369 + dodoc README
370 + docinto bfd
371 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
372 + docinto binutils
373 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
374 + docinto gas
375 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
376 + docinto gprof
377 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
378 + docinto ld
379 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
380 + docinto libiberty
381 + dodoc libiberty/ChangeLog* libiberty/README
382 + docinto opcodes
383 + dodoc opcodes/ChangeLog*
384 + fi
385 +
386 + # Remove shared info pages
387 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
388 +
389 + # Trim all empty dirs
390 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
391 +
392 + # the hppa64 hack; this should go into 9999 as a PN-conditional
393 + # tweak the default fake list a little bit
394 + cd "${D}"/etc/env.d/binutils
395 + sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${BVER} || die
396 +}
397 +
398 +pkg_postinst() {
399 + # Make sure this ${CTARGET} has a binutils version selected
400 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
401 + binutils-config ${CTARGET}-${BVER}
402 +}
403 +
404 +pkg_postrm() {
405 + local current_profile=$(binutils-config -c ${CTARGET})
406 +
407 + # If no other versions exist, then uninstall for this
408 + # target ... otherwise, switch to the newest version
409 + # Note: only do this if this version is unmerged. We
410 + # rerun binutils-config if this is a remerge, as
411 + # we want the mtimes on the symlinks updated (if
412 + # it is the same as the current selected profile)
413 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
414 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
415 + choice=${choice//$'\n'/ }
416 + choice=${choice/* }
417 + if [[ -z ${choice} ]] ; then
418 + binutils-config -u ${CTARGET}
419 + else
420 + binutils-config ${choice}
421 + fi
422 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
423 + binutils-config ${CTARGET}-${BVER}
424 + fi
425 +}