]> granicus.if.org Git - apache/commitdiff
Install multiple files per install.sh invocation
authorStefan Fritsch <sf@apache.org>
Sun, 29 Jan 2012 20:11:55 +0000 (20:11 +0000)
committerStefan Fritsch <sf@apache.org>
Sun, 29 Jan 2012 20:11:55 +0000 (20:11 +0000)
Libtool and BSD install support installing several files in one run.
Add support to install.sh and instdso.sh, too.
Replace for-loops in the Makefiles.

This reduces 'make install' time by approx. 50% because we save
lots of calls to the huge libtool shell script.

The AIX-specific magic in instdso.sh could use some testing.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1237447 13f79535-47bb-0310-9956-ffa450edef68

Makefile.in
build/install.sh
build/instdso.sh
build/special.mk

index 39a1b2e11a874635eb2c5ba31c51a78317065b7e..31a59fc1319c2b77ef996196fce05bd9e488af5f 100644 (file)
@@ -102,16 +102,14 @@ build/config_vars.out: build/config_vars.mk
        @$(SHELL) build/config_vars.sh < build/config_vars.mk > build/config_vars.out
 
 install-build: build/config_vars.out
-       @echo Installing build system files 
-       @$(MKINSTALLDIRS) $(DESTDIR)$(installbuilddir) 
-       @for f in $(top_srcdir)/build/*.mk build/*.mk; do \
-        $(INSTALL_DATA) $$f $(DESTDIR)$(installbuilddir); \
-       done
-       @for f in $(top_builddir)/config.nice \
-                 $(top_srcdir)/build/mkdir.sh \
-                 $(top_srcdir)/build/instdso.sh; do \
-        $(INSTALL_PROGRAM) $$f $(DESTDIR)$(installbuilddir); \
-       done
+       @echo Installing build system files
+       @$(MKINSTALLDIRS) $(DESTDIR)$(installbuilddir)
+       @$(INSTALL_DATA) $(top_srcdir)/build/*.mk build/*.mk \
+               $(DESTDIR)$(installbuilddir)
+       @$(INSTALL_PROGRAM) $(top_builddir)/config.nice \
+               $(top_srcdir)/build/mkdir.sh \
+               $(top_srcdir)/build/instdso.sh \
+               $(DESTDIR)$(installbuilddir)
        @$(INSTALL_DATA) build/config_vars.out $(DESTDIR)$(installbuilddir)/config_vars.mk
        @rm build/config_vars.out
 
@@ -218,9 +216,7 @@ INSTALL_HEADERS = \
 install-include:
        @echo Installing header files
        @$(MKINSTALLDIRS) $(DESTDIR)$(includedir)
-       @for hdr in $(INSTALL_HEADERS); do \
-         $(INSTALL_DATA) $$hdr $(DESTDIR)$(includedir); \
-       done
+       @$(INSTALL_DATA) $(INSTALL_HEADERS) $(DESTDIR)$(includedir)
 
 install-man:
        @echo Installing man pages and online manual
index c5d20dac6b9165e63c6c68576be45fe04e104a1a..21bc16c2d2093b200d2e648d9509cc879e88b11a 100755 (executable)
@@ -71,53 +71,57 @@ while [ "x$1" != "x" ]; do
         -e) ext="$2"
             shift; shift; continue
             ;;
-        *)  if [ "x$src" = "x" ]; then
-                src=$1
-            else
-                dst=$1
-            fi
-            shift; continue
+        *)  break
             ;;
     esac
 done
-if [ "x$src" = "x" ]; then
-     echo "install.sh: no input file specified"
-     exit 1
+if test $# -eq 0 ; then
+    echo "install.sh: no input file(s) specified"
+    exit 1
 fi
-if [ "x$dst" = "x" ]; then
-     echo "install.sh: no destination specified"
-     exit 1
+if test $# -eq 1 ; then
+    echo "install.sh: no destination specified"
+    exit 1
 fi
+for arg ; do
+    dstarg="$arg"
+done
 
-#
-#  If destination is a directory, append the input filename; if
-#  your system does not like double slashes in filenames, you may
-#  need to add some logic
-#
-if [ -d $dst ]; then
-    dst="$dst/`basename $src`"
-fi
+while test $# -gt 1 ; do
+    dst="$dstarg"
+    src="$1"
+    shift
+    #
+    #  If destination is a directory, append the input filename; if
+    #  your system does not like double slashes in filenames, you may
+    #  need to add some logic
+    #
+    if [ -d $dst ]; then
+        dst="$dst/`basename $src`"
+    fi
+
+    #  Add a possible extension (such as ".exe") to src and dst
+    src="$src$ext"
+    dst="$dst$ext"
 
-#  Add a possible extension (such as ".exe") to src and dst
-src="$src$ext"
-dst="$dst$ext"
+    #  Make a temp file name in the proper directory.
+    dstdir=`dirname $dst`
+    dsttmp=$dstdir/#inst.$$#
 
-#  Make a temp file name in the proper directory.
-dstdir=`dirname $dst`
-dsttmp=$dstdir/#inst.$$#
+    #  Move or copy the file name to the temp name
+    $instcmd $src $dsttmp
 
-#  Move or copy the file name to the temp name
-$instcmd $src $dsttmp
+    #  And set any options; do chmod last to preserve setuid bits
+    if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
+    if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
+    if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
+    if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
 
-#  And set any options; do chmod last to preserve setuid bits
-if [ "x$chowncmd" != "x" ]; then $chowncmd $dsttmp; fi
-if [ "x$chgrpcmd" != "x" ]; then $chgrpcmd $dsttmp; fi
-if [ "x$stripcmd" != "x" ]; then $stripcmd $dsttmp; fi
-if [ "x$chmodcmd" != "x" ]; then $chmodcmd $dsttmp; fi
+    #  Now rename the file to the real destination.
+    $rmcmd $dst
+    $mvcmd $dsttmp $dst
 
-#  Now rename the file to the real destination.
-$rmcmd $dst
-$mvcmd $dsttmp $dst
+done
 
 exit 0
 
index 3ca52722c3f57b900999b0abcd2de41a49050db4..405b304c9a770b8027d50c8a16916d08e459c08e 100755 (executable)
 # 2) we never want the .la files copied, so we might as well copy
 #    the .so files ourselves
 
-if test "$#" != "3"; then
-    echo "wrong number of arguments to instdso.sh"
-    echo "Usage: instdso.sh SH_LIBTOOL-value dso-name path-to-modules"
+if test "$#" -lt "3"; then
+    echo "too few arguments to instdso.sh"
+    echo "Usage: instdso.sh SH_LIBTOOL-value dso-name [dso-name [...]] path-to-modules"
     exit 1
 fi
 
 SH_LIBTOOL=`echo $1 | sed -e 's/^SH_LIBTOOL=//'`
-DSOARCHIVE=$2
-DSOARCHIVE_BASENAME=`basename $2`
-TARGETDIR=$3
-DSOBASE=`echo $DSOARCHIVE_BASENAME | sed -e 's/\.la$//'`
-TARGET_NAME="$DSOBASE.so"
+shift
+# get last arg
+for arg ; do
+    DSOARCHIVES="$DSOARCHIVES $TARGETDIR"
+    TARGETDIR=$arg
+done
 
 SYS=`uname -s`
 
@@ -44,7 +45,11 @@ then
     # on AIX, shared libraries remain in storage even when
     # all processes using them have exited; standard practice
     # prior to installing a shared library is to rm -f first
-    CMD="rm -f $TARGETDIR/$TARGET_NAME"
+    CMD="rm -f"
+    for DSOARCHIVE in $DSOARCHIVES ; do
+        DSOBASE=`basename $DSOARCHIVE|sed -e 's/\.la$//'`
+        CMD="$CMD $TARGETDIR/$DSOBASE.so"
+    done
     echo $CMD
     $CMD || exit $?
 fi
@@ -58,7 +63,7 @@ case $SYS in
         ;;
 esac
 
-CMD="$SH_LIBTOOL --mode=install $INSTALL_CMD $DSOARCHIVE $TARGETDIR/"
+CMD="$SH_LIBTOOL --mode=install $INSTALL_CMD $DSOARCHIVES $TARGETDIR/"
 echo $CMD
 $CMD || exit $?
 
@@ -70,6 +75,11 @@ then
     exit 0
 fi
 
+for DSOARCHIVE in $DSOARCHIVES ; do
+DSOARCHIVE_BASENAME=`basename $DSOARCHIVE`
+DSOBASE=`echo $DSOARCHIVE_BASENAME | sed -e 's/\.la$//'`
+TARGET_NAME="$DSOBASE.so"
+
 if test -s "$TARGETDIR/$DSOARCHIVE_BASENAME"
 then
   DLNAME=`sed -n "/^dlname=/{s/.*='\([^']*\)'/\1/;p;}" $TARGETDIR/$DSOARCHIVE_BASENAME`
@@ -81,7 +91,7 @@ if test -z "$DLNAME"
 then
   echo "Warning!  dlname not found in $TARGETDIR/$DSOARCHIVE_BASENAME."
   echo "Assuming installing a .so rather than a libtool archive."
-  exit 0
+  continue
 fi
 
 if test -n "$LIBRARY_NAMES"
@@ -102,4 +112,6 @@ rm -f $TARGETDIR/$DSOBASE.a
 rm -f $TARGETDIR/lib$DSOBASE.a
 rm -f $TARGETDIR/lib$TARGET_NAME
 
+done
+
 exit 0
index 38e7a864fd5c4b3305277d2b4fa3a5f2c1c2843e..66c9c7c8cea29aec09a56b1e2aa05b375e60384b 100644 (file)
@@ -28,9 +28,7 @@ include $(top_builddir)/build/rules.mk
 
 install-modules-yes: $(SHARED_TARGETS)
        @$(MKINSTALLDIRS) $(DESTDIR)$(libexecdir)
-       @list='$(shared)'; for i in $$list; do \
-         $(top_srcdir)/build/instdso.sh SH_LIBTOOL='$(SH_LIBTOOL)' $$i $(DESTDIR)$(libexecdir); \
-       done
+       @$(top_srcdir)/build/instdso.sh SH_LIBTOOL='$(SH_LIBTOOL)' $(shared) $(DESTDIR)$(libexecdir)
 
 install-modules-no: