minimal-bootstrap.bash: build with musl

+35 -19
+21 -14
pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix
··· 4 4 , fetchurl 5 5 , bootBash 6 6 , gnumake 7 + , gnupatch 7 8 , gnused 8 9 , gnugrep 9 10 , gnutar 10 11 , gawk 11 12 , gzip 12 - , gcc 13 - , glibc 14 - , binutils 15 - , linux-headers 13 + , diffutils 14 + , tinycc 16 15 , derivationWithMeta 17 16 , bash 18 17 , coreutils ··· 25 24 url = "mirror://gnu/bash/bash-${version}.tar.gz"; 26 25 sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk"; 27 26 }; 27 + 28 + patches = [ 29 + # flush output for generated code 30 + ./mksignames-flush.patch 31 + ]; 28 32 in 29 33 bootBash.runCommand "${pname}-${version}" { 30 34 inherit pname version; 31 35 32 36 nativeBuildInputs = [ 33 - gcc 34 - binutils 37 + coreutils 38 + tinycc.compiler 35 39 gnumake 40 + gnupatch 36 41 gnused 37 42 gnugrep 38 43 gnutar 39 44 gawk 40 45 gzip 46 + diffutils 41 47 ]; 42 48 43 49 passthru.runCommand = name: env: buildCommand: ··· 78 84 tar xzf ${src} 79 85 cd bash-${version} 80 86 87 + # Patch 88 + ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 89 + 81 90 # Configure 82 - export CC="gcc -I${glibc}/include -I${linux-headers}/include" 83 - export LIBRARY_PATH="${glibc}/lib" 84 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 85 - export ac_cv_func_dlopen=no 91 + export CC="tcc -B ${tinycc.libs}/lib" 92 + export AR="tcc -ar" 93 + export LD=tcc 86 94 bash ./configure \ 87 95 --prefix=$out \ 88 96 --build=${buildPlatform.config} \ 89 97 --host=${hostPlatform.config} \ 90 - --disable-nls \ 91 - --disable-net-redirections 98 + --without-bash-malloc 92 99 93 100 # Build 94 - make SHELL=bash 101 + make -j $NIX_BUILD_CORES SHELL=bash 95 102 96 103 # Install 97 - make install 104 + make -j $NIX_BUILD_CORES install 98 105 ln -s bash $out/bin/sh 99 106 ''
+10
pkgs/os-specific/linux/minimal-bootstrap/bash/mksignames-flush.patch
··· 1 + --- a/support/mksignames.c 2 + +++ b/support/mksignames.c 3 + @@ -68,6 +68,7 @@ write_signames (stream) 4 + fprintf (stream, "};\n\n"); 5 + fprintf (stream, "#define initialize_signames()\n\n"); 6 + #endif 7 + + fflush(stream); 8 + } 9 + 10 + int
+4 -3
pkgs/os-specific/linux/minimal-bootstrap/default.nix
··· 17 17 18 18 bash = callPackage ./bash { 19 19 bootBash = bash_2_05; 20 - gcc = gcc2; 21 - glibc = glibc22; 20 + tinycc = tinycc-musl; 21 + coreutils = coreutils-musl; 22 + gnumake = gnumake-musl; 23 + gnutar = gnutar-musl; 22 24 }; 23 25 24 26 binutils = callPackage ./binutils { ··· 73 75 }; 74 76 75 77 gcc46 = callPackage ./gcc/4.6.nix { 76 - coreutils = coreutils-musl; 77 78 tinycc = tinycc-musl; 78 79 gnumake = gnumake-musl; 79 80 gnutar = gnutar-musl;
-2
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
··· 3 3 , hostPlatform 4 4 , fetchurl 5 5 , bash 6 - , coreutils 7 6 , tinycc 8 7 , binutils 9 8 , gnumake ··· 57 56 inherit pname version; 58 57 59 58 nativeBuildInputs = [ 60 - coreutils 61 59 tinycc.compiler 62 60 binutils 63 61 gnumake