sys-devel/binutils: Version bump to point release 2.31.1
authorAndreas K. Hüttel <dilfridge@gentoo.org>
Wed, 18 Jul 2018 14:45:09 +0000 (16:45 +0200)
committerAndreas K. Hüttel <dilfridge@gentoo.org>
Wed, 18 Jul 2018 15:04:30 +0000 (17:04 +0200)
Package-Manager: Portage-2.3.40, Repoman-2.3.9

sys-devel/binutils/Manifest
sys-devel/binutils/binutils-2.31.1.ebuild [new file with mode: 0644]
sys-devel/binutils/binutils-2.31.9999.ebuild
sys-devel/binutils/binutils-9999.ebuild

index 2f09e530523e7e1a5a5b55b9f423aa63b015a643..276c7a8c7491d995a25e20325a145ec4a5ad1e4f 100644 (file)
@@ -12,5 +12,7 @@ DIST binutils-2.30-patches-2.tar.xz 490272 BLAKE2B a28a5b5bb8faa33fec269f2c69d6e
 DIST binutils-2.30-patches-3.tar.xz 548804 BLAKE2B 428a1750233ae3f019e20cb5ed1d8e6fe6455181e8f5961dbfe7b66493d1c42050f889e45c02c1fc1a84d545c9e61f81ad6ffd5afc0b1099a702ccc7637c3abe SHA512 c91e902d1d9fc2e9782df04c93173c3207c771f1c063e2ff12c9336593c954ea3f1b2474a8fc045927d72fe18f7401874059599d100c4a1fd152081f05913d03
 DIST binutils-2.30.tar.xz 20286700 BLAKE2B 2dd5436a15a601011a1950e6082ec00082f5916fb82ce95ceab424fd8dc19f6daa7ac32a149f222ccdcc603354165cc206fde070eaa44fe2cc5e57486efc7868 SHA512 e747ea20d8d79fcd21b9d9f6695059caa7189d60f19256da398e34b789fea9a133c32b192e9693b5828d27683739b0198431bf8b3e39fb3b04884cf89d9aa839
 DIST binutils-2.31-patches-1.tar.xz 16692 BLAKE2B ee9c7b344b12073c881eaf6fa80e8cb3187add720a26b60e7ef7db9dc3eb8e6e2b83cd0afb3115c4846aa914f8957554bd010f67af34dc5ad81e676639cf361e SHA512 4004d52327babd00f946b199f71e9eca840e66c65a287730af80b5a69138fe5f946f33c13400e028088238314c644f00b858049f8923948d2e6144dc779c24c0
+DIST binutils-2.31.1-patches-1.tar.xz 10644 BLAKE2B 3c2e09713593fc01d78d45ee4e4ac92020d5de781325c8ea98a5193a36a2a0a814f1b6730ae718ad92f92c5876e8e47d0eee7c42d2fce281cc0b37fadb85c42b SHA512 d701e6e2c9d22ca5c7ac4bf08d9206a6648b299b7b04a053aaabc34fa94d7c5fd074a08e3f3af66365069918d9000986c646430bf2adf94213cbf0d55d6e6c51
+DIST binutils-2.31.1.tar.xz 20467996 BLAKE2B 6b914df1fbb7cf54f2159f71b2c2b09f3f6a569b7a3cb4cf9790d0a3733a7548bc0ea32334a178ed3b56e8b97656ae99c7abaf212601beeaeae9a0884c0f6051 SHA512 0fca326feb1d5f5fe505a827b20237fe3ec9c13eaf7ec7e35847fd71184f605ba1cefe1314b1b8f8a29c0aa9d88162849ee1c1a3e70c2f7407d88339b17edb30
 DIST binutils-2.31.tar.xz 20445772 BLAKE2B 02d9ef7f8ea0d24682716b6890916d507762b4672a3148192afbbc1d6323b3f3970eb630ec9af5e18c60ba1d4579d49d847e571bcd8b1236c24b04c9e3815481 SHA512 3448a71c42d790569c1159c1042aa520b2d8ac8af7506fb1f2a4199dfb13b39f1c2271a5cb3a643d10c7d8a388a73f190e90503d4793a016da7893473aa1c635
 DIST binutils-9999-patches-1.tar.xz 10116 BLAKE2B 1ae970fd13ea1b94f554ed5b3fde4b6bdd90efcfc2488efc2f1465511279027c2e7f2a7371069afadb91bf833680a24e1a5df50d3169c9ee132c933b3c1fdba9 SHA512 a5d97d7070b876bf072db2a99a2876c239e03409849b9c93467bd3e70cd97c468110031a09e1c182c05d48004ec3e1651f44a1850b0275a385c3bae598cd98d7
diff --git a/sys-devel/binutils/binutils-2.31.1.ebuild b/sys-devel/binutils/binutils-2.31.1.ebuild
new file mode 100644 (file)
index 0000000..46fc4e2
--- /dev/null
@@ -0,0 +1,423 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils libtool flag-o-matic gnuconfig multilib versionator
+
+DESCRIPTION="Tools necessary to build programs"
+HOMEPAGE="https://sourceware.org/binutils/"
+LICENSE="GPL-3+"
+IUSE="+cxx doc multitarget +nls static-libs test"
+
+# Variables that can be set here:
+# PATCH_VER          - the patchset version
+#                      Default: empty, no patching
+# PATCH_BINUTILS_VER - the binutils version in the patchset name
+#                    - Default: PV
+# PATCH_DEV          - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/...
+#                      for the patchsets
+#                      Default: dilfridge :)
+
+PATCH_VER=1
+
+case ${PV} in
+       9999)
+               EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
+               inherit git-r3
+               S=${WORKDIR}/binutils
+               EGIT_CHECKOUT_DIR=${S}
+               SLOT=${PV}
+               ;;
+       *.9999)
+               EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git"
+               inherit git-r3
+               S=${WORKDIR}/binutils
+               EGIT_CHECKOUT_DIR=${S}
+               EGIT_BRANCH=$(get_version_component_range 1-2)
+               EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
+               SLOT=$(get_version_component_range 1-2)
+               ;;
+       *)
+               SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
+               SLOT=$(get_version_component_range 1-2)
+               ;;
+esac
+
+#
+# The Gentoo patchset
+#
+PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}}
+PATCH_DEV=${PATCH_DEV:-dilfridge}
+
+[[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI}
+       https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz"
+
+#
+# The cross-compile logic
+#
+export CTARGET=${CTARGET:-${CHOST}}
+if [[ ${CTARGET} == ${CHOST} ]] ; then
+       if [[ ${CATEGORY} == cross-* ]] ; then
+               export CTARGET=${CATEGORY#cross-}
+       fi
+fi
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
+
+#
+# The dependencies
+#
+RDEPEND="
+       >=sys-devel/binutils-config-3
+       sys-libs/zlib
+"
+DEPEND="${RDEPEND}
+       doc? ( sys-apps/texinfo )
+       test? ( dev-util/dejagnu )
+       nls? ( sys-devel/gettext )
+       sys-devel/flex
+       virtual/yacc
+"
+if is_cross ; then
+       # The build assumes the host has libiberty and such when cross-compiling
+       # its build tools.  We should probably make binutils itself build a local
+       # copy to use, but until then, be lazy.
+       DEPEND+=" >=sys-libs/binutils-libs-${PV}"
+fi
+
+MY_BUILDDIR=${WORKDIR}/build
+
+src_unpack() {
+       case ${PV} in
+               *9999)
+                       git-r3_src_unpack
+                       ;;
+               *)
+                       ;;
+       esac
+       default
+       mkdir -p "${MY_BUILDDIR}"
+}
+
+src_prepare() {
+       if [[ ! -z ${PATCH_VER} ]] ; then
+               einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}"
+               eapply "${WORKDIR}/patch"/*.patch
+       fi
+
+       # This check should probably go somewhere else, like pkg_pretend.
+       if [[ ${CTARGET} == *-uclibc* ]] ; then
+               if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
+                       die "sorry, but this binutils doesn't yet support uClibc :("
+               fi
+       fi
+
+       # Make sure our explicit libdir paths don't get clobbered. #562460
+       sed -i \
+               -e 's:@bfdlibdir@:@libdir@:g' \
+               -e 's:@bfdincludedir@:@includedir@:g' \
+               {bfd,opcodes}/Makefile.in || die
+
+       # Fix locale issues if possible #122216
+       if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
+               einfo "Fixing misc issues in configure files"
+               for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
+                       ebegin "  Updating ${f/${S}\/}"
+                       patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
+                               || eerror "Please file a bug about this"
+                       eend $?
+               done
+       fi
+
+       # Fix conflicts with newer glibc #272594
+       if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
+               sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
+       fi
+
+       # Apply things from PATCHES and user dirs
+       default
+
+       # Run misc portage update scripts
+       gnuconfig_update
+       elibtoolize --portage --no-uclibc
+}
+
+toolchain-binutils_bugurl() {
+       printf "https://bugs.gentoo.org/"
+}
+toolchain-binutils_pkgversion() {
+       printf "Gentoo ${PV}"
+       [[ -n ${PATCH_VER} ]] && printf " p${PATCH_VER}"
+}
+
+src_configure() {
+       # Setup some paths
+       LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
+       INCPATH=${LIBPATH}/include
+       DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
+       if is_cross ; then
+               TOOLPATH=/usr/${CHOST}/${CTARGET}
+       else
+               TOOLPATH=/usr/${CTARGET}
+       fi
+       BINPATH=${TOOLPATH}/binutils-bin/${PV}
+
+       # Make sure we filter $LINGUAS so that only ones that
+       # actually work make it through #42033
+       strip-linguas -u */po
+
+       # Keep things sane
+       strip-flags
+
+       local x
+       echo
+       for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
+               einfo "$(printf '%10s' ${x}:) ${!x}"
+       done
+       echo
+
+       cd "${MY_BUILDDIR}"
+       local myconf=()
+
+       # enable gold (installed as ld.gold) and ld's plugin architecture
+       if use cxx ; then
+               myconf+=( --enable-gold )
+               myconf+=( --enable-plugins )
+       fi
+
+       if use nls ; then
+               myconf+=( --without-included-gettext )
+       else
+               myconf+=( --disable-nls )
+       fi
+
+       myconf+=( --with-system-zlib )
+
+       # For bi-arch systems, enable a 64bit bfd.  This matches
+       # the bi-arch logic in toolchain.eclass. #446946
+       # We used to do it for everyone, but it's slow on 32bit arches. #438522
+       case $(tc-arch) in
+               ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
+       esac
+
+       use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
+
+       [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
+
+       is_cross && myconf+=(
+               --with-sysroot="${EPREFIX}"/usr/${CTARGET}
+               --enable-poison-system-directories
+       )
+
+       # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
+       # on everyone in alpha (for now), we'll just enable it when possible
+       has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
+       has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
+
+       # mips can't do hash-style=gnu ...
+       if [[ $(tc-arch) != mips ]] ; then
+               myconf+=( --enable-default-hash-style=gnu )
+       fi
+
+       myconf+=(
+               --prefix="${EPREFIX}"/usr
+               --host=${CHOST}
+               --target=${CTARGET}
+               --datadir="${EPREFIX}"${DATAPATH}
+               --datarootdir="${EPREFIX}"${DATAPATH}
+               --infodir="${EPREFIX}"${DATAPATH}/info
+               --mandir="${EPREFIX}"${DATAPATH}/man
+               --bindir="${EPREFIX}"${BINPATH}
+               --libdir="${EPREFIX}"${LIBPATH}
+               --libexecdir="${EPREFIX}"${LIBPATH}
+               --includedir="${EPREFIX}"${INCPATH}
+               --enable-obsolete
+               --enable-shared
+               --enable-threads
+               # Newer versions (>=2.27) offer a configure flag now.
+               --enable-relro
+               # Newer versions (>=2.24) make this an explicit option. #497268
+               --enable-install-libiberty
+               --disable-werror
+               --with-bugurl="$(toolchain-binutils_bugurl)"
+               --with-pkgversion="$(toolchain-binutils_pkgversion)"
+               $(use_enable static-libs static)
+               ${EXTRA_ECONF}
+               # Disable modules that are in a combined binutils/gdb tree. #490566
+               --disable-{gdb,libdecnumber,readline,sim}
+               # Strip out broken static link flags.
+               # https://gcc.gnu.org/PR56750
+               --without-stage1-ldflags
+       )
+       echo ./configure "${myconf[@]}"
+       "${S}"/configure "${myconf[@]}" || die
+
+       # Prevent makeinfo from running if doc is unset.
+       if ! use doc ; then
+               sed -i \
+                       -e '/^MAKEINFO/s:=.*:= true:' \
+                       Makefile || die
+       fi
+}
+
+src_compile() {
+       cd "${MY_BUILDDIR}"
+       # see Note [tooldir hack for ldscripts]
+       emake tooldir="${EPREFIX}${TOOLPATH}" all
+
+       # only build info pages if the user wants them
+       if use doc ; then
+               emake info
+       fi
+
+       # we nuke the manpages when we're left with junk
+       # (like when we bootstrap, no perl -> no manpages)
+       find . -name '*.1' -a -size 0 -delete
+}
+
+src_test() {
+       cd "${MY_BUILDDIR}"
+       emake -k check
+}
+
+src_install() {
+       local x d
+
+       cd "${MY_BUILDDIR}"
+       # see Note [tooldir hack for ldscripts]
+       emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install
+       rm -rf "${ED}"/${LIBPATH}/bin
+       use static-libs || find "${ED}" -name '*.la' -delete
+
+       # Newer versions of binutils get fancy with ${LIBPATH} #171905
+       cd "${ED}"/${LIBPATH}
+       for d in ../* ; do
+               [[ ${d} == ../${PV} ]] && continue
+               mv ${d}/* . || die
+               rmdir ${d} || die
+       done
+
+       # Now we collect everything intp the proper SLOT-ed dirs
+       # When something is built to cross-compile, it installs into
+       # /usr/$CHOST/ by default ... we have to 'fix' that :)
+       if is_cross ; then
+               cd "${ED}"/${BINPATH}
+               for x in * ; do
+                       mv ${x} ${x/${CTARGET}-}
+               done
+
+               if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
+                       mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
+                       mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
+                       rm -r "${ED}"/usr/${CHOST}/{include,lib}
+               fi
+       fi
+       insinto ${INCPATH}
+       local libiberty_headers=(
+               # Not all the libiberty headers.  See libiberty/Makefile.in:install_to_libdir.
+               demangle.h
+               dyn-string.h
+               fibheap.h
+               hashtab.h
+               libiberty.h
+               objalloc.h
+               splay-tree.h
+       )
+       doins "${libiberty_headers[@]/#/${S}/include/}" || die
+       if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
+               mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
+               rm -r "${ED}"/${LIBPATH}/lib
+       fi
+
+       # Generate an env.d entry for this binutils
+       insinto /etc/env.d/binutils
+       cat <<-EOF > "${T}"/env.d
+               TARGET="${CTARGET}"
+               VER="${PV}"
+               LIBPATH="${EPREFIX}${LIBPATH}"
+       EOF
+       newins "${T}"/env.d ${CTARGET}-${PV}
+
+       # Handle documentation
+       if ! is_cross ; then
+               cd "${S}"
+               dodoc README
+               docinto bfd
+               dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
+               docinto binutils
+               dodoc binutils/ChangeLog binutils/NEWS binutils/README
+               docinto gas
+               dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
+               docinto gprof
+               dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
+               docinto ld
+               dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
+               docinto libiberty
+               dodoc libiberty/ChangeLog* libiberty/README
+               docinto opcodes
+               dodoc opcodes/ChangeLog*
+       fi
+
+       # Remove shared info pages
+       rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
+
+       # Trim all empty dirs
+       find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
+}
+
+pkg_postinst() {
+       # Make sure this ${CTARGET} has a binutils version selected
+       [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
+       binutils-config ${CTARGET}-${PV}
+}
+
+pkg_postrm() {
+       local current_profile=$(binutils-config -c ${CTARGET})
+
+       # If no other versions exist, then uninstall for this
+       # target ... otherwise, switch to the newest version
+       # Note: only do this if this version is unmerged.  We
+       #       rerun binutils-config if this is a remerge, as
+       #       we want the mtimes on the symlinks updated (if
+       #       it is the same as the current selected profile)
+       if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${PV} ]] ; then
+               local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
+               choice=${choice//$'\n'/ }
+               choice=${choice/* }
+               if [[ -z ${choice} ]] ; then
+                       binutils-config -u ${CTARGET}
+               else
+                       binutils-config ${choice}
+               fi
+       elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${PV} ]] ; then
+               binutils-config ${CTARGET}-${PV}
+       fi
+}
+
+# Note [slotting support]
+# -----------------------
+# Gentoo's layout for binutils files is non-standard as Gentoo
+# supports slotted installation for binutils. Many tools
+# still expect binutils to reside in known locations.
+# binutils-config package restores symlinks into known locations,
+# like:
+#    /usr/bin/${CTARGET}-<tool>
+#    /usr/bin/${CHOST}/${CTARGET}/lib/ldscrips
+#    /usr/include/
+#
+# Note [tooldir hack for ldscripts]
+# ---------------------------------
+# Build system does not allow ./configure to tweak every location
+# we need for slotting binutils hence all the shuffling in
+# src_install(). This note is about SCRIPTDIR define handling.
+#
+# SCRIPTDIR defines 'ldscripts/' directory location. SCRIPTDIR value
+# is set at build-time in ld/Makefile.am as: 'scriptdir = $(tooldir)/lib'
+# and hardcoded as -DSCRIPTDIR='"$(scriptdir)"' at compile time.
+# Thus we can't just move files around after compilation finished.
+#
+# Our goal is the following:
+# - at build-time set scriptdir to point to symlinked location:
+#   ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case)
+# - at install-time set scriptdir to point to slotted location:
+#   ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV}
index 5a79c08c6b9dcad161ed94cdbfe668d624531fc2..b51be8aa269b4300bcf027e931d4513f5df22784 100644 (file)
@@ -35,13 +35,13 @@ case ${PV} in
                inherit git-r3
                S=${WORKDIR}/binutils
                EGIT_CHECKOUT_DIR=${S}
-               EGIT_BRANCH=${PV%.9999}
+               EGIT_BRANCH=$(get_version_component_range 1-2)
                EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
-               SLOT=${PV%.9999}
+               SLOT=$(get_version_component_range 1-2)
                ;;
        *)
                SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
-               SLOT=${PV}
+               SLOT=$(get_version_component_range 1-2)
                ;;
 esac
 
index a2e72661a566f71127c7cff3c691a7555a8d0ddd..b51be8aa269b4300bcf027e931d4513f5df22784 100644 (file)
@@ -20,6 +20,7 @@ IUSE="+cxx doc multitarget +nls static-libs test"
 #                      Default: dilfridge :)
 
 PATCH_VER=1
+PATCH_BINUTILS_VER=9999
 
 case ${PV} in
        9999)
@@ -34,13 +35,13 @@ case ${PV} in
                inherit git-r3
                S=${WORKDIR}/binutils
                EGIT_CHECKOUT_DIR=${S}
-               EGIT_BRANCH=${PV%.9999}
+               EGIT_BRANCH=$(get_version_component_range 1-2)
                EGIT_BRANCH="binutils-${EGIT_BRANCH/./_}-branch"
-               SLOT=${PV%.9999}
+               SLOT=$(get_version_component_range 1-2)
                ;;
        *)
                SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz"
-               SLOT=${PV}
+               SLOT=$(get_version_component_range 1-2)
                ;;
 esac