Subject: [patch] make install stage destdir-aware From: Robert Schwebel This patch makes the install stage DESTDIR aware. The DESTDIR variable is used to specify where the result of the installation shall go to and is usually used for distribution building. Signed-off-by: Robert Schwebel --- Index: db-4.1.25.NC/dist/Makefile.in =================================================================== --- db-4.1.25.NC.orig/dist/Makefile.in +++ db-4.1.25.NC/dist/Makefile.in @@ -541,30 +541,30 @@ library_install: install_include install uninstall: uninstall_include uninstall_lib uninstall_utilities uninstall_docs install_setup: - @test -d $(prefix) || \ - ($(mkdir) -p $(prefix) && $(chmod) $(dmode) $(prefix)) + @test -d $(DESTDIR)/$(prefix) || \ + ($(mkdir) -p $(DESTDIR)/$(prefix) && $(chmod) $(dmode) $(DESTDIR)/$(prefix)) INCDOT= db.h db_cxx.h @ADDITIONAL_INCS@ INCINC= cxx_common.h cxx_except.h install_include: @echo "Installing DB include files: $(includedir) ..." - @test -d $(includedir) || \ - ($(mkdir) -p $(includedir) && $(chmod) $(dmode) $(includedir)) - @cd $(includedir) && $(rm) -f $(INCDOT) $(INCINC) - @$(cp) -p $(INCDOT) $(includedir) - @cd $(srcdir)/dbinc/ && $(cp) -p $(INCINC) $(includedir) - @cd $(includedir) && $(chmod) $(fmode) $(INCDOT) $(INCINC) + @test -d $(DESTDIR)/$(includedir) || \ + ($(mkdir) -p $(DESTDIR)/$(includedir) && $(chmod) $(dmode) $(DESTDIR)/$(includedir)) + @cd $(DESTDIR)/$(includedir) && $(rm) -f $(INCDOT) $(INCINC) + @$(cp) -p $(INCDOT) $(DESTDIR)/$(includedir) + @cd $(srcdir)/dbinc/ && $(cp) -p $(INCINC) $(DESTDIR)/$(includedir) + @cd $(DESTDIR)/$(includedir) && $(chmod) $(fmode) $(INCDOT) $(INCINC) uninstall_include: - @cd $(includedir) && $(rm) -f $(INCDOT) $(INCINC) + @cd $(DESTDIR)/$(includedir) && $(rm) -f $(INCDOT) $(INCINC) install_lib: @echo "Installing DB library: $(libdir) ..." - @test -d $(libdir) || \ - ($(mkdir) -p $(libdir) && $(chmod) $(dmode) $(libdir)) - @cd $(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST) - @$(INSTALLER) @INSTALL_LIBS@ $(libdir) - @(cd $(libdir) && \ + @test -d $(DESTDIR)/$(libdir) || \ + ($(mkdir) -p $(DESTDIR)/$(libdir) && $(chmod) $(dmode) $(DESTDIR)/$(libdir)) + @cd $(DESTDIR)/$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST) + @$(INSTALLER) @INSTALL_LIBS@ $(DESTDIR)/$(libdir) + @(cd $(DESTDIR)/$(libdir) && \ test -f $(libso) && $(ln) -s $(libso) $(libso_default); \ test -f $(libso) && $(ln) -s $(libso) $(libso_major); \ test -f $(libso_static) && $(ln) -s $(libso_static) $(libdb); \ @@ -577,26 +577,26 @@ install_lib: test -f $(libjso) && $(ln) -s $(libjso) $(libjso_major); \ test -f $(libjso) && $(ln) -s $(libjso) $(libjso_g)) || true @(test -f $(libj_jarfile) && \ - $(cp) $(libj_jarfile) $(libdir) && \ - $(chmod) $(fmode) $(libdir)/$(libj_jarfile)) || true + $(cp) $(libj_jarfile) $(DESTDIR)/$(libdir) && \ + $(chmod) $(fmode) $(DESTDIR)/$(libdir)/$(libj_jarfile)) || true uninstall_lib: - @cd $(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST) + @cd $(DESTDIR)/$(libdir) && $(rm) -f $(LIB_INSTALL_FILE_LIST) install_utilities: echo "Installing DB utilities: $(bindir) ..." - @test -d $(bindir) || \ - ($(mkdir) -p $(bindir) && $(chmod) $(dmode) $(bindir)) + @test -d $(DESTDIR)/$(bindir) || \ + ($(mkdir) -p $(DESTDIR)/$(bindir) && $(chmod) $(dmode) $(DESTDIR)/$(bindir)) @for i in $(UTIL_PROGS); do \ - $(rm) -f $(bindir)/$$i $(bindir)/$$i.exe; \ + $(rm) -f $(DESTDIR)/$(bindir)/$$i $(bindir)/$$i.exe; \ test -f $$i.exe && i=$$i.exe || true; \ - $(INSTALLER) $$i $(bindir)/$$i; \ - test -f $(strip) && $(strip) $(bindir)/$$i || true; \ - $(chmod) $(emode) $(bindir)/$$i; \ + $(INSTALLER) $$i $(DESTDIR)/$(bindir)/$$i; \ + test -f $(strip) && $(strip) $(DESTDIR)/$(bindir)/$$i || true; \ + $(chmod) $(emode) $(DESTDIR)/$(bindir)/$$i; \ done uninstall_utilities: - @(cd $(bindir); for i in $(UTIL_PROGS); do \ + @(cd $(DESTDIR)/$(bindir); for i in $(UTIL_PROGS); do \ $(rm) -f $$i $$i.exe; \ done) @@ -605,13 +605,13 @@ DOCLIST=\ sleepycat utility install_docs: @echo "Installing documentation: $(docdir) ..." - @test -d $(docdir) || \ - ($(mkdir) -p $(docdir) && $(chmod) $(dmode) $(docdir)) - @cd $(docdir) && $(rm) -rf $(DOCLIST) - @cd $(srcdir)/docs && $(cp) -pr $(DOCLIST) $(docdir)/ + @test -d $(DESTDIR)/$(docdir) || \ + ($(mkdir) -p $(DESTDIR)/$(docdir) && $(chmod) $(dmode) $(DESTDIR)/$(docdir)) + @cd $(DESTDIR)/$(docdir) && $(rm) -rf $(DOCLIST) + @cd $(srcdir)/docs && $(cp) -pr $(DOCLIST) $(DESTDIR)/$(docdir)/ uninstall_docs: - @cd $(docdir) && $(rm) -rf $(DOCLIST) + @cd $(DESTDIR)/$(docdir) && $(rm) -rf $(DOCLIST) ################################################## # RPM, Embedix build and install.