From fa3f85b0b79402c5a34f46346a2ef3fbca45972d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Tue, 18 Aug 2020 19:53:55 +0700 Subject: [PATCH 1/4] xbps-src: use internal config in foreign environment When xbps-install is called without "-C", xbps-install will pick configuration from the location configured at build time. Should the default location not have a valid repository configuration, we couldn't run binary-bootstrap. On bootstrapping from scratch, without this change, xbps looks into system configuration, which isn't what we want. Run xbps-install with our internal configuration instead. --- xbps-src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbps-src b/xbps-src index 2462ddc0b89..1c83708c8da 100755 --- a/xbps-src +++ b/xbps-src @@ -613,8 +613,8 @@ if [ "$IN_CHROOT" ]; then readonly XBPS_BUILDDIR=/builddir else readonly XBPS_UHELPER_CMD="xbps-uhelper -r $XBPS_MASTERDIR" - readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR" - readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR" + readonly XBPS_INSTALL_CMD="xbps-install -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d" + readonly XBPS_QUERY_CMD="xbps-query -c $XBPS_HOSTDIR/repocache-$XBPS_MACHINE -r $XBPS_MASTERDIR -C etc/xbps.d" readonly XBPS_RECONFIGURE_CMD="xbps-reconfigure -r $XBPS_MASTERDIR" readonly XBPS_REMOVE_CMD="xbps-remove -r $XBPS_MASTERDIR" readonly XBPS_CHECKVERS_CMD="xbps-checkvers -r $XBPS_MASTERDIR" From b14dbb7fc0875bf4c01f3eb9145b433bbdac4cb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Tue, 18 Aug 2020 20:42:51 +0700 Subject: [PATCH 2/4] xbps-src: environment: keep LD_LIBRARY_PATH outside of chroot Using self-built xbps in non-standard location requires setting LD_LIBRARY_PATH. Thus, bootstrapping from foreign distribution with those binaries failed. --- common/environment/setup/sourcepkg.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/environment/setup/sourcepkg.sh b/common/environment/setup/sourcepkg.sh index bc06f745b78..d7253459be3 100644 --- a/common/environment/setup/sourcepkg.sh +++ b/common/environment/setup/sourcepkg.sh @@ -16,9 +16,13 @@ unset -v go_import_path go_package go_mod_mode unset -v patch_args disable_parallel_build keep_libtool_archives make_use_env unset -v reverts subpackages makedepends hostmakedepends checkdepends depends restricted unset -v nopie build_options build_options_default bootstrap repository reverts -unset -v CFLAGS CXXFLAGS FFLAGS CPPFLAGS LDFLAGS LD_LIBRARY_PATH +unset -v CFLAGS CXXFLAGS FFLAGS CPPFLAGS LDFLAGS unset -v CC CXX CPP GCC LD AR AS RANLIB NM OBJDUMP OBJCOPY STRIP READELF PKG_CONFIG +if [ "$IN_CHROOT" ]; then + unset -v LD_LIBRARY_PATH +fi + # hooks/do-extract/00-distfiles unset -v skip_extraction From 371ffe20e284a5f08249a738eea816d8aacaecba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Thu, 20 Aug 2020 20:24:52 +0700 Subject: [PATCH 3/4] glibc: fix bootstrap with gcc -fcf-protection Some distros ship gcc that implicitly enables the "-fcf-protection". Upstream GCC does not do that, so the glibc configure logic is not prepared for that. Hence, bootstrapping glibc on such system will result in error: elf/ld.so.new: hidden symbol `_dl_cet_open_check' isn't defined We must --enable-cet to fix it. Future glibc will --enable-cet automatically if -fcf-protection. Reference: 1: https://stackoverflow.com/a/59006638 2: https://sourceware.org/bugzilla/show_bug.cgi?id=25225 --- srcpkgs/glibc/template | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/srcpkgs/glibc/template b/srcpkgs/glibc/template index 4ea327aa1fa..5f0868ceb77 100644 --- a/srcpkgs/glibc/template +++ b/srcpkgs/glibc/template @@ -88,8 +88,11 @@ do_configure() { configure_args+=" --host=${XBPS_CROSS_TRIPLET}" configure_args+=" --with-sysroot=${XBPS_CROSS_BASE}" configure_args+=" --with-headers=${XBPS_CROSS_BASE}/usr/include" - else + elif [ ! "$CHROOT_READY" ]; then configure_args+=" --with-headers=${XBPS_MASTERDIR}/usr/include" + # TODO: remove when upgrade to newer version + configure_args+=" --enable-cet" + CPPFLAGS+=" -isystem ${XBPS_MASTERDIR}/usr/include" fi # Disable SSP from CFLAGS (enabled below) From 8e384e0bc4015a34da072d271b69dc4420dcfeaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Sat, 22 Aug 2020 08:10:13 +0700 Subject: [PATCH 4/4] [ci skip] binutils: rebootstrap from Debian --- srcpkgs/binutils/template | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/srcpkgs/binutils/template b/srcpkgs/binutils/template index 06a279cff2c..dfdb053b739 100644 --- a/srcpkgs/binutils/template +++ b/srcpkgs/binutils/template @@ -17,6 +17,10 @@ if [ "$CHROOT_READY" ]; then else unset XBPS_CHECK_PKGS XBPS_TRIPLET=x86_64-unknown-linux-gnu + case "$XBPS_TARGET_LIBC" in + musl) makedepends+=" musl-devel" ;; + *) makedepends+=" glibc-devel" ;; + esac fi makedepends+=" zlib-devel" @@ -28,6 +32,9 @@ do_configure() { # Do not use configure_args nor build_style=gnu-configure, # avoiding --with-sysroot to $XBPS_CROSS_BASE. CONFIGFLAG="--host=$XBPS_CROSS_TRIPLET --with-build-sysroot=$XBPS_CROSS_BASE" + elif [ "$CHROOT_READY" ]; then + CONFIGFLAG="--with-build-sysroot=$XBPS_MASTERDIR" + LDFLAGS+=" -Wl,--sysroot=$XBPS_MASTERDIR" fi if [ "$XBPS_TARGET_MACHINE" = "mips-musl" -o "$XBPS_TARGET_MACHINE" = "mipsel-musl" ]; then CONFIGFLAG+=" --with-float=soft --without-fp"