nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPlatform,
4 hostPlatform,
5 fetchurl,
6 bash,
7 gnumake,
8 tinycc,
9}:
10
11let
12 inherit (import ./common.nix { inherit lib; }) meta;
13 pname = "gnused-mes";
14 # last version that can be compiled with mes-libc
15 version = "4.0.9";
16
17 src = fetchurl {
18 url = "mirror://gnu/sed/sed-${version}.tar.gz";
19 sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
20 };
21
22 # Thanks to the live-bootstrap project!
23 # See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
24 makefile = fetchurl {
25 url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk";
26 sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya";
27 };
28in
29bash.runCommand "${pname}-${version}"
30 {
31 inherit pname version meta;
32
33 nativeBuildInputs = [
34 gnumake
35 tinycc.compiler
36 ];
37
38 passthru.tests.get-version =
39 result:
40 bash.runCommand "${pname}-get-version-${version}" { } ''
41 ${result}/bin/sed --version
42 mkdir ''${out}
43 '';
44 }
45 (''
46 # Unpack
47 ungz --file ${src} --output sed.tar
48 untar --file sed.tar
49 rm sed.tar
50 cd sed-${version}
51
52 # Configure
53 cp ${makefile} Makefile
54 catm config.h
55
56 # Build
57 make \
58 CC="tcc -B ${tinycc.libs}/lib" \
59 LIBC=mes
60
61 # Install
62 make install PREFIX=$out
63 '')