1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
{
lib,
buildPlatform,
hostPlatform,
fetchurl,
bash,
gcc,
musl,
binutils,
gnumake,
gnused,
gnugrep,
gawk,
diffutils,
findutils,
gnutar,
gzip,
}:
let
inherit (import ./common.nix { inherit lib; }) meta;
pname = "bash-static";
version = "5.3";
src = fetchurl {
url = "mirror://gnu/bash/bash-${version}.tar.gz";
sha256 = "sha256-DVzYaWX4aaJs9k9Lcb57lvkKO6iz104n6OnZ1VUPMbo=";
};
in
bash.runCommand "${pname}-${version}"
{
inherit pname version meta;
nativeBuildInputs = [
gcc
musl
binutils
gnumake
gnused
gnugrep
gawk
diffutils
findutils
gnutar
gzip
];
passthru.tests.get-version =
result:
bash.runCommand "${pname}-get-version-${version}" { } ''
${result}/bin/bash --version
mkdir $out
'';
}
''
# Unpack
tar xf ${src}
cd bash-${version}
# Configure
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--without-bash-malloc \
--disable-dependency-tracking \
--enable-static-link \
CC=musl-gcc
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install-strip
rm $out/bin/bashbug
ln -s $out/bin/bash $out/bin/sh
''
|