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}:
12let
13 pname = "gnutar";
14 # >= 1.13 is incompatible with mes-libc
15 version = "1.12";
16
17 src = fetchurl {
18 url = "mirror://gnu/tar/tar-${version}.tar.gz";
19 sha256 = "02m6gajm647n8l9a5bnld6fnbgdpyi4i3i83p7xcwv0kif47xhy6";
20 };
21in
22bash.runCommand "${pname}-${version}"
23 {
24 inherit pname version;
25
26 nativeBuildInputs = [
27 tinycc.compiler
28 gnumake
29 gnused
30 gnugrep
31 ];
32
33 passthru.tests.get-version =
34 result:
35 bash.runCommand "${pname}-get-version-${version}" { } ''
36 ${result}/bin/tar --version
37 mkdir $out
38 '';
39
40 meta = with lib; {
41 description = "GNU implementation of the `tar' archiver";
42 homepage = "https://www.gnu.org/software/tar";
43 license = licenses.gpl3Plus;
44 teams = [ teams.minimal-bootstrap ];
45 mainProgram = "tar";
46 platforms = platforms.unix;
47 };
48 }
49 ''
50 # Unpack
51 ungz --file ${src} --output tar.tar
52 untar --file tar.tar
53 rm tar.tar
54 cd tar-${version}
55
56 # Configure
57 export CC="tcc -B ${tinycc.libs}/lib"
58 bash ./configure \
59 --build=${buildPlatform.config} \
60 --host=${hostPlatform.config} \
61 --disable-nls \
62 --prefix=$out
63
64 # Build
65 make AR="tcc -ar"
66
67 # Install
68 make install
69 ''