[PATCH] multipath-tools: enable libdmmp installation in alternative directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce a new Makefile variable, usr_prefix, to be used for
libdmmp and the associated pkgconfig file.

Some distributions install those libraries which are  necessary
for booting (and mounting /usr) in a different location (/lib or
/lib64) than other libraries (/usr/lib or /usr/lib64). On such
distributions, installation to the different paths can be achieved
by setting "usr_prefix=/usr". This will affect only libdmmp at this
time, as all other libaries in the multipath-tools package may be
relevant for booting.

For distributions on which /lib and /lib64 are just symlinks to their
/usr counterparts, nothing changes.

Comments are welcome.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 Makefile.inc     |  4 +++-
 libdmmp/Makefile | 11 ++++++-----
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/Makefile.inc b/Makefile.inc
index ad55aa10..ad08f307 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -47,6 +47,7 @@ endif
 
 prefix		=
 exec_prefix	= $(prefix)
+usr_prefix	= $(prefix)
 bindir		= $(exec_prefix)/sbin
 libudevdir	= $(prefix)/$(SYSTEMDPATH)/udev
 udevrulesdir	= $(libudevdir)/rules.d
@@ -55,6 +56,7 @@ man8dir		= $(prefix)/usr/share/man/man8
 man5dir		= $(prefix)/usr/share/man/man5
 man3dir		= $(prefix)/usr/share/man/man3
 syslibdir	= $(prefix)/$(LIB)
+usrlibdir	= $(usr_prefix)/$(LIB)
 libdir		= $(prefix)/$(LIB)/multipath
 unitdir		= $(prefix)/$(SYSTEMDPATH)/systemd/system
 mpathpersistdir	= $(TOPDIR)/libmpathpersist
@@ -62,7 +64,7 @@ mpathcmddir	= $(TOPDIR)/libmpathcmd
 thirdpartydir	= $(TOPDIR)/third-party
 libdmmpdir	= $(TOPDIR)/libdmmp
 includedir	= $(prefix)/usr/include
-pkgconfdir	= $(prefix)/$(LIB)/pkgconfig
+pkgconfdir	= $(usrlibdir)/pkgconfig
 
 GZIP		= gzip -9 -c
 RM		= rm -f
diff --git a/libdmmp/Makefile b/libdmmp/Makefile
index 1c5329aa..908e294b 100644
--- a/libdmmp/Makefile
+++ b/libdmmp/Makefile
@@ -27,15 +27,16 @@ $(LIBS): $(OBJS)
 	$(LN) $@ $(DEVLIB)
 
 install:
-	$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(syslibdir)/$(LIBS)
+	mkdir -p $(DESTDIR)$(usrlibdir)
+	$(INSTALL_PROGRAM) -m 755 $(LIBS) $(DESTDIR)$(usrlibdir)/$(LIBS)
 	$(INSTALL_PROGRAM) -m 644 -D \
 		$(HEADERS) $(DESTDIR)$(includedir)/$(HEADERS)
-	$(LN) $(LIBS) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+	$(LN) $(LIBS) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
 	$(INSTALL_PROGRAM) -m 644 -D \
 		$(PKGFILE).in $(DESTDIR)$(pkgconfdir)/$(PKGFILE)
 	perl -i -pe 's|__VERSION__|$(LIBDMMP_VERSION)|g' \
 		$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
-	perl -i -pe 's|__LIBDIR__|$(syslibdir)|g' \
+	perl -i -pe 's|__LIBDIR__|$(usrlibdir)|g' \
 		$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
 	perl -i -pe 's|__INCLUDEDIR__|$(includedir)|g' \
 		$(DESTDIR)$(pkgconfdir)/$(PKGFILE)
@@ -46,9 +47,9 @@ install:
 	done
 
 uninstall:
-	$(RM) $(DESTDIR)$(syslibdir)/$(LIBS)
+	$(RM) $(DESTDIR)$(usrlibdir)/$(LIBS)
 	$(RM) $(DESTDIR)$(includedir)/$(HEADERS)
-	$(RM) $(DESTDIR)$(syslibdir)/$(DEVLIB)
+	$(RM) $(DESTDIR)$(usrlibdir)/$(DEVLIB)
 	@for file in $(DESTDIR)$(man3dir)/dmmp_*; do \
 		$(RM) $$file; \
 	done
-- 
2.12.2

--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux