Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ stdenv, fetchFromRepoOrCz, fetchurl, nasm, perl, python3, libuuid, mtools, makeWrapper }:
2
3stdenv.mkDerivation {
4 name = "syslinux-2019-02-07";
5
6 # This is syslinux-6.04-pre3^1; syslinux-6.04-pre3 fails to run.
7 # Same issue here https://www.syslinux.org/archives/2019-February/026330.html
8 src = fetchFromRepoOrCz {
9 repo = "syslinux";
10 rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7";
11 sha256 = "1qrxl1114sr2i2791z9rf8v53g200aq30f08808d7i8qnmgvxl2w";
12 };
13
14 patches = let
15 mkURL = commit: patchName:
16 "https://salsa.debian.org/images-team/syslinux/raw/${commit}/debian/patches/"
17 + patchName;
18 in [
19 (fetchurl {
20 url = mkURL "fa1349f1" "0002-gfxboot-menu-label.patch";
21 sha256 = "06ifgzbpjj4picpj17zgprsfi501zf4pp85qjjgn29i5rs291zni";
22 })
23 (fetchurl {
24 url = mkURL "477e56d2" "0005-gnu-efi-version-compatibility.patch";
25 sha256 = "041568b4abb79wynyps1n04lg4fr26rc3sbjncz99pp0mbz0ajlm";
26 })
27 (fetchurl {
28 # mbr.bin: too big (452 > 440)
29 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
30 url = mkURL "7468ef0e38c43" "0016-strip-gnu-property.patch";
31 sha256 = "17n63b8wz6szv8npla1234g1ip7lqgzx2whrpv358ppf67lq8vwm";
32 })
33 (fetchurl {
34 # mbr.bin: too big (452 > 440)
35 url = mkURL "012e1dd312eb" "0017-single-load-segment.patch";
36 sha256 = "0azqzicsjw47b9ppyikhzaqmjl4lrvkxris1356bkmgcaiv6d98b";
37 })
38 (fetchurl {
39 url = mkURL "26f0e7b2" "0018-prevent-pow-optimization.patch";
40 sha256 = "1c8g0jz5yj9a0rsmryx9vdjsw4hw8mjfcg05c9pmyjg85w3dfp3m";
41 })
42 ];
43
44 postPatch = ''
45 substituteInPlace Makefile --replace /bin/pwd $(type -P pwd)
46 substituteInPlace utils/ppmtolss16 --replace /usr/bin/perl $(type -P perl)
47
48 # fix tests
49 substituteInPlace tests/unittest/include/unittest/unittest.h \
50 --replace /usr/include/ ""
51 '';
52
53 nativeBuildInputs = [ nasm perl python3 ];
54 buildInputs = [ libuuid makeWrapper ];
55
56 enableParallelBuilding = false; # Fails very rarely with 'No rule to make target: ...'
57 hardeningDisable = [ "pic" "stackprotector" "fortify" ];
58
59 stripDebugList = "bin sbin share/syslinux/com32";
60
61 makeFlags = [
62 "BINDIR=$(out)/bin"
63 "SBINDIR=$(out)/sbin"
64 "LIBDIR=$(out)/lib"
65 "INCDIR=$(out)/include"
66 "DATADIR=$(out)/share"
67 "MANDIR=$(out)/share/man"
68 "PERL=perl"
69 "bios"
70 ];
71
72 doCheck = false; # fails. some fail in a sandbox, others require qemu
73
74 postInstall = ''
75 wrapProgram $out/bin/syslinux \
76 --prefix PATH : "${mtools}/bin"
77
78 # Delete com32 headers to save space, nobody seems to be using them
79 rm -rf $out/share/syslinux/com32
80 '';
81
82 meta = with stdenv.lib; {
83 homepage = http://www.syslinux.org/;
84 description = "A lightweight bootloader";
85 license = licenses.gpl2;
86 maintainers = [ maintainers.samueldr ];
87 platforms = [ "i686-linux" "x86_64-linux" ];
88 };
89}