at 22.05-pre 101 lines 3.6 kB view raw
1{ lib, 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://raw.githubusercontent.com/archlinux/svntogit-packages/821c3da473d1399d930d5b4a086e46a4179eaa45/trunk/0005-gnu-efi-version-compatibility.patch"; 27 name = "0005-gnu-efi-version-compatibility.patch"; 28 sha256 = "1mz2idg8cwn0mvd3jixxynhkn7rhmi5fp8cc8zznh5f0ysfra446"; 29 }) 30 (fetchurl { 31 url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/821c3da473d1399d930d5b4a086e46a4179eaa45/trunk/0025-reproducible-build.patch"; 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 ./gcc10.patch 51 ]; 52 53 postPatch = '' 54 substituteInPlace Makefile --replace /bin/pwd $(type -P pwd) 55 substituteInPlace utils/ppmtolss16 --replace /usr/bin/perl $(type -P perl) 56 57 # fix tests 58 substituteInPlace tests/unittest/include/unittest/unittest.h \ 59 --replace /usr/include/ "" 60 61 # Hack to get `gcc -m32' to work without having 32-bit Glibc headers. 62 mkdir gnu-efi/inc/ia32/gnu 63 touch gnu-efi/inc/ia32/gnu/stubs-32.h 64 ''; 65 66 nativeBuildInputs = [ nasm perl python3 makeWrapper ]; 67 buildInputs = [ libuuid ]; 68 69 enableParallelBuilding = false; # Fails very rarely with 'No rule to make target: ...' 70 hardeningDisable = [ "pic" "stackprotector" "fortify" ]; 71 72 stripDebugList = [ "bin" "sbin" "share/syslinux/com32" ]; 73 74 makeFlags = [ 75 "BINDIR=$(out)/bin" 76 "SBINDIR=$(out)/sbin" 77 "DATADIR=$(out)/share" 78 "MANDIR=$(out)/share/man" 79 "PERL=perl" 80 "HEXDATE=0x00000000" 81 ] 82 ++ lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ]; 83 84 doCheck = false; # fails. some fail in a sandbox, others require qemu 85 86 postInstall = '' 87 wrapProgram $out/bin/syslinux \ 88 --prefix PATH : "${mtools}/bin" 89 90 # Delete com32 headers to save space, nobody seems to be using them 91 rm -rf $out/share/syslinux/com32 92 ''; 93 94 meta = with lib; { 95 homepage = "http://www.syslinux.org/"; 96 description = "A lightweight bootloader"; 97 license = licenses.gpl2; 98 maintainers = [ maintainers.samueldr ]; 99 platforms = [ "i686-linux" "x86_64-linux" ]; 100 }; 101}