minimal-bootstrap.bash: build with musl
This commit is contained in:
parent
25a264c6c4
commit
1c1962f975
4 changed files with 35 additions and 19 deletions
|
@ -4,15 +4,14 @@
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, bootBash
|
, bootBash
|
||||||
, gnumake
|
, gnumake
|
||||||
|
, gnupatch
|
||||||
, gnused
|
, gnused
|
||||||
, gnugrep
|
, gnugrep
|
||||||
, gnutar
|
, gnutar
|
||||||
, gawk
|
, gawk
|
||||||
, gzip
|
, gzip
|
||||||
, gcc
|
, diffutils
|
||||||
, glibc
|
, tinycc
|
||||||
, binutils
|
|
||||||
, linux-headers
|
|
||||||
, derivationWithMeta
|
, derivationWithMeta
|
||||||
, bash
|
, bash
|
||||||
, coreutils
|
, coreutils
|
||||||
|
@ -25,19 +24,26 @@ let
|
||||||
url = "mirror://gnu/bash/bash-${version}.tar.gz";
|
url = "mirror://gnu/bash/bash-${version}.tar.gz";
|
||||||
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
|
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
# flush output for generated code
|
||||||
|
./mksignames-flush.patch
|
||||||
|
];
|
||||||
in
|
in
|
||||||
bootBash.runCommand "${pname}-${version}" {
|
bootBash.runCommand "${pname}-${version}" {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
gcc
|
coreutils
|
||||||
binutils
|
tinycc.compiler
|
||||||
gnumake
|
gnumake
|
||||||
|
gnupatch
|
||||||
gnused
|
gnused
|
||||||
gnugrep
|
gnugrep
|
||||||
gnutar
|
gnutar
|
||||||
gawk
|
gawk
|
||||||
gzip
|
gzip
|
||||||
|
diffutils
|
||||||
];
|
];
|
||||||
|
|
||||||
passthru.runCommand = name: env: buildCommand:
|
passthru.runCommand = name: env: buildCommand:
|
||||||
|
@ -78,22 +84,23 @@ bootBash.runCommand "${pname}-${version}" {
|
||||||
tar xzf ${src}
|
tar xzf ${src}
|
||||||
cd bash-${version}
|
cd bash-${version}
|
||||||
|
|
||||||
|
# Patch
|
||||||
|
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
|
||||||
|
|
||||||
# Configure
|
# Configure
|
||||||
export CC="gcc -I${glibc}/include -I${linux-headers}/include"
|
export CC="tcc -B ${tinycc.libs}/lib"
|
||||||
export LIBRARY_PATH="${glibc}/lib"
|
export AR="tcc -ar"
|
||||||
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
|
export LD=tcc
|
||||||
export ac_cv_func_dlopen=no
|
|
||||||
bash ./configure \
|
bash ./configure \
|
||||||
--prefix=$out \
|
--prefix=$out \
|
||||||
--build=${buildPlatform.config} \
|
--build=${buildPlatform.config} \
|
||||||
--host=${hostPlatform.config} \
|
--host=${hostPlatform.config} \
|
||||||
--disable-nls \
|
--without-bash-malloc
|
||||||
--disable-net-redirections
|
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
make SHELL=bash
|
make -j $NIX_BUILD_CORES SHELL=bash
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
make install
|
make -j $NIX_BUILD_CORES install
|
||||||
ln -s bash $out/bin/sh
|
ln -s bash $out/bin/sh
|
||||||
''
|
''
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
--- a/support/mksignames.c
|
||||||
|
+++ b/support/mksignames.c
|
||||||
|
@@ -68,6 +68,7 @@ write_signames (stream)
|
||||||
|
fprintf (stream, "};\n\n");
|
||||||
|
fprintf (stream, "#define initialize_signames()\n\n");
|
||||||
|
#endif
|
||||||
|
+ fflush(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
|
@ -17,8 +17,10 @@ lib.makeScope
|
||||||
|
|
||||||
bash = callPackage ./bash {
|
bash = callPackage ./bash {
|
||||||
bootBash = bash_2_05;
|
bootBash = bash_2_05;
|
||||||
gcc = gcc2;
|
tinycc = tinycc-musl;
|
||||||
glibc = glibc22;
|
coreutils = coreutils-musl;
|
||||||
|
gnumake = gnumake-musl;
|
||||||
|
gnutar = gnutar-musl;
|
||||||
};
|
};
|
||||||
|
|
||||||
binutils = callPackage ./binutils {
|
binutils = callPackage ./binutils {
|
||||||
|
@ -73,7 +75,6 @@ lib.makeScope
|
||||||
};
|
};
|
||||||
|
|
||||||
gcc46 = callPackage ./gcc/4.6.nix {
|
gcc46 = callPackage ./gcc/4.6.nix {
|
||||||
coreutils = coreutils-musl;
|
|
||||||
tinycc = tinycc-musl;
|
tinycc = tinycc-musl;
|
||||||
gnumake = gnumake-musl;
|
gnumake = gnumake-musl;
|
||||||
gnutar = gnutar-musl;
|
gnutar = gnutar-musl;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
, hostPlatform
|
, hostPlatform
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, bash
|
, bash
|
||||||
, coreutils
|
|
||||||
, tinycc
|
, tinycc
|
||||||
, binutils
|
, binutils
|
||||||
, gnumake
|
, gnumake
|
||||||
|
@ -57,7 +56,6 @@ bash.runCommand "${pname}-${version}" {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
coreutils
|
|
||||||
tinycc.compiler
|
tinycc.compiler
|
||||||
binutils
|
binutils
|
||||||
gnumake
|
gnumake
|
||||||
|
|
Loading…
Reference in a new issue