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
, fetchurl
5
, bootBash
6
, gnumake
0
7
, gnused
8
, gnugrep
9
, gnutar
10
, gawk
11
, gzip
12
-
, gcc
13
-
, glibc
14
-
, binutils
15
-
, linux-headers
16
, derivationWithMeta
17
, bash
18
, coreutils
···
25
url = "mirror://gnu/bash/bash-${version}.tar.gz";
26
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
27
};
0
0
0
0
0
28
in
29
bootBash.runCommand "${pname}-${version}" {
30
inherit pname version;
31
32
nativeBuildInputs = [
33
-
gcc
34
-
binutils
35
gnumake
0
36
gnused
37
gnugrep
38
gnutar
39
gawk
40
gzip
0
41
];
42
43
passthru.runCommand = name: env: buildCommand:
···
78
tar xzf ${src}
79
cd bash-${version}
80
0
0
0
81
# 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
86
bash ./configure \
87
--prefix=$out \
88
--build=${buildPlatform.config} \
89
--host=${hostPlatform.config} \
90
-
--disable-nls \
91
-
--disable-net-redirections
92
93
# Build
94
-
make SHELL=bash
95
96
# Install
97
-
make install
98
ln -s bash $out/bin/sh
99
''
···
4
, fetchurl
5
, bootBash
6
, gnumake
7
+
, gnupatch
8
, gnused
9
, gnugrep
10
, gnutar
11
, gawk
12
, gzip
13
+
, diffutils
14
+
, tinycc
0
0
15
, derivationWithMeta
16
, bash
17
, coreutils
···
24
url = "mirror://gnu/bash/bash-${version}.tar.gz";
25
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
26
};
27
+
28
+
patches = [
29
+
# flush output for generated code
30
+
./mksignames-flush.patch
31
+
];
32
in
33
bootBash.runCommand "${pname}-${version}" {
34
inherit pname version;
35
36
nativeBuildInputs = [
37
+
coreutils
38
+
tinycc.compiler
39
gnumake
40
+
gnupatch
41
gnused
42
gnugrep
43
gnutar
44
gawk
45
gzip
46
+
diffutils
47
];
48
49
passthru.runCommand = name: env: buildCommand:
···
84
tar xzf ${src}
85
cd bash-${version}
86
87
+
# Patch
88
+
${lib.concatMapStringsSep "\n" (f: "patch -Np1 -i ${f}") patches}
89
+
90
# Configure
91
+
export CC="tcc -B ${tinycc.libs}/lib"
92
+
export AR="tcc -ar"
93
+
export LD=tcc
0
94
bash ./configure \
95
--prefix=$out \
96
--build=${buildPlatform.config} \
97
--host=${hostPlatform.config} \
98
+
--without-bash-malloc
0
99
100
# Build
101
+
make -j $NIX_BUILD_CORES SHELL=bash
102
103
# Install
104
+
make -j $NIX_BUILD_CORES install
105
ln -s bash $out/bin/sh
106
''
+10
pkgs/os-specific/linux/minimal-bootstrap/bash/mksignames-flush.patch
···
0
0
0
0
0
0
0
0
0
0
···
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
+4
-3
pkgs/os-specific/linux/minimal-bootstrap/default.nix
···
17
18
bash = callPackage ./bash {
19
bootBash = bash_2_05;
20
-
gcc = gcc2;
21
-
glibc = glibc22;
0
0
22
};
23
24
binutils = callPackage ./binutils {
···
73
};
74
75
gcc46 = callPackage ./gcc/4.6.nix {
76
-
coreutils = coreutils-musl;
77
tinycc = tinycc-musl;
78
gnumake = gnumake-musl;
79
gnutar = gnutar-musl;
···
17
18
bash = callPackage ./bash {
19
bootBash = bash_2_05;
20
+
tinycc = tinycc-musl;
21
+
coreutils = coreutils-musl;
22
+
gnumake = gnumake-musl;
23
+
gnutar = gnutar-musl;
24
};
25
26
binutils = callPackage ./binutils {
···
75
};
76
77
gcc46 = callPackage ./gcc/4.6.nix {
0
78
tinycc = tinycc-musl;
79
gnumake = gnumake-musl;
80
gnutar = gnutar-musl;
-2
pkgs/os-specific/linux/minimal-bootstrap/gcc/4.6.nix
···
3
, hostPlatform
4
, fetchurl
5
, bash
6
-
, coreutils
7
, tinycc
8
, binutils
9
, gnumake
···
57
inherit pname version;
58
59
nativeBuildInputs = [
60
-
coreutils
61
tinycc.compiler
62
binutils
63
gnumake
···
3
, hostPlatform
4
, fetchurl
5
, bash
0
6
, tinycc
7
, binutils
8
, gnumake
···
56
inherit pname version;
57
58
nativeBuildInputs = [
0
59
tinycc.compiler
60
binutils
61
gnumake