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