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 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
+39 -41
pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix
··· 3 3 , hostPlatform 4 4 , fetchurl 5 5 , bash 6 + , coreutils 6 7 , gnumake 7 8 , gnupatch 9 + , gnused 8 10 , gnugrep 9 - , gnutar 10 11 , gawk 11 - , bzip2 12 - , sed 13 - , mesBootstrap ? false, tinycc ? null 14 - , gcc ? null, glibc ? null, binutils ? null, linux-headers 12 + , diffutils 13 + , gnutar 14 + , xz 15 + , tinycc 15 16 }: 16 - assert mesBootstrap -> tinycc != null; 17 - assert !mesBootstrap -> gcc != null && glibc != null && binutils != null; 17 + 18 18 let 19 - pname = "binutils" + lib.optionalString mesBootstrap "-mes"; 20 - version = "2.20.1"; 21 - rev = "a"; 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 22 23 23 src = fetchurl { 24 - url = "mirror://gnu/binutils/binutils-${version}${rev}.tar.bz2"; 25 - sha256 = "0r7dr0brfpchh5ic0z9r4yxqn4ybzmlh25sbp30cacqk8nb7rlvi"; 24 + url = "mirror://gnu/binutils/binutils-${version}.tar.xz"; 25 + hash = "sha256-rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA="; 26 26 }; 27 27 28 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 29 # Make binutils output deterministic by default. 36 30 ./deterministic.patch 37 31 ]; ··· 40 34 "--prefix=${placeholder "out"}" 41 35 "--build=${buildPlatform.config}" 42 36 "--host=${hostPlatform.config}" 43 - "--disable-nls" 44 - "--disable-shared" 45 - "--disable-werror" 46 37 "--with-sysroot=/" 38 + "--enable-deterministic-archives" 39 + # depends on bison 40 + "--disable-gprofng" 47 41 48 42 # Turn on --enable-new-dtags by default to make the linker set 49 43 # RUNPATH instead of RPATH on binaries. This is important because ··· 60 54 inherit pname version; 61 55 62 56 nativeBuildInputs = [ 63 - (if mesBootstrap then tinycc.compiler else gcc) 57 + tinycc.compiler 64 58 gnumake 65 59 gnupatch 60 + gnused 66 61 gnugrep 67 - gnutar 68 62 gawk 69 - bzip2 70 - sed 71 - ] ++ lib.optional (!mesBootstrap) binutils; 63 + diffutils 64 + gnutar 65 + xz 66 + ]; 72 67 73 68 passthru.tests.get-version = result: 74 69 bash.runCommand "${pname}-get-version-${version}" {} '' ··· 85 80 }; 86 81 } '' 87 82 # Unpack 88 - cp ${src} binutils.tar.bz2 89 - bunzip2 binutils.tar.bz2 83 + cp ${src} binutils.tar.xz 84 + unxz binutils.tar.xz 90 85 tar xf binutils.tar 91 86 rm binutils.tar 92 87 cd binutils-${version} 93 88 94 89 # Patch 95 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" 96 99 97 100 # 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 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" 109 105 bash ./configure ${lib.concatStringsSep " " configureFlags} 110 106 111 107 # Build 112 - make 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 113 111 114 112 # Install 115 - make install 113 + make -j $NIX_BUILD_CORES install 116 114 ''
+7 -22
pkgs/os-specific/linux/minimal-bootstrap/bzip2/default.nix
··· 3 3 , bash 4 4 , tinycc 5 5 , gnumake 6 - , gnupatch 6 + , gnutar 7 7 , gzip 8 8 }: 9 9 let ··· 14 14 url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz"; 15 15 sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb"; 16 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 17 in 28 18 bash.runCommand "${pname}-${version}" { 29 19 inherit pname version; ··· 31 21 nativeBuildInputs = [ 32 22 tinycc.compiler 33 23 gnumake 34 - gnupatch 24 + gnutar 35 25 gzip 36 26 ]; 37 27 38 28 passthru.tests.get-version = result: 39 29 bash.runCommand "${pname}-get-version-${version}" {} '' 40 - ${result}/bin/bzip2 --version --help 30 + ${result}/bin/bzip2 --help 41 31 mkdir $out 42 32 ''; 43 33 ··· 50 40 }; 51 41 } '' 52 42 # Unpack 53 - cp ${src} bzip2.tar.gz 54 - gunzip bzip2.tar.gz 55 - untar --file bzip2.tar 56 - rm bzip2.tar 43 + tar xzf ${src} 57 44 cd bzip2-${version} 58 45 59 - # Patch 60 - ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} 61 - 62 46 # Build 63 47 make \ 64 - CC="tcc -B ${tinycc.libs}/lib -I ." \ 48 + -j $NIX_BUILD_CORES \ 49 + CC="tcc -B ${tinycc.libs}/lib" \ 65 50 AR="tcc -ar" \ 66 51 bzip2 bzip2recover 67 52 68 53 # Install 69 - make install PREFIX=$out 54 + make install -j $NIX_BUILD_CORES PREFIX=$out 70 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 17 18 18 bash = callPackage ./bash { 19 19 bootBash = bash_2_05; 20 - gcc = gcc2; 21 - glibc = glibc22; 22 - gawk = gawk-mes; 20 + tinycc = tinycc-musl; 21 + coreutils = coreutils-musl; 22 + gnumake = gnumake-musl; 23 + gnutar = gnutar-musl; 23 24 }; 24 25 25 26 binutils = callPackage ./binutils { 26 27 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; 28 + tinycc = tinycc-musl; 29 + gnumake = gnumake-musl; 30 + gnutar = gnutar-musl; 39 31 }; 40 32 41 33 bzip2 = callPackage ./bzip2 { 42 34 bash = bash_2_05; 43 - tinycc = tinycc-mes; 35 + tinycc = tinycc-musl; 36 + gnumake = gnumake-musl; 37 + gnutar = gnutar-musl; 44 38 }; 45 39 46 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 47 48 48 diffutils = callPackage ./diffutils { 49 49 bash = bash_2_05; 50 - gcc = gcc2; 51 - glibc = glibc22; 52 - gawk = gawk-mes; 50 + tinycc = tinycc-musl; 51 + gnumake = gnumake-musl; 52 + gnutar = gnutar-musl; 53 53 }; 54 54 55 55 findutils = callPackage ./findutils { 56 56 bash = bash_2_05; 57 - gcc = gcc2; 58 - glibc = glibc22; 59 - gawk = gawk-mes; 57 + tinycc = tinycc-musl; 58 + gnumake = gnumake-musl; 59 + gnutar = gnutar-musl; 60 60 }; 61 61 62 62 gawk-mes = callPackage ./gawk/mes.nix { ··· 67 67 68 68 gawk = callPackage ./gawk { 69 69 bash = bash_2_05; 70 - gcc = gcc2; 71 - glibc = glibc22; 70 + tinycc = tinycc-musl; 71 + gnumake = gnumake-musl; 72 + gnutar = gnutar-musl; 72 73 bootGawk = gawk-mes; 73 74 }; 74 75 75 76 gcc2 = callPackage ./gcc/2.nix { 76 77 bash = bash_2_05; 77 78 gcc = gcc2-mes; 78 - binutils = binutils-mes; 79 79 glibc = glibc22; 80 80 }; 81 81 gcc2-mes = callPackage ./gcc/2.nix { 82 82 bash = bash_2_05; 83 83 tinycc = tinycc-mes; 84 - binutils = binutils-mes; 85 84 mesBootstrap = true; 86 85 }; 87 86 88 87 gcc46 = callPackage ./gcc/4.6.nix { 89 - gcc = gcc2; 90 - glibc = glibc22; 88 + tinycc = tinycc-musl; 89 + gnumake = gnumake-musl; 90 + gnutar = gnutar-musl; 91 + # FIXME: not sure why new gawk doesn't work 91 92 gawk = gawk-mes; 92 93 }; 93 94 94 95 inherit (callPackage ./glibc { 95 96 bash = bash_2_05; 96 97 gnused = gnused-mes; 97 - gawk = gawk-mes; 98 98 }) glibc22; 99 99 100 100 gnugrep = callPackage ./gnugrep { ··· 104 104 105 105 gnumake = callPackage ./gnumake { tinycc = tinycc-mes; }; 106 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 + 107 114 gnupatch = callPackage ./gnupatch { tinycc = tinycc-mes; }; 108 115 109 116 gnused = callPackage ./gnused { 110 117 bash = bash_2_05; 111 - gcc = gcc2; 112 - glibc = glibc22; 118 + tinycc = tinycc-musl; 113 119 gnused = gnused-mes; 114 120 }; 115 - gnused-mes = callPackage ./gnused { 121 + gnused-mes = callPackage ./gnused/mes.nix { 116 122 bash = bash_2_05; 117 123 tinycc = tinycc-mes; 118 - mesBootstrap = true; 119 124 }; 120 125 121 - gnutar = callPackage ./gnutar { 126 + gnutar = callPackage ./gnutar/mes.nix { 122 127 bash = bash_2_05; 123 128 tinycc = tinycc-mes; 124 129 gnused = gnused-mes; 125 130 }; 126 131 132 + gnutar-musl = callPackage ./gnutar/musl.nix { 133 + bash = bash_2_05; 134 + tinycc = tinycc-musl; 135 + gnused = gnused-mes; 136 + }; 137 + 127 138 gzip = callPackage ./gzip { 128 139 bash = bash_2_05; 129 140 tinycc = tinycc-mes; ··· 152 163 153 164 musl = callPackage ./musl { 154 165 gcc = gcc46; 166 + gnumake = gnumake-musl; 155 167 }; 156 168 157 169 stage0-posix = callPackage ./stage0-posix { }; ··· 167 179 168 180 xz = callPackage ./xz { 169 181 bash = bash_2_05; 170 - tinycc = tinycc-mes; 171 - gawk = gawk-mes; 172 - inherit (heirloom) sed; 182 + tinycc = tinycc-musl; 183 + gnumake = gnumake-musl; 184 + gnutar = gnutar-musl; 173 185 }; 174 186 175 187 inherit (callPackage ./utils.nix { }) derivationWithMeta writeTextFile writeText; ··· 178 190 echo ${bash.tests.get-version} 179 191 echo ${bash_2_05.tests.get-version} 180 192 echo ${binutils.tests.get-version} 181 - echo ${binutils-mes.tests.get-version} 182 193 echo ${bzip2.tests.get-version} 194 + echo ${coreutils-musl.tests.get-version} 183 195 echo ${diffutils.tests.get-version} 184 196 echo ${findutils.tests.get-version} 185 197 echo ${gawk-mes.tests.get-version} ··· 191 203 echo ${gnused.tests.get-version} 192 204 echo ${gnused-mes.tests.get-version} 193 205 echo ${gnutar.tests.get-version} 206 + echo ${gnutar-musl.tests.get-version} 194 207 echo ${gzip.tests.get-version} 195 208 echo ${heirloom.tests.get-version} 196 209 echo ${mes.compiler.tests.get-version}
+16 -17
pkgs/os-specific/linux/minimal-bootstrap/diffutils/default.nix
··· 3 3 , hostPlatform 4 4 , fetchurl 5 5 , bash 6 - , gcc 7 - , glibc 8 - , binutils 9 - , linux-headers 6 + , tinycc 10 7 , gnumake 11 8 , gnugrep 12 9 , gnused 13 10 , gawk 14 11 , gnutar 15 - , gzip 12 + , xz 16 13 }: 17 14 let 18 15 pname = "diffutils"; 19 - version = "2.8.1"; 16 + # last version that can be built by tinycc-musl 0.9.27 17 + version = "3.8"; 20 18 21 19 src = fetchurl { 22 - url = "mirror://gnu/diffutils/diffutils-${version}.tar.gz"; 23 - sha256 = "0nizs9r76aiymzasmj1jngl7s71jfzl9xfziigcls8k9n141f065"; 20 + url = "mirror://gnu/diffutils/diffutils-${version}.tar.xz"; 21 + hash = "sha256-pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w="; 24 22 }; 25 23 in 26 24 bash.runCommand "${pname}-${version}" { 27 25 inherit pname version; 28 26 29 27 nativeBuildInputs = [ 30 - gcc 31 - binutils 28 + tinycc.compiler 32 29 gnumake 33 30 gnused 34 31 gnugrep 35 32 gawk 36 33 gnutar 37 - gzip 34 + xz 38 35 ]; 39 36 40 37 passthru.tests.get-version = result: ··· 52 49 }; 53 50 } '' 54 51 # Unpack 55 - tar xzf ${src} 52 + cp ${src} diffutils.tar.xz 53 + unxz diffutils.tar.xz 54 + tar xf diffutils.tar 55 + rm diffutils.tar 56 56 cd diffutils-${version} 57 57 58 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" 59 + export CC="tcc -B ${tinycc.libs}/lib" 60 + export LD=tcc 62 61 bash ./configure \ 63 62 --prefix=$out \ 64 63 --build=${buildPlatform.config} \ 65 64 --host=${hostPlatform.config} 66 65 67 66 # Build 68 - make 67 + make -j $NIX_BUILD_CORES AR="tcc -ar" 69 68 70 69 # Install 71 - make install 70 + make -j $NIX_BUILD_CORES install 72 71 ''
+20 -17
pkgs/os-specific/linux/minimal-bootstrap/findutils/default.nix
··· 3 3 , hostPlatform 4 4 , fetchurl 5 5 , bash 6 - , gcc 7 - , glibc 8 - , binutils 9 - , linux-headers 6 + , tinycc 10 7 , gnumake 11 8 , gnugrep 12 9 , gnused 13 10 , gawk 14 11 , gnutar 15 - , gzip 12 + , xz 16 13 }: 17 14 let 18 15 pname = "findutils"; 19 - version = "4.4.2"; 16 + version = "4.9.0"; 20 17 21 18 src = fetchurl { 22 - url = "mirror://gnu/findutils/findutils-${version}.tar.gz"; 23 - sha256 = "0amn0bbwqvsvvsh6drfwz20ydc2czk374lzw5kksbh6bf78k4ks3"; 19 + url = "mirror://gnu/findutils/findutils-${version}.tar.xz"; 20 + hash = "sha256-or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4="; 24 21 }; 25 22 in 26 23 bash.runCommand "${pname}-${version}" { 27 24 inherit pname version; 28 25 29 26 nativeBuildInputs = [ 30 - gcc 31 - binutils 27 + tinycc.compiler 32 28 gnumake 33 29 gnused 34 30 gnugrep 35 31 gawk 36 32 gnutar 37 - gzip 33 + xz 38 34 ]; 39 35 40 36 passthru.tests.get-version = result: ··· 52 48 }; 53 49 } '' 54 50 # Unpack 55 - tar xzf ${src} 51 + cp ${src} findutils.tar.xz 52 + unxz findutils.tar.xz 53 + tar xf findutils.tar 54 + rm findutils.tar 56 55 cd findutils-${version} 57 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 + 58 61 # 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 + export CC="tcc -B ${tinycc.libs}/lib" 63 + export AR="tcc -ar" 64 + export LD=tcc 62 65 bash ./configure \ 63 66 --prefix=$out \ 64 67 --build=${buildPlatform.config} \ 65 68 --host=${hostPlatform.config} 66 69 67 70 # Build 68 - make 71 + make -j $NIX_BUILD_CORES 69 72 70 73 # Install 71 - make install 74 + make -j $NIX_BUILD_CORES install 72 75 ''
+9 -16
pkgs/os-specific/linux/minimal-bootstrap/gawk/default.nix
··· 3 3 , hostPlatform 4 4 , fetchurl 5 5 , bash 6 - , gcc 7 - , glibc 8 - , binutils 9 - , linux-headers 6 + , tinycc 10 7 , gnumake 11 8 , gnugrep 12 9 , gnused ··· 17 14 let 18 15 inherit (import ./common.nix { inherit lib; }) meta; 19 16 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"; 17 + version = "5.2.2"; 23 18 24 19 src = fetchurl { 25 20 url = "mirror://gnu/gawk/gawk-${version}.tar.gz"; 26 - sha256 = "0dadjkpyyizmyd0l098qps8lb39r0vrz3xl3hwz2cmjs5c70h0wc"; 21 + hash = "sha256-lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA="; 27 22 }; 28 23 in 29 24 bash.runCommand "${pname}-${version}" { 30 25 inherit pname version meta; 31 26 32 27 nativeBuildInputs = [ 33 - gcc 34 - binutils 28 + tinycc.compiler 35 29 gnumake 36 30 gnused 37 31 gnugrep ··· 51 45 cd gawk-${version} 52 46 53 47 # 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" 48 + export CC="tcc -B ${tinycc.libs}/lib" 49 + export AR="tcc -ar" 50 + export LD=tcc 57 51 bash ./configure \ 58 52 --prefix=$out \ 59 53 --build=${buildPlatform.config} \ 60 54 --host=${hostPlatform.config} 61 55 62 56 # Build 63 - make gawk 57 + make -j $NIX_BUILD_CORES 64 58 65 59 # Install 66 - install -D gawk $out/bin/gawk 67 - ln -s gawk $out/bin/awk 60 + make -j $NIX_BUILD_CORES install 68 61 ''
+17 -33
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
··· 3 3 , hostPlatform 4 4 , fetchurl 5 5 , bash 6 - , gcc 7 - , glibc 8 - , linux-headers 6 + , tinycc 9 7 , binutils 10 8 , gnumake 11 9 , gnupatch ··· 32 30 }; 33 31 34 32 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 33 + # Remove hardcoded NATIVE_SYSTEM_HEADER_DIR 34 + ./no-system-headers.patch 48 35 ]; 49 36 50 - # To reduce the set of pre-built bootstrap inputs, build 51 - # GMP & co. from GCC. 52 37 gmpVersion = "4.3.2"; 53 38 gmp = fetchurl { 54 39 url = "mirror://gnu/gmp/gmp-${gmpVersion}.tar.gz"; ··· 71 56 inherit pname version; 72 57 73 58 nativeBuildInputs = [ 74 - gcc 59 + tinycc.compiler 75 60 binutils 76 61 gnumake 77 62 gnupatch ··· 84 69 gzip 85 70 ]; 86 71 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 72 passthru.tests.get-version = result: 92 73 bash.runCommand "${pname}-get-version-${version}" {} '' 93 74 ${result}/bin/gcc --version ··· 118 99 ${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches} 119 100 120 101 # Configure 121 - export C_INCLUDE_PATH="${gcc}/lib/gcc-lib/${hostPlatform.config}/${gcc.version}/include:${linux-headers}/include:${glibc}/include:$(pwd)/mpfr/src" 102 + export CC="tcc -B ${tinycc.libs}/lib" 103 + export C_INCLUDE_PATH="${tinycc.libs}/include:$(pwd)/mpfr/src" 122 104 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" 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 + 127 111 bash ./configure \ 128 112 --prefix=$out \ 129 113 --build=${buildPlatform.config} \ 130 114 --host=${hostPlatform.config} \ 131 - --with-native-system-header-dir=${glibc}/include \ 132 - --with-build-sysroot=${glibc}/include \ 115 + --with-native-system-header-dir=${tinycc.libs}/include \ 116 + --with-build-sysroot=${tinycc.libs}/include \ 133 117 --disable-bootstrap \ 134 118 --disable-decimal-float \ 135 119 --disable-libatomic \ ··· 146 130 --disable-multilib \ 147 131 --disable-plugin \ 148 132 --disable-threads \ 149 - --enable-languages=c,c++ \ 133 + --enable-languages=c \ 150 134 --enable-static \ 151 135 --disable-shared \ 152 136 --enable-threads=single \ ··· 154 138 --disable-build-with-cxx 155 139 156 140 # Build 157 - make 141 + make -j $NIX_BUILD_CORES 158 142 159 143 # Install 160 - make install 144 + make -j $NIX_BUILD_CORES install 161 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 12 , gzip 13 13 , gawk 14 14 , heirloom 15 - , binutils-mes 15 + , binutils 16 16 , linux-headers 17 17 }: 18 18 let 19 19 pname = "glibc"; 20 20 21 - buildGlibc = { version, src, patches, configureFlags, gcc, binutils, CC, CPP }: 21 + buildGlibc = { version, src, patches, configureFlags, gcc, CC, CPP }: 22 22 bash.runCommand "${pname}-${version}" { 23 23 inherit pname version; 24 24 ··· 114 114 ]; 115 115 116 116 gcc = gcc2-mes; 117 - binutils = binutils-mes; 118 117 CC = "gcc -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1 -L $(pwd)"; 119 118 CPP = "gcc -E -D MES_BOOTSTRAP=1 -D BOOTSTRAP_GLIBC=1"; 120 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 4 , fetchurl 5 5 , bash 6 6 , gnumake 7 - , mesBootstrap ? false, tinycc ? null 8 - , gcc ? null, glibc ? null, binutils ? null, gnused ? null, linux-headers, gnugrep 7 + , tinycc 8 + , gnused 9 + , gnugrep 10 + , gnutar 11 + , gzip 9 12 }: 10 - assert mesBootstrap -> tinycc != null; 11 - assert !mesBootstrap -> gcc != null && glibc != null && binutils != null && gnused != null; 13 + 12 14 let 13 - pname = "gnused" + lib.optionalString mesBootstrap "-mes"; 14 - # last version that can be compiled with mes-libc 15 - version = "4.0.9"; 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"; 16 19 17 20 src = fetchurl { 18 21 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"; 22 + hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM="; 27 23 }; 28 24 in 29 25 bash.runCommand "${pname}-${version}" { 30 - inherit pname version; 26 + inherit pname version meta; 31 27 32 28 nativeBuildInputs = [ 33 29 gnumake 34 - ] ++ lib.optionals mesBootstrap [ 35 30 tinycc.compiler 36 - ] ++ lib.optionals (!mesBootstrap) [ 37 - gcc 38 - glibc 39 - binutils 40 31 gnused 41 32 gnugrep 33 + gnutar 34 + gzip 42 35 ]; 43 36 44 37 passthru.tests.get-version = result: ··· 46 39 ${result}/bin/sed --version 47 40 mkdir ''${out} 48 41 ''; 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 42 } ('' 59 43 # Unpack 60 - ungz --file ${src} --output sed.tar 61 - untar --file sed.tar 62 - rm sed.tar 44 + tar xzf ${src} 63 45 cd sed-${version} 64 46 65 - '' + lib.optionalString mesBootstrap '' 66 47 # 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 48 + export CC="tcc -B ${tinycc.libs}/lib" 49 + export LD=tcc 81 50 ./configure \ 82 51 --build=${buildPlatform.config} \ 83 52 --host=${hostPlatform.config} \ 84 53 --disable-shared \ 85 54 --disable-nls \ 86 55 --disable-dependency-tracking \ 87 - --without-included-regex \ 88 56 --prefix=$out 89 57 90 58 # Build 91 - make 59 + make AR="tcc -ar" 92 60 93 - '' + '' 94 61 # Install 95 - make install PREFIX=$out 62 + make install 96 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 58 # url = "${liveBootstrap}/patches/stdio_flush_on_exit.patch"; 59 59 # hash = "sha256-/z5ze3h3QTysay8nRvyvwPv3pmTcKptdkBIaMCoeLDg="; 60 60 # }) 61 + # HACK: always flush stdio immediately 62 + ./always-flush.patch 61 63 (fetchurl { 62 64 url = "${liveBootstrap}/patches/va_list.patch"; 63 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 70 --host=${hostPlatform.config} 71 71 72 72 # Build 73 - make 73 + make -j $NIX_BUILD_CORES 74 74 75 75 # Install 76 - make install 76 + make -j $NIX_BUILD_CORES install 77 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 1 { lib 8 2 , fetchurl 9 3 , callPackage ··· 12 6 , musl 13 7 , gnupatch 14 8 , gnutar 15 - , bzip2 9 + , gzip 16 10 }: 17 11 let 18 12 pname = "tinycc-musl"; 19 - version = "0.9.27"; 13 + # next commit introduces use of realpath (unsupported in mes-libc) 14 + version = "unstable-2023-07-10"; 15 + rev = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d"; 20 16 21 17 src = fetchurl { 22 - url = "https://download.savannah.gnu.org/releases/tinycc/tcc-${version}.tar.bz2"; 23 - hash = "sha256-3iOvePypDOMt/y3UWzQysjNHQLubt7Bb9g/b/Dls65w="; 18 + url = "https://repo.or.cz/tinycc.git/snapshot/${rev}.tar.gz"; 19 + hash = "sha256-R81SNbEmh4s9FNQxCWZwUiMCYRkkwOHAdRf0aMnnRiA="; 24 20 }; 25 21 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 22 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 - }) 23 + ./ignore-duplicate-symbols.patch 24 + ./ignore-static-inside-array.patch 25 + ./static-link.patch 42 26 ]; 43 27 44 28 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 - }; 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 + }; 51 35 52 36 tinycc-musl = bash.runCommand "${pname}-${version}" { 53 37 inherit pname version meta; ··· 56 40 tinycc-bootstrappable.compiler 57 41 gnupatch 58 42 gnutar 59 - bzip2 43 + gzip 60 44 ]; 61 45 } '' 62 46 # 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} 47 + tar xzf ${src} 48 + cd tinycc-${builtins.substring 0 7 rev} 68 49 69 50 # Patch 70 51 ${lib.concatMapStringsSep "\n" (f: "patch -Np0 -i ${f}") patches} ··· 77 58 # but when linked with musl it is. 78 59 ln -s ${musl}/lib/libtcc1.a ./libtcc1.a 79 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 + 80 68 tcc -v \ 81 69 -static \ 82 70 -o tcc-musl \ ··· 92 80 -D CONFIG_USE_LIBGCC=1 \ 93 81 -D TCC_VERSION=\"0.9.27\" \ 94 82 -D ONE_SOURCE=1 \ 83 + -D TCC_MUSL=1 \ 84 + -D CONFIG_TCC_PREDEFS=1 \ 85 + -D CONFIG_TCC_SEMLOCK=0 \ 95 86 -B . \ 96 87 -B ${tinycc-bootstrappable.libs}/lib \ 97 88 tcc.c ··· 117 108 -D CONFIG_USE_LIBGCC=1 \ 118 109 -D TCC_VERSION=\"0.9.27\" \ 119 110 -D ONE_SOURCE=1 \ 111 + -D TCC_MUSL=1 \ 112 + -D CONFIG_TCC_PREDEFS=1 \ 113 + -D CONFIG_TCC_SEMLOCK=0 \ 120 114 -B . \ 121 115 -B ${musl}/lib \ 122 116 tcc.c 123 117 # libtcc1.a 124 118 rm -f libtcc1.a 125 119 ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/libtcc1.c 126 - ./tcc-musl -ar cr libtcc1.a libtcc1.o 120 + ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/alloca.S 121 + ./tcc-musl -ar cr libtcc1.a libtcc1.o alloca.o 127 122 128 123 # Install 129 124 install -D tcc-musl $out/bin/tcc ··· 151 146 152 147 libs = bash.runCommand "${pname}-${version}-libs" { 153 148 inherit pname version meta; 154 - } "install -D ${tinycc-musl}/lib/libtcc1.a $out/lib/libtcc1.a"; 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 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 5 , bash 6 6 , tinycc 7 7 , gnumake 8 + , gnused 8 9 , gnugrep 9 10 , gawk 10 - , sed 11 + , gnutar 12 + , gzip 11 13 }: 12 14 let 13 15 pname = "xz"; 14 - # >=5.2 uses poll.h, unsupported by meslibc 15 - version = "5.0.8"; 16 + version = "5.4.3"; 16 17 17 18 src = fetchurl { 18 - url = "https://tukaani.org/xz/xz-${version}.tar.bz2"; 19 - sha256 = "1nkb68dyrf16xwyqichcy1vhgbfg20dxz459rcsdx85h1gczk1i2"; 19 + url = "https://tukaani.org/xz/xz-${version}.tar.gz"; 20 + hash = "sha256-HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k="; 20 21 }; 21 22 in 22 23 bash.runCommand "${pname}-${version}" { ··· 25 26 nativeBuildInputs = [ 26 27 tinycc.compiler 27 28 gnumake 29 + gnused 28 30 gnugrep 29 31 gawk 30 - sed 32 + gnutar 33 + gzip 31 34 ]; 32 35 33 36 passthru.tests.get-version = result: ··· 45 48 }; 46 49 } '' 47 50 # Unpack 48 - unbz2 --file ${src} --output xz.tar 49 - untar --file xz.tar 50 - rm xz.tar 51 + tar xzf ${src} 51 52 cd xz-${version} 52 53 53 54 # Configure 54 - export CC="tcc -B ${tinycc.libs}/lib -include${./stubs.h}" 55 - export CPP="tcc -E" 56 - export LD=tcc 55 + export CC="tcc -B ${tinycc.libs}/lib" 57 56 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 57 + export LD=tcc 64 58 bash ./configure \ 65 59 --prefix=$out \ 66 60 --build=${buildPlatform.config} \ 67 61 --host=${hostPlatform.config} \ 68 62 --disable-shared \ 69 - --disable-nls \ 70 - --disable-threads \ 71 63 --disable-assembler 72 64 73 65 # Build 74 - make all 66 + make -j $NIX_BUILD_CORES 75 67 76 68 # Install 77 - make install 69 + make -j $NIX_BUILD_CORES install 78 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 - }