1{ stdenv, fetchFromGitHub, fetchurl, nasm, perl, python, libuuid, mtools, makeWrapper }:
2
3stdenv.mkDerivation rec {
4 name = "syslinux-2015-11-09";
5
6 src = fetchFromGitHub {
7 owner = "geneC";
8 repo = "syslinux";
9 rev = "0cc9a99e560a2f52bcf052fd85b1efae35ee812f";
10 sha256 = "0wk3r5ki4lc334f9jpml07wpl8d0bnxi9h1l4h4fyf9a0d7n4kmw";
11 };
12
13 patches = [
14 ./perl-deps.patch
15 (fetchurl {
16 # ldlinux.elf: Not enough room for program headers, try linking with -N
17 name = "not-enough-room.patch";
18 url = "https://anonscm.debian.org/cgit/collab-maint/syslinux.git/plain/"
19 + "debian/patches/0014_fix_ftbfs_no_dynamic_linker.patch?id=a556ad7";
20 sha256 = "0ijqjsjmnphmvsx0z6ppnajsfv6xh6crshy44i2a5klxw4nlvrsw";
21 })
22 ];
23
24 nativeBuildInputs = [ nasm perl python ];
25 buildInputs = [ libuuid makeWrapper ];
26
27 enableParallelBuilding = false; # Fails very rarely with 'No rule to make target: ...'
28 hardeningDisable = [ "pic" "stackprotector" "fortify" ];
29
30 preBuild = ''
31 substituteInPlace Makefile --replace /bin/pwd $(type -P pwd)
32 substituteInPlace gpxe/src/Makefile.housekeeping --replace /bin/echo $(type -P echo)
33 substituteInPlace utils/ppmtolss16 --replace /usr/bin/perl $(type -P perl)
34 substituteInPlace gpxe/src/Makefile --replace /usr/bin/perl $(type -P perl)
35 '';
36
37 stripDebugList = "bin sbin share/syslinux/com32";
38
39 makeFlags = [
40 "BINDIR=$(out)/bin"
41 "SBINDIR=$(out)/sbin"
42 "LIBDIR=$(out)/lib"
43 "INCDIR=$(out)/include"
44 "DATADIR=$(out)/share"
45 "MANDIR=$(out)/share/man"
46 "PERL=perl"
47 "bios"
48 ];
49
50 postInstall = ''
51 wrapProgram $out/bin/syslinux \
52 --prefix PATH : "${mtools}/bin"
53 '';
54
55 meta = with stdenv.lib; {
56 homepage = http://www.syslinux.org/;
57 description = "A lightweight bootloader";
58 license = licenses.gpl2;
59 platforms = platforms.linux;
60 };
61}