From 58320c41a9368a81b66a90656e85a068829566d0 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 1 Nov 2020 03:01:58 +0100 Subject: [PATCH] binutils: guess triplet correctly when bootstrapping --- srcpkgs/binutils/template | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/srcpkgs/binutils/template b/srcpkgs/binutils/template index 766b9ae8cb3..e6f916ed68d 100644 --- a/srcpkgs/binutils/template +++ b/srcpkgs/binutils/template @@ -14,11 +14,20 @@ if [ "$CHROOT_READY" ]; then hostmakedepends="flex perl texinfo" checkdepends="bc" depends="binutils-doc" -else - XBPS_TRIPLET=x86_64-unknown-linux-gnu fi makedepends+=" zlib-devel" +_get_triplet() { + if [ -z "$XBPS_TRIPLET" ]; then + echo $( + source "${XBPS_COMMONDIR}/build-profiles/${XBPS_MACHINE}.sh" + echo "$XBPS_TRIPLET" + ) + else + echo "$XBPS_TRIPLET" + fi +} + do_configure() { if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then CONFIGFLAG="--enable-64-bit-bfd --enable-multilib" @@ -36,7 +45,7 @@ do_configure() { elif [ "${XBPS_TARGET_MACHINE%-musl}" = "i686" ]; then CONFIGFLAG+=" --enable-64-bit-bfd --enable-targets=x86_64-linux-gnu,x86_64-pep" fi - ./configure --build=$XBPS_TRIPLET --prefix=/usr --enable-threads \ + ./configure --build=$(_get_triplet) --prefix=/usr --enable-threads \ --enable-plugins --enable-secureplt --with-mmap \ --disable-shared --enable-gold --disable-werror \ --enable-deterministic-archives --enable-ld=default \ @@ -66,11 +75,12 @@ do_build() { # if you enable this later, keep it off for [ -z "$CHROOT_READY" ] do_check() { # Seems like upstream forgot to include their new - # test-driver executable in their tarball... + # test-driver executable in their tarball... : } do_install() { + local _triplet=$(_get_triplet) if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then mkdir -p ${DESTDIR}/usr/lib cd ${DESTDIR}/usr @@ -108,7 +118,7 @@ do_install() { done # Create triplet symlinks for f in ${DESTDIR}/usr/bin/*; do - ln -s ${f##*/} ${DESTDIR}/usr/bin/${XBPS_CROSS_TRIPLET:-${XBPS_TRIPLET}}-${f##*/} + ln -s ${f##*/} ${DESTDIR}/usr/bin/${XBPS_CROSS_TRIPLET:-${_triplet}}-${f##*/} done }