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
108
109
109
gnused = callPackage ./gnused {
110
110
bash = bash_2_05;
111
111
-
gcc = gcc2;
112
112
-
glibc = glibc22;
111
111
+
tinycc = tinycc-musl;
112
112
+
musl = musl11;
113
113
gnused = gnused-mes;
114
114
};
115
115
-
gnused-mes = callPackage ./gnused {
115
115
+
gnused-mes = callPackage ./gnused/mes.nix {
116
116
bash = bash_2_05;
117
117
tinycc = tinycc-mes;
118
118
-
mesBootstrap = true;
119
118
};
120
119
121
120
gnutar = callPackage ./gnutar {
+12
pkgs/os-specific/linux/minimal-bootstrap/gnused/common.nix
···
1
1
+
{ lib }:
2
2
+
3
3
+
{
4
4
+
meta = with lib; {
5
5
+
description = "GNU sed, a batch stream editor";
6
6
+
homepage = "https://www.gnu.org/software/sed";
7
7
+
license = licenses.gpl3Plus;
8
8
+
maintainers = teams.minimal-bootstrap.members;
9
9
+
mainProgram = "sed";
10
10
+
platforms = platforms.unix;
11
11
+
};
12
12
+
}
+20
-52
pkgs/os-specific/linux/minimal-bootstrap/gnused/default.nix
···
4
4
, fetchurl
5
5
, bash
6
6
, gnumake
7
7
-
, mesBootstrap ? false, tinycc ? null
8
8
-
, gcc ? null, glibc ? null, binutils ? null, gnused ? null, linux-headers, gnugrep
7
7
+
, tinycc
8
8
+
, musl
9
9
+
, gnused
10
10
+
, gnugrep
11
11
+
, gnutar
12
12
+
, gzip
9
13
}:
10
10
-
assert mesBootstrap -> tinycc != null;
11
11
-
assert !mesBootstrap -> gcc != null && glibc != null && binutils != null && gnused != null;
14
14
+
12
15
let
13
13
-
pname = "gnused" + lib.optionalString mesBootstrap "-mes";
14
14
-
# last version that can be compiled with mes-libc
15
15
-
version = "4.0.9";
16
16
+
inherit (import ./common.nix { inherit lib; }) meta;
17
17
+
pname = "gnused";
18
18
+
# last version that can be bootstrapped with our slightly buggy gnused-mes
19
19
+
version = "4.2";
16
20
17
21
src = fetchurl {
18
22
url = "mirror://gnu/sed/sed-${version}.tar.gz";
19
19
-
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
20
20
-
};
21
21
-
22
22
-
# Thanks to the live-bootstrap project!
23
23
-
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
24
24
-
makefile = fetchurl {
25
25
-
url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk";
26
26
-
sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya";
23
23
+
hash = "sha256-20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM=";
27
24
};
28
25
in
29
26
bash.runCommand "${pname}-${version}" {
30
30
-
inherit pname version;
27
27
+
inherit pname version meta;
31
28
32
29
nativeBuildInputs = [
33
30
gnumake
34
34
-
] ++ lib.optionals mesBootstrap [
35
31
tinycc.compiler
36
36
-
] ++ lib.optionals (!mesBootstrap) [
37
37
-
gcc
38
38
-
glibc
39
39
-
binutils
40
32
gnused
41
33
gnugrep
34
34
+
gnutar
35
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
49
-
50
50
-
meta = with lib; {
51
51
-
description = "GNU sed, a batch stream editor";
52
52
-
homepage = "https://www.gnu.org/software/sed";
53
53
-
license = licenses.gpl3Plus;
54
54
-
maintainers = teams.minimal-bootstrap.members;
55
55
-
mainProgram = "sed";
56
56
-
platforms = platforms.unix;
57
57
-
};
58
43
} (''
59
44
# Unpack
60
60
-
ungz --file ${src} --output sed.tar
61
61
-
untar --file sed.tar
62
62
-
rm sed.tar
45
45
+
tar xzf ${src}
63
46
cd sed-${version}
64
47
65
65
-
'' + lib.optionalString mesBootstrap ''
66
48
# Configure
67
67
-
cp ${makefile} Makefile
68
68
-
catm config.h
69
69
-
70
70
-
# Build
71
71
-
make \
72
72
-
CC="tcc -B ${tinycc.libs}/lib" \
73
73
-
LIBC=mes
74
74
-
75
75
-
'' + lib.optionalString (!mesBootstrap) ''
76
76
-
# Configure
77
77
-
export CC="gcc -I${glibc}/include -I${linux-headers}/include"
78
78
-
export LIBRARY_PATH="${glibc}/lib"
79
79
-
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
80
80
-
chmod +x configure
49
49
+
export CC="tcc -B ${musl}/lib"
50
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
87
-
--without-included-regex \
88
57
--prefix=$out
89
58
90
59
# Build
91
91
-
make
60
60
+
make AR="tcc -ar"
92
61
93
93
-
'' + ''
94
62
# Install
95
95
-
make install PREFIX=$out
63
63
+
make install
96
64
'')
+59
pkgs/os-specific/linux/minimal-bootstrap/gnused/mes.nix
···
1
1
+
{ lib
2
2
+
, buildPlatform
3
3
+
, hostPlatform
4
4
+
, fetchurl
5
5
+
, bash
6
6
+
, gnumake
7
7
+
, tinycc
8
8
+
}:
9
9
+
10
10
+
let
11
11
+
inherit (import ./common.nix { inherit lib; }) meta;
12
12
+
pname = "gnused-mes";
13
13
+
# last version that can be compiled with mes-libc
14
14
+
version = "4.0.9";
15
15
+
16
16
+
src = fetchurl {
17
17
+
url = "mirror://gnu/sed/sed-${version}.tar.gz";
18
18
+
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
19
19
+
};
20
20
+
21
21
+
# Thanks to the live-bootstrap project!
22
22
+
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
23
23
+
makefile = fetchurl {
24
24
+
url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk";
25
25
+
sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya";
26
26
+
};
27
27
+
in
28
28
+
bash.runCommand "${pname}-${version}" {
29
29
+
inherit pname version meta;
30
30
+
31
31
+
nativeBuildInputs = [
32
32
+
gnumake
33
33
+
tinycc.compiler
34
34
+
];
35
35
+
36
36
+
passthru.tests.get-version = result:
37
37
+
bash.runCommand "${pname}-get-version-${version}" {} ''
38
38
+
${result}/bin/sed --version
39
39
+
mkdir ''${out}
40
40
+
'';
41
41
+
} (''
42
42
+
# Unpack
43
43
+
ungz --file ${src} --output sed.tar
44
44
+
untar --file sed.tar
45
45
+
rm sed.tar
46
46
+
cd sed-${version}
47
47
+
48
48
+
# Configure
49
49
+
cp ${makefile} Makefile
50
50
+
catm config.h
51
51
+
52
52
+
# Build
53
53
+
make \
54
54
+
CC="tcc -B ${tinycc.libs}/lib" \
55
55
+
LIBC=mes
56
56
+
57
57
+
# Install
58
58
+
make install PREFIX=$out
59
59
+
'')