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 gnugrep,
10 gnused,
11 gnutar,
12 gzip,
13 bootGawk,
14}:
15let
16 inherit (import ./common.nix { inherit lib; }) meta;
17 pname = "gawk";
18 version = "5.2.2";
19
20 src = fetchurl {
21 url = "mirror://gnu/gawk/gawk-${version}.tar.gz";
22 hash = "sha256-lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
23 };
24in
25bash.runCommand "${pname}-${version}"
26 {
27 inherit pname version meta;
28
29 nativeBuildInputs = [
30 tinycc.compiler
31 gnumake
32 gnused
33 gnugrep
34 gnutar
35 gzip
36 bootGawk
37 ];
38
39 passthru.tests.get-version =
40 result:
41 bash.runCommand "${pname}-get-version-${version}" { } ''
42 ${result}/bin/awk --version
43 mkdir $out
44 '';
45 }
46 ''
47 # Unpack
48 tar xzf ${src}
49 cd gawk-${version}
50
51 # Configure
52 export CC="tcc -B ${tinycc.libs}/lib"
53 export AR="tcc -ar"
54 export LD=tcc
55 bash ./configure \
56 --prefix=$out \
57 --build=${buildPlatform.config} \
58 --host=${hostPlatform.config}
59
60 # Build
61 make -j $NIX_BUILD_CORES
62
63 # Install
64 make -j $NIX_BUILD_CORES install
65 ''