diff --git a/sys-libs/binutils-libs/Manifest b/sys-libs/binutils-libs/Manifest index 4780068275e62..7aaadaa4caf08 100644 --- a/sys-libs/binutils-libs/Manifest +++ b/sys-libs/binutils-libs/Manifest @@ -31,3 +31,6 @@ DIST binutils-2.46.1-patches-1.tar.xz 6916 BLAKE2B 4588923757470819d7d0f344b8c14 DIST binutils-2.46.1-patches-2.tar.xz 9852 BLAKE2B e024d51fc049e71ce215024ed39c4dae2d459f97f83ed1c6dec9cea9da923462150bf830712e1be17b12f804e19454f13d6a663dd2c5724474ac78e46f16068f SHA512 221000686c65e31a1727aba2dd3c2f23172b3423fa0f1d6b277ec0ba01f8846ad85c51483e292cbd5c44f206639e222d34246cefb7660e2c1c4730f421715487 DIST binutils-2.46.1.tar.xz 28636456 BLAKE2B a5a0578281d6315a43437ccf7636b3b91185c2706f1582b22af6973f55a86f5b4bc7eb03aa9ceaec547070152c08c982bc40ee9ce07679f2e3bb49e050bae76c SHA512 a5c65e56e400ed3fb8906a995dbb93eb5bea54b16344244653d7f44ef29ceb60270da263b19d25302c37759784e14fcb4b9421b29e0e2c7f450bd99f6bb4595c DIST binutils-2.46.1.tar.xz.sig 395 BLAKE2B 5c8d5fc9fd3abf8de72e603d5f529d8fdef2345851d6af6644e443e95e50558a6b2006914edf54094178075b1ed9e51a630773b7c74e7b421eacba4bb8028a29 SHA512 e7746a14c74a04cee1a7b82bd463ff42f304e3646e4808a03ac7ee8d367a61627297c30816f008b919b8db7cc706062d927f424a787e0f1da3ad432ec18cfa0f +DIST binutils-2.47-patches-1.tar.xz 9736 BLAKE2B 8a0aad0635792c5474b7ddeda234e146b57cebf3346474fbd1e53c3f9f30df317be1363967cffbd46605adc302a172bf2eec5d94a256169eb1ccbd2b309b4a32 SHA512 82986da3abcc0e751d0dcd8df1615688906d7d5b01490969fe4afbc4b400c79b6eb35afd09c56668f930e67082ec751895a635af42021a9162f3fcaa84eda11b +DIST binutils-2.47.tar.xz 29034716 BLAKE2B 329cae8792c500c71d8cce03aab127e8d77f1d409f74872082e64df5163e5c730fe585f8f9c21905cb6227cae18e6675ae4caed653223a26b5d9d4fdb90910ea SHA512 3126a1064374d8da40d4d70630c204ed1e75d542c447d53fca9778c7ceff095c28e9b445e15a313fef9729082d7966471ee6b5b715d479aa6d568528743e1d98 +DIST binutils-2.47.tar.xz.sig 833 BLAKE2B 3a3cd16813153eeba88e604d3137c695cba91132ac89ec26a0d82e35332028db3302954f5812120d5e79379a21670a33703b571315970a9570759fd3cf03088d SHA512 ca3e62d4746da129405c7d69e757f295aed68fbe267c9efc8d248cf2ce98fde55d953e663896507db494dbbaa5a904cd82d159ef9d9b26944e047bff1e40439c diff --git a/sys-libs/binutils-libs/binutils-libs-2.47.ebuild b/sys-libs/binutils-libs/binutils-libs-2.47.ebuild new file mode 100644 index 0000000000000..68624167535fc --- /dev/null +++ b/sys-libs/binutils-libs/binutils-libs-2.47.ebuild @@ -0,0 +1,266 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit dot-a flag-o-matic libtool toolchain-funcs multilib-minimal + +DESCRIPTION="Core binutils libraries (libbfd, libopcodes, libiberty) for external packages" +HOMEPAGE="https://sourceware.org/binutils/" + +LICENSE="|| ( GPL-3 LGPL-3 )" +IUSE="64-bit-bfd cet multitarget nls static-libs test" + +# 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=1 + +MY_PN=binutils +MY_P=${MY_PN}-${PV} + +if [[ ${PV} == 9999 ]]; then + inherit git-r3 + SLOT="0/${PV}" +elif [[ ${PV} == *9999 ]]; then + inherit git-r3 + SLOT="0/$(ver_cut 1-2)" +else + VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/binutils.asc + inherit verify-sig + PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${PV}} + PATCH_DEV=${PATCH_DEV:-dilfridge} + SRC_URI=" + mirror://gnu/binutils/${MY_P}.tar.xz + verify-sig? ( mirror://gnu/binutils/${MY_P}.tar.xz.sig ) + " + [[ -z ${PATCH_VER} ]] || SRC_URI+=" https://distfiles.gentoo.org/pub/proj/toolchain/${MY_PN}/patches/${MY_PN}-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" + SLOT="0/${PV}" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~arm64-macos ~x64-macos ~x64-solaris" + + BDEPEND="verify-sig? ( sec-keys/openpgp-keys-binutils )" +fi + +BDEPEND+=" + nls? ( sys-devel/gettext ) + test? ( dev-util/dejagnu ) +" +DEPEND="virtual/zlib:=[${MULTILIB_USEDEP}]" +# Need a newer binutils-config that'll reset include/lib symlinks for us. +RDEPEND="${DEPEND} + >=sys-devel/binutils-config-5 +" + +RESTRICT="!test? ( test )" + +MULTILIB_WRAPPED_HEADERS=( + /usr/include/bfd.h +) + +src_unpack() { + if [[ ${PV} == *9999 ]] ; then + EGIT_REPO_URI=" + https://anongit.gentoo.org/git/proj/toolchain/binutils-patches.git + https://github.com/gentoo/binutils-patches + " + EGIT_CHECKOUT_DIR=${WORKDIR}/patches-git + git-r3_src_unpack + mv patches-git/9999 patches || die + + if [[ ${PV} != 9999 ]] ; then + EGIT_BRANCH=binutils-$(ver_cut 1)_$(ver_cut 2)-branch + fi + EGIT_REPO_URI=" + https://sourceware.org/git/binutils-gdb.git + https://git.sr.ht/~sourceware/binutils-gdb + https://gitlab.com/x86-binutils/binutils-gdb.git + " + S=${WORKDIR}/binutils + EGIT_CHECKOUT_DIR=${S} + git-r3_src_unpack + else + use verify-sig && verify-sig_verify_detached "${DISTDIR}"/${MY_P/-hppa64/}.tar.xz{,.sig} + unpack ${MY_P}.tar.xz + + cd "${WORKDIR}" || die + unpack binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz + + # _p patch versions are Gentoo specific tarballs ... + local dir=${MY_P} + dir=${dir/-hppa64/} + + S=${WORKDIR}/${dir} + fi + + cd "${WORKDIR}" || die +} + +src_prepare() { + if [[ -n ${PATCH_VER} ]] ; then + einfo "Applying binutils-${PATCH_BINUTILS_VER} patchset ${PATCH_VER}" + eapply "${WORKDIR}/patches" + fi + + # Fix cross-compile relinking issue, bug #626402 + elibtoolize + + if [[ ${CHOST} == *-darwin* ]] ; then + # somehow libtool/configure is messed up and (custom patch at + # upstream?) and misdetects (basically assumes) nm can be called + # with -B arg -- can't run eautoreconf (fails), so patch up + # manually, this would break any target that needs -B to nm + sed -i -e 's/lt_cv_path_NM="$tmp_nm -B"/lt_cv_path_NM="$tmp_nm"/' \ + libctf/configure || die + fi + + # 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. + export MAKEOPTS="--output-sync=line ${MAKEOPTS}" + + default +} + +pkgversion() { + printf "Gentoo ${PVR}" + [[ -n ${PATCHVER} ]] && printf " p${PATCHVER}" +} + +src_configure() { + lto-guarantee-fat + multilib-minimal_src_configure +} + +multilib_src_configure() { + local myconf=( + # portage's econf() does not detect presence of --d-d-t + # because it greps only top-level ./configure. But not + # libiberty's or bfd's configure. + --disable-dependency-tracking + --disable-silent-rules + --enable-obsolete + --enable-shared + --enable-threads + # Newer versions (>=2.24) make this an explicit option. #497268 + --enable-install-libiberty + --disable-werror + --with-bugurl="https://bugs.gentoo.org/" + --with-pkgversion="$(pkgversion)" + $(use_enable static-libs static) + # The binutils eclass enables this flag for all bi-arch builds, + # but other tools often don't care about that support. Put it + # beyond a flag if people really want it, but otherwise leave + # it disabled as it can slow things down on 32bit arches. #438522 + $(use_enable 64-bit-bfd) + # This only disables building in the zlib subdir. + # For binutils itself, it'll use the system version. #591516 + --without-zlib + --with-system-zlib + # We only care about the libs, so disable programs. #528088 + --disable-{binutils,etc,ld,gas,gprof,gprofng} + # Disable modules that are in a combined binutils/gdb tree. #490566 + --disable-{gdb,gdbserver,libbacktrace,libdecnumber,readline,sim} + # Strip out broken static link flags. + # https://gcc.gnu.org/PR56750 + --without-stage1-ldflags + # We pull in all USE-flags that change ABI in an incompatible + # way. #666100 + # USE=multitarget change size of global arrays + # USE=64-bit-bfd changes data structures of exported API + --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st)-$(usex 64-bit-bfd 64 def) + + # Avoid automagic dependency on (currently prefix) systems + # with debuginfod library, bug #754753 + --without-debuginfod + + # Revisit if it's useful, we do have binutils[zstd] though + --without-zstd + + # 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) + ) + + # mips can't do hash-style=gnu ... + if [[ $(tc-arch) != mips ]] ; then + myconf+=( --enable-default-hash-style=gnu ) + fi + + use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd ) + + use nls \ + && myconf+=( --without-included-gettext ) \ + || myconf+=( --disable-nls ) + + if [[ ${CHOST} == *-darwin* ]] && use nls ; then + # fix underlinking in opcodes + sed -i -e 's/@SHARED_LDFLAGS@/@SHARED_LDFLAGS@ -lintl/' \ + "${S}"/opcodes/Makefile.in || die + fi + + ECONF_SOURCE="${S}" econf "${myconf[@]}" + + # Prevent makeinfo from running as we don't build docs here. + # bug #622652 + sed -i \ + -e '/^MAKEINFO/s:=.*:= true:' \ + Makefile || die +} + +multilib_src_test() { + ( + # Tests don't expect LTO + filter-lto + + # If we have e.g. -mfpmath=sse -march=pentium4 in CFLAGS, + # we'll get lto1 warnings for some tests which cause + # spurious failures because -mfpmath isn't passed at + # link-time. Filter accordingly. + # + # Alternatively, we could pass C{C,XX}_FOR_TARGET with + # some (ideally not all, surely would break some tests) + # stuffed in. + filter-flags '-mfpmath=*' + + # lto-wrapper warnings which confuse tests + filter-flags '-Wa,*' + + # bug #637066 + filter-flags -Wall -Wreturn-type + + # Note that we need 'check' explicitly if ever cleaning this + # up: the default `src_test` check for the 'check' target + # with `-n` may fail with parallel make and silently skip tests (bug #955595) + emake -k check \ + CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \ + CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \ + LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \ + CFLAGS="${CFLAGS}" \ + CXXFLAGS="${CXXFLAGS}" \ + LDFLAGS="${LDFLAGS}" + ) +} + +multilib_src_install() { + emake DESTDIR="${D}" install + + # Provided by dev-debug/gdb instead + if [[ ${PV} != 9999 ]] ; then + rm "${ED}"/usr/share/info/sframe-spec.info || die + fi + + # Provide libiberty.h directly. + dosym libiberty/libiberty.h /usr/include/libiberty.h +} + +multilib_src_install_all() { + use static-libs || find "${ED}"/usr -name '*.la' -delete + # Explicit "${ED}" as we need it to do things even w/ USE=-static-libs + strip-lto-bytecode "${ED}" +}