minimal-bootstrap.gnused: replace glibc with musl

+94 -56
+3 -4
pkgs/os-specific/linux/minimal-bootstrap/default.nix
··· 108 108 109 109 gnused = callPackage ./gnused { 110 110 bash = bash_2_05; 111 - gcc = gcc2; 112 - glibc = glibc22; 111 + tinycc = tinycc-musl; 112 + musl = musl11; 113 113 gnused = gnused-mes; 114 114 }; 115 - gnused-mes = callPackage ./gnused { 115 + gnused-mes = callPackage ./gnused/mes.nix { 116 116 bash = bash_2_05; 117 117 tinycc = tinycc-mes; 118 - mesBootstrap = true; 119 118 }; 120 119 121 120 gnutar = callPackage ./gnutar {
+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 + }
+20 -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 + , musl 9 + , gnused 10 + , gnugrep 11 + , gnutar 12 + , gzip 9 13 }: 10 - assert mesBootstrap -> tinycc != null; 11 - assert !mesBootstrap -> gcc != null && glibc != null && binutils != null && gnused != null; 14 + 12 15 let 13 - pname = "gnused" + lib.optionalString mesBootstrap "-mes"; 14 - # last version that can be compiled with mes-libc 15 - version = "4.0.9"; 16 + inherit (import ./common.nix { inherit lib; }) meta; 17 + pname = "gnused"; 18 + # last version that can be bootstrapped with our slightly buggy gnused-mes 19 + version = "4.2"; 16 20 17 21 src = fetchurl { 18 22 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"; 23 + hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM="; 27 24 }; 28 25 in 29 26 bash.runCommand "${pname}-${version}" { 30 - inherit pname version; 27 + inherit pname version meta; 31 28 32 29 nativeBuildInputs = [ 33 30 gnumake 34 - ] ++ lib.optionals mesBootstrap [ 35 31 tinycc.compiler 36 - ] ++ lib.optionals (!mesBootstrap) [ 37 - gcc 38 - glibc 39 - binutils 40 32 gnused 41 33 gnugrep 34 + gnutar 35 + gzip 42 36 ]; 43 37 44 38 passthru.tests.get-version = result: ··· 46 40 ${result}/bin/sed --version 47 41 mkdir ''${out} 48 42 ''; 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 43 } ('' 59 44 # Unpack 60 - ungz --file ${src} --output sed.tar 61 - untar --file sed.tar 62 - rm sed.tar 45 + tar xzf ${src} 63 46 cd sed-${version} 64 47 65 - '' + lib.optionalString mesBootstrap '' 66 48 # 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 49 + export CC="tcc -B ${musl}/lib" 50 + export LD=tcc 81 51 ./configure \ 82 52 --build=${buildPlatform.config} \ 83 53 --host=${hostPlatform.config} \ 84 54 --disable-shared \ 85 55 --disable-nls \ 86 56 --disable-dependency-tracking \ 87 - --without-included-regex \ 88 57 --prefix=$out 89 58 90 59 # Build 91 - make 60 + make AR="tcc -ar" 92 61 93 - '' + '' 94 62 # Install 95 - make install PREFIX=$out 63 + make install 96 64 '')
+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 + '')