fwupdate: 8 → 10
This commit is contained in:
parent
8b1cf100cd
commit
41e85ef889
@ -1,37 +1,62 @@
|
||||
{ stdenv, fetchurl, gnu-efi, efivar, libsmbios, popt, pkgconfig
|
||||
, gettext }:
|
||||
let version = "8"; in
|
||||
stdenv.mkDerivation
|
||||
{ name = "fwupdate-${version}";
|
||||
src = fetchurl
|
||||
{ url = "https://github.com/rhinstaller/fwupdate/releases/download/${version}/fwupdate-${version}.tar.bz2";
|
||||
sha256 = "10q8k1kghvbcb5fwcl2smzp8vqdfzimx9dkk0c3hz39py1phy4n8";
|
||||
};
|
||||
makeFlags =
|
||||
[ "EFIDIR=nixos"
|
||||
"LIBDIR=$(out)/lib"
|
||||
"GNUEFIDIR=${gnu-efi}/lib"
|
||||
"TARGETDIR=$(out)/boot/efi/nixos/"
|
||||
"prefix=$(out)/"
|
||||
];
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
buildInputs = [ gnu-efi libsmbios popt gettext ];
|
||||
propagatedBuildInputs = [ efivar ];
|
||||
# TODO: Just apply the disable to the efi subdir
|
||||
hardeningDisable = [ "all" ];
|
||||
patchPhase = ''
|
||||
sed -i 's|/usr/include/smbios_c/token.h|smbios_c/token.h|' \
|
||||
linux/libfwup.c
|
||||
sed -i 's|/usr/share|$(prefix)share|' linux/Makefile
|
||||
sed -i "s|/usr/include|$out/include|" linux/fwup.pc.in
|
||||
find . -type f -print0 | xargs -0 sed -i -e 's|/boot/efi|/boot|g' -e 's|/boot/efi/EFI|/boot/EFI|g'
|
||||
'';
|
||||
configurePhase = ''
|
||||
arch=$(cc -dumpmachine | cut -f1 -d- | sed 's,i[3456789]86,ia32,' )
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gnu-efi}/include/efi -I${efivar}/include/efivar -I${gnu-efi}/include/efi/$arch"
|
||||
'';
|
||||
meta =
|
||||
{ license = [ stdenv.lib.licenses.gpl2 ];
|
||||
platforms = stdenv.lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
{ efivar, fetchurl, gettext, gnu-efi, libsmbios, pkgconfig, popt, stdenv }:
|
||||
let
|
||||
version = "10";
|
||||
in stdenv.mkDerivation {
|
||||
name = "fwupdate-${version}";
|
||||
src = fetchurl {
|
||||
url = "https://github.com/rhinstaller/fwupdate/releases/download/${version}/fwupdate-${version}.tar.bz2";
|
||||
sha256 = "0fpk3q0msq2l0bs2mvk0cqp8jbwnmi17ggc81r4v96h4jxh2rx3k";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# https://github.com/rhboot/fwupdate/pull/99
|
||||
./fix-paths.patch
|
||||
./do-not-create-sharedstatedir.patch
|
||||
];
|
||||
|
||||
NIX_CFLAGS_COMPILE = [ "-I${gnu-efi}/include/efi" ];
|
||||
|
||||
# TODO: Just apply the disable to the efi subdir
|
||||
hardeningDisable = [ "stackprotector" ];
|
||||
|
||||
makeFlags = [
|
||||
"EFIDIR=nixos"
|
||||
"prefix=$(out)"
|
||||
"LIBDIR=$(out)/lib"
|
||||
"GNUEFIDIR=${gnu-efi}/lib"
|
||||
"ESPMOUNTPOINT=$(out)/boot"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkgconfig
|
||||
gettext
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gnu-efi
|
||||
libsmbios
|
||||
popt
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
efivar
|
||||
];
|
||||
|
||||
# TODO: fix wrt cross-compilation
|
||||
preConfigure = ''
|
||||
arch=$(cc -dumpmachine | cut -f1 -d- | sed 's,i[3456789]86,ia32,' )
|
||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gnu-efi}/include/efi/$arch"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
rm -rf $out/src
|
||||
rm -rf $out/lib/debug
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Tools for using the ESRT and UpdateCapsule() to apply firmware updates";
|
||||
maintainers = with maintainers; [ ];
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
--- a/linux/Makefile
|
||||
+++ b/linux/Makefile
|
||||
@@ -131,7 +131,6 @@
|
||||
ln -fs $(x) $(patsubst %.so.1.$(VERSION),%.so.1,$(DESTDIR)$(libdir)/$(x)) ;\
|
||||
ln -fs $(x) $(patsubst %.so.1.$(VERSION),%.so,$(DESTDIR)$(libdir)/$(x)) ;\
|
||||
)
|
||||
- $(INSTALL) -d -m 755 $(DESTDIR)$(sharedstatedir)/fwupdate/
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(libexecdir)/fwupdate/
|
||||
$(INSTALL) -m 755 cleanup $(DESTDIR)$(libexecdir)/fwupdate/cleanup
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(libdatadir)/systemd/system
|
116
pkgs/os-specific/linux/firmware/fwupdate/fix-paths.patch
Normal file
116
pkgs/os-specific/linux/firmware/fwupdate/fix-paths.patch
Normal file
@ -0,0 +1,116 @@
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -18,19 +18,20 @@
|
||||
ABIDIFF := abidiff
|
||||
ABIDW := abidw
|
||||
prefix ?= /usr/
|
||||
-prefix := $(abspath $(prefix))/
|
||||
+prefix := $(abspath $(prefix))
|
||||
+exec_prefix ?= $(prefix)
|
||||
ARCH = $(shell $(CC) -dumpmachine | cut -f1 -d- | sed s,i[3456789]86,ia32,)
|
||||
ifeq ($(ARCH),x86_64)
|
||||
- LIBDIR ?= $(prefix)lib64
|
||||
+ LIBDIR ?= $(exec_prefix)/lib64
|
||||
endif
|
||||
ifeq ($(ARCH),ia32)
|
||||
- LIBDIR ?= $(prefix)lib
|
||||
+ LIBDIR ?= $(exec_prefix)/lib
|
||||
endif
|
||||
ifeq ($(ARCH),aarch64)
|
||||
- LIBDIR ?= $(prefix)lib64
|
||||
+ LIBDIR ?= $(exec_prefix)/lib64
|
||||
endif
|
||||
ifeq ($(ARCH),arm)
|
||||
- LIBDIR ?= $(prefix)lib
|
||||
+ LIBDIR ?= $(exec_prefix)/lib
|
||||
endif
|
||||
LIBDIR ?= unknown
|
||||
ifeq ($(LIBDIR),unknown)
|
||||
@@ -45,13 +46,13 @@
|
||||
GNUEFIDIR ?= $(LIBDIR)/gnuefi
|
||||
libdir ?= $(LIBDIR)
|
||||
pcdir ?= $(libdir)/pkgconfig
|
||||
-mandir ?= $(prefix)share/man
|
||||
-includedir ?= $(prefix)include
|
||||
-bindir ?= $(prefix)bin
|
||||
-datadir ?= $(prefix)share
|
||||
+mandir ?= $(prefix)/share/man
|
||||
+includedir ?= $(prefix)/include
|
||||
+bindir ?= $(exec_prefix)/bin
|
||||
+datadir ?= $(prefix)/share
|
||||
localedir ?= $(datadir)/locale
|
||||
-libexecdir ?= $(prefix)libexec
|
||||
-libdatadir ?= $(prefix)lib
|
||||
+libexecdir ?= $(exec_prefix)/libexec
|
||||
+libdatadir ?= $(exec_prefix)/lib
|
||||
sharedstatedir ?= /var/lib
|
||||
|
||||
EFIDIR ?= $(shell x=$$(which --skip-alias --skip-functions git 2>/dev/null) ; [ -n "$$x" ] && git config --get fwupdate.efidir)
|
||||
@@ -63,8 +64,8 @@
|
||||
ESPMOUNTPOINT = "/boot/efi"
|
||||
endif
|
||||
|
||||
-DEBUGINFO ?= $(prefix)lib/debug
|
||||
-DEBUGSOURCE ?= $(prefix)src/debug
|
||||
+DEBUGINFO ?= $(exec_prefix)/lib/debug
|
||||
+DEBUGSOURCE ?= $(prefix)/src/debug
|
||||
TARGETDIR ?= $(ESPMOUNTPOINT)/EFI/$(EFIDIR)
|
||||
|
||||
.PHONY: check_efidir_error
|
||||
--- a/linux/Makefile
|
||||
+++ b/linux/Makefile
|
||||
@@ -93,16 +93,19 @@
|
||||
sed -e "s,@@VERSION@@,$(VERSION),g" \
|
||||
-e "s,@@FWUP_MAJOR_VERSION@@,$(MAJOR_VERSION),g" \
|
||||
-e "s,@@FWUP_MINOR_VERSION@@,$(MINOR_VERSION),g" \
|
||||
+ -e "s,@@PREFIX@@,$(prefix),g" \
|
||||
+ -e "s,@@EXEC_PREFIX@@,$(exec_prefix),g" \
|
||||
-e "s,@@SHAREDSTATEDIR@@,$(sharedstatedir),g" \
|
||||
-e "s,@@ESPMOUNTPOINT@@,$(ESPMOUNTPOINT),g" \
|
||||
-e "s,@@EFIDIR@@,$(EFIDIR),g" \
|
||||
-e "s,@@LIBDIR@@,$(libdir),g" \
|
||||
-e "s,@@LIBEXECDIR@@,$(libexecdir),g" \
|
||||
+ -e "s,@@INCLUDEDIR@@,$(includedir),g" \
|
||||
$< > $@
|
||||
|
||||
tester : tester.c
|
||||
- $(CC) -Wall -Werror -ggdb -L. -I./include -I/usr/include/efivar \
|
||||
- -lefivar -lfwup -o $@ $^
|
||||
+ $(CC) -Wall -Werror -ggdb -L. -I./include $(shell $(PKG_CONFIG) --cflags efivar) \
|
||||
+ $(shell $(PKG_CONFIG) --libs efivar) -lfwup -o $@ $^
|
||||
|
||||
test : tester
|
||||
LD_LIBRARY_PATH=$(shell pwd) ./tester
|
||||
@@ -134,6 +137,6 @@
|
||||
$(INSTALL) -d -m 755 $(DESTDIR)$(libdatadir)/systemd/system
|
||||
$(INSTALL) -m 644 cleanup.service \
|
||||
$(DESTDIR)$(libdatadir)/systemd/system/fwupdate-cleanup.service
|
||||
- $(INSTALL) -d -m 755 $(DESTDIR)/usr/share/bash-completion/completions/
|
||||
+ $(INSTALL) -d -m 755 $(DESTDIR)$(datadir)/bash-completion/completions/
|
||||
$(INSTALL) -m 755 $(VPATH)/bash-completion \
|
||||
- $(DESTDIR)/usr/share/bash-completion/completions/fwupdate
|
||||
+ $(DESTDIR)$(datadir)/bash-completion/completions/fwupdate
|
||||
--- a/linux/fwup.pc.in
|
||||
+++ b/linux/fwup.pc.in
|
||||
@@ -1,7 +1,7 @@
|
||||
-prefix=/usr
|
||||
-exec_prefix=/usr
|
||||
+prefix=@@PREFIX@@
|
||||
+exec_prefix=@@EXEC_PREFIX@@
|
||||
libdir=@@LIBDIR@@
|
||||
-includedir=/usr/include
|
||||
+includedir=@@INCLUDEDIR@@
|
||||
|
||||
Name: fwup
|
||||
Description: Library for deployment of UEFI firmware updates.
|
||||
--- a/linux/libfwup.c
|
||||
+++ b/linux/libfwup.c
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
#include <dell-wmi-smi.h>
|
||||
#ifdef FWUPDATE_HAVE_LIBSMBIOS__
|
||||
-#include </usr/include/smbios_c/token.h>
|
||||
+#include <smbios_c/token.h>
|
||||
#include <smbios_c/smi.h>
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user