syslinux: refactor

+67 -39
+67 -39
pkgs/os-specific/linux/syslinux/default.nix
··· 1 - { lib, stdenv, fetchgit, fetchurl, fetchpatch, nasm, perl, python3, libuuid, mtools, makeWrapper }: 1 + { lib 2 + , stdenv 3 + , fetchgit 4 + , fetchurl 5 + , libuuid 6 + , makeWrapper 7 + , mtools 8 + , nasm 9 + , perl 10 + , python3 11 + }: 2 12 3 13 stdenv.mkDerivation { 4 14 pname = "syslinux"; 5 - version = "unstable-20190207"; 15 + version = "unstable-2019-02-07"; 6 16 7 17 # This is syslinux-6.04-pre3^1; syslinux-6.04-pre3 fails to run. 8 18 # Same issue here https://www.syslinux.org/archives/2019-February/026330.html 9 19 src = fetchgit { 10 20 url = "https://repo.or.cz/syslinux"; 11 21 rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7"; 12 - sha256 = "1acf6byx7i6vz8hq6mra526g8mf7fmfhid211y8nq0v6px7d3aqs"; 22 + sha256 = "sha256-GqvRTr9mA2yRD0G0CF11x1X0jCgqV4Mh+tvE0/0yjqk="; 13 23 fetchSubmodules = true; 14 24 }; 15 25 16 26 patches = let 17 - mkURL = commit: patchName: 18 - "https://salsa.debian.org/images-team/syslinux/raw/${commit}/debian/patches/" 19 - + patchName; 27 + fetchDebianPatch = name: commit: hash: 28 + fetchurl { 29 + url = "https://salsa.debian.org/images-team/syslinux/raw/" 30 + + commit + "/debian/patches/" + name; 31 + inherit name hash; 32 + }; 33 + fetchArchlinuxPatch = name: commit: hash: 34 + fetchurl { 35 + url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/" 36 + + commit + "/trunk/" + name; 37 + inherit name hash; 38 + }; 20 39 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 { 40 + ./gcc10.patch 41 + (fetchDebianPatch 42 + "0002-gfxboot-menu-label.patch" 43 + "fa1349f1" 44 + "sha256-0f6QhM4lJmGflLige4n7AZTodL7vnyAvi5dIedd/Lho=") 45 + (fetchArchlinuxPatch 46 + "0005-gnu-efi-version-compatibility.patch" 47 + "821c3da473d1399d930d5b4a086e46a4179eaa45" 48 + "sha256-hhCVnfbAFWj/R4yh60qsMB87ofW9RznarsByhl6L4tc=") 49 + (fetchArchlinuxPatch 50 + "0025-reproducible-build.patch" 51 + "821c3da473d1399d930d5b4a086e46a4179eaa45" 52 + "sha256-mnb291pCSFvDNxY7o4BosJ94ib3BpOGRQIiY8Q3jZmI=") 53 + (fetchDebianPatch 36 54 # mbr.bin: too big (452 > 440) 37 55 # 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 { 56 + "0016-strip-gnu-property.patch" 57 + "7468ef0e38c43" 58 + "sha256-lW+E6THuXlTGvhly0f/D9NwYHhkiKHot2l+bz9Eaxp4=") 59 + (fetchDebianPatch 42 60 # 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 61 + "0017-single-load-segment.patch" 62 + "012e1dd312eb" 63 + "sha256-C6VmdlTs1blMGUHH3OfOlFBZsfpwRn9vWodwqVn8+Cs=") 64 + (fetchDebianPatch 65 + "0018-prevent-pow-optimization.patch" 66 + "26f0e7b2" 67 + "sha256-dVzXBi/oSV9vYgU85mRFHBKuZdup+1x1BipJX74ED7E=") 51 68 ]; 52 69 53 70 postPatch = '' ··· 63 80 touch gnu-efi/inc/ia32/gnu/stubs-32.h 64 81 ''; 65 82 66 - nativeBuildInputs = [ nasm perl python3 makeWrapper ]; 67 - buildInputs = [ libuuid ]; 83 + nativeBuildInputs = [ 84 + nasm 85 + perl 86 + python3 87 + makeWrapper 88 + ]; 68 89 69 - enableParallelBuilding = false; # Fails very rarely with 'No rule to make target: ...' 90 + buildInputs = [ 91 + libuuid 92 + ]; 93 + 94 + # Fails very rarely with 'No rule to make target: ...' 95 + enableParallelBuilding = false; 96 + 70 97 hardeningDisable = [ "pic" "stackprotector" "fortify" ]; 71 98 72 99 stripDebugList = [ "bin" "sbin" "share/syslinux/com32" ]; ··· 85 112 "PERL=perl" 86 113 "HEXDATE=0x00000000" 87 114 ] 88 - ++ lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ]; 115 + ++ lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ]; 89 116 90 - doCheck = false; # fails. some fail in a sandbox, others require qemu 117 + # Some tests require qemu, some others fail in a sandboxed environment 118 + doCheck = false; 91 119 92 120 postInstall = '' 93 121 wrapProgram $out/bin/syslinux \ ··· 100 128 meta = with lib; { 101 129 homepage = "http://www.syslinux.org/"; 102 130 description = "A lightweight bootloader"; 103 - license = licenses.gpl2; 131 + license = licenses.gpl2Plus; 104 132 maintainers = [ maintainers.samueldr ]; 105 133 platforms = [ "i686-linux" "x86_64-linux" ]; 106 134 };