0035-Make-make-make-DESTDIR-.-foo-install-work-right.patch (1316B)
1 From c0963d33ad37ff62da31208b1688d164bd8a1449 Mon Sep 17 00:00:00 2001 2 From: Peter Jones <pjones@redhat.com> 3 Date: Fri, 25 Oct 2019 15:39:35 -0400 4 Subject: [PATCH 35/46] Make: make "make DESTDIR=../foo install" work right. 5 6 This makes the normal DESTDIR= variable work on the command line, and 7 makes relative paths always relative to the top-level directory. 8 9 Signed-off-by: Peter Jones <pjones@redhat.com> 10 --- 11 Make.defaults | 14 +++++++++++++- 12 1 file changed, 13 insertions(+), 1 deletion(-) 13 14 diff --git a/Make.defaults b/Make.defaults 15 index 696028dd6c2..157559d20ee 100755 16 --- a/Make.defaults 17 +++ b/Make.defaults 18 @@ -47,7 +47,19 @@ ARCHES=aa64 arm ia32 ia64 mips64el x64 19 # Where to install the package. GNU-EFI will create and access 20 # lib and include under the root 21 # 22 -INSTALLROOT := / 23 +DESTDIR ?= / 24 +ifeq ($(origin INSTALLROOT),undefined) 25 +INSTALLROOT = $(DESTDIR) 26 +endif 27 + 28 +empty := 29 +space := $(empty) $(empty) 30 +stripped = $(subst $(space),/,$(strip $(subst /,$(space),$(1)))) 31 +unstripped = $(subst $(space),/,$(subst /,$(space),$(1))) 32 +is_absolute = $(subst $(call stripped,$(1)),$(empty),$(call unstripped,$(1))) 33 + 34 +override INSTALLROOT:=$(if $(call is_absolute,$(INSTALLROOT)),,$(TOPDIR)/)$(INSTALLROOT) 35 + 36 PREFIX := /usr/local 37 LIBDIR := $(PREFIX)/lib 38 INSTALL := install 39 -- 40 2.24.1 41