nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPlatform,
4 hostPlatform,
5 fetchurl,
6 bash,
7 tinycc,
8 gnumake,
9 gnused,
10 gnugrep,
11 gawk,
12 gnutar,
13 gzip,
14}:
15let
16 pname = "xz";
17 version = "5.4.3";
18
19 src = fetchurl {
20 url = "https://tukaani.org/xz/xz-${version}.tar.gz";
21 hash = "sha256-HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k=";
22 };
23in
24bash.runCommand "${pname}-${version}"
25 {
26 inherit pname version;
27
28 nativeBuildInputs = [
29 tinycc.compiler
30 gnumake
31 gnused
32 gnugrep
33 gawk
34 gnutar
35 gzip
36 ];
37
38 passthru.tests.get-version =
39 result:
40 bash.runCommand "${pname}-get-version-${version}" { } ''
41 ${result}/bin/xz --version
42 mkdir $out
43 '';
44
45 meta = with lib; {
46 description = "General-purpose data compression software, successor of LZMA";
47 homepage = "https://tukaani.org/xz";
48 license = with licenses; [
49 gpl2Plus
50 lgpl21Plus
51 ];
52 teams = [ teams.minimal-bootstrap ];
53 platforms = platforms.unix;
54 };
55 }
56 ''
57 # Unpack
58 tar xzf ${src}
59 cd xz-${version}
60
61 # Configure
62 export CC="tcc -B ${tinycc.libs}/lib"
63 export AR="tcc -ar"
64 export LD=tcc
65 bash ./configure \
66 --prefix=$out \
67 --build=${buildPlatform.config} \
68 --host=${hostPlatform.config} \
69 --disable-shared \
70 --disable-assembler
71
72 # Build
73 make -j $NIX_BUILD_CORES
74
75 # Install
76 make -j $NIX_BUILD_CORES install
77 ''