tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
minimal-bootstrap.bash: build with musl
Emily Trau
2 years ago
1c1962f9
25a264c6
+35
-19
4 changed files
expand all
collapse all
unified
split
pkgs
os-specific
linux
minimal-bootstrap
bash
default.nix
mksignames-flush.patch
default.nix
gcc
4.6.nix
+21
-14
pkgs/os-specific/linux/minimal-bootstrap/bash/default.nix
···
4
4
, fetchurl
5
5
, bootBash
6
6
, gnumake
7
7
+
, gnupatch
7
8
, gnused
8
9
, gnugrep
9
10
, gnutar
10
11
, gawk
11
12
, gzip
12
12
-
, gcc
13
13
-
, glibc
14
14
-
, binutils
15
15
-
, linux-headers
13
13
+
, diffutils
14
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
27
+
28
28
+
patches = [
29
29
+
# flush output for generated code
30
30
+
./mksignames-flush.patch
31
31
+
];
28
32
in
29
33
bootBash.runCommand "${pname}-${version}" {
30
34
inherit pname version;
31
35
32
36
nativeBuildInputs = [
33
33
-
gcc
34
34
-
binutils
37
37
+
coreutils
38
38
+
tinycc.compiler
35
39
gnumake
40
40
+
gnupatch
36
41
gnused
37
42
gnugrep
38
43
gnutar
39
44
gawk
40
45
gzip
46
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
87
+
# Patch
88
88
+
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
89
89
+
81
90
# Configure
82
82
-
export CC="gcc -I${glibc}/include -I${linux-headers}/include"
83
83
-
export LIBRARY_PATH="${glibc}/lib"
84
84
-
export LIBS="-lc -lnss_files -lnss_dns -lresolv"
85
85
-
export ac_cv_func_dlopen=no
91
91
+
export CC="tcc -B ${tinycc.libs}/lib"
92
92
+
export AR="tcc -ar"
93
93
+
export LD=tcc
86
94
bash ./configure \
87
95
--prefix=$out \
88
96
--build=${buildPlatform.config} \
89
97
--host=${hostPlatform.config} \
90
90
-
--disable-nls \
91
91
-
--disable-net-redirections
98
98
+
--without-bash-malloc
92
99
93
100
# Build
94
94
-
make SHELL=bash
101
101
+
make -j $NIX_BUILD_CORES SHELL=bash
95
102
96
103
# Install
97
97
-
make install
104
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
1
+
--- a/support/mksignames.c
2
2
+
+++ b/support/mksignames.c
3
3
+
@@ -68,6 +68,7 @@ write_signames (stream)
4
4
+
fprintf (stream, "};\n\n");
5
5
+
fprintf (stream, "#define initialize_signames()\n\n");
6
6
+
#endif
7
7
+
+ fflush(stream);
8
8
+
}
9
9
+
10
10
+
int
+4
-3
pkgs/os-specific/linux/minimal-bootstrap/default.nix
···
17
17
18
18
bash = callPackage ./bash {
19
19
bootBash = bash_2_05;
20
20
-
gcc = gcc2;
21
21
-
glibc = glibc22;
20
20
+
tinycc = tinycc-musl;
21
21
+
coreutils = coreutils-musl;
22
22
+
gnumake = gnumake-musl;
23
23
+
gnutar = gnutar-musl;
22
24
};
23
25
24
26
binutils = callPackage ./binutils {
···
73
75
};
74
76
75
77
gcc46 = callPackage ./gcc/4.6.nix {
76
76
-
coreutils = coreutils-musl;
77
78
tinycc = tinycc-musl;
78
79
gnumake = gnumake-musl;
79
80
gnutar = gnutar-musl;
-2
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
···
3
3
, hostPlatform
4
4
, fetchurl
5
5
, bash
6
6
-
, coreutils
7
6
, tinycc
8
7
, binutils
9
8
, gnumake
···
57
56
inherit pname version;
58
57
59
58
nativeBuildInputs = [
60
60
-
coreutils
61
59
tinycc.compiler
62
60
binutils
63
61
gnumake