From 0f558761aa2dee1017b4751e4017205e015a9560 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 29 Jun 2022 12:04:12 +0100 Subject: gentoo resync : 29.12.2022 --- sys-devel/binutils/Manifest | 6 +- sys-devel/binutils/binutils-2.37_p1-r3.ebuild | 476 +++++++++++++++++++++++++ sys-devel/binutils/binutils-2.38-r2.ebuild | 16 +- sys-devel/binutils/binutils-2.38-r3.ebuild | 484 ++++++++++++++++++++++++++ sys-devel/binutils/binutils-9999.ebuild | 52 ++- 5 files changed, 1018 insertions(+), 16 deletions(-) create mode 100644 sys-devel/binutils/binutils-2.37_p1-r3.ebuild create mode 100644 sys-devel/binutils/binutils-2.38-r3.ebuild (limited to 'sys-devel/binutils') diff --git a/sys-devel/binutils/Manifest b/sys-devel/binutils/Manifest index f1e69f5fd2c0..6207fb8f1514 100644 --- a/sys-devel/binutils/Manifest +++ b/sys-devel/binutils/Manifest @@ -25,7 +25,9 @@ EBUILD binutils-2.34-r2.ebuild 11770 BLAKE2B 7cb3c8bbeb0ae93677d13f8c036a8886e2d EBUILD binutils-2.35.2.ebuild 12651 BLAKE2B d97d3cfab222e74e94bdc5d462bf95f9d39cd62ffc686982598a8041b6bda0358ab39fcf4cfdd6fda3b444859db97c39a50971032008dbd982301e1afff94b41 SHA512 6c6820a8206cb8cf5d4df8e1c1e5448e0a3ba77ab067bc49525787beadad464aef27fb04debbfde4720a3a44b02a4206fd4b3c4d18eb19428a7d98254753fd05 EBUILD binutils-2.36.1-r2.ebuild 12553 BLAKE2B 8ce3d14f6d7cc81e920f7d5a28875a5bcc45b396169afe5a6e4429849eb9b420977f39fd85487d3ef93a2aef838c6122413b7ef5c9f8c6273d9d1b1bf5b4608a SHA512 53935fec45e8241e73c76be22dde5e9576360cb511642bb5fded59515ea0641cbcb7eb6bd6eef2f30d6d4e940cf1869908c96b194ec1f5e9a016664a5c6cf2eb EBUILD binutils-2.37_p1-r2.ebuild 13024 BLAKE2B e67ed4a55a9f07ebd064c82901bc6b5e23933f562c8b6258d32649571f38cbc81061fcb886feaa70619d46d47c52cd701745c173ccf060e47c5cfef2d202a8ca SHA512 480b1921ff344b943b1cf2c1ea9960cd5252f8055a4bffc109f096b038d4d1fc2dd670d696ce7217fd1d827eef5c07cc81c7d0886fc554d939535582d5300f26 +EBUILD binutils-2.37_p1-r3.ebuild 13521 BLAKE2B a3b84f02236cb365ff292737a1953095f55112fbd83443c8ae59396309e7eaa9ceae2f50701aaa9bfc54b2c1e8f018440d46400cdff5c0806262ed9cea2ef62d SHA512 241e1f20b8f2f6eaa350c490a4fa32fc1fbf9092cc665728bc5bfa0a560deebcc9f17634e992fa5af28b64cff05156e59730c3421dd891a292a598809dc01c5e EBUILD binutils-2.38-r1.ebuild 13032 BLAKE2B 23dcf886c2fc5837ad09a69fb5671b65e57cedd0b1275242da32d6fa07ca198ebfc08875f0675193651f33a39b4f872cea46de2953bff94246d5f0db22e20abc SHA512 9fcd78ef633f16e1ecdd5c5ffe68f182e93ad8c2fbbcda8a80d00870b102c4801a65781251ecc623a6f7d42a20d60cb29e88d074d7b8b9a0736e63f252420603 -EBUILD binutils-2.38-r2.ebuild 13039 BLAKE2B 3cdb3f950fa3655e6d780dc719e6138c8e30e50c900c6ef8d14aab8a8cab236b3dfdb7f223e5e77df34d4fce5906e762bc9c06b61cf38eb9833d87f2e65aa122 SHA512 c38d454684725143884edc109f6f93a7b36af8bc33e8b7780e259a36a02b3c6da44d04e9e2719d0033b5d7744e78c83570e40df9caaff4428736576666a20d2f -EBUILD binutils-9999.ebuild 12756 BLAKE2B 61bbda21788637482b6e882792f651d2818cf40628f04efe7998531e1fba866c7f3709ebfb7b450eb33447f64140f4332bcf675df34e94dd636e8b26d0ef2d7a SHA512 c568133af68520a4c2e0701d3652082ddd1988346bb69159da558d9b2457e20134c6226f6660c72ebaecfb24d64651fc36badccdc486c103542bbf993c00b2f0 +EBUILD binutils-2.38-r2.ebuild 13410 BLAKE2B 2aadf421e6be88cd7988bd7220b16f465f4503457161886a7a8d4bb922fe673a4e061648c1a16529e0ef9901ad962a77591d8a5ca90f0a21a4ef5ce6e38dcacf SHA512 686d9d74b708f752bdd5028fac45bef48d565b39253f7fb46721dbffed6228e100561af0ab6c2d138813983f580a582a5823481b7ddeaa0bc348e79ad875a4e6 +EBUILD binutils-2.38-r3.ebuild 13899 BLAKE2B b630055d3594adf80ff2064089645725f371dc87ae806cff4cfb21409f321414a7fdc7c019f76ccfbae477f968b3361a7f558622f3b8e6879fb52600a442afac SHA512 52da3b15acae5e0908417ef37aa52a0d0f79b61a90ee224dadcb1873940106d4ab3a5b47f41c670a8b3ca8acab3ab992b5e7b4cac0c28b6522509003dd0c5c99 +EBUILD binutils-9999.ebuild 13781 BLAKE2B b418d53a5f00969e5d94efcc6de5a3cf1c84d7aaecc2bab60fab62cd417879ad59d55abc91eecd7971a8f38db0faa3581f227487e7aca32d886f5c10a5252fb4 SHA512 8c86a423290361d6201b952c9517751a3ee7b4a0d3cfc2ee5a49926d1f3e65889c53b139f570dd65eb4c4bfb5767ec9f743f208cbc5babe7b540cc11fcb8a23e MISC metadata.xml 815 BLAKE2B 0d866827f8a6d0244be472dea595d5784ea60464ba361cde9bd062473b5eb19ccecc99bb58729acadd2cfe7dc017cdb2107fc282a31be6ed96c757954e6c9ac0 SHA512 8996f29b159ba483293b8d80eb62372ee0016e817d9ac55b7de9c211aca770b5a05135e705aac108099181d879daf5e22df1facab64bc7765966b3d7e3274e16 diff --git a/sys-devel/binutils/binutils-2.37_p1-r3.ebuild b/sys-devel/binutils/binutils-2.37_p1-r3.ebuild new file mode 100644 index 000000000000..b6100c1d6a22 --- /dev/null +++ b/sys-devel/binutils/binutils-2.37_p1-r3.ebuild @@ -0,0 +1,476 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs + +DESCRIPTION="Tools necessary to build programs" +HOMEPAGE="https://sourceware.org/binutils/" +LICENSE="GPL-3+" +IUSE="cet default-gold doc +gold multitarget +nls pgo +plugins static-libs test vanilla" +REQUIRED_USE="default-gold? ( gold )" + +# Variables that can be set here (ignored for live ebuilds) +# 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 + +PATCH_VER=2 +PATCH_DEV=dilfridge + +if [[ ${PV} == 9999* ]]; then + inherit git-r3 + SLOT=${PV} +else + PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} + PATCH_DEV=${PATCH_DEV:-dilfridge} + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" + [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" + SLOT=$(ver_cut 1-2) + #KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" +fi + +# +# 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}" +BDEPEND=" + doc? ( sys-apps/texinfo ) + test? ( + dev-util/dejagnu + sys-devel/bc + ) + nls? ( sys-devel/gettext ) + sys-devel/flex + virtual/yacc +" + +RESTRICT="!test? ( test )" + +MY_BUILDDIR=${WORKDIR}/build + +src_unpack() { + if [[ ${PV} == 9999* ]] ; then + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git" + EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git + git-r3_src_unpack + mv patches-git/9999 patch || die + + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" + S=${WORKDIR}/binutils + EGIT_CHECKOUT_DIR=${S} + git-r3_src_unpack + else + unpack ${P/-hppa64/}.tar.xz + + cd "${WORKDIR}" || die + unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz + + # _p patch versions are Gentoo specific tarballs ... + local dir=${P%_p?} + dir=${dir/-hppa64/} + + S=${WORKDIR}/${dir} + fi + + cd "${WORKDIR}" || die + mkdir -p "${MY_BUILDDIR}" || die +} + +src_prepare() { + local patchsetname + if [[ ${PV} == 9999* ]] ; then + patchsetname="from git master" + else + patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}" + fi + + if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then + if ! use vanilla; then + einfo "Applying binutils patchset ${patchsetname}" + eapply "${WORKDIR}/patch" + einfo "Done." + 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:\: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} + + # see Note [tooldir hack for ldscripts] + if is_cross ; then + TOOLPATH=/usr/${CHOST}/${CTARGET} + BINPATH=${TOOLPATH}/binutils-bin/${PV} + else + BINPATH=/usr/${CTARGET}/binutils-bin/${PV} + fi + + # 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 + + use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 + + 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=() + + if use plugins ; then + myconf+=( --enable-plugins ) + fi + # enable gold (installed as ld.gold) and ld's plugin architecture + if use gold ; then + myconf+=( --enable-gold ) + if use default-gold; then + myconf+=( --enable-gold=default ) + fi + 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 + # Available from 2.35 on + --enable-textrel-check=warning + # Works better than vapier's patch... #808787 + --enable-new-dtags + --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 + # Change SONAME to avoid conflict across + # {native,cross}/binutils, binutils-libs. #666100 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) + + # avoid automagic dependency on (currently prefix) systems + # systems with debuginfod library, bug #754753 + --without-debuginfod + + # Allow user to opt into CET for host libraries. + # Ideally we would like automagic-or-disabled here. + # But the check does not quite work on i686: bug #760926. + $(use_enable cet) + ) + + if ! is_cross ; then + myconf+=( $(use_enable pgo pgo-build lto) ) + + if use pgo ; then + export BUILD_CFLAGS="${CFLAGS}" + fi + fi + + 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] + if is_cross ; then + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + else + emake V=1 all + fi + + # 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}" + + # bug 637066 + filter-flags -Wall -Wreturn-type + + emake -k check +} + +src_install() { + local x d + + cd "${MY_BUILDDIR}" + + # see Note [tooldir hack for ldscripts] + emake V=1 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/}" + 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}- +# /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} +# +# Now, this would all be very nice except for the fact that the changed +# directory makes libtool re-link libraries during the install phase. +# It uses libraries from the system installation to do that (bad) +# and fails if it cant handle these (e.g. newer LTO version than in +# current gcc, see bugs 834720 and 838925). +# +# So, we apply this whole hack only for cross builds. diff --git a/sys-devel/binutils/binutils-2.38-r2.ebuild b/sys-devel/binutils/binutils-2.38-r2.ebuild index 4a491aa88c86..dcf30dbb65a6 100644 --- a/sys-devel/binutils/binutils-2.38-r2.ebuild +++ b/sys-devel/binutils/binutils-2.38-r2.ebuild @@ -152,6 +152,11 @@ toolchain-binutils_pkgversion() { } src_configure() { + # See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html + # Avoid really confusing logs from subconfigure spam, makes logs far + # more legible. + MAKEOPTS="--output-sync=line ${MAKEOPTS}" + # Setup some paths LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} INCPATH=${LIBPATH}/include @@ -228,6 +233,9 @@ src_configure() { fi myconf+=( + # (--disable-silent-rules should get passed automatically w/ econf which we use + # in >= 2.39, so can drop it then.) + --disable-silent-rules --prefix="${EPREFIX}"/usr --host=${CHOST} --target=${CTARGET} @@ -296,11 +304,11 @@ src_configure() { src_compile() { cd "${MY_BUILDDIR}" # see Note [tooldir hack for ldscripts] - emake tooldir="${EPREFIX}${TOOLPATH}" all + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all # only build info pages if the user wants them if use doc ; then - emake info + emake V=1 info fi # we nuke the manpages when we're left with junk @@ -314,7 +322,7 @@ src_test() { # bug 637066 filter-flags -Wall -Wreturn-type - emake -k check + emake -k V=1 check } src_install() { @@ -322,7 +330,7 @@ src_install() { cd "${MY_BUILDDIR}" # see Note [tooldir hack for ldscripts] - emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install + emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install rm -rf "${ED}"/${LIBPATH}/bin use static-libs || find "${ED}" -name '*.la' -delete diff --git a/sys-devel/binutils/binutils-2.38-r3.ebuild b/sys-devel/binutils/binutils-2.38-r3.ebuild new file mode 100644 index 000000000000..3fd587616c36 --- /dev/null +++ b/sys-devel/binutils/binutils-2.38-r3.ebuild @@ -0,0 +1,484 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit libtool flag-o-matic gnuconfig strip-linguas toolchain-funcs + +DESCRIPTION="Tools necessary to build programs" +HOMEPAGE="https://sourceware.org/binutils/" +LICENSE="GPL-3+" +IUSE="cet default-gold doc +gold multitarget +nls pgo +plugins static-libs test vanilla" +REQUIRED_USE="default-gold? ( gold )" + +# Variables that can be set here (ignored for live ebuilds) +# 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 + +PATCH_VER=4 +PATCH_DEV=dilfridge + +if [[ ${PV} == 9999* ]]; then + inherit git-r3 + SLOT=${PV} +else + PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} + PATCH_DEV=${PATCH_DEV:-dilfridge} + SRC_URI="mirror://gnu/binutils/binutils-${PV}.tar.xz https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PV}.tar.xz" + [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} + https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" + SLOT=$(ver_cut 1-2) + #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +fi + +# +# 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}" +BDEPEND=" + doc? ( sys-apps/texinfo ) + test? ( + dev-util/dejagnu + sys-devel/bc + ) + nls? ( sys-devel/gettext ) + sys-devel/flex + virtual/yacc +" + +RESTRICT="!test? ( test )" + +MY_BUILDDIR=${WORKDIR}/build + +src_unpack() { + if [[ ${PV} == 9999* ]] ; then + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git" + EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git + git-r3_src_unpack + mv patches-git/9999 patch || die + + EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" + S=${WORKDIR}/binutils + EGIT_CHECKOUT_DIR=${S} + git-r3_src_unpack + else + unpack ${P/-hppa64/}.tar.xz + + cd "${WORKDIR}" || die + unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz + + # _p patch versions are Gentoo specific tarballs ... + local dir=${P%_p?} + dir=${dir/-hppa64/} + + S=${WORKDIR}/${dir} + fi + + cd "${WORKDIR}" || die + mkdir -p "${MY_BUILDDIR}" || die +} + +src_prepare() { + local patchsetname + if [[ ${PV} == 9999* ]] ; then + patchsetname="from git master" + else + patchsetname="${PATCH_BINUTILS_VER}-${PATCH_VER}" + fi + + if [[ -n ${PATCH_VER} ]] || [[ ${PV} == 9999* ]] ; then + if ! use vanilla; then + einfo "Applying binutils patchset ${patchsetname}" + eapply "${WORKDIR}/patch" + einfo "Done." + 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:\: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() { + # See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html + # Avoid really confusing logs from subconfigure spam, makes logs far + # more legible. + MAKEOPTS="--output-sync=line ${MAKEOPTS}" + + # Setup some paths + LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} + INCPATH=${LIBPATH}/include + DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} + + # see Note [tooldir hack for ldscripts] + if is_cross ; then + TOOLPATH=/usr/${CHOST}/${CTARGET} + BINPATH=${TOOLPATH}/binutils-bin/${PV} + else + BINPATH=/usr/${CTARGET}/binutils-bin/${PV} + fi + + # 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 + + use elibc_musl && append-ldflags -Wl,-z,stack-size=2097152 + + 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=() + + if use plugins ; then + myconf+=( --enable-plugins ) + fi + # enable gold (installed as ld.gold) and ld's plugin architecture + if use gold ; then + myconf+=( --enable-gold ) + if use default-gold; then + myconf+=( --enable-gold=default ) + fi + 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+=( + # (--disable-silent-rules should get passed automatically w/ econf which we use + # in >= 2.39, so can drop it then.) + --disable-silent-rules + --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 + # Available from 2.35 on + --enable-textrel-check=warning + # Works better than vapier's patch... #808787 + --enable-new-dtags + --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 + # Change SONAME to avoid conflict across + # {native,cross}/binutils, binutils-libs. #666100 + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) + + # avoid automagic dependency on (currently prefix) systems + # systems with debuginfod library, bug #754753 + --without-debuginfod + + # Allow user to opt into CET for host libraries. + # Ideally we would like automagic-or-disabled here. + # But the check does not quite work on i686: bug #760926. + $(use_enable cet) + ) + + if ! is_cross ; then + myconf+=( $(use_enable pgo pgo-build lto) ) + + if use pgo ; then + export BUILD_CFLAGS="${CFLAGS}" + fi + fi + + 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] + if is_cross ; then + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + else + emake V=1 all + fi + + # only build info pages if the user wants them + if use doc ; then + emake V=1 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}" + + # bug 637066 + filter-flags -Wall -Wreturn-type + + emake -k V=1 check +} + +src_install() { + local x d + + cd "${MY_BUILDDIR}" + + # see Note [tooldir hack for ldscripts] + emake V=1 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/}" + 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}- +# /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} +# +# Now, this would all be very nice except for the fact that the changed +# directory makes libtool re-link libraries during the install phase. +# It uses libraries from the system installation to do that (bad) +# and fails if it cant handle these (e.g. newer LTO version than in +# current gcc, see bugs 834720 and 838925). +# +# So, we apply this whole hack only for cross builds. diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild index 10b90a94daee..ae887224952e 100644 --- a/sys-devel/binutils/binutils-9999.ebuild +++ b/sys-devel/binutils/binutils-9999.ebuild @@ -148,16 +148,23 @@ toolchain-binutils_pkgversion() { } src_configure() { + # See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html + # Avoid really confusing logs from subconfigure spam, makes logs far + # more legible. + MAKEOPTS="--output-sync=line ${MAKEOPTS}" + # Setup some paths LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} INCPATH=${LIBPATH}/include DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} + + # see Note [tooldir hack for ldscripts] if is_cross ; then TOOLPATH=/usr/${CHOST}/${CTARGET} + BINPATH=${TOOLPATH}/binutils-bin/${PV} else - TOOLPATH=/usr/${CTARGET} + BINPATH=/usr/${CTARGET}/binutils-bin/${PV} fi - BINPATH=${TOOLPATH}/binutils-bin/${PV} # Make sure we filter $LINGUAS so that only ones that # actually work make it through, bug #42033 @@ -175,7 +182,7 @@ src_configure() { done echo - cd "${MY_BUILDDIR}" + cd "${MY_BUILDDIR}" || die local myconf=() if use plugins ; then @@ -242,13 +249,26 @@ src_configure() { --enable-install-libiberty # Available from 2.35 on --enable-textrel-check=warning + + # Available from 2.39 on + --enable-warn-execstack + --enable-warn-rwx-segments + # TODO: Available from 2.39+ on but let's try the warning on for a bit + # first... (--enable-warn-execstack) + # Could put it under USE=hardened? + #--enable-default-execstack + + # Things to think about + #--enable-deterministic-archives + # Works better than vapier's patch, bug #808787 --enable-new-dtags + + --disable-jansson --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, bug #490566 --disable-{gdb,libdecnumber,readline,sim} # Strip out broken static link flags. @@ -276,8 +296,7 @@ src_configure() { fi fi - echo ./configure "${myconf[@]}" - "${S}"/configure "${myconf[@]}" || die + ECONF_SOURCE="${S}" econf "${myconf[@]}" || die # Prevent makeinfo from running if doc is unset. if ! use doc ; then @@ -291,11 +310,15 @@ src_compile() { cd "${MY_BUILDDIR}" || die # see Note [tooldir hack for ldscripts] - emake tooldir="${EPREFIX}${TOOLPATH}" all + if is_cross ; then + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + else + emake V=1 all + fi # only build info pages if the user wants them if use doc ; then - emake info + emake V=1 info fi # we nuke the manpages when we're left with junk @@ -309,7 +332,7 @@ src_test() { # bug #637066 filter-flags -Wall -Wreturn-type - emake -k check + emake -k V=1 check } src_install() { @@ -318,7 +341,8 @@ src_install() { cd "${MY_BUILDDIR}" || die # see Note [tooldir hack for ldscripts] - emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install + emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install + rm -rf "${ED}"/${LIBPATH}/bin || die use static-libs || find "${ED}" -name '*.la' -delete @@ -462,3 +486,11 @@ pkg_postrm() { # ${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} +# +# Now, this would all be very nice except for the fact that the changed +# directory makes libtool re-link libraries during the install phase. +# It uses libraries from the system installation to do that (bad) +# and fails if it cant handle these (e.g. newer LTO version than in +# current gcc, see bugs 834720 and 838925). +# +# So, we apply this whole hack only for cross builds. -- cgit v1.2.3