refind: refactorings
- Remove redundant build inputs These are (optional) run-time dependencies, adding them to build inputs does nothing. - Use standard buildPhase Note that specifying linker script is unnecessary. Also specify correct host arch and efi platform. - Replace non-working ad-hoc patch with wrapper The ad-hoc patching of refind-install didn't actually substitute anything; with a wrapper script patching becomes unnecessary - Remove use of deprecated meta.version Closes https://github.com/NixOS/nixpkgs/pull/18103
This commit is contained in:
parent
8c90b7db89
commit
191a85349b
@ -1,15 +1,23 @@
|
|||||||
{ stdenv, fetchurl, fetchpatch
|
{ stdenv, fetchurl, fetchpatch, gnu-efi }:
|
||||||
, gnu-efi, efibootmgr, dosfstools, imagemagick }:
|
|
||||||
|
|
||||||
assert (stdenv.system == "x86_64-linux" ||stdenv.system == "i686-linux");
|
let
|
||||||
|
archids = {
|
||||||
|
"x86_64-linux" = { hostarch = "x86_64"; efiPlatform = "x64"; };
|
||||||
|
"i686-linux" = rec { hostarch = "ia32"; efiPlatform = hostarch; };
|
||||||
|
};
|
||||||
|
|
||||||
|
inherit
|
||||||
|
(archids.${stdenv.system} or (throw "unsupported system: ${stdenv.system}"))
|
||||||
|
hostarch efiPlatform;
|
||||||
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
|
name = "refind-${version}";
|
||||||
name = "refind-${meta.version}";
|
version = "0.10.3";
|
||||||
srcName = "refind-src-${meta.version}";
|
srcName = "refind-src-${version}";
|
||||||
|
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
url = "mirror://sourceforge/project/refind/${meta.version}/${srcName}.tar.gz";
|
url = "mirror://sourceforge/project/refind/${version}/${srcName}.tar.gz";
|
||||||
sha256 = "1r2qp29mz08lx36i7x52i2598773bxvfhwryd954ssq2baifjav5";
|
sha256 = "1r2qp29mz08lx36i7x52i2598773bxvfhwryd954ssq2baifjav5";
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -21,33 +29,31 @@ stdenv.mkDerivation rec {
|
|||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = [ gnu-efi efibootmgr dosfstools imagemagick ];
|
buildInputs = [ gnu-efi ];
|
||||||
|
|
||||||
hardeningDisable = [ "stackprotector" ];
|
hardeningDisable = [ "stackprotector" ];
|
||||||
|
|
||||||
HOSTARCH =
|
|
||||||
if stdenv.system == "x86_64-linux" then "x64"
|
|
||||||
else if stdenv.system == "i686-linux" then "ia32"
|
|
||||||
else "null";
|
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
sed -e 's|-DEFI_FUNCTION_WRAPPER|-DEFI_FUNCTION_WRAPPER -maccumulate-outgoing-args|g' -i Make.common
|
sed -e 's|-DEFI_FUNCTION_WRAPPER|-DEFI_FUNCTION_WRAPPER -maccumulate-outgoing-args|g' -i Make.common
|
||||||
sed -e 's|-DEFIX64|-DEFIX64 -maccumulate-outgoing-args|g' -i Make.common
|
sed -e 's|-DEFIX64|-DEFIX64 -maccumulate-outgoing-args|g' -i Make.common
|
||||||
sed -e 's|-m64|-maccumulate-outgoing-args -m64|g' -i filesystems/Make.gnuefi
|
sed -e 's|-m64|-maccumulate-outgoing-args -m64|g' -i filesystems/Make.gnuefi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase =
|
makeFlags =
|
||||||
let ldScript =
|
[ "prefix="
|
||||||
if stdenv.system == "x86_64-linux" then "elf_x86_64_efi.lds"
|
"EFIINC=${gnu-efi}/include/efi"
|
||||||
else if stdenv.system == "i686-linux" then "elf_ia32_efi.lds" else "null";
|
"EFILIB=${gnu-efi}/lib"
|
||||||
in ''
|
"GNUEFILIB=${gnu-efi}/lib"
|
||||||
make prefix= EFIINC=${gnu-efi}/include/efi EFILIB=${gnu-efi}/lib GNUEFILIB=${gnu-efi}/lib EFICRT0=${gnu-efi}/lib LDSCRIPT=${gnu-efi}/lib/${ldScript} gnuefi fs_gnuefi
|
"EFICRT0=${gnu-efi}/lib"
|
||||||
'';
|
"HOSTARCH=${hostarch}"
|
||||||
|
];
|
||||||
|
|
||||||
|
buildFlags = [ "gnuefi" "fs_gnuefi" ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -d $out/bin/
|
install -d $out/bin/
|
||||||
install -d $out/share/refind/drivers_${HOSTARCH}/
|
install -d $out/share/refind/drivers_${efiPlatform}/
|
||||||
install -d $out/share/refind/tools_${HOSTARCH}/
|
install -d $out/share/refind/tools_${efiPlatform}/
|
||||||
install -d $out/share/refind/docs/html/
|
install -d $out/share/refind/docs/html/
|
||||||
install -d $out/share/refind/docs/Styles/
|
install -d $out/share/refind/docs/Styles/
|
||||||
install -d $out/share/refind/fonts/
|
install -d $out/share/refind/fonts/
|
||||||
@ -56,16 +62,16 @@ stdenv.mkDerivation rec {
|
|||||||
install -d $out/share/refind/keys/
|
install -d $out/share/refind/keys/
|
||||||
|
|
||||||
# refind uefi app
|
# refind uefi app
|
||||||
install -D -m0644 refind/refind_${HOSTARCH}.efi $out/share/refind/refind_${HOSTARCH}.efi
|
install -D -m0644 refind/refind_${efiPlatform}.efi $out/share/refind/refind_${efiPlatform}.efi
|
||||||
|
|
||||||
# uefi drivers
|
# uefi drivers
|
||||||
install -D -m0644 drivers_${HOSTARCH}/*.efi $out/share/refind/drivers_${HOSTARCH}/
|
install -D -m0644 drivers_${efiPlatform}/*.efi $out/share/refind/drivers_${efiPlatform}/
|
||||||
|
|
||||||
# uefi apps
|
# uefi apps
|
||||||
install -D -m0644 gptsync/gptsync_${HOSTARCH}.efi $out/share/refind/tools_${HOSTARCH}/gptsync_${HOSTARCH}.efi
|
install -D -m0644 gptsync/gptsync_${efiPlatform}.efi $out/share/refind/tools_${efiPlatform}/gptsync_${efiPlatform}.efi
|
||||||
|
|
||||||
# helper scripts
|
# helper scripts
|
||||||
install -D -m0755 refind-install $out/bin/refind-install
|
install -D -m0755 refind-install $out/share/refind/refind-install
|
||||||
install -D -m0755 mkrlconf $out/bin/refind-mkrlconf
|
install -D -m0755 mkrlconf $out/bin/refind-mkrlconf
|
||||||
install -D -m0755 mvrefind $out/bin/refind-mvrefind
|
install -D -m0755 mvrefind $out/bin/refind-mvrefind
|
||||||
install -D -m0755 fonts/mkfont.sh $out/bin/refind-mkfont
|
install -D -m0755 fonts/mkfont.sh $out/bin/refind-mkfont
|
||||||
@ -94,16 +100,26 @@ stdenv.mkDerivation rec {
|
|||||||
# keys
|
# keys
|
||||||
install -D -m0644 keys/* $out/share/refind/keys/
|
install -D -m0644 keys/* $out/share/refind/keys/
|
||||||
|
|
||||||
# fix sharp-bang paths
|
# The refind-install script assumes that all resource files are
|
||||||
patchShebangs $out/bin/refind-*
|
# installed under the same directory as the script itself. To avoid
|
||||||
|
# having to patch around this assumption, generate a wrapper that
|
||||||
|
# cds into $out/share/refind and executes the real script from
|
||||||
|
# there.
|
||||||
|
cat >$out/bin/refind-install <<EOF
|
||||||
|
#! ${stdenv.shell}
|
||||||
|
cd $out/share/refind && exec -a $out/bin/refind-install ./refind-install \$*
|
||||||
|
EOF
|
||||||
|
chmod +x $out/bin/refind-install
|
||||||
|
|
||||||
# Post-install fixes
|
# Patch uses of `which`. We could patch in calls to efibootmgr,
|
||||||
sed -e "s|^ThisDir=.*|ThisDir=$out/share/refind/|g" -i $out/bin/refind-install
|
# openssl, convert, and openssl, but that would greatly enlarge
|
||||||
sed -e "s|^RefindDir=.*|RefindDir=$out/share/refind/|g" -i $out/bin/refind-install
|
# refind's closure (from ca 28MB to over 400MB).
|
||||||
|
sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/share/refind/refind-install
|
||||||
|
sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-mvrefind
|
||||||
|
sed -i 's,`which \(.*\)`,`type -p \1`,g' $out/bin/refind-mkfont
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
version = "0.10.3";
|
|
||||||
description = "A graphical {,U}EFI boot manager";
|
description = "A graphical {,U}EFI boot manager";
|
||||||
longDescription = ''
|
longDescription = ''
|
||||||
rEFInd is a graphical boot manager for EFI- and UEFI-based
|
rEFInd is a graphical boot manager for EFI- and UEFI-based
|
||||||
|
Loading…
Reference in New Issue
Block a user