1{
2 lib,
3 fetchurl,
4 bash,
5 tinycc,
6 gnumake,
7 gnutar,
8 gzip,
9}:
10let
11 pname = "bzip2";
12 version = "1.0.8";
13
14 src = fetchurl {
15 url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
16 sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
17 };
18in
19bash.runCommand "${pname}-${version}"
20 {
21 inherit pname version;
22
23 nativeBuildInputs = [
24 tinycc.compiler
25 gnumake
26 gnutar
27 gzip
28 ];
29
30 passthru.tests.get-version =
31 result:
32 bash.runCommand "${pname}-get-version-${version}" { } ''
33 ${result}/bin/bzip2 --help
34 mkdir $out
35 '';
36
37 meta = with lib; {
38 description = "High-quality data compression program";
39 homepage = "https://www.sourceware.org/bzip2";
40 license = licenses.bsdOriginal;
41 teams = [ teams.minimal-bootstrap ];
42 platforms = platforms.unix;
43 };
44 }
45 ''
46 # Unpack
47 tar xzf ${src}
48 cd bzip2-${version}
49
50 # Build
51 make \
52 -j $NIX_BUILD_CORES \
53 CC="tcc -B ${tinycc.libs}/lib" \
54 AR="tcc -ar" \
55 bzip2 bzip2recover
56
57 # Install
58 make install -j $NIX_BUILD_CORES PREFIX=$out
59 ''