minimal-bootstrap: Prepare late-stage packages for cross-compilation (#507836)

This commit is contained in:
Ramses
2026-06-28 15:23:18 +00:00
committed by GitHub
25 changed files with 266 additions and 96 deletions

View File

@@ -4,8 +4,8 @@
hostPlatform,
fetchurl,
bash,
gcc-buildbuild,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -25,6 +25,10 @@ let
url = "mirror://gnu/bash/bash-${version}.tar.gz";
sha256 = "sha256-DVzYaWX4aaJs9k9Lcb57lvkKO6iz104n6OnZ1VUPMbo=";
};
binutilsTargetPrefix = lib.optionalString (
hostPlatform.config != buildPlatform.config
) "${hostPlatform.config}-";
in
bash.runCommand "${pname}-${version}"
{
@@ -32,7 +36,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -56,6 +59,10 @@ bash.runCommand "${pname}-${version}"
tar xf ${src}
cd bash-${version}
export AR="${binutilsTargetPrefix}ar"
export STRIP="${binutilsTargetPrefix}strip"
export STRIPPROG="$STRIP"
# Configure
bash ./configure \
--prefix=$out \
@@ -65,7 +72,7 @@ bash.runCommand "${pname}-${version}"
--disable-dependency-tracking \
--disable-nls \
--enable-static-link \
CC=musl-gcc
CC_FOR_BUILD=${gcc-buildbuild}/bin/gcc
# Build
make -j $NIX_BUILD_CORES

View File

@@ -4,8 +4,8 @@
hostPlatform,
fetchurl,
bash,
gcc-buildbuild,
gcc,
musl,
binutils,
gnumake,
gnupatch,
@@ -33,8 +33,6 @@ let
];
configureFlags = [
"CC=musl-gcc"
"LDFLAGS=--static"
"--prefix=${placeholder "out"}"
"--build=${buildPlatform.config}"
"--host=${hostPlatform.config}"
@@ -42,7 +40,6 @@ let
"--disable-dependency-tracking"
"--disable-nls"
"--with-sysroot=/"
"--enable-deterministic-archives"
# depends on bison
"--disable-gprofng"
@@ -70,7 +67,7 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
gcc-buildbuild
binutils
gnumake
gnupatch

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -32,7 +31,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -70,8 +68,7 @@ bash.runCommand "${pname}-${version}"
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
CC=musl-gcc
--disable-dependency-tracking
# Build
make -j $NIX_BUILD_CORES

View File

@@ -1,9 +1,10 @@
{
lib,
fetchurl,
buildPlatform,
hostPlatform,
bash,
gcc,
musl,
binutils,
findutils,
gnumake,
@@ -18,6 +19,10 @@ let
url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
};
binutilsTargetPrefix = lib.optionalString (
hostPlatform.config != buildPlatform.config
) "${hostPlatform.config}-";
in
bash.runCommand "${pname}-${version}"
{
@@ -25,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
findutils
gnumake
@@ -72,9 +76,10 @@ bash.runCommand "${pname}-${version}"
# Build
make \
-j $NIX_BUILD_CORES \
CC=musl-gcc \
CFLAGS=-static \
bzip2
bzip2 \
CC=${hostPlatform.config}-gcc \
AR=${binutilsTargetPrefix}ar \
RANLIB=${binutilsTargetPrefix}ranlib
# Install
mkdir -p $out/bin
@@ -84,5 +89,5 @@ bash.runCommand "${pname}-${version}"
# Strip
# Ignore failures, because strip may fail on non-elf files.
strip --strip-debug $out/bin/bzip2 || true
${binutilsTargetPrefix}strip --strip-debug $out/bin/bzip2 || true
''

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -36,8 +35,7 @@ let
# libstdbuf.so fails in static builds
"--enable-no-install-program=stdbuf"
"--enable-single-binary=symlinks"
"CC=musl-gcc"
"CFLAGS=\"-static -I${linux-headers}/include\""
"CFLAGS=\"-I${linux-headers}/include\""
];
in
bash.runCommand "${pname}-${version}"
@@ -46,7 +44,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused

View File

@@ -48,6 +48,7 @@ lib.makeScope
};
bash-static = callPackage ./bash/static.nix {
gcc-buildbuild = gcc-latest;
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
@@ -60,6 +61,7 @@ lib.makeScope
};
binutils-static = callPackage ./binutils/static.nix {
gcc-buildbuild = gcc-latest;
gcc = gcc-latest;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
@@ -154,11 +156,19 @@ lib.makeScope
gnutar = gnutar-latest;
};
gcc-latest = callPackage ./gcc/latest.nix {
gcc-latest-unwrapped = callPackage ./gcc/latest.nix {
gcc = gcc10;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
};
gcc-latest = callPackage ./gcc/wrapper.nix {
bash-build = bash;
gcc-unwrapped = gcc-latest-unwrapped;
targetPlatform = hostPlatform;
libc = musl;
libgcc = gcc-latest-unwrapped;
libstdcxx = gcc-latest-unwrapped;
};
gnugrep = callPackage ./gnugrep {
bash = bash_2_05;
@@ -294,6 +304,7 @@ lib.makeScope
};
musl-static = callPackage ./musl/static.nix {
libgcc = gcc-latest-unwrapped;
gcc = gcc-latest;
gnumake = gnumake-musl;
};
@@ -426,7 +437,7 @@ lib.makeScope
echo ${gcc46.tests.get-version}
echo ${gcc46-cxx.tests.hello-world}
echo ${gcc10.tests.hello-world}
echo ${gcc-latest.tests.hello-world}
echo ${gcc-latest-unwrapped.tests.hello-world}
''
+ (lib.strings.optionalString (hostPlatform.libc == "glibc") ''
echo ${gcc-glibc.tests.hello-world}
@@ -455,7 +466,7 @@ lib.makeScope
};
glibc = callPackage ./glibc {
gcc = gcc-latest;
gcc = gcc-latest-unwrapped;
gnumake = gnumake-musl;
gnutar = gnutar-latest;
gnugrep = gnugrep-static;

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -31,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -64,15 +62,15 @@ bash.runCommand "${pname}-${version}"
cd diffutils-${version}
# Configure
# Manually set strcasecmp_works, because we might be cross-compiling
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS=-static \
ac_cv_path_PR_PROGRAM=pr
ac_cv_path_PR_PROGRAM=pr \
gl_cv_func_strcasecmp_works=y
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -31,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -70,9 +68,7 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS=-static
--disable-nls
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -32,7 +31,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -66,9 +64,7 @@ bash.runCommand "${pname}-${version}"
--disable-extensions \
--disable-mpfr \
--disable-nls \
--disable-pma \
CC=musl-gcc \
CFLAGS=-static
--disable-pma
# Build
make -j $NIX_BUILD_CORES

View File

@@ -126,10 +126,12 @@ bash.runCommand "${pname}-${version}"
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--with-native-system-header-dir=/include \
--with-sysroot=${musl} \
--with-native-system-header-dir=${musl}/include \
--with-sysroot=/ \
--enable-languages=c,c++ \
--enable-checking=release \
--enable-static \
--disable-shared \
--disable-bootstrap \
--disable-dependency-tracking \
--disable-libsanitizer \
@@ -144,8 +146,7 @@ bash.runCommand "${pname}-${version}"
--disable-multilib \
--disable-nls \
--disable-plugin \
--without-isl \
--disable-shared
--without-isl
# Build
make -j $NIX_BUILD_CORES
@@ -155,4 +156,14 @@ bash.runCommand "${pname}-${version}"
# libstdc++ gdb pretty-printers + man pages are unused downstream.
rm -rf $out/share/gcc-*/python $out/share/man $out/share/info
if [ -d "$out/lib64" ]; then
shopt -s dotglob
for lib in $out/lib64/*; do
mv --no-clobber "$lib" "$out/lib/"
done
shopt -u dotglob
rm -rf "$out/lib64"
ln -s lib "$out/lib64"
fi
''

View File

@@ -0,0 +1,81 @@
{
fetchurl,
lib,
gnutar,
xz,
bash-build,
gnused,
targetPlatform,
libc,
libgcc,
libstdcxx,
gcc-unwrapped,
binutils,
bash,
}:
let
pname = "gcc-wrapper";
extraFlags = "-static-libgcc ";
# only supports musl for now
dynamicLinkerGlob = "${libc}/lib/libc.so";
in
bash-build.runCommand "${pname}-${gcc-unwrapped.version}"
{
inherit pname;
version = gcc-unwrapped.version;
meta = gcc-unwrapped.meta;
nativeBuildInputs = [ gnused ];
passthru.unwrapped = gcc-unwrapped;
}
''
if [[ -z '${dynamicLinkerGlob}' ]]; then
echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead."
dynamicLinker="${libc}/lib/ld*.so.?"
else
dynamicLinker='${dynamicLinkerGlob}'
fi
dynamicLinker=($dynamicLinker)
case ''${#dynamicLinker[@]} in
0) echo "No dynamic linker found for platform '${targetPlatform.config}'.";;
1) echo "Using dynamic linker: '$dynamicLinker'";;
*) echo "Multiple dynamic linkers found for platform '${targetPlatform.config}'.";;
esac
mkdir -p "$out/bin"
for orig in ${gcc-unwrapped}/bin/*gcc ${gcc-unwrapped}/bin/*gcc-${gcc-unwrapped.version}; do
sed \
-e 's,@bash@,${lib.getExe bash},' \
-e "s,@gcc@,$orig," \
-e "s,@origname@,$(basename "$orig")," \
-e "s,@origdir@,${gcc-unwrapped}/libexec/gcc," \
-e "s,@dynlinker@,$dynamicLinker," \
-e 's,@libgcc@,${libgcc}/lib/gcc/${targetPlatform.config}/${libgcc.version},' \
-e 's,@libc@,${libc}/lib,' \
-e 's,@gccinc@,${gcc-unwrapped}/lib/gcc/${targetPlatform.config}/${libgcc.version}/include,' \
-e 's,@binutils@,${binutils}/bin,' \
-e 's,@extraflags@,${extraFlags},' \
'${./wrapper.sh}' > "$out/bin/$(basename "$orig")"
chmod +x "$out/bin/$(basename "$orig")"
done
for orig in ${gcc-unwrapped}/bin/*++; do
sed \
-e 's,@bash@,${lib.getExe bash},' \
-e "s,@gcc@,$orig," \
-e "s,@origname@,$(basename "$orig")," \
-e "s,@origdir@,${gcc-unwrapped}/libexec/gcc," \
-e "s,@dynlinker@,$dynamicLinker," \
-e 's,@libgcc@,${libgcc}/lib/gcc/${targetPlatform.config}/${libgcc.version},' \
-e 's,@libc@,${libc}/lib,' \
-e 's,@libstdcxx@,${libstdcxx}/lib,' \
-e 's,@libstdcxxinc@,${libstdcxx}/include/c++/${libstdcxx.version},' \
-e 's,@libstdcxxarchinc@,${libstdcxx}/include/c++/${libstdcxx.version}/${targetPlatform.config},' \
-e 's,@gccinc@,${gcc-unwrapped}/lib/gcc/${targetPlatform.config}/${libgcc.version}/include,' \
-e 's,@binutils@,${binutils}/bin,' \
-e 's,@extraflags@,${extraFlags},' \
'${./wrappercxx.sh}' > "$out/bin/$(basename "$orig")"
chmod +x "$out/bin/$(basename "$orig")"
done
for orig in ${gcc-unwrapped}/bin/*cpp ${gcc-unwrapped}/bin/*-ar ${gcc-unwrapped}/bin/*-nm ${gcc-unwrapped}/bin/*-ranlib; do
ln -s "$orig" "$out/bin/$(basename "$orig")"
done
''

View File

@@ -0,0 +1,51 @@
#!@bash@
if [ 1 = "$#" ] && [ "x-v" = "x$1" ]; then
# HACK! should not pass -Wl if there are no input files, otherwise libtool breaks
exec -a "@origname@" @gcc@ -v
fi
# logic based on pkgs/build-support/bintools-wrapper/ld-wrapper.sh
# very hacky
extraRpath=""
prev=""
for param in "$@"; do
case "$prev" in
-L | -B)
case "$param" in
"$NIX_STORE"/*)
extraRpath="$extraRpath -Wl,-rpath,${param}"
;;
*)
;;
esac
;;
*)
case "$param" in
-L"$NIX_STORE"/* | -B"$NIX_STORE"/*)
extraRpath="$extraRpath -Wl,-rpath,${param:2}"
;;
"$NIX_STORE"/*.so | "$NIX_STORE"/*.so.*)
extraRpath="$extraRpath -Wl,-rpath,${param%/*}"
;;
*)
;;
esac
;;
esac
prev="$param"
done
# Order of -B is very particular. musl detection in gnulib requires that
# libc/.. comes before libgcc, otherwise libc is assumed to be glibc.
exec -a "@origname@" @gcc@ -Wl,-dynamic-linker=@dynlinker@ \
@extraflags@ \
$extraRpath \
-Wl,-rpath,@libc@,-rpath,@libgcc@ \
-B@libc@/.. \
-B@libgcc@ \
-B@libc@ \
-B@origdir@ \
-B@binutils@ \
-isystem @gccinc@ \
"$@"

View File

@@ -0,0 +1,57 @@
#!@bash@
if [ 1 = "$#" ] && [ "x-v" = "x$1" ]; then
# HACK! should not pass -Wl if there are no input files, otherwise libtool breaks
exec -a "@origname@" @gcc@ -v
fi
# logic based on pkgs/build-support/bintools-wrapper/ld-wrapper.sh
# very hacky
extraRpath=""
prev=""
for param in "$@"; do
case "$prev" in
-L | -B)
case "$param" in
"$NIX_STORE"*)
extraRpath="$extraRpath -Wl,-rpath,${param}"
;;
*)
;;
esac
;;
*)
case "$param" in
-L"$NIX_STORE"/* | -B"$NIX_STORE"/*)
extraRpath="$extraRpath -Wl,-rpath,${param:2}"
;;
"$NIX_STORE"/*.so | "$NIX_STORE"/*.so.*)
extraRpath="$extraRpath -Wl,-rpath,${param%/*}"
;;
*)
;;
esac
;;
esac
prev="$param"
done
# Order of -B is very particular. musl detection in gnulib requires that
# libc/.. comes before libgcc, otherwise libc is assumed to be glibc.
# Also, libstdcxxinc uses #include_next directives that depend on
# libc headers, so libstdcxx must come before libc.
exec -a "@origname@" @gcc@ -Wl,-dynamic-linker=@dynlinker@ \
@extraflags@ \
$extraRpath \
-Wl,-rpath,@libc@,-rpath,@libgcc@,-rpath,@libstdcxx@ \
-I @libstdcxxarchinc@ \
-I @libstdcxxinc@ \
-B@libc@/.. \
-B@libc@ \
-B@libgcc@ \
-B@origdir@ \
-B@binutils@ \
-B@libstdcxx@ \
-isystem @gccinc@ \
"$@"

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -31,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -70,9 +68,7 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS=-static
--disable-nls
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -32,7 +31,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -71,7 +69,6 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
CC=musl-gcc \
CFLAGS=-I${linux-headers}/include
# Build

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnupatch,
@@ -42,7 +41,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnupatch
@@ -80,8 +78,7 @@ bash.runCommand "${pname}-${version}"
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS="-static -std=gnu17"
CFLAGS="-std=gnu17"
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -31,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -69,9 +67,7 @@ bash.runCommand "${pname}-${version}"
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
CC=musl-gcc \
CFLAGS=-static
--disable-dependency-tracking
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -32,7 +31,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -62,9 +60,7 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS=-static
--disable-nls
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -32,7 +31,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -62,9 +60,7 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
--disable-nls \
CC=musl-gcc \
CFLAGS=-static
--disable-nls
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -31,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -69,7 +67,6 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
CC=musl-gcc \
CFLAGS=-static
# Build

View File

@@ -13,6 +13,7 @@
gnutar,
gzip,
linux-headers,
libgcc,
}:
let
inherit (import ./common.nix { inherit lib; }) pname meta;
@@ -22,6 +23,10 @@ let
url = "https://musl.libc.org/releases/musl-${version}.tar.gz";
hash = "sha256-1YX9O2E8ZhUfwySejtRPdwIMtebB5jWmFtP5+CRgUSo=";
};
binutilsTargetPrefix = lib.optionalString (
hostPlatform.config != buildPlatform.config
) "${hostPlatform.config}-";
in
bash.runCommand "${pname}-${version}"
{
@@ -77,23 +82,23 @@ bash.runCommand "${pname}-${version}"
src/misc/wordexp.c
# Configure
export CC="${binutilsTargetPrefix}gcc -B${libgcc}/lib/gcc/${hostPlatform.config}/${libgcc.version} -Wl,-rpath,${libgcc}/lib/gcc/${hostPlatform.config}/${libgcc.version}"
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--syslibdir=$out/lib \
--enable-wrapper
--syslibdir=$out/lib
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
sed -i 's|/bin/sh|${lib.getExe bash}|' $out/bin/*
mkdir -p $out/bin
ln -s ../lib/libc.so $out/bin/ldd
ln -s $(ls -d ${linux-headers}/include/* | grep -v scsi\$) $out/include/
# Strip
# Ignore failures, because strip may fail on non-elf files.
find $out/{bin,lib} -type f -exec strip --strip-debug {} + || true
find $out/{bin,lib} -type f -exec ${binutilsTargetPrefix}strip --strip-debug {} + || true
''

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -31,7 +30,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -71,8 +69,7 @@ bash.runCommand "${pname}-${version}"
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-dependency-tracking \
CC=musl-gcc \
CXXFLAGS="-static -g0 -O2 -DNDEBUG -ffile-prefix-map=${gcc}=. -fmacro-prefix-map=${gcc}=."
CXXFLAGS="-g0 -O2 -DNDEBUG -ffile-prefix-map=${gcc}=. -fmacro-prefix-map=${gcc}=."
# Build
make -j $NIX_BUILD_CORES

View File

@@ -5,7 +5,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnupatch,
@@ -42,7 +41,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnupatch
@@ -80,11 +78,9 @@ bash.runCommand "${pname}-${version}"
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
# Configure
export CC=musl-gcc
export C_INCLUDE_PATH="${zlib}/include"
export LIBRARY_PATH="${zlib}/lib"
export LDFLAGS="-Wl,-rpath,${zlib}/lib -L${zlib}/lib"
export LD_LIBRARY_PATH="$LIBRARY_PATH"
export LDFLAGS="-L${zlib}/lib"
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \

View File

@@ -12,7 +12,6 @@
gawk,
gnutar,
gzip,
musl,
}:
let
pname = "xz";
@@ -30,7 +29,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
binutils
gcc
musl
gnumake
gnused
gnugrep
@@ -39,7 +37,7 @@ bash.runCommand "${pname}-${version}"
gzip
];
disallowedReferences = [ musl ];
disallowedReferences = [ gcc ];
passthru.tests.get-version =
result:
@@ -66,10 +64,8 @@ bash.runCommand "${pname}-${version}"
cd xz-${version}
# Configure
export CC=musl-gcc
export CFLAGS="-g0 -O2 -DNDEBUG"
export CXXFLAGS="$CFLAGS"
export LDFLAGS=-static
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
@@ -87,7 +83,7 @@ bash.runCommand "${pname}-${version}"
--disable-assembler
# Build
make -j $NIX_BUILD_CORES LDFLAGS=-all-static
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install-strip

View File

@@ -3,7 +3,6 @@
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
@@ -26,7 +25,6 @@ bash.runCommand "${pname}-${version}"
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
@@ -49,7 +47,6 @@ bash.runCommand "${pname}-${version}"
cd zlib-${version}
# Configure
export CC=musl-gcc
bash ./configure --prefix=$out
# Build