syslinux: refactor

This commit is contained in:
AndersonTorres 2022-05-29 20:47:51 -03:00
parent c24cea676d
commit 64ad6ef2fe

View file

@ -1,53 +1,70 @@
{ lib, stdenv, fetchgit, fetchurl, fetchpatch, nasm, perl, python3, libuuid, mtools, makeWrapper }: { lib
, stdenv
, fetchgit
, fetchurl
, libuuid
, makeWrapper
, mtools
, nasm
, perl
, python3
}:
stdenv.mkDerivation { stdenv.mkDerivation {
pname = "syslinux"; pname = "syslinux";
version = "unstable-20190207"; version = "unstable-2019-02-07";
# This is syslinux-6.04-pre3^1; syslinux-6.04-pre3 fails to run. # This is syslinux-6.04-pre3^1; syslinux-6.04-pre3 fails to run.
# Same issue here https://www.syslinux.org/archives/2019-February/026330.html # Same issue here https://www.syslinux.org/archives/2019-February/026330.html
src = fetchgit { src = fetchgit {
url = "https://repo.or.cz/syslinux"; url = "https://repo.or.cz/syslinux";
rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7"; rev = "b40487005223a78c3bb4c300ef6c436b3f6ec1f7";
sha256 = "1acf6byx7i6vz8hq6mra526g8mf7fmfhid211y8nq0v6px7d3aqs"; sha256 = "sha256-GqvRTr9mA2yRD0G0CF11x1X0jCgqV4Mh+tvE0/0yjqk=";
fetchSubmodules = true; fetchSubmodules = true;
}; };
patches = let patches = let
mkURL = commit: patchName: fetchDebianPatch = name: commit: hash:
"https://salsa.debian.org/images-team/syslinux/raw/${commit}/debian/patches/" fetchurl {
+ patchName; url = "https://salsa.debian.org/images-team/syslinux/raw/"
+ commit + "/debian/patches/" + name;
inherit name hash;
};
fetchArchlinuxPatch = name: commit: hash:
fetchurl {
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/"
+ commit + "/trunk/" + name;
inherit name hash;
};
in [ in [
(fetchurl { ./gcc10.patch
url = mkURL "fa1349f1" "0002-gfxboot-menu-label.patch"; (fetchDebianPatch
sha256 = "06ifgzbpjj4picpj17zgprsfi501zf4pp85qjjgn29i5rs291zni"; "0002-gfxboot-menu-label.patch"
}) "fa1349f1"
(fetchurl { "sha256-0f6QhM4lJmGflLige4n7AZTodL7vnyAvi5dIedd/Lho=")
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/821c3da473d1399d930d5b4a086e46a4179eaa45/trunk/0005-gnu-efi-version-compatibility.patch"; (fetchArchlinuxPatch
name = "0005-gnu-efi-version-compatibility.patch"; "0005-gnu-efi-version-compatibility.patch"
sha256 = "1mz2idg8cwn0mvd3jixxynhkn7rhmi5fp8cc8zznh5f0ysfra446"; "821c3da473d1399d930d5b4a086e46a4179eaa45"
}) "sha256-hhCVnfbAFWj/R4yh60qsMB87ofW9RznarsByhl6L4tc=")
(fetchurl { (fetchArchlinuxPatch
url = "https://raw.githubusercontent.com/archlinux/svntogit-packages/821c3da473d1399d930d5b4a086e46a4179eaa45/trunk/0025-reproducible-build.patch"; "0025-reproducible-build.patch"
name = "0025-reproducible-build.patch"; "821c3da473d1399d930d5b4a086e46a4179eaa45"
sha256 = "0qk6wc6z3648828y3961pn4pi7xhd20a6fqn6z1mnj22bbvzcxls"; "sha256-mnb291pCSFvDNxY7o4BosJ94ib3BpOGRQIiY8Q3jZmI=")
}) (fetchDebianPatch
(fetchurl {
# mbr.bin: too big (452 > 440) # mbr.bin: too big (452 > 440)
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414 # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=906414
url = mkURL "7468ef0e38c43" "0016-strip-gnu-property.patch"; "0016-strip-gnu-property.patch"
sha256 = "17n63b8wz6szv8npla1234g1ip7lqgzx2whrpv358ppf67lq8vwm"; "7468ef0e38c43"
}) "sha256-lW+E6THuXlTGvhly0f/D9NwYHhkiKHot2l+bz9Eaxp4=")
(fetchurl { (fetchDebianPatch
# mbr.bin: too big (452 > 440) # mbr.bin: too big (452 > 440)
url = mkURL "012e1dd312eb" "0017-single-load-segment.patch"; "0017-single-load-segment.patch"
sha256 = "0azqzicsjw47b9ppyikhzaqmjl4lrvkxris1356bkmgcaiv6d98b"; "012e1dd312eb"
}) "sha256-C6VmdlTs1blMGUHH3OfOlFBZsfpwRn9vWodwqVn8+Cs=")
(fetchurl { (fetchDebianPatch
url = mkURL "26f0e7b2" "0018-prevent-pow-optimization.patch"; "0018-prevent-pow-optimization.patch"
sha256 = "1c8g0jz5yj9a0rsmryx9vdjsw4hw8mjfcg05c9pmyjg85w3dfp3m"; "26f0e7b2"
}) "sha256-dVzXBi/oSV9vYgU85mRFHBKuZdup+1x1BipJX74ED7E=")
./gcc10.patch
]; ];
postPatch = '' postPatch = ''
@ -63,10 +80,20 @@ stdenv.mkDerivation {
touch gnu-efi/inc/ia32/gnu/stubs-32.h touch gnu-efi/inc/ia32/gnu/stubs-32.h
''; '';
nativeBuildInputs = [ nasm perl python3 makeWrapper ]; nativeBuildInputs = [
buildInputs = [ libuuid ]; nasm
perl
python3
makeWrapper
];
buildInputs = [
libuuid
];
# Fails very rarely with 'No rule to make target: ...'
enableParallelBuilding = false;
enableParallelBuilding = false; # Fails very rarely with 'No rule to make target: ...'
hardeningDisable = [ "pic" "stackprotector" "fortify" ]; hardeningDisable = [ "pic" "stackprotector" "fortify" ];
stripDebugList = [ "bin" "sbin" "share/syslinux/com32" ]; stripDebugList = [ "bin" "sbin" "share/syslinux/com32" ];
@ -85,9 +112,10 @@ stdenv.mkDerivation {
"PERL=perl" "PERL=perl"
"HEXDATE=0x00000000" "HEXDATE=0x00000000"
] ]
++ lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ]; ++ lib.optionals stdenv.hostPlatform.isi686 [ "bios" "efi32" ];
doCheck = false; # fails. some fail in a sandbox, others require qemu # Some tests require qemu, some others fail in a sandboxed environment
doCheck = false;
postInstall = '' postInstall = ''
wrapProgram $out/bin/syslinux \ wrapProgram $out/bin/syslinux \
@ -100,7 +128,7 @@ stdenv.mkDerivation {
meta = with lib; { meta = with lib; {
homepage = "http://www.syslinux.org/"; homepage = "http://www.syslinux.org/";
description = "A lightweight bootloader"; description = "A lightweight bootloader";
license = licenses.gpl2; license = licenses.gpl2Plus;
maintainers = [ maintainers.samueldr ]; maintainers = [ maintainers.samueldr ];
platforms = [ "i686-linux" "x86_64-linux" ]; platforms = [ "i686-linux" "x86_64-linux" ];
}; };