nixpkgs/pkgs/os-specific/linux/firmware/fwupdate/fix-paths.patch
2018-02-22 13:18:21 +01:00

117 lines
3.4 KiB
Diff

--- 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