Gentoo Archives: gentoo-commits

From: "Andreas K. Hüttel" <dilfridge@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-devel/binutils-hppa64/
Date: Mon, 08 Feb 2021 22:17:34
Message-Id: 1612822636.7bb5befd5e0de8dcde7d5db99966ef88a23dd27f.dilfridge@gentoo
1 commit: 7bb5befd5e0de8dcde7d5db99966ef88a23dd27f
2 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 8 22:15:54 2021 +0000
4 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 8 22:17:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7bb5befd
7
8 sys-devel/binutils-hppa64: Version bump
9
10 Package-Manager: Portage-3.0.13, Repoman-3.0.2
11 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
12
13 sys-devel/binutils-hppa64/Manifest | 2 +
14 .../binutils-hppa64/binutils-hppa64-2.36.1.ebuild | 434 +++++++++++++++++++++
15 2 files changed, 436 insertions(+)
16
17 diff --git a/sys-devel/binutils-hppa64/Manifest b/sys-devel/binutils-hppa64/Manifest
18 index cb25acc9135..0919089b858 100644
19 --- a/sys-devel/binutils-hppa64/Manifest
20 +++ b/sys-devel/binutils-hppa64/Manifest
21 @@ -9,4 +9,6 @@ DIST binutils-2.35.1.tar.xz 22031720 BLAKE2B d3468da90b75e9b5fa7fbd64d3fdb0a4bc4
22 DIST binutils-2.35.2-patches-1.tar.xz 11836 BLAKE2B 0141349c9618992d1ab1e0309f7ed8fbc43b60a58be1dfed05eae8a8fee857241d9e112ae673da6fc9778767675f536ece818cb85567367bb1c8f87a0693623f SHA512 35de5f227c745c5fb800784fe657b2a6216faf43e2498e8481e7b0dc79b0d2f86b3b6a10b896e060319a77a51c61d2e1b7a951ae962b3a6ef8c1a2a261d9bb6c
23 DIST binutils-2.35.2.tar.xz 22056908 BLAKE2B 9c392e0db2b482442f9476f30bd80cf2796321cbf7be79cf21af7bef167b6074c4ae009dcf9b438d2f2f4a23381c935176b2cfa85de1a526ab46e0fd844a7ca5 SHA512 9974ede5978d32e0d68fef23da48fa00bd06b0bff7ec45b00ca075c126d6bbe0cf2defc03ecc3f17bc6cc85b64271a13009c4049d7ba17de26e84e3a6e2c0348
24 DIST binutils-2.36-patches-1.tar.xz 13200 BLAKE2B 82e8ef3c51984d4418466d7b838fa5c0a5a72c3bbe3e631b8aeb28503fd8b81e2b187908a2a4e1b286eba8af0db25eafadc5ffe42dd07677e6bd659cf5483b07 SHA512 88c5ac42d25d131c1507d94992fdd11a15700a0304da10cedd3b0db9bc689d3387189d6d97f847d77e8a5d053619b174695a0a6b3c6c1bb66ea8f122f0b38d63
25 +DIST binutils-2.36.1-patches-1.tar.xz 11392 BLAKE2B 8112dda3f000d29952cbf58101f842ca519054bf9de6e22908881fe4d46cc1ea9a26db74ab00c64aedd3746eb058c19a978b8dc025ad8de07b6365c70a1803b2 SHA512 c6f5645b09d0c149f2eef8e992ff7181716dfb961f1155207a1349168f2d2fb76857cc224c27b4d764cfbc4ddec0630ef8c0a91d7bac489896f28de64651b367
26 +DIST binutils-2.36.1.tar.xz 22772248 BLAKE2B 03fbfbedd6dba2beaa836b1ed254eddd7a54a163d3061fd93edd2b9591cae24ba049b26658c524b5ccecc2f22d431dfa168218d2531aa356945c994fbbe896fa SHA512 cc24590bcead10b90763386b6f96bb027d7594c659c2d95174a6352e8b98465a50ec3e4088d0da038428abe059bbc4ae5f37b269f31a40fc048072c8a234f4e9
27 DIST binutils-2.36.tar.xz 22760136 BLAKE2B 6666841e26c89a07b7e6c1144d893bab112278906d7917f3ca6273aa78094951686f0d5893857cae1edde1e1ecd7c6798bc14eac88d03c5a1e6e3e480a788f9c SHA512 0b89b70d4ad5cfe5bd0011dc7e342ae9de96efdbfc3442a0d6b5f7660e38bbcad36f2c72ba8f074323f02bde022ff1cd723ae99f0ea55cf94ee2dbbc0e4efdb2
28
29 diff --git a/sys-devel/binutils-hppa64/binutils-hppa64-2.36.1.ebuild b/sys-devel/binutils-hppa64/binutils-hppa64-2.36.1.ebuild
30 new file mode 100644
31 index 00000000000..f26da6552ae
32 --- /dev/null
33 +++ b/sys-devel/binutils-hppa64/binutils-hppa64-2.36.1.ebuild
34 @@ -0,0 +1,434 @@
35 +# Copyright 1999-2021 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +export CTARGET=hppa64-${CHOST#*-}
41 +
42 +inherit eutils libtool flag-o-matic gnuconfig multilib toolchain-funcs
43 +
44 +DESCRIPTION="Tools necessary to build programs"
45 +HOMEPAGE="https://sourceware.org/binutils/"
46 +LICENSE="GPL-3+"
47 +IUSE="default-gold doc +gold multitarget +nls +plugins static-libs test"
48 +REQUIRED_USE="default-gold? ( gold )"
49 +
50 +# Variables that can be set here:
51 +# PATCH_VER - the patchset version
52 +# Default: empty, no patching
53 +# PATCH_BINUTILS_VER - the binutils version in the patchset name
54 +# - Default: PV
55 +# PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
56 +# for the patchsets
57 +
58 +PATCH_VER=1
59 +PATCH_DEV=dilfridge
60 +
61 +case ${PV} in
62 + 9999)
63 + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
64 + inherit git-r3
65 + S=${WORKDIR}/binutils
66 + EGIT_CHECKOUT_DIR=${S}
67 + SLOT=${PV}
68 + ;;
69 + *)
70 + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
71 + SLOT=$(ver_cut 1-2)
72 + # KEYWORDS="-* ~hppa"
73 + ;;
74 +esac
75 +
76 +#
77 +# The Gentoo patchset
78 +#
79 +PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
80 +PATCH_DEV=${PATCH_DEV:-slyfox}
81 +
82 +[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
83 + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
84 +
85 +#
86 +# The cross-compile logic
87 +#
88 +export CTARGET=${CTARGET:-${CHOST}}
89 +if [[ ${CTARGET} == ${CHOST} ]] ; then
90 + if [[ ${CATEGORY} == cross-* ]] ; then
91 + export CTARGET=${CATEGORY#cross-}
92 + fi
93 +fi
94 +is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
95 +
96 +#
97 +# The dependencies
98 +#
99 +RDEPEND="
100 + >=sys-devel/binutils-config-3
101 + sys-libs/zlib
102 +"
103 +DEPEND="${RDEPEND}"
104 +BDEPEND="
105 + doc? ( sys-apps/texinfo )
106 + test? ( dev-util/dejagnu )
107 + nls? ( sys-devel/gettext )
108 + sys-devel/flex
109 + virtual/yacc
110 +"
111 +
112 +RESTRICT="!test? ( test )"
113 +
114 +MY_BUILDDIR=${WORKDIR}/build
115 +S=${WORKDIR}/${P/-hppa64/}
116 +
117 +src_unpack() {
118 + case ${PV} in
119 + *9999)
120 + git-r3_src_unpack
121 + ;;
122 + *)
123 + ;;
124 + esac
125 + default
126 + mkdir -p "${MY_BUILDDIR}"
127 +}
128 +
129 +src_prepare() {
130 + if [[ ! -z ${PATCH_VER} ]] ; then
131 + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
132 + eapply "${WORKDIR}/patch"/*.patch
133 + fi
134 +
135 + # This check should probably go somewhere else, like pkg_pretend.
136 + if [[ ${CTARGET} == *-uclibc* ]] ; then
137 + if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
138 + die "sorry, but this binutils doesn't yet support uClibc :("
139 + fi
140 + fi
141 +
142 + # Make sure our explicit libdir paths don't get clobbered. #562460
143 + sed -i \
144 + -e 's:@bfdlibdir@:@libdir@:g' \
145 + -e 's:@bfdincludedir@:@includedir@:g' \
146 + {bfd,opcodes}/Makefile.in || die
147 +
148 + # Fix locale issues if possible #122216
149 + if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
150 + einfo "Fixing misc issues in configure files"
151 + for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
152 + ebegin " Updating ${f/${S}\/}"
153 + patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
154 + || eerror "Please file a bug about this"
155 + eend $?
156 + done
157 + fi
158 +
159 + # Fix conflicts with newer glibc #272594
160 + if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
161 + sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
162 + fi
163 +
164 + # Apply things from PATCHES and user dirs
165 + default
166 +
167 + # Run misc portage update scripts
168 + gnuconfig_update
169 + elibtoolize --portage --no-uclibc
170 +}
171 +
172 +toolchain-binutils_bugurl() {
173 + printf "https://bugs.gentoo.org/"
174 +}
175 +toolchain-binutils_pkgversion() {
176 + printf "Gentoo ${PV}"
177 + [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
178 +}
179 +
180 +src_configure() {
181 + # Setup some paths
182 + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
183 + INCPATH=${LIBPATH}/include
184 + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
185 + if is_cross ; then
186 + TOOLPATH=/usr/${CHOST}/${CTARGET}
187 + else
188 + TOOLPATH=/usr/${CTARGET}
189 + fi
190 + BINPATH=${TOOLPATH}/binutils-bin/${PV}
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 + if use plugins ; then
210 + myconf+=( --enable-plugins )
211 + fi
212 + # enable gold (installed as ld.gold) and ld's plugin architecture
213 + if use gold ; then
214 + myconf+=( --enable-gold )
215 + if use default-gold; then
216 + myconf+=( --enable-gold=default )
217 + fi
218 + fi
219 +
220 + if use nls ; then
221 + myconf+=( --without-included-gettext )
222 + else
223 + myconf+=( --disable-nls )
224 + fi
225 +
226 + myconf+=( --with-system-zlib )
227 +
228 + # For bi-arch systems, enable a 64bit bfd. This matches
229 + # the bi-arch logic in toolchain.eclass. #446946
230 + # We used to do it for everyone, but it's slow on 32bit arches. #438522
231 + case $(tc-arch) in
232 + ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
233 + esac
234 +
235 + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
236 +
237 + [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
238 +
239 + is_cross && myconf+=(
240 + --with-sysroot="${EPREFIX}"/usr/${CTARGET}
241 + --enable-poison-system-directories
242 + )
243 +
244 + # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
245 + # on everyone in alpha (for now), we'll just enable it when possible
246 + has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
247 + has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
248 +
249 + # mips can't do hash-style=gnu ...
250 + if [[ $(tc-arch) != mips ]] ; then
251 + myconf+=( --enable-default-hash-style=gnu )
252 + fi
253 +
254 + myconf+=(
255 + --prefix="${EPREFIX}"/usr
256 + --host=${CHOST}
257 + --target=${CTARGET}
258 + --datadir="${EPREFIX}"${DATAPATH}
259 + --datarootdir="${EPREFIX}"${DATAPATH}
260 + --infodir="${EPREFIX}"${DATAPATH}/info
261 + --mandir="${EPREFIX}"${DATAPATH}/man
262 + --bindir="${EPREFIX}"${BINPATH}
263 + --libdir="${EPREFIX}"${LIBPATH}
264 + --libexecdir="${EPREFIX}"${LIBPATH}
265 + --includedir="${EPREFIX}"${INCPATH}
266 + --enable-obsolete
267 + --enable-shared
268 + --enable-threads
269 + # Newer versions (>=2.27) offer a configure flag now.
270 + --enable-relro
271 + # Newer versions (>=2.24) make this an explicit option. #497268
272 + --enable-install-libiberty
273 + --disable-werror
274 + --with-bugurl="$(toolchain-binutils_bugurl)"
275 + --with-pkgversion="$(toolchain-binutils_pkgversion)"
276 + $(use_enable static-libs static)
277 + ${EXTRA_ECONF}
278 + # Disable modules that are in a combined binutils/gdb tree. #490566
279 + --disable-{gdb,libdecnumber,readline,sim}
280 + # Strip out broken static link flags.
281 + # https://gcc.gnu.org/PR56750
282 + --without-stage1-ldflags
283 + # Change SONAME to avoid conflict across
284 + # {native,cross}/binutils, binutils-libs. #666100
285 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)
286 +
287 + # avoid automagic dependency on (currently prefix) systems
288 + # systems with debuginfod library, bug #754753
289 + --without-debuginfod
290 + )
291 + echo ./configure "${myconf[@]}"
292 + "${S}"/configure "${myconf[@]}" || die
293 +
294 + # Prevent makeinfo from running if doc is unset.
295 + if ! use doc ; then
296 + sed -i \
297 + -e '/^MAKEINFO/s:=.*:= true:' \
298 + Makefile || die
299 + fi
300 +}
301 +
302 +src_compile() {
303 + cd "${MY_BUILDDIR}"
304 + # see Note [tooldir hack for ldscripts]
305 + emake tooldir="${EPREFIX}${TOOLPATH}" all
306 +
307 + # only build info pages if the user wants them
308 + if use doc ; then
309 + emake info
310 + fi
311 +
312 + # we nuke the manpages when we're left with junk
313 + # (like when we bootstrap, no perl -> no manpages)
314 + find . -name '*.1' -a -size 0 -delete
315 +}
316 +
317 +src_test() {
318 + cd "${MY_BUILDDIR}"
319 + # bug 637066
320 + filter-flags -Wall -Wreturn-type
321 + emake -k check
322 +}
323 +
324 +src_install() {
325 + local x d
326 +
327 + cd "${MY_BUILDDIR}"
328 + # see Note [tooldir hack for ldscripts]
329 + emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
330 + rm -rf "${ED}"/${LIBPATH}/bin
331 + use static-libs || find "${ED}" -name '*.la' -delete
332 +
333 + # Newer versions of binutils get fancy with ${LIBPATH} #171905
334 + cd "${ED}"/${LIBPATH}
335 + for d in ../* ; do
336 + [[ ${d} == ../${PV} ]] && continue
337 + mv ${d}/* . || die
338 + rmdir ${d} || die
339 + done
340 +
341 + # Now we collect everything intp the proper SLOT-ed dirs
342 + # When something is built to cross-compile, it installs into
343 + # /usr/$CHOST/ by default ... we have to 'fix' that :)
344 + if is_cross ; then
345 + cd "${ED}"/${BINPATH}
346 + for x in * ; do
347 + mv ${x} ${x/${CTARGET}-}
348 + done
349 +
350 + if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
351 + mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
352 + mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
353 + rm -r "${ED}"/usr/${CHOST}/{include,lib}
354 + fi
355 + fi
356 + insinto ${INCPATH}
357 + local libiberty_headers=(
358 + # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
359 + demangle.h
360 + dyn-string.h
361 + fibheap.h
362 + hashtab.h
363 + libiberty.h
364 + objalloc.h
365 + splay-tree.h
366 + )
367 + doins "${libiberty_headers[@]/#/${S}/include/}"
368 + if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
369 + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
370 + rm -r "${ED}"/${LIBPATH}/lib
371 + fi
372 +
373 + # Generate an env.d entry for this binutils
374 + insinto /etc/env.d/binutils
375 + cat <<-EOF > "${T}"/env.d
376 + TARGET="${CTARGET}"
377 + VER="${PV}"
378 + LIBPATH="${EPREFIX}${LIBPATH}"
379 + EOF
380 + newins "${T}"/env.d ${CTARGET}-${PV}
381 +
382 + # Handle documentation
383 + if ! is_cross ; then
384 + cd "${S}"
385 + dodoc README
386 + docinto bfd
387 + dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
388 + docinto binutils
389 + dodoc binutils/ChangeLog binutils/NEWS binutils/README
390 + docinto gas
391 + dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
392 + docinto gprof
393 + dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
394 + docinto ld
395 + dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
396 + docinto libiberty
397 + dodoc libiberty/ChangeLog* libiberty/README
398 + docinto opcodes
399 + dodoc opcodes/ChangeLog*
400 + fi
401 +
402 + # Remove shared info pages
403 + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
404 +
405 + # Trim all empty dirs
406 + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
407 +
408 + # the hppa64 hack; this should go into 9999 as a PN-conditional
409 + # tweak the default fake list a little bit
410 + cd "${D}"/etc/env.d/binutils
411 + sed -i '/FAKE_TARGETS=/s:"$: hppa64-linux":' ${CTARGET}-${PV} || die
412 +}
413 +
414 +pkg_postinst() {
415 + # Make sure this ${CTARGET} has a binutils version selected
416 + [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
417 + binutils-config ${CTARGET}-${PV}
418 +}
419 +
420 +pkg_postrm() {
421 + local current_profile=$(binutils-config -c ${CTARGET})
422 +
423 + # If no other versions exist, then uninstall for this
424 + # target ... otherwise, switch to the newest version
425 + # Note: only do this if this version is unmerged. We
426 + # rerun binutils-config if this is a remerge, as
427 + # we want the mtimes on the symlinks updated (if
428 + # it is the same as the current selected profile)
429 + if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
430 + local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
431 + choice=${choice//$'\n'/ }
432 + choice=${choice/* }
433 + if [[ -z ${choice} ]] ; then
434 + binutils-config -u ${CTARGET}
435 + else
436 + binutils-config ${choice}
437 + fi
438 + elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
439 + binutils-config ${CTARGET}-${PV}
440 + fi
441 +}
442 +# Note [slotting support]
443 +# -----------------------
444 +# Gentoo's layout for binutils files is non-standard as Gentoo
445 +# supports slotted installation for binutils. Many tools
446 +# still expect binutils to reside in known locations.
447 +# binutils-config package restores symlinks into known locations,
448 +# like:
449 +# /usr/bin/${CTARGET}-<tool>
450 +# /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
451 +# /usr/include/
452 +#
453 +# Note [tooldir hack for ldscripts]
454 +# ---------------------------------
455 +# Build system does not allow ./configure to tweak every location
456 +# we need for slotting binutils hence all the shuffling in
457 +# src_install(). This note is about SCRIPTDIR define handling.
458 +#
459 +# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
460 +# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
461 +# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
462 +# Thus we can't just move files around after compilation finished.
463 +#
464 +# Our goal is the following:
465 +# - at build-time set scriptdir to point to symlinked location:
466 +# ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
467 +# - at install-time set scriptdir to point to slotted location:
468 +# ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}