From 23b059e7b7559280966b806e30d5b1e9c1ecfeaa Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 9 Apr 2010 21:42:48 +0000 Subject: [PATCH] INSTALL rules updates Patch is inspired by Debian's extra patch. - removes OWNER & GROUP make vars they are parts of INSTALL command. - adds INSTALL_PROGRAM for executable, uses $(INSTALL) - adds INSTALL_DATA for non-executable data, uses ($INSTALL) - adds INSTALL_WDATA for writable non-executable data, uses ($INSTALL) - adds configure option --enable-write_install - to support installatin of writable files used by distribution - replaces usage of ifeq @LIB_SUFFIX@ with $(LIB_SUFFIX) - installs .a files from static builds without executable flag - installs .a files to $(usrlibdir) instead of $(libdir) - installs all static binaries to $(staticdir) - create .so links for devel package in $(usrlibdir) instead of $(libdir) - makes .so and .so.LIB_VERSION files within builddir - removes VERSIONED_SHLIB and created versioned LIB_SHARED automagicaly - install LIB_SHARED via install_lib_shared target - install plugins via install_lib_shared_plugin target - prints whole 'install' command during installation instead of less informative "Installing $(something) $(somewhere)" - install multiple man pages with one INSTALL command - use DISTCLEAN_TARGETS instead of creating multiple distclean targets --- WHATS_NEW | 3 ++ configure | 22 +++++--- configure.in | 16 +++--- daemons/clvmd/Makefile.in | 3 +- daemons/cmirrord/Makefile.in | 7 ++- daemons/dmeventd/Makefile.in | 47 +++++------------ daemons/dmeventd/plugins/lvm2/Makefile.in | 11 +--- daemons/dmeventd/plugins/mirror/Makefile.in | 11 +--- daemons/dmeventd/plugins/snapshot/Makefile.in | 11 +--- doc/Makefile.in | 7 ++- lib/Makefile.in | 2 +- lib/format1/Makefile.in | 10 ++-- lib/format_pool/Makefile.in | 12 ++--- lib/locking/Makefile.in | 11 ++-- lib/mirror/Makefile.in | 10 ++-- lib/snapshot/Makefile.in | 11 ++-- libdm/Makefile.in | 51 ++++++------------- liblvm/Makefile.in | 44 ++++------------ make.tmpl.in | 49 +++++++++++++----- man/Makefile.in | 45 ++++++---------- po/Makefile.in | 4 +- scripts/Makefile.in | 20 ++++---- test/Makefile.in | 2 +- tools/Makefile.in | 47 ++++++++--------- 24 files changed, 181 insertions(+), 275 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 257ace5a3..f3c741104 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,8 @@ Version 2.02.63 - ================================ + Install .a .so links to $(usrlibdir). + Add --enable-write_install options to install user writable files. + Use INSTALL_PROGRAM/DATA/WDATA target. Switch from using VPATH to vpath in Makefiles. Permit mimage LVs to be striped in lvcreate and lvresize. Fix pvmove allocation to take existing parallel stripes into account. diff --git a/configure b/configure index 08895a516..3c8c9a628 100755 --- a/configure +++ b/configure @@ -646,6 +646,7 @@ kernelvsn missingkernel kerneldir interface +WRITE_INSTALL UDEV_SYNC UDEV_RULES UDEV_LIBS @@ -657,7 +658,6 @@ READLINE_LIBS PTHREAD_LIBS POOL PKGCONFIG -OWNER MIRRORS LVM_RELEASE_DATE LVM_RELEASE @@ -676,7 +676,6 @@ INTL_PACKAGE INTL HAVE_REALTIME HAVE_LIBDL -GROUP FSADM DM_LIB_PATCHLEVEL DM_LIB_VERSION @@ -836,6 +835,7 @@ enable_o_direct enable_applib enable_cmdlib enable_pkgconfig +enable_write_install enable_fsadm enable_dmeventd enable_selinux @@ -1527,6 +1527,7 @@ Optional Features: --enable-applib Build application library --enable-cmdlib Build shared command library --enable-pkgconfig Install pkgconfig support + --enable-write_install Install user writable files --disable-fsadm Disable fsadm --enable-dmeventd Enable the device-mapper event daemon --disable-selinux Disable selinux support @@ -9083,8 +9084,6 @@ $as_echo "$STATIC_LINK" >&6; } ################################################################################ { $as_echo "$as_me:$LINENO: checking file owner" >&5 $as_echo_n "checking file owner... " >&6; } -OWNER="" - # Check whether --with-user was given. if test "${with_user+set}" = set; then @@ -9095,13 +9094,12 @@ fi $as_echo "$OWNER" >&6; } if test x$OWNER != x; then - OWNER="-o $OWNER" + INSTALL="$INSTALL -o $OWNER" fi ################################################################################ { $as_echo "$as_me:$LINENO: checking group owner" >&5 $as_echo_n "checking group owner... " >&6; } -GROUP="" # Check whether --with-group was given. if test "${with_group+set}" = set; then @@ -9112,7 +9110,7 @@ fi $as_echo "$GROUP" >&6; } if test x$GROUP != x; then - GROUP="-g $GROUP" + INSTALL="$INSTALL -g $GROUP" fi ################################################################################ @@ -12450,6 +12448,15 @@ else fi +################################################################################ +# Check whether --enable-write_install was given. +if test "${enable_write_install+set}" = set; then + enableval=$enable_write_install; WRITE_INSTALL=$enableval +else + WRITE_INSTALL=no +fi + + ################################################################################ { $as_echo "$as_me:$LINENO: checking whether to install fsadm" >&5 $as_echo_n "checking whether to install fsadm... " >&6; } @@ -15600,7 +15607,6 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'` - ################################################################################ diff --git a/configure.in b/configure.in index ede1a7404..ed9e631dd 100644 --- a/configure.in +++ b/configure.in @@ -144,28 +144,25 @@ AC_PREFIX_DEFAULT(/usr) ################################################################################ dnl -- Setup the ownership of the files AC_MSG_CHECKING(file owner) -OWNER="" - AC_ARG_WITH(user, [ --with-user=USER Set the owner of installed files [[USER=]] ], [ OWNER="$withval" ]) AC_MSG_RESULT($OWNER) if test x$OWNER != x; then - OWNER="-o $OWNER" + INSTALL="$INSTALL -o $OWNER" fi ################################################################################ dnl -- Setup the group ownership of the files AC_MSG_CHECKING(group owner) -GROUP="" AC_ARG_WITH(group, [ --with-group=GROUP Set the group owner of installed files [[GROUP=]] ], [ GROUP="$withval" ]) AC_MSG_RESULT($GROUP) if test x$GROUP != x; then - GROUP="-g $GROUP" + INSTALL="$INSTALL -g $GROUP" fi ################################################################################ @@ -732,6 +729,12 @@ dnl -- Enable pkg-config AC_ARG_ENABLE(pkgconfig, [ --enable-pkgconfig Install pkgconfig support], PKGCONFIG=$enableval, PKGCONFIG=no) +################################################################################ +dnl -- Enable installation of writable files by user +AC_ARG_ENABLE(write_install, AC_HELP_STRING([--enable-write_install], + [Install user writable files]), + [WRITE_INSTALL=$enableval], [WRITE_INSTALL=no]) + ################################################################################ dnl -- Enable fsadm AC_MSG_CHECKING(whether to install fsadm) @@ -1080,7 +1083,6 @@ AC_SUBST(DM_IOCTLS) AC_SUBST(DM_LIB_VERSION) AC_SUBST(DM_LIB_PATCHLEVEL) AC_SUBST(FSADM) -AC_SUBST(GROUP) AC_SUBST(GULM_CFLAGS) AC_SUBST(GULM_LIBS) AC_SUBST(HAVE_LIBDL) @@ -1103,7 +1105,6 @@ AC_SUBST(LVM_RELEASE) AC_SUBST(LVM_RELEASE_DATE) AC_SUBST(MIRRORS) AC_SUBST(MSGFMT) -AC_SUBST(OWNER) AC_SUBST(PKGCONFIG) AC_SUBST(POOL) AC_SUBST(PTHREAD_LIBS) @@ -1121,6 +1122,7 @@ AC_SUBST(STATIC_LINK) AC_SUBST(UDEV_LIBS) AC_SUBST(UDEV_RULES) AC_SUBST(UDEV_SYNC) +AC_SUBST(WRITE_INSTALL) AC_SUBST(interface) AC_SUBST(kerneldir) AC_SUBST(missingkernel) diff --git a/daemons/clvmd/Makefile.in b/daemons/clvmd/Makefile.in index 773c3689d..ee19e6ceb 100644 --- a/daemons/clvmd/Makefile.in +++ b/daemons/clvmd/Makefile.in @@ -110,8 +110,7 @@ clvmd: $(OBJECTS) $(top_builddir)/lib/liblvm-internal.a .PHONY: install_clvmd install_clvmd: $(TARGETS) - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clvmd \ - $(usrsbindir)/clvmd + $(INSTALL_PROGRAM) -D clvmd $(usrsbindir)/clvmd install: $(INSTALL_TARGETS) diff --git a/daemons/cmirrord/Makefile.in b/daemons/cmirrord/Makefile.in index 583c4549d..0efc8d4af 100644 --- a/daemons/cmirrord/Makefile.in +++ b/daemons/cmirrord/Makefile.in @@ -1,5 +1,5 @@ # -# Copyright (C) 2009 Red Hat, Inc. All rights reserved. +# Copyright (C) 2009-2010 Red Hat, Inc. All rights reserved. # # This file is part of LVM2. # @@ -31,9 +31,8 @@ LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS) CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) cmirrord: $(OBJECTS) $(top_builddir)/lib/liblvm-internal.a - $(CC) $(CFLAGS) $(LDFLAGS) -o cmirrord $(OBJECTS) \ + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) \ $(LVMLIBS) $(LMLIBS) $(LIBS) install: $(TARGETS) - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) cmirrord \ - $(usrsbindir)/cmirrord + $(INSTALL_PROGRAM) -D cmirrord $(usrsbindir)/cmirrord diff --git a/daemons/dmeventd/Makefile.in b/daemons/dmeventd/Makefile.in index e0a634950..fb4f8f514 100644 --- a/daemons/dmeventd/Makefile.in +++ b/daemons/dmeventd/Makefile.in @@ -36,13 +36,7 @@ ifeq ("@STATIC_LINK@", "yes") endif LIB_VERSION = $(LIB_VERSION_DM) - -ifeq ("@LIB_SUFFIX@","dylib") - LIB_SHARED = $(LIB_NAME).dylib -else - LIB_SHARED = $(LIB_NAME).so - VERSIONED_SHLIB = $(LIB_SHARED).$(LIB_VERSION) -endif +LIB_SHARED = $(LIB_NAME).$(LIB_SUFFIX) CLEAN_TARGETS = dmeventd.static $(LIB_NAME).a @@ -61,11 +55,7 @@ device-mapper: $(TARGETS) LVMLIBS += -ldevmapper-event -ldevmapper $(PTHREAD_LIBS) -$(VERSIONED_SHLIB): $(LIB_SHARED) - $(RM) -f $@ - $(LN_S) $(LIB_SHARED) $@ - -dmeventd: $(LIB_SHARED) $(VERSIONED_SHLIB) dmeventd.o +dmeventd: $(LIB_SHARED) dmeventd.o $(CC) $(CFLAGS) $(LDFLAGS) -L. -o $@ dmeventd.o \ $(DL_LIBS) $(LVMLIBS) $(LIBS) -rdynamic @@ -86,32 +76,24 @@ CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES)) -include $(top_builddir)/daemons/dmeventd/plugins/mirror/$(LIB_NAME)-lvm2mirror.cflow endif -install_include: - $(INSTALL) -D $(OWNER) $(GROUP) -m 444 $(srcdir)/libdevmapper-event.h \ - $(includedir)/libdevmapper-event.h +install_include: $(srcdir)/libdevmapper-event.h + $(INSTALL_DATA) -D $< $(includedir)/$( $@ ;; \ esac -install_lvm2: - @echo "Installing $(MAN8) in $(MAN8DIR)" - @for f in $(MAN8); \ - do \ - $(RM) $(MAN8DIR)/$$f; \ - @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \ - done +install_man5: $(MAN5) + $(INSTALL) -d $(MAN5DIR) + $(INSTALL_DATA) $(MAN5) $(MAN5DIR)/ - @echo "Installing $(MAN5) in $(MAN5DIR)" - @for f in $(MAN5); \ - do \ - $(RM) $(MAN5DIR)/$$f; \ - @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN5DIR)/$$f; \ - done +install_man8: $(MAN8) + $(INSTALL) -d $(MAN8DIR) + $(INSTALL_DATA) $(MAN8) $(MAN8DIR)/ -install_cluster: - @echo "Installing $(MAN8CLUSTER) in $(MAN8DIR)" - @for f in $(MAN8CLUSTER); \ - do \ - $(RM) $(MAN8DIR)/$$f; \ - @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \ - done +install_lvm2: install_man5 install_man8 -install_device-mapper: - @echo "Installing $(MAN8DM) in $(MAN8DIR)" - @for f in $(MAN8DM); \ - do \ - $(RM) $(MAN8DIR)/$$f; \ - @INSTALL@ -D $(OWNER) $(GROUP) -m 444 $$f $(MAN8DIR)/$$f; \ - done +install_cluster: $(MAN8CLUSTER) + $(INSTALL) -d $(MAN8DIR) + $(INSTALL_DATA) $(MAN8CLUSTER) $(MAN8DIR)/ + +install_device-mapper: $(MAN8DM) + $(INSTALL) -d $(MAN8DIR) + $(INSTALL_DATA) $(MAN8DM) $(MAN8DIR)/ install: install_lvm2 install_device-mapper diff --git a/po/Makefile.in b/po/Makefile.in index 79bd34005..a4f57a68f 100644 --- a/po/Makefile.in +++ b/po/Makefile.in @@ -53,13 +53,13 @@ install: $(TARGETS) @echo Installing translation files in $(localedir) @( \ for lang in $(LANGS); do \ - $(INSTALL) -D $(OWNER) $(GROUP) -m 444 $$lang.mo \ + $(INSTALL_DATA) -D $$lang.mo \ $(localedir)/$$lang/LC_MESSAGES/lvm2.mo;\ done; \ ) @( \ for lang in $(LANGS); do \ - $(INSTALL) -D $(OWNER) $(GROUP) -m 444 $$lang.mo \ + $(INSTALL_DATA) -D $$lang.mo \ $(localedir)/$$lang/LC_MESSAGES/device-mapper.mo;\ done; \ ) diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 4b1ab7f33..b76e33926 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -1,5 +1,5 @@ # -# Copyright (C) 2006 Red Hat, Inc. All rights reserved. +# Copyright (C) 2006-2010 Red Hat, Inc. All rights reserved. # # This file is part of LVM2. # @@ -17,16 +17,18 @@ top_builddir = @top_builddir@ include $(top_builddir)/make.tmpl -install: - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(srcdir)/lvm_dump.sh \ - $(sbindir)/lvmdump - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(srcdir)/vgimportclone.sh \ - $(sbindir)/vgimportclone +SCRIPTS = lvm_dump.sh vgimportclone.sh ifeq ("@FSADM@", "yes") - $(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(srcdir)/fsadm.sh \ - $(sbindir)/fsadm + SCRIPTS += fsadm.sh endif -install_lvm2: install +vpath %.sh $(srcdir) + +%_install: %.sh + $(INSTALL_PROGRAM) -D $< $(sbindir)/$(basename $( /dev/null | \ egrep -v '^ *(|#.*|dumpconfig|formats|help|pvdata|segtypes|version) *$$' > .commands @@ -155,44 +159,37 @@ CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES)) -include $(top_builddir)/lib/liblvm-internal.cflow endif -.PHONY: install_cmdlib_dynamic install_cmdlib_static \ +.PHONY: install_cmdlib_dynamic install_cmdlib_static install_cmdlib_include \ install_tools_dynamic install_tools_static \ install_dmsetup_dynamic install_dmsetup_static +install_cmdlib_include: $(srcdir)/lvm2cmd.h + $(INSTALL_DATA) -D $< $(includedir)/$(