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