tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
minimal-bootstrap.gnused: replace glibc with musl
Emily Trau
2 years ago
477a6035
198f108a
+94
-56
4 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
minimal-bootstrap
default.nix
gnused
common.nix
default.nix
mes.nix
+3
-4
pkgs/os-specific/linux/minimal-bootstrap/default.nix
···
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 {
···
108
109
gnused = callPackage ./gnused {
110
bash = bash_2_05;
111
+
tinycc = tinycc-musl;
112
+
musl = musl11;
113
gnused = gnused-mes;
114
};
115
+
gnused-mes = callPackage ./gnused/mes.nix {
116
bash = bash_2_05;
117
tinycc = tinycc-mes;
0
118
};
119
120
gnutar = callPackage ./gnutar {
+12
pkgs/os-specific/linux/minimal-bootstrap/gnused/common.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
···
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
, fetchurl
5
, bash
6
, gnumake
7
-
, mesBootstrap ? false, tinycc ? null
8
-
, gcc ? null, glibc ? null, binutils ? null, gnused ? null, linux-headers, gnugrep
0
0
0
0
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";
0
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
0
0
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
+
, musl
9
+
, gnused
10
+
, gnugrep
11
+
, gnutar
12
+
, gzip
13
}:
14
+
0
15
let
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";
20
21
src = fetchurl {
22
url = "mirror://gnu/sed/sed-${version}.tar.gz";
23
+
hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM=";
0
0
0
0
0
0
0
24
};
25
in
26
bash.runCommand "${pname}-${version}" {
27
+
inherit pname version meta;
28
29
nativeBuildInputs = [
30
gnumake
0
31
tinycc.compiler
0
0
0
0
32
gnused
33
gnugrep
34
+
gnutar
35
+
gzip
36
];
37
38
passthru.tests.get-version = result:
···
40
${result}/bin/sed --version
41
mkdir ''${out}
42
'';
0
0
0
0
0
0
0
0
0
43
} (''
44
# Unpack
45
+
tar xzf ${src}
0
0
46
cd sed-${version}
47
0
48
# Configure
49
+
export CC="tcc -B ${musl}/lib"
50
+
export LD=tcc
0
0
0
0
0
0
0
0
0
0
0
0
51
./configure \
52
--build=${buildPlatform.config} \
53
--host=${hostPlatform.config} \
54
--disable-shared \
55
--disable-nls \
56
--disable-dependency-tracking \
0
57
--prefix=$out
58
59
# Build
60
+
make AR="tcc -ar"
61
0
62
# Install
63
+
make install
64
'')
+59
pkgs/os-specific/linux/minimal-bootstrap/gnused/mes.nix
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
···
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
+
'')