Merge pull request #257559 from emilytrau/minimal-glibc-removal

minimal-bootstrap.*: rebuild packages with musl

authored by John Ericson and committed by GitHub 3d007e8a 1486c62d

+632 -341
+21 -14
pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix
··· 4 , fetchurl 5 , bootBash 6 , gnumake 7 , gnused 8 , gnugrep 9 , gnutar 10 , gawk 11 , gzip 12 - , gcc 13 - , glibc 14 - , binutils 15 - , linux-headers 16 , derivationWithMeta 17 , bash 18 , coreutils ··· 25 url = "mirror://gnu/bash/bash-${version}.tar.gz"; 26 sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk"; 27 }; 28 in 29 bootBash.runCommand "${pname}-${version}" { 30 inherit pname version; 31 32 nativeBuildInputs = [ 33 - gcc 34 - binutils 35 gnumake 36 gnused 37 gnugrep 38 gnutar 39 gawk 40 gzip 41 ]; 42 43 passthru.runCommand = name: env: buildCommand: ··· 78 tar xzf ${src} 79 cd bash-${version} 80 81 # 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 86 bash ./configure \ 87 --prefix=$out \ 88 --build=${buildPlatform.config} \ 89 --host=${hostPlatform.config} \ 90 - --disable-nls \ 91 - --disable-net-redirections 92 93 # Build 94 - make SHELL=bash 95 96 # Install 97 - make install 98 ln -s bash $out/bin/sh 99 ''
··· 4 , fetchurl 5 , bootBash 6 , gnumake 7 + , gnupatch 8 , gnused 9 , gnugrep 10 , gnutar 11 , gawk 12 , gzip 13 + , diffutils 14 + , tinycc 15 , derivationWithMeta 16 , bash 17 , coreutils ··· 24 url = "mirror://gnu/bash/bash-${version}.tar.gz"; 25 sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk"; 26 }; 27 + 28 + patches = [ 29 + # flush output for generated code 30 + ./mksignames-flush.patch 31 + ]; 32 in 33 bootBash.runCommand "${pname}-${version}" { 34 inherit pname version; 35 36 nativeBuildInputs = [ 37 + coreutils 38 + tinycc.compiler 39 gnumake 40 + gnupatch 41 gnused 42 gnugrep 43 gnutar 44 gawk 45 gzip 46 + diffutils 47 ]; 48 49 passthru.runCommand = name: env: buildCommand: ··· 84 tar xzf ${src} 85 cd bash-${version} 86 87 + # Patch 88 + ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 89 + 90 # Configure 91 + export CC="tcc -B ${tinycc.libs}/lib" 92 + export AR="tcc -ar" 93 + export LD=tcc 94 bash ./configure \ 95 --prefix=$out \ 96 --build=${buildPlatform.config} \ 97 --host=${hostPlatform.config} \ 98 + --without-bash-malloc 99 100 # Build 101 + make -j $NIX_BUILD_CORES SHELL=bash 102 103 # Install 104 + make -j $NIX_BUILD_CORES install 105 ln -s bash $out/bin/sh 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
+39 -41
pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 , gnumake 7 , gnupatch 8 , gnugrep 9 - , gnutar 10 , gawk 11 - , bzip2 12 - , sed 13 - , mesBootstrap ? false, tinycc ? null 14 - , gcc ? null, glibc ? null, binutils ? null, linux-headers 15 }: 16 - assert mesBootstrap -> tinycc != null; 17 - assert !mesBootstrap -> gcc != null && glibc != null && binutils != null; 18 let 19 - pname = "binutils" + lib.optionalString mesBootstrap "-mes"; 20 - version = "2.20.1"; 21 - rev = "a"; 22 23 src = fetchurl { 24 - url = "mirror://gnu/binutils/binutils-${version}${rev}.tar.bz2"; 25 - sha256 = "0r7dr0brfpchh5ic0z9r4yxqn4ybzmlh25sbp30cacqk8nb7rlvi"; 26 }; 27 28 patches = [ 29 - # Enables building binutils using TCC and Mes C Library 30 - (fetchurl { 31 - url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/binutils-boot-2.20.1a.patch?id=50249cab3a98839ade2433456fe618acc6f804a5"; 32 - sha256 = "086sf6an2k56axvs4jlky5n3hs2l3rq8zq5d37h0b69cdyh7igpn"; 33 - }) 34 - 35 # Make binutils output deterministic by default. 36 ./deterministic.patch 37 ]; ··· 40 "--prefix=${placeholder "out"}" 41 "--build=${buildPlatform.config}" 42 "--host=${hostPlatform.config}" 43 - "--disable-nls" 44 - "--disable-shared" 45 - "--disable-werror" 46 "--with-sysroot=/" 47 48 # Turn on --enable-new-dtags by default to make the linker set 49 # RUNPATH instead of RPATH on binaries. This is important because ··· 60 inherit pname version; 61 62 nativeBuildInputs = [ 63 - (if mesBootstrap then tinycc.compiler else gcc) 64 gnumake 65 gnupatch 66 gnugrep 67 - gnutar 68 gawk 69 - bzip2 70 - sed 71 - ] ++ lib.optional (!mesBootstrap) binutils; 72 73 passthru.tests.get-version = result: 74 bash.runCommand "${pname}-get-version-${version}" {} '' ··· 85 }; 86 } '' 87 # Unpack 88 - cp ${src} binutils.tar.bz2 89 - bunzip2 binutils.tar.bz2 90 tar xf binutils.tar 91 rm binutils.tar 92 cd binutils-${version} 93 94 # Patch 95 ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 96 97 # Configure 98 - ${if mesBootstrap then '' 99 - export CC="tcc -B ${tinycc.libs}/lib -D __GLIBC_MINOR__=6 -D MES_BOOTSTRAP=1" 100 - export AR="tcc -ar" 101 - '' else '' 102 - export CC="gcc -B ${glibc}/lib -I${glibc}/include -I${linux-headers}/include" 103 - export CPP="gcc -E -I${glibc}/include -I${linux-headers}/include" 104 - export AR="ar" 105 - export LIBRARY_PATH="${glibc}/lib" 106 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 107 - ''} 108 - export SED=sed 109 bash ./configure ${lib.concatStringsSep " " configureFlags} 110 111 # Build 112 - make 113 114 # Install 115 - make install 116 ''
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 + , coreutils 7 , gnumake 8 , gnupatch 9 + , gnused 10 , gnugrep 11 , gawk 12 + , diffutils 13 + , gnutar 14 + , xz 15 + , tinycc 16 }: 17 + 18 let 19 + # Based on https://github.com/ZilchOS/bootstrap-from-tcc/blob/2e0c68c36b3437386f786d619bc9a16177f2e149/using-nix/2a1-static-binutils.nix 20 + pname = "binutils"; 21 + version = "2.41"; 22 23 src = fetchurl { 24 + url = "mirror://gnu/binutils/binutils-${version}.tar.xz"; 25 + hash = "sha256-rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA="; 26 }; 27 28 patches = [ 29 # Make binutils output deterministic by default. 30 ./deterministic.patch 31 ]; ··· 34 "--prefix=${placeholder "out"}" 35 "--build=${buildPlatform.config}" 36 "--host=${hostPlatform.config}" 37 "--with-sysroot=/" 38 + "--enable-deterministic-archives" 39 + # depends on bison 40 + "--disable-gprofng" 41 42 # Turn on --enable-new-dtags by default to make the linker set 43 # RUNPATH instead of RPATH on binaries. This is important because ··· 54 inherit pname version; 55 56 nativeBuildInputs = [ 57 + tinycc.compiler 58 gnumake 59 gnupatch 60 + gnused 61 gnugrep 62 gawk 63 + diffutils 64 + gnutar 65 + xz 66 + ]; 67 68 passthru.tests.get-version = result: 69 bash.runCommand "${pname}-get-version-${version}" {} '' ··· 80 }; 81 } '' 82 # Unpack 83 + cp ${src} binutils.tar.xz 84 + unxz binutils.tar.xz 85 tar xf binutils.tar 86 rm binutils.tar 87 cd binutils-${version} 88 89 # Patch 90 ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 91 + sed -i 's|/bin/sh|${bash}/bin/bash|' \ 92 + missing install-sh mkinstalldirs 93 + # see libtool's 74c8993c178a1386ea5e2363a01d919738402f30 94 + sed -i 's/| \$NL2SP/| sort | $NL2SP/' ltmain.sh 95 + # alias makeinfo to true 96 + mkdir aliases 97 + ln -s ${coreutils}/bin/true aliases/makeinfo 98 + export PATH="$(pwd)/aliases/:$PATH" 99 100 # Configure 101 + export CC="tcc -B ${tinycc.libs}/lib" 102 + export AR="tcc -ar" 103 + export lt_cv_sys_max_cmd_len=32768 104 + export CFLAGS="-D__LITTLE_ENDIAN__=1" 105 bash ./configure ${lib.concatStringsSep " " configureFlags} 106 107 # Build 108 + make -j $NIX_BUILD_CORES all-libiberty all-gas all-bfd all-libctf all-zlib all-gprof 109 + make all-ld # race condition on ld/.deps/ldwrite.Po, serialize 110 + make -j $NIX_BUILD_CORES 111 112 # Install 113 + make -j $NIX_BUILD_CORES install 114 ''
+7 -22
pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix
··· 3 , bash 4 , tinycc 5 , gnumake 6 - , gnupatch 7 , gzip 8 }: 9 let ··· 14 url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz"; 15 sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb"; 16 }; 17 - 18 - patches = [ 19 - # mes libc has no time support, so we remove that. 20 - # It also does not have fch{own,mod}, which we don't care about in the bootstrap 21 - # anyway, so we can null-op those calls. 22 - (fetchurl { 23 - url = "https://github.com/fosslinux/live-bootstrap/raw/87e9d7db9d22b400d1c05247254ac39ee2577e80/sysa/bzip2-1.0.8/patches/mes-libc.patch"; 24 - sha256 = "14dciwib28h413skzfkh7samzh8x87dmwhldyxxphff04pvl1j3c"; 25 - }) 26 - ]; 27 in 28 bash.runCommand "${pname}-${version}" { 29 inherit pname version; ··· 31 nativeBuildInputs = [ 32 tinycc.compiler 33 gnumake 34 - gnupatch 35 gzip 36 ]; 37 38 passthru.tests.get-version = result: 39 bash.runCommand "${pname}-get-version-${version}" {} '' 40 - ${result}/bin/bzip2 --version --help 41 mkdir $out 42 ''; 43 ··· 50 }; 51 } '' 52 # Unpack 53 - cp ${src} bzip2.tar.gz 54 - gunzip bzip2.tar.gz 55 - untar --file bzip2.tar 56 - rm bzip2.tar 57 cd bzip2-${version} 58 59 - # Patch 60 - ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} 61 - 62 # Build 63 make \ 64 - CC="tcc -B ${tinycc.libs}/lib -I ." \ 65 AR="tcc -ar" \ 66 bzip2 bzip2recover 67 68 # Install 69 - make install PREFIX=$out 70 ''
··· 3 , bash 4 , tinycc 5 , gnumake 6 + , gnutar 7 , gzip 8 }: 9 let ··· 14 url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz"; 15 sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb"; 16 }; 17 in 18 bash.runCommand "${pname}-${version}" { 19 inherit pname version; ··· 21 nativeBuildInputs = [ 22 tinycc.compiler 23 gnumake 24 + gnutar 25 gzip 26 ]; 27 28 passthru.tests.get-version = result: 29 bash.runCommand "${pname}-get-version-${version}" {} '' 30 + ${result}/bin/bzip2 --help 31 mkdir $out 32 ''; 33 ··· 40 }; 41 } '' 42 # Unpack 43 + tar xzf ${src} 44 cd bzip2-${version} 45 46 # Build 47 make \ 48 + -j $NIX_BUILD_CORES \ 49 + CC="tcc -B ${tinycc.libs}/lib" \ 50 AR="tcc -ar" \ 51 bzip2 bzip2recover 52 53 # Install 54 + make install -j $NIX_BUILD_CORES PREFIX=$out 55 ''
+74
pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix
···
··· 1 + { lib 2 + , buildPlatform 3 + , hostPlatform 4 + , fetchurl 5 + , bash 6 + , tinycc 7 + , gnumake 8 + , gnugrep 9 + , gnused 10 + , gawk 11 + , gnutar 12 + , gzip 13 + }: 14 + let 15 + pname = "coreutils"; 16 + version = "9.4"; 17 + 18 + src = fetchurl { 19 + url = "mirror://gnu/coreutils/coreutils-${version}.tar.gz"; 20 + hash = "sha256-X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk="; 21 + }; 22 + 23 + configureFlags = [ 24 + "--prefix=${placeholder "out"}" 25 + "--build=${buildPlatform.config}" 26 + "--host=${hostPlatform.config}" 27 + # musl 1.1.x doesn't use 64bit time_t 28 + "--disable-year2038" 29 + # libstdbuf.so fails in static builds 30 + "--enable-no-install-program=stdbuf" 31 + ]; 32 + in 33 + bash.runCommand "${pname}-${version}" { 34 + inherit pname version; 35 + 36 + nativeBuildInputs = [ 37 + tinycc.compiler 38 + gnumake 39 + gnused 40 + gnugrep 41 + gawk 42 + gnutar 43 + gzip 44 + ]; 45 + 46 + passthru.tests.get-version = result: 47 + bash.runCommand "${pname}-get-version-${version}" {} '' 48 + ${result}/bin/cat --version 49 + mkdir $out 50 + ''; 51 + 52 + meta = with lib; { 53 + description = "The GNU Core Utilities"; 54 + homepage = "https://www.gnu.org/software/coreutils"; 55 + license = licenses.gpl3Plus; 56 + maintainers = teams.minimal-bootstrap.members; 57 + platforms = platforms.unix; 58 + }; 59 + } '' 60 + # Unpack 61 + tar xzf ${src} 62 + cd coreutils-${version} 63 + 64 + # Configure 65 + export CC="tcc -B ${tinycc.libs}/lib" 66 + export LD=tcc 67 + bash ./configure ${lib.concatStringsSep " " configureFlags} 68 + 69 + # Build 70 + make -j $NIX_BUILD_CORES AR="tcc -ar" MAKEINFO="true" 71 + 72 + # Install 73 + make -j $NIX_BUILD_CORES install MAKEINFO="true" 74 + ''
+51 -38
pkgs/os-specific/linux/minimal-bootstrap/default.nix
··· 17 18 bash = callPackage ./bash { 19 bootBash = bash_2_05; 20 - gcc = gcc2; 21 - glibc = glibc22; 22 - gawk = gawk-mes; 23 }; 24 25 binutils = callPackage ./binutils { 26 bash = bash_2_05; 27 - gcc = gcc2; 28 - binutils = binutils-mes; 29 - glibc = glibc22; 30 - sed = heirloom.sed; 31 - gawk = gawk-mes; 32 - }; 33 - binutils-mes = callPackage ./binutils { 34 - bash = bash_2_05; 35 - tinycc = tinycc-mes; 36 - sed = heirloom.sed; 37 - gawk = gawk-mes; 38 - mesBootstrap = true; 39 }; 40 41 bzip2 = callPackage ./bzip2 { 42 bash = bash_2_05; 43 - tinycc = tinycc-mes; 44 }; 45 46 coreutils = callPackage ./coreutils { tinycc = tinycc-mes; }; 47 48 diffutils = callPackage ./diffutils { 49 bash = bash_2_05; 50 - gcc = gcc2; 51 - glibc = glibc22; 52 - gawk = gawk-mes; 53 }; 54 55 findutils = callPackage ./findutils { 56 bash = bash_2_05; 57 - gcc = gcc2; 58 - glibc = glibc22; 59 - gawk = gawk-mes; 60 }; 61 62 gawk-mes = callPackage ./gawk/mes.nix { ··· 67 68 gawk = callPackage ./gawk { 69 bash = bash_2_05; 70 - gcc = gcc2; 71 - glibc = glibc22; 72 bootGawk = gawk-mes; 73 }; 74 75 gcc2 = callPackage ./gcc/2.nix { 76 bash = bash_2_05; 77 gcc = gcc2-mes; 78 - binutils = binutils-mes; 79 glibc = glibc22; 80 }; 81 gcc2-mes = callPackage ./gcc/2.nix { 82 bash = bash_2_05; 83 tinycc = tinycc-mes; 84 - binutils = binutils-mes; 85 mesBootstrap = true; 86 }; 87 88 gcc46 = callPackage ./gcc/4.6.nix { 89 - gcc = gcc2; 90 - glibc = glibc22; 91 gawk = gawk-mes; 92 }; 93 94 inherit (callPackage ./glibc { 95 bash = bash_2_05; 96 gnused = gnused-mes; 97 - gawk = gawk-mes; 98 }) glibc22; 99 100 gnugrep = callPackage ./gnugrep { ··· 104 105 gnumake = callPackage ./gnumake { tinycc = tinycc-mes; }; 106 107 gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; }; 108 109 gnused = callPackage ./gnused { 110 bash = bash_2_05; 111 - gcc = gcc2; 112 - glibc = glibc22; 113 gnused = gnused-mes; 114 }; 115 - gnused-mes = callPackage ./gnused { 116 bash = bash_2_05; 117 tinycc = tinycc-mes; 118 - mesBootstrap = true; 119 }; 120 121 - gnutar = callPackage ./gnutar { 122 bash = bash_2_05; 123 tinycc = tinycc-mes; 124 gnused = gnused-mes; 125 }; 126 127 gzip = callPackage ./gzip { 128 bash = bash_2_05; 129 tinycc = tinycc-mes; ··· 152 153 musl = callPackage ./musl { 154 gcc = gcc46; 155 }; 156 157 stage0-posix = callPackage ./stage0-posix { }; ··· 167 168 xz = callPackage ./xz { 169 bash = bash_2_05; 170 - tinycc = tinycc-mes; 171 - gawk = gawk-mes; 172 - inherit (heirloom) sed; 173 }; 174 175 inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; ··· 178 echo ${bash.tests.get-version} 179 echo ${bash_2_05.tests.get-version} 180 echo ${binutils.tests.get-version} 181 - echo ${binutils-mes.tests.get-version} 182 echo ${bzip2.tests.get-version} 183 echo ${diffutils.tests.get-version} 184 echo ${findutils.tests.get-version} 185 echo ${gawk-mes.tests.get-version} ··· 191 echo ${gnused.tests.get-version} 192 echo ${gnused-mes.tests.get-version} 193 echo ${gnutar.tests.get-version} 194 echo ${gzip.tests.get-version} 195 echo ${heirloom.tests.get-version} 196 echo ${mes.compiler.tests.get-version}
··· 17 18 bash = callPackage ./bash { 19 bootBash = bash_2_05; 20 + tinycc = tinycc-musl; 21 + coreutils = coreutils-musl; 22 + gnumake = gnumake-musl; 23 + gnutar = gnutar-musl; 24 }; 25 26 binutils = callPackage ./binutils { 27 bash = bash_2_05; 28 + tinycc = tinycc-musl; 29 + gnumake = gnumake-musl; 30 + gnutar = gnutar-musl; 31 }; 32 33 bzip2 = callPackage ./bzip2 { 34 bash = bash_2_05; 35 + tinycc = tinycc-musl; 36 + gnumake = gnumake-musl; 37 + gnutar = gnutar-musl; 38 }; 39 40 coreutils = callPackage ./coreutils { tinycc = tinycc-mes; }; 41 + coreutils-musl = callPackage ./coreutils/musl.nix { 42 + bash = bash_2_05; 43 + tinycc = tinycc-musl; 44 + gnumake = gnumake-musl; 45 + gnutar = gnutar-musl; 46 + }; 47 48 diffutils = callPackage ./diffutils { 49 bash = bash_2_05; 50 + tinycc = tinycc-musl; 51 + gnumake = gnumake-musl; 52 + gnutar = gnutar-musl; 53 }; 54 55 findutils = callPackage ./findutils { 56 bash = bash_2_05; 57 + tinycc = tinycc-musl; 58 + gnumake = gnumake-musl; 59 + gnutar = gnutar-musl; 60 }; 61 62 gawk-mes = callPackage ./gawk/mes.nix { ··· 67 68 gawk = callPackage ./gawk { 69 bash = bash_2_05; 70 + tinycc = tinycc-musl; 71 + gnumake = gnumake-musl; 72 + gnutar = gnutar-musl; 73 bootGawk = gawk-mes; 74 }; 75 76 gcc2 = callPackage ./gcc/2.nix { 77 bash = bash_2_05; 78 gcc = gcc2-mes; 79 glibc = glibc22; 80 }; 81 gcc2-mes = callPackage ./gcc/2.nix { 82 bash = bash_2_05; 83 tinycc = tinycc-mes; 84 mesBootstrap = true; 85 }; 86 87 gcc46 = callPackage ./gcc/4.6.nix { 88 + tinycc = tinycc-musl; 89 + gnumake = gnumake-musl; 90 + gnutar = gnutar-musl; 91 + # FIXME: not sure why new gawk doesn't work 92 gawk = gawk-mes; 93 }; 94 95 inherit (callPackage ./glibc { 96 bash = bash_2_05; 97 gnused = gnused-mes; 98 }) glibc22; 99 100 gnugrep = callPackage ./gnugrep { ··· 104 105 gnumake = callPackage ./gnumake { tinycc = tinycc-mes; }; 106 107 + gnumake-musl = callPackage ./gnumake/musl.nix { 108 + bash = bash_2_05; 109 + tinycc = tinycc-musl; 110 + gawk = gawk-mes; 111 + gnumakeBoot = gnumake; 112 + }; 113 + 114 gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; }; 115 116 gnused = callPackage ./gnused { 117 bash = bash_2_05; 118 + tinycc = tinycc-musl; 119 gnused = gnused-mes; 120 }; 121 + gnused-mes = callPackage ./gnused/mes.nix { 122 bash = bash_2_05; 123 tinycc = tinycc-mes; 124 }; 125 126 + gnutar = callPackage ./gnutar/mes.nix { 127 bash = bash_2_05; 128 tinycc = tinycc-mes; 129 gnused = gnused-mes; 130 }; 131 132 + gnutar-musl = callPackage ./gnutar/musl.nix { 133 + bash = bash_2_05; 134 + tinycc = tinycc-musl; 135 + gnused = gnused-mes; 136 + }; 137 + 138 gzip = callPackage ./gzip { 139 bash = bash_2_05; 140 tinycc = tinycc-mes; ··· 163 164 musl = callPackage ./musl { 165 gcc = gcc46; 166 + gnumake = gnumake-musl; 167 }; 168 169 stage0-posix = callPackage ./stage0-posix { }; ··· 179 180 xz = callPackage ./xz { 181 bash = bash_2_05; 182 + tinycc = tinycc-musl; 183 + gnumake = gnumake-musl; 184 + gnutar = gnutar-musl; 185 }; 186 187 inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; ··· 190 echo ${bash.tests.get-version} 191 echo ${bash_2_05.tests.get-version} 192 echo ${binutils.tests.get-version} 193 echo ${bzip2.tests.get-version} 194 + echo ${coreutils-musl.tests.get-version} 195 echo ${diffutils.tests.get-version} 196 echo ${findutils.tests.get-version} 197 echo ${gawk-mes.tests.get-version} ··· 203 echo ${gnused.tests.get-version} 204 echo ${gnused-mes.tests.get-version} 205 echo ${gnutar.tests.get-version} 206 + echo ${gnutar-musl.tests.get-version} 207 echo ${gzip.tests.get-version} 208 echo ${heirloom.tests.get-version} 209 echo ${mes.compiler.tests.get-version}
+16 -17
pkgs/os-specific/linux/minimal-bootstrap/diffutils/default.nix
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 - , gcc 7 - , glibc 8 - , binutils 9 - , linux-headers 10 , gnumake 11 , gnugrep 12 , gnused 13 , gawk 14 , gnutar 15 - , gzip 16 }: 17 let 18 pname = "diffutils"; 19 - version = "2.8.1"; 20 21 src = fetchurl { 22 - url = "mirror://gnu/diffutils/diffutils-${version}.tar.gz"; 23 - sha256 = "0nizs9r76aiymzasmj1jngl7s71jfzl9xfziigcls8k9n141f065"; 24 }; 25 in 26 bash.runCommand "${pname}-${version}" { 27 inherit pname version; 28 29 nativeBuildInputs = [ 30 - gcc 31 - binutils 32 gnumake 33 gnused 34 gnugrep 35 gawk 36 gnutar 37 - gzip 38 ]; 39 40 passthru.tests.get-version = result: ··· 52 }; 53 } '' 54 # Unpack 55 - tar xzf ${src} 56 cd diffutils-${version} 57 58 # Configure 59 - export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include" 60 - export LIBRARY_PATH="${glibc}/lib" 61 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 62 bash ./configure \ 63 --prefix=$out \ 64 --build=${buildPlatform.config} \ 65 --host=${hostPlatform.config} 66 67 # Build 68 - make 69 70 # Install 71 - make install 72 ''
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 + , tinycc 7 , gnumake 8 , gnugrep 9 , gnused 10 , gawk 11 , gnutar 12 + , xz 13 }: 14 let 15 pname = "diffutils"; 16 + # last version that can be built by tinycc-musl 0.9.27 17 + version = "3.8"; 18 19 src = fetchurl { 20 + url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz"; 21 + hash = "sha256-pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w="; 22 }; 23 in 24 bash.runCommand "${pname}-${version}" { 25 inherit pname version; 26 27 nativeBuildInputs = [ 28 + tinycc.compiler 29 gnumake 30 gnused 31 gnugrep 32 gawk 33 gnutar 34 + xz 35 ]; 36 37 passthru.tests.get-version = result: ··· 49 }; 50 } '' 51 # Unpack 52 + cp ${src} diffutils.tar.xz 53 + unxz diffutils.tar.xz 54 + tar xf diffutils.tar 55 + rm diffutils.tar 56 cd diffutils-${version} 57 58 # Configure 59 + export CC="tcc -B ${tinycc.libs}/lib" 60 + export LD=tcc 61 bash ./configure \ 62 --prefix=$out \ 63 --build=${buildPlatform.config} \ 64 --host=${hostPlatform.config} 65 66 # Build 67 + make -j $NIX_BUILD_CORES AR="tcc -ar" 68 69 # Install 70 + make -j $NIX_BUILD_CORES install 71 ''
+20 -17
pkgs/os-specific/linux/minimal-bootstrap/findutils/default.nix
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 - , gcc 7 - , glibc 8 - , binutils 9 - , linux-headers 10 , gnumake 11 , gnugrep 12 , gnused 13 , gawk 14 , gnutar 15 - , gzip 16 }: 17 let 18 pname = "findutils"; 19 - version = "4.4.2"; 20 21 src = fetchurl { 22 - url = "mirror://gnu/findutils/findutils-${version}.tar.gz"; 23 - sha256 = "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"; 24 }; 25 in 26 bash.runCommand "${pname}-${version}" { 27 inherit pname version; 28 29 nativeBuildInputs = [ 30 - gcc 31 - binutils 32 gnumake 33 gnused 34 gnugrep 35 gawk 36 gnutar 37 - gzip 38 ]; 39 40 passthru.tests.get-version = result: ··· 52 }; 53 } '' 54 # Unpack 55 - tar xzf ${src} 56 cd findutils-${version} 57 58 # Configure 59 - export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include" 60 - export LIBRARY_PATH="${glibc}/lib" 61 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 62 bash ./configure \ 63 --prefix=$out \ 64 --build=${buildPlatform.config} \ 65 --host=${hostPlatform.config} 66 67 # Build 68 - make 69 70 # Install 71 - make install 72 ''
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 + , tinycc 7 , gnumake 8 , gnugrep 9 , gnused 10 , gawk 11 , gnutar 12 + , xz 13 }: 14 let 15 pname = "findutils"; 16 + version = "4.9.0"; 17 18 src = fetchurl { 19 + url = "mirror://gnu/findutils/findutils-${version}.tar.xz"; 20 + hash = "sha256-or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4="; 21 }; 22 in 23 bash.runCommand "${pname}-${version}" { 24 inherit pname version; 25 26 nativeBuildInputs = [ 27 + tinycc.compiler 28 gnumake 29 gnused 30 gnugrep 31 gawk 32 gnutar 33 + xz 34 ]; 35 36 passthru.tests.get-version = result: ··· 48 }; 49 } '' 50 # Unpack 51 + cp ${src} findutils.tar.xz 52 + unxz findutils.tar.xz 53 + tar xf findutils.tar 54 + rm findutils.tar 55 cd findutils-${version} 56 57 + # Patch 58 + # configure fails to accurately detect PATH_MAX support 59 + sed -i 's/chdir_long/chdir/' gl/lib/save-cwd.c 60 + 61 # Configure 62 + export CC="tcc -B ${tinycc.libs}/lib" 63 + export AR="tcc -ar" 64 + export LD=tcc 65 bash ./configure \ 66 --prefix=$out \ 67 --build=${buildPlatform.config} \ 68 --host=${hostPlatform.config} 69 70 # Build 71 + make -j $NIX_BUILD_CORES 72 73 # Install 74 + make -j $NIX_BUILD_CORES install 75 ''
+9 -16
pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 - , gcc 7 - , glibc 8 - , binutils 9 - , linux-headers 10 , gnumake 11 , gnugrep 12 , gnused ··· 17 let 18 inherit (import ./common.nix { inherit lib; }) meta; 19 pname = "gawk"; 20 - # >= 4.2.0 fails to cleanly build. may be worth investigating in the future. 21 - # for now this version is sufficient to build glibc 2.16 22 - version = "4.1.4"; 23 24 src = fetchurl { 25 url = "mirror://gnu/gawk/gawk-${version}.tar.gz"; 26 - sha256 = "0dadjkpyyizmyd0l098qps8lb39r0vrz3xl3hwz2cmjs5c70h0wc"; 27 }; 28 in 29 bash.runCommand "${pname}-${version}" { 30 inherit pname version meta; 31 32 nativeBuildInputs = [ 33 - gcc 34 - binutils 35 gnumake 36 gnused 37 gnugrep ··· 51 cd gawk-${version} 52 53 # Configure 54 - export C_INCLUDE_PATH="${glibc}/include:${linux-headers}/include" 55 - export LIBRARY_PATH="${glibc}/lib" 56 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 57 bash ./configure \ 58 --prefix=$out \ 59 --build=${buildPlatform.config} \ 60 --host=${hostPlatform.config} 61 62 # Build 63 - make gawk 64 65 # Install 66 - install -D gawk $out/bin/gawk 67 - ln -s gawk $out/bin/awk 68 ''
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 + , tinycc 7 , gnumake 8 , gnugrep 9 , gnused ··· 14 let 15 inherit (import ./common.nix { inherit lib; }) meta; 16 pname = "gawk"; 17 + version = "5.2.2"; 18 19 src = fetchurl { 20 url = "mirror://gnu/gawk/gawk-${version}.tar.gz"; 21 + hash = "sha256-lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA="; 22 }; 23 in 24 bash.runCommand "${pname}-${version}" { 25 inherit pname version meta; 26 27 nativeBuildInputs = [ 28 + tinycc.compiler 29 gnumake 30 gnused 31 gnugrep ··· 45 cd gawk-${version} 46 47 # Configure 48 + export CC="tcc -B ${tinycc.libs}/lib" 49 + export AR="tcc -ar" 50 + export LD=tcc 51 bash ./configure \ 52 --prefix=$out \ 53 --build=${buildPlatform.config} \ 54 --host=${hostPlatform.config} 55 56 # Build 57 + make -j $NIX_BUILD_CORES 58 59 # Install 60 + make -j $NIX_BUILD_CORES install 61 ''
+17 -33
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 - , gcc 7 - , glibc 8 - , linux-headers 9 , binutils 10 , gnumake 11 , gnupatch ··· 32 }; 33 34 patches = [ 35 - # This patch enables building gcc-4.6.4 using gcc-2.95.3 and glibc-2.2.5 36 - # * Tweak Makefile to allow overriding NATIVE_SYSTEM_HEADER_DIR using #:makeflags 37 - # * Add missing limits.h include. 38 - # * Add SSIZE_MAX define. The SSIZE_MAX define has been added to Mes 39 - # upstream and can be removed with the next Mes release. 40 - # * Remove -fbuilding-libgcc flag, it assumes features being present from a 41 - # newer gcc or glibc. 42 - # * [MES_BOOTSTRAP_GCC]: Disable threads harder. 43 - (fetchurl { 44 - url = "https://git.savannah.gnu.org/cgit/guix.git/plain/gnu/packages/patches/gcc-boot-4.6.4.patch?id=50249cab3a98839ade2433456fe618acc6f804a5"; 45 - sha256 = "1zzd8gnihw6znrgb6c6pfsmm0vix89xw3giv1nnsykm57j0v3z0d"; 46 - }) 47 - ./libstdc++-target.patch 48 ]; 49 50 - # To reduce the set of pre-built bootstrap inputs, build 51 - # GMP & co. from GCC. 52 gmpVersion = "4.3.2"; 53 gmp = fetchurl { 54 url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz"; ··· 71 inherit pname version; 72 73 nativeBuildInputs = [ 74 - gcc 75 binutils 76 gnumake 77 gnupatch ··· 84 gzip 85 ]; 86 87 - # condition in ./libcpp/configure requires `env` which is not available in this coreutils 88 - am_cv_CXX_dependencies_compiler_type = "gcc"; 89 - am_cv_CC_dependencies_compiler_type = "gcc"; 90 - 91 passthru.tests.get-version = result: 92 bash.runCommand "${pname}-get-version-${version}" {} '' 93 ${result}/bin/gcc --version ··· 118 ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 119 120 # Configure 121 - export C_INCLUDE_PATH="${gcc}/lib/gcc-lib/${hostPlatform.config}/${gcc.version}/include:${linux-headers}/include:${glibc}/include:$(pwd)/mpfr/src" 122 export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH" 123 - export LDFLAGS="-B${glibc}/lib -Wl,-dynamic-linker -Wl,${glibc}" 124 - export LDFLAGS_FOR_TARGET=$LDFLAGS 125 - export LIBRARY_PATH="${glibc}/lib:${gcc}/lib" 126 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 127 bash ./configure \ 128 --prefix=$out \ 129 --build=${buildPlatform.config} \ 130 --host=${hostPlatform.config} \ 131 - --with-native-system-header-dir=${glibc}/include \ 132 - --with-build-sysroot=${glibc}/include \ 133 --disable-bootstrap \ 134 --disable-decimal-float \ 135 --disable-libatomic \ ··· 146 --disable-multilib \ 147 --disable-plugin \ 148 --disable-threads \ 149 - --enable-languages=c,c++ \ 150 --enable-static \ 151 --disable-shared \ 152 --enable-threads=single \ ··· 154 --disable-build-with-cxx 155 156 # Build 157 - make 158 159 # Install 160 - make install 161 ''
··· 3 , hostPlatform 4 , fetchurl 5 , bash 6 + , tinycc 7 , binutils 8 , gnumake 9 , gnupatch ··· 30 }; 31 32 patches = [ 33 + # Remove hardcoded NATIVE_SYSTEM_HEADER_DIR 34 + ./no-system-headers.patch 35 ]; 36 37 gmpVersion = "4.3.2"; 38 gmp = fetchurl { 39 url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz"; ··· 56 inherit pname version; 57 58 nativeBuildInputs = [ 59 + tinycc.compiler 60 binutils 61 gnumake 62 gnupatch ··· 69 gzip 70 ]; 71 72 passthru.tests.get-version = result: 73 bash.runCommand "${pname}-get-version-${version}" {} '' 74 ${result}/bin/gcc --version ··· 99 ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 100 101 # Configure 102 + export CC="tcc -B ${tinycc.libs}/lib" 103 + export C_INCLUDE_PATH="${tinycc.libs}/include:$(pwd)/mpfr/src" 104 export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH" 105 + 106 + # Avoid "Link tests are not allowed after GCC_NO_EXECUTABLES" 107 + export lt_cv_shlibpath_overrides_runpath=yes 108 + export ac_cv_func_memcpy=yes 109 + export ac_cv_func_strerror=yes 110 + 111 bash ./configure \ 112 --prefix=$out \ 113 --build=${buildPlatform.config} \ 114 --host=${hostPlatform.config} \ 115 + --with-native-system-header-dir=${tinycc.libs}/include \ 116 + --with-build-sysroot=${tinycc.libs}/include \ 117 --disable-bootstrap \ 118 --disable-decimal-float \ 119 --disable-libatomic \ ··· 130 --disable-multilib \ 131 --disable-plugin \ 132 --disable-threads \ 133 + --enable-languages=c \ 134 --enable-static \ 135 --disable-shared \ 136 --enable-threads=single \ ··· 138 --disable-build-with-cxx 139 140 # Build 141 + make -j $NIX_BUILD_CORES 142 143 # Install 144 + make -j $NIX_BUILD_CORES install 145 ''
+11
pkgs/os-specific/linux/minimal-bootstrap/gcc/no-system-headers.patch
···
··· 1 + --- a/gcc/Makefile.in 2 + +++ b/gcc/Makefile.in 3 + @@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h 4 + LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h 5 + 6 + # Default native SYSTEM_HEADER_DIR, to be overridden by targets. 7 + -NATIVE_SYSTEM_HEADER_DIR = /usr/include 8 + +# NATIVE_SYSTEM_HEADER_DIR = /usr/include 9 + # Default cross SYSTEM_HEADER_DIR, to be overridden by targets. 10 + CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@ 11 +
+2 -3
pkgs/os-specific/linux/minimal-bootstrap/glibc/default.nix
··· 12 , gzip 13 , gawk 14 , heirloom 15 - , binutils-mes 16 , linux-headers 17 }: 18 let 19 pname = "glibc"; 20 21 - buildGlibc = { version, src, patches, configureFlags, gcc, binutils, CC, CPP }: 22 bash.runCommand "${pname}-${version}" { 23 inherit pname version; 24 ··· 114 ]; 115 116 gcc = gcc2-mes; 117 - binutils = binutils-mes; 118 CC = "gcc -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1 -L $(pwd)"; 119 CPP = "gcc -E -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1"; 120 };
··· 12 , gzip 13 , gawk 14 , heirloom 15 + , binutils 16 , linux-headers 17 }: 18 let 19 pname = "glibc"; 20 21 + buildGlibc = { version, src, patches, configureFlags, gcc, CC, CPP }: 22 bash.runCommand "${pname}-${version}" { 23 inherit pname version; 24 ··· 114 ]; 115 116 gcc = gcc2-mes; 117 CC = "gcc -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1 -L $(pwd)"; 118 CPP = "gcc -E -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1"; 119 };
+82
pkgs/os-specific/linux/minimal-bootstrap/gnumake/musl.nix
···
··· 1 + { lib 2 + , buildPlatform 3 + , hostPlatform 4 + , fetchurl 5 + , bash 6 + , tinycc 7 + , gnumakeBoot 8 + , gnupatch 9 + , gnused 10 + , gnugrep 11 + , gawk 12 + , gnutar 13 + , gzip 14 + }: 15 + let 16 + pname = "gnumake-musl"; 17 + version = "4.4.1"; 18 + 19 + src = fetchurl { 20 + url = "mirror://gnu/make/make-${version}.tar.gz"; 21 + hash = "sha256-3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M="; 22 + }; 23 + 24 + patches = [ 25 + # Replaces /bin/sh with sh, see patch file for reasoning 26 + ./0001-No-impure-bin-sh.patch 27 + # Purity: don't look for library dependencies (of the form `-lfoo') in /lib 28 + # and /usr/lib. It's a stupid feature anyway. Likewise, when searching for 29 + # included Makefiles, don't look in /usr/include and friends. 30 + ./0002-remove-impure-dirs.patch 31 + ]; 32 + in 33 + bash.runCommand "${pname}-${version}" { 34 + inherit pname version; 35 + 36 + nativeBuildInputs = [ 37 + tinycc.compiler 38 + gnumakeBoot 39 + gnupatch 40 + gnused 41 + gnugrep 42 + gawk 43 + gnutar 44 + gzip 45 + ]; 46 + 47 + passthru.tests.get-version = result: 48 + bash.runCommand "${pname}-get-version-${version}" {} '' 49 + ${result}/bin/make --version 50 + mkdir $out 51 + ''; 52 + 53 + meta = with lib; { 54 + description = "A tool to control the generation of non-source files from sources"; 55 + homepage = "https://www.gnu.org/software/make"; 56 + license = licenses.gpl3Plus; 57 + maintainers = teams.minimal-bootstrap.members; 58 + mainProgram = "make"; 59 + platforms = platforms.unix; 60 + }; 61 + } '' 62 + # Unpack 63 + tar xzf ${src} 64 + cd make-${version} 65 + 66 + # Patch 67 + ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 68 + 69 + # Configure 70 + export CC="tcc -B ${tinycc.libs}/lib" 71 + export LD=tcc 72 + bash ./configure \ 73 + --prefix=$out \ 74 + --build=${buildPlatform.config} \ 75 + --host=${hostPlatform.config} 76 + 77 + # Build 78 + make AR="tcc -ar" 79 + 80 + # Install 81 + make install 82 + ''
+12
pkgs/os-specific/linux/minimal-bootstrap/gnused/common.nix
···
··· 1 + { lib }: 2 + 3 + { 4 + meta = with lib; { 5 + description = "GNU sed, a batch stream editor"; 6 + homepage = "https://www.gnu.org/software/sed"; 7 + license = licenses.gpl3Plus; 8 + maintainers = teams.minimal-bootstrap.members; 9 + mainProgram = "sed"; 10 + platforms = platforms.unix; 11 + }; 12 + }
+19 -52
pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix
··· 4 , fetchurl 5 , bash 6 , gnumake 7 - , mesBootstrap ? false, tinycc ? null 8 - , gcc ? null, glibc ? null, binutils ? null, gnused ? null, linux-headers, gnugrep 9 }: 10 - assert mesBootstrap -> tinycc != null; 11 - assert !mesBootstrap -> gcc != null && glibc != null && binutils != null && gnused != null; 12 let 13 - pname = "gnused" + lib.optionalString mesBootstrap "-mes"; 14 - # last version that can be compiled with mes-libc 15 - version = "4.0.9"; 16 17 src = fetchurl { 18 url = "mirror://gnu/sed/sed-${version}.tar.gz"; 19 - sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3"; 20 - }; 21 - 22 - # Thanks to the live-bootstrap project! 23 - # See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem 24 - makefile = fetchurl { 25 - url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk"; 26 - sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya"; 27 }; 28 in 29 bash.runCommand "${pname}-${version}" { 30 - inherit pname version; 31 32 nativeBuildInputs = [ 33 gnumake 34 - ] ++ lib.optionals mesBootstrap [ 35 tinycc.compiler 36 - ] ++ lib.optionals (!mesBootstrap) [ 37 - gcc 38 - glibc 39 - binutils 40 gnused 41 gnugrep 42 ]; 43 44 passthru.tests.get-version = result: ··· 46 ${result}/bin/sed --version 47 mkdir ''${out} 48 ''; 49 - 50 - meta = with lib; { 51 - description = "GNU sed, a batch stream editor"; 52 - homepage = "https://www.gnu.org/software/sed"; 53 - license = licenses.gpl3Plus; 54 - maintainers = teams.minimal-bootstrap.members; 55 - mainProgram = "sed"; 56 - platforms = platforms.unix; 57 - }; 58 } ('' 59 # Unpack 60 - ungz --file ${src} --output sed.tar 61 - untar --file sed.tar 62 - rm sed.tar 63 cd sed-${version} 64 65 - '' + lib.optionalString mesBootstrap '' 66 # Configure 67 - cp ${makefile} Makefile 68 - catm config.h 69 - 70 - # Build 71 - make \ 72 - CC="tcc -B ${tinycc.libs}/lib" \ 73 - LIBC=mes 74 - 75 - '' + lib.optionalString (!mesBootstrap) '' 76 - # Configure 77 - export CC="gcc -I${glibc}/include -I${linux-headers}/include" 78 - export LIBRARY_PATH="${glibc}/lib" 79 - export LIBS="-lc -lnss_files -lnss_dns -lresolv" 80 - chmod +x configure 81 ./configure \ 82 --build=${buildPlatform.config} \ 83 --host=${hostPlatform.config} \ 84 --disable-shared \ 85 --disable-nls \ 86 --disable-dependency-tracking \ 87 - --without-included-regex \ 88 --prefix=$out 89 90 # Build 91 - make 92 93 - '' + '' 94 # Install 95 - make install PREFIX=$out 96 '')
··· 4 , fetchurl 5 , bash 6 , gnumake 7 + , tinycc 8 + , gnused 9 + , gnugrep 10 + , gnutar 11 + , gzip 12 }: 13 + 14 let 15 + inherit (import ./common.nix { inherit lib; }) meta; 16 + pname = "gnused"; 17 + # last version that can be bootstrapped with our slightly buggy gnused-mes 18 + version = "4.2"; 19 20 src = fetchurl { 21 url = "mirror://gnu/sed/sed-${version}.tar.gz"; 22 + hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM="; 23 }; 24 in 25 bash.runCommand "${pname}-${version}" { 26 + inherit pname version meta; 27 28 nativeBuildInputs = [ 29 gnumake 30 tinycc.compiler 31 gnused 32 gnugrep 33 + gnutar 34 + gzip 35 ]; 36 37 passthru.tests.get-version = result: ··· 39 ${result}/bin/sed --version 40 mkdir ''${out} 41 ''; 42 } ('' 43 # Unpack 44 + tar xzf ${src} 45 cd sed-${version} 46 47 # Configure 48 + export CC="tcc -B ${tinycc.libs}/lib" 49 + export LD=tcc 50 ./configure \ 51 --build=${buildPlatform.config} \ 52 --host=${hostPlatform.config} \ 53 --disable-shared \ 54 --disable-nls \ 55 --disable-dependency-tracking \ 56 --prefix=$out 57 58 # Build 59 + make AR="tcc -ar" 60 61 # Install 62 + make install 63 '')
+59
pkgs/os-specific/linux/minimal-bootstrap/gnused/mes.nix
···
··· 1 + { lib 2 + , buildPlatform 3 + , hostPlatform 4 + , fetchurl 5 + , bash 6 + , gnumake 7 + , tinycc 8 + }: 9 + 10 + let 11 + inherit (import ./common.nix { inherit lib; }) meta; 12 + pname = "gnused-mes"; 13 + # last version that can be compiled with mes-libc 14 + version = "4.0.9"; 15 + 16 + src = fetchurl { 17 + url = "mirror://gnu/sed/sed-${version}.tar.gz"; 18 + sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3"; 19 + }; 20 + 21 + # Thanks to the live-bootstrap project! 22 + # See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem 23 + makefile = fetchurl { 24 + url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk"; 25 + sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya"; 26 + }; 27 + in 28 + bash.runCommand "${pname}-${version}" { 29 + inherit pname version meta; 30 + 31 + nativeBuildInputs = [ 32 + gnumake 33 + tinycc.compiler 34 + ]; 35 + 36 + passthru.tests.get-version = result: 37 + bash.runCommand "${pname}-get-version-${version}" {} '' 38 + ${result}/bin/sed --version 39 + mkdir ''${out} 40 + ''; 41 + } ('' 42 + # Unpack 43 + ungz --file ${src} --output sed.tar 44 + untar --file sed.tar 45 + rm sed.tar 46 + cd sed-${version} 47 + 48 + # Configure 49 + cp ${makefile} Makefile 50 + catm config.h 51 + 52 + # Build 53 + make \ 54 + CC="tcc -B ${tinycc.libs}/lib" \ 55 + LIBC=mes 56 + 57 + # Install 58 + make install PREFIX=$out 59 + '')
pkgs/os-specific/linux/minimal-bootstrap/gnutar/default.nix pkgs/os-specific/linux/minimal-bootstrap/gnutar/mes.nix
+70
pkgs/os-specific/linux/minimal-bootstrap/gnutar/musl.nix
···
··· 1 + { lib 2 + , buildPlatform 3 + , hostPlatform 4 + , fetchurl 5 + , bash 6 + , tinycc 7 + , gnumake 8 + , gnugrep 9 + , gnused 10 + }: 11 + let 12 + # gnutar with musl preserves modify times, allowing make to not try 13 + # rebuilding pregenerated files 14 + pname = "gnutar-musl"; 15 + version = "1.12"; 16 + 17 + src = fetchurl { 18 + url = "mirror://gnu/tar/tar-${version}.tar.gz"; 19 + hash = "sha256-xsN+iIsTbM76uQPFEUn0t71lnWnUrqISRfYQU6V6pgo="; 20 + }; 21 + in 22 + bash.runCommand "${pname}-${version}" { 23 + inherit pname version; 24 + 25 + nativeBuildInputs = [ 26 + tinycc.compiler 27 + gnumake 28 + gnused 29 + gnugrep 30 + ]; 31 + 32 + passthru.tests.get-version = result: 33 + bash.runCommand "${pname}-get-version-${version}" {} '' 34 + ${result}/bin/tar --version 35 + mkdir $out 36 + ''; 37 + 38 + meta = with lib; { 39 + description = "GNU implementation of the `tar' archiver"; 40 + homepage = "https://www.gnu.org/software/tar"; 41 + license = licenses.gpl3Plus; 42 + maintainers = teams.minimal-bootstrap.members; 43 + mainProgram = "tar"; 44 + platforms = platforms.unix; 45 + }; 46 + } '' 47 + # Unpack 48 + ungz --file ${src} --output tar.tar 49 + untar --file tar.tar 50 + rm tar.tar 51 + cd tar-${version} 52 + 53 + # Configure 54 + export CC="tcc -B ${tinycc.libs}/lib" 55 + export LD=tcc 56 + export ac_cv_sizeof_unsigned_long=4 57 + export ac_cv_sizeof_long_long=8 58 + export ac_cv_header_netdb_h=no 59 + bash ./configure \ 60 + --prefix=$out \ 61 + --build=${buildPlatform.config} \ 62 + --host=${hostPlatform.config} \ 63 + --disable-nls 64 + 65 + # Build 66 + make AR="tcc -ar" 67 + 68 + # Install 69 + make install 70 + ''
+2
pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix
··· 58 # url = "${liveBootstrap}/patches/stdio_flush_on_exit.patch"; 59 # hash = "sha256-/z5ze3h3QTysay8nRvyvwPv3pmTcKptdkBIaMCoeLDg="; 60 # }) 61 (fetchurl { 62 url = "${liveBootstrap}/patches/va_list.patch"; 63 hash = "sha256-UmcMIl+YCi3wIeVvjbsCyqFlkyYsM4ECNwTfXP+s7vg=";
··· 58 # url = "${liveBootstrap}/patches/stdio_flush_on_exit.patch"; 59 # hash = "sha256-/z5ze3h3QTysay8nRvyvwPv3pmTcKptdkBIaMCoeLDg="; 60 # }) 61 + # HACK: always flush stdio immediately 62 + ./always-flush.patch 63 (fetchurl { 64 url = "${liveBootstrap}/patches/va_list.patch"; 65 hash = "sha256-UmcMIl+YCi3wIeVvjbsCyqFlkyYsM4ECNwTfXP+s7vg=";
+12
pkgs/os-specific/linux/minimal-bootstrap/musl/always-flush.patch
···
··· 1 + diff --git src/env/__libc_start_main.c src/env/__libc_start_main.c 2 + index 8fbe526..9476c22 100644 3 + --- src/env/__libc_start_main.c 4 + +++ src/env/__libc_start_main.c 5 + @@ -91,6 +91,7 @@ static int libc_start_main_stage2(int (*main)(int,char **,char **), int argc, ch 6 + __libc_start_init(); 7 + 8 + /* Pass control to the application */ 9 + + setbuf(stdout, NULL); 10 + exit(main(argc, argv, envp)); 11 + return 0; 12 + }
+2 -2
pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix
··· 70 --host=${hostPlatform.config} 71 72 # Build 73 - make 74 75 # Install 76 - make install 77 ''
··· 70 --host=${hostPlatform.config} 71 72 # Build 73 + make -j $NIX_BUILD_CORES 74 75 # Install 76 + make -j $NIX_BUILD_CORES install 77 ''
+13
pkgs/os-specific/linux/minimal-bootstrap/tinycc/ignore-duplicate-symbols.patch
···
··· 1 + --- tccelf.c 2 + +++ tccelf.c 3 + @@ -710,8 +710,9 @@ ST_FUNC int set_elf_sym(Section *s, addr_t value, unsigned long size, 4 + #if 0 5 + printf("new_bind=%x new_shndx=%x new_vis=%x old_bind=%x old_shndx=%x old_vis=%x\n", 6 + sym_bind, shndx, new_vis, esym_bind, esym->st_shndx, esym_vis); 7 + -#endif 8 + tcc_error_noabort("'%s' defined twice", name); 9 + +#endif 10 + + goto do_patch; 11 + } 12 + } else { 13 + esym->st_other = other;
+21
pkgs/os-specific/linux/minimal-bootstrap/tinycc/ignore-static-inside-array.patch
···
··· 1 + --- tccgen.c 2 + +++ tccgen.c 3 + @@ -4941,7 +4941,7 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) 4 + next(); 5 + n = -1; 6 + t1 = 0; 7 + - if (td & TYPE_PARAM) while (1) { 8 + + while (1) { 9 + /* XXX The optional type-quals and static should only be accepted 10 + in parameter decls. The '*' as well, and then even only 11 + in prototypes (not function defs). */ 12 + @@ -4972,7 +4972,8 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) 13 + } 14 + break; 15 + 16 + - } else if (tok != ']') { 17 + + } 18 + + if (tok != ']') { 19 + if (!local_stack || (storage & VT_STATIC)) 20 + vpushi(expr_const()); 21 + else {
+39 -39
pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix
··· 1 - # Build steps adapted from https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/tcc-0.9.27/tcc-musl-pass1.sh 2 - # 3 - # SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space> 4 - # 5 - # SPDX-License-Identifier: GPL-3.0-or-later 6 - 7 { lib 8 , fetchurl 9 , callPackage ··· 12 , musl 13 , gnupatch 14 , gnutar 15 - , bzip2 16 }: 17 let 18 pname = "tinycc-musl"; 19 - version = "0.9.27"; 20 21 src = fetchurl { 22 - url = "https://download.savannah.gnu.org/releases/tinycc/tcc-${version}.tar.bz2"; 23 - hash = "sha256-3iOvePypDOMt/y3UWzQysjNHQLubt7Bb9g/b/Dls65w="; 24 }; 25 26 - # Thanks to the live-bootstrap project! 27 - # See https://github.com/fosslinux/live-bootstrap/blob/424aa5be38a3023aa6842883a3954599b1597986/sysa/tcc-0.9.27/tcc-musl-pass1.sh 28 - liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/424aa5be38a3023aa6842883a3954599b1597986/sysa/tcc-0.9.27"; 29 patches = [ 30 - (fetchurl { 31 - url = "${liveBootstrap}/patches/ignore-duplicate-symbols.patch"; 32 - hash = "sha256-6Js8HkzjYlA8ETxeEYRWu+03OJI60NvR5h1QPkcMTlQ="; 33 - }) 34 - (fetchurl { 35 - url = "${liveBootstrap}/patches/ignore-static-inside-array.patch"; 36 - hash = "sha256-IF4RevLGjzRBuYqhuyG7+x6SVljzMAsYRKicNsmtbDY="; 37 - }) 38 - (fetchurl { 39 - url = "${liveBootstrap}/patches/static-link.patch"; 40 - hash = "sha256-gX/hJ9a/0Zg29KIBUme+mOA8WrPQvp0SvojP8DN9mSI="; 41 - }) 42 ]; 43 44 meta = with lib; { 45 - description = "Small, fast, and embeddable C compiler and interpreter"; 46 - homepage = "http://savannah.nongnu.org/projects/tinycc"; 47 - license = licenses.lgpl21Only; 48 - maintainers = teams.minimal-bootstrap.members; 49 - platforms = [ "i686-linux" ]; 50 - }; 51 52 tinycc-musl = bash.runCommand "${pname}-${version}" { 53 inherit pname version meta; ··· 56 tinycc-bootstrappable.compiler 57 gnupatch 58 gnutar 59 - bzip2 60 ]; 61 } '' 62 # Unpack 63 - cp ${src} tinycc.tar.bz2 64 - bunzip2 tinycc.tar.bz2 65 - tar xf tinycc.tar 66 - rm tinycc.tar 67 - cd tcc-${version} 68 69 # Patch 70 ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} ··· 77 # but when linked with musl it is. 78 ln -s ${musl}/lib/libtcc1.a ./libtcc1.a 79 80 tcc -v \ 81 -static \ 82 -o tcc-musl \ ··· 92 -D CONFIG_USE_LIBGCC=1 \ 93 -D TCC_VERSION=\"0.9.27\" \ 94 -D ONE_SOURCE=1 \ 95 -B . \ 96 -B ${tinycc-bootstrappable.libs}/lib \ 97 tcc.c ··· 117 -D CONFIG_USE_LIBGCC=1 \ 118 -D TCC_VERSION=\"0.9.27\" \ 119 -D ONE_SOURCE=1 \ 120 -B . \ 121 -B ${musl}/lib \ 122 tcc.c 123 # libtcc1.a 124 rm -f libtcc1.a 125 ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/libtcc1.c 126 - ./tcc-musl -ar cr libtcc1.a libtcc1.o 127 128 # Install 129 install -D tcc-musl $out/bin/tcc ··· 151 152 libs = bash.runCommand "${pname}-${version}-libs" { 153 inherit pname version meta; 154 - } "install -D ${tinycc-musl}/lib/libtcc1.a $out/lib/libtcc1.a"; 155 }
··· 1 { lib 2 , fetchurl 3 , callPackage ··· 6 , musl 7 , gnupatch 8 , gnutar 9 + , gzip 10 }: 11 let 12 pname = "tinycc-musl"; 13 + # next commit introduces use of realpath (unsupported in mes-libc) 14 + version = "unstable-2023-07-10"; 15 + rev = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d"; 16 17 src = fetchurl { 18 + url = "https://repo.or.cz/tinycc.git/snapshot/${rev}.tar.gz"; 19 + hash = "sha256-R81SNbEmh4s9FNQxCWZwUiMCYRkkwOHAdRf0aMnnRiA="; 20 }; 21 22 patches = [ 23 + ./ignore-duplicate-symbols.patch 24 + ./ignore-static-inside-array.patch 25 + ./static-link.patch 26 ]; 27 28 meta = with lib; { 29 + description = "Small, fast, and embeddable C compiler and interpreter"; 30 + homepage = "https://repo.or.cz/w/tinycc.git"; 31 + license = licenses.lgpl21Only; 32 + maintainers = teams.minimal-bootstrap.members; 33 + platforms = [ "i686-linux" ]; 34 + }; 35 36 tinycc-musl = bash.runCommand "${pname}-${version}" { 37 inherit pname version meta; ··· 40 tinycc-bootstrappable.compiler 41 gnupatch 42 gnutar 43 + gzip 44 ]; 45 } '' 46 # Unpack 47 + tar xzf ${src} 48 + cd tinycc-${builtins.substring 0 7 rev} 49 50 # Patch 51 ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} ··· 58 # but when linked with musl it is. 59 ln -s ${musl}/lib/libtcc1.a ./libtcc1.a 60 61 + tcc \ 62 + -B ${tinycc-bootstrappable.libs}/lib \ 63 + -DC2STR \ 64 + -o c2str \ 65 + conftest.c 66 + ./c2str include/tccdefs.h tccdefs_.h 67 + 68 tcc -v \ 69 -static \ 70 -o tcc-musl \ ··· 80 -D CONFIG_USE_LIBGCC=1 \ 81 -D TCC_VERSION=\"0.9.27\" \ 82 -D ONE_SOURCE=1 \ 83 + -D TCC_MUSL=1 \ 84 + -D CONFIG_TCC_PREDEFS=1 \ 85 + -D CONFIG_TCC_SEMLOCK=0 \ 86 -B . \ 87 -B ${tinycc-bootstrappable.libs}/lib \ 88 tcc.c ··· 108 -D CONFIG_USE_LIBGCC=1 \ 109 -D TCC_VERSION=\"0.9.27\" \ 110 -D ONE_SOURCE=1 \ 111 + -D TCC_MUSL=1 \ 112 + -D CONFIG_TCC_PREDEFS=1 \ 113 + -D CONFIG_TCC_SEMLOCK=0 \ 114 -B . \ 115 -B ${musl}/lib \ 116 tcc.c 117 # libtcc1.a 118 rm -f libtcc1.a 119 ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/libtcc1.c 120 + ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/alloca.S 121 + ./tcc-musl -ar cr libtcc1.a libtcc1.o alloca.o 122 123 # Install 124 install -D tcc-musl $out/bin/tcc ··· 146 147 libs = bash.runCommand "${pname}-${version}-libs" { 148 inherit pname version meta; 149 + } '' 150 + mkdir $out 151 + cp -r ${musl}/* $out 152 + chmod +w $out/lib/libtcc1.a 153 + cp ${tinycc-musl}/lib/libtcc1.a $out/lib/libtcc1.a 154 + ''; 155 }
+10
pkgs/os-specific/linux/minimal-bootstrap/tinycc/static-link.patch
···
··· 1 + --- libtcc.c 2 + +++ libtcc.c 3 + @@ -793,6 +793,7 @@ LIBTCCAPI TCCState *tcc_new(void) 4 + 5 + s->gnu_ext = 1; 6 + s->tcc_ext = 1; 7 + + s->static_link = 1; 8 + s->nocommon = 1; 9 + s->dollars_in_identifiers = 1; /*on by default like in gcc/clang*/ 10 + s->cversion = 199901; /* default unless -std=c11 is supplied */
+14 -22
pkgs/os-specific/linux/minimal-bootstrap/xz/default.nix
··· 5 , bash 6 , tinycc 7 , gnumake 8 , gnugrep 9 , gawk 10 - , sed 11 }: 12 let 13 pname = "xz"; 14 - # >=5.2 uses poll.h, unsupported by meslibc 15 - version = "5.0.8"; 16 17 src = fetchurl { 18 - url = "https://tukaani.org/xz/xz-${version}.tar.bz2"; 19 - sha256 = "1nkb68dyrf16xwyqichcy1vhgbfg20dxz459rcsdx85h1gczk1i2"; 20 }; 21 in 22 bash.runCommand "${pname}-${version}" { ··· 25 nativeBuildInputs = [ 26 tinycc.compiler 27 gnumake 28 gnugrep 29 gawk 30 - sed 31 ]; 32 33 passthru.tests.get-version = result: ··· 45 }; 46 } '' 47 # Unpack 48 - unbz2 --file ${src} --output xz.tar 49 - untar --file xz.tar 50 - rm xz.tar 51 cd xz-${version} 52 53 # Configure 54 - export CC="tcc -B ${tinycc.libs}/lib -include${./stubs.h}" 55 - export CPP="tcc -E" 56 - export LD=tcc 57 export AR="tcc -ar" 58 - export SED=sed 59 - export ac_cv_prog_cc_c99= 60 - export ac_cv_header_fcntl_h=yes 61 - export ac_cv_header_limits_h=yes 62 - export ac_cv_header_sys_time_h=yes 63 - export ac_cv_func_utime=no 64 bash ./configure \ 65 --prefix=$out \ 66 --build=${buildPlatform.config} \ 67 --host=${hostPlatform.config} \ 68 --disable-shared \ 69 - --disable-nls \ 70 - --disable-threads \ 71 --disable-assembler 72 73 # Build 74 - make all 75 76 # Install 77 - make install 78 ''
··· 5 , bash 6 , tinycc 7 , gnumake 8 + , gnused 9 , gnugrep 10 , gawk 11 + , gnutar 12 + , gzip 13 }: 14 let 15 pname = "xz"; 16 + version = "5.4.3"; 17 18 src = fetchurl { 19 + url = "https://tukaani.org/xz/xz-${version}.tar.gz"; 20 + hash = "sha256-HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k="; 21 }; 22 in 23 bash.runCommand "${pname}-${version}" { ··· 26 nativeBuildInputs = [ 27 tinycc.compiler 28 gnumake 29 + gnused 30 gnugrep 31 gawk 32 + gnutar 33 + gzip 34 ]; 35 36 passthru.tests.get-version = result: ··· 48 }; 49 } '' 50 # Unpack 51 + tar xzf ${src} 52 cd xz-${version} 53 54 # Configure 55 + export CC="tcc -B ${tinycc.libs}/lib" 56 export AR="tcc -ar" 57 + export LD=tcc 58 bash ./configure \ 59 --prefix=$out \ 60 --build=${buildPlatform.config} \ 61 --host=${hostPlatform.config} \ 62 --disable-shared \ 63 --disable-assembler 64 65 # Build 66 + make -j $NIX_BUILD_CORES 67 68 # Install 69 + make -j $NIX_BUILD_CORES install 70 ''
-25
pkgs/os-specific/linux/minimal-bootstrap/xz/stubs.h
··· 1 - #define sig_atomic_t int 2 - 3 - #define SSIZE_MAX LONG_MAX 4 - 5 - #define O_NOCTTY 0400 6 - #define O_NONBLOCK 04000 7 - 8 - #define S_ISVTX 01000 9 - #define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK) 10 - 11 - int fchmod (int fd, int mode) 12 - { 13 - return 0; 14 - } 15 - 16 - int fchown (int fd, int owner, int group) 17 - { 18 - return 0; 19 - } 20 - 21 - #include <signal.h> 22 - int sigfillset (sigset_t * set) 23 - { 24 - return 0; 25 - }
···