diff options
Diffstat (limited to 'build')
-rwxr-xr-x | build/install.sh | 76 | ||||
-rwxr-xr-x | build/instdso.sh | 34 | ||||
-rw-r--r-- | build/special.mk | 4 |
3 files changed, 64 insertions, 50 deletions
diff --git a/build/install.sh b/build/install.sh index c5d20dac6b..21bc16c2d2 100755 --- a/build/install.sh +++ b/build/install.sh @@ -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 diff --git a/build/instdso.sh b/build/instdso.sh index 3ca52722c3..405b304c9a 100755 --- a/build/instdso.sh +++ b/build/instdso.sh @@ -24,18 +24,19 @@ # 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 diff --git a/build/special.mk b/build/special.mk index 38e7a864fd..66c9c7c8ce 100644 --- a/build/special.mk +++ b/build/special.mk @@ -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: |