Gentoo Archives: gentoo-commits

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