bug-libtool
[Top][All Lists]
Advanced

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

libtool and DESTDIR support


From: Steve M. Robbins
Subject: libtool and DESTDIR support
Date: Sat, 14 Sep 2002 15:11:08 -0400
User-agent: Mutt/1.4i

Hi,

Libtool's support for inter-library dependencies breaks if you
do "make install DESTDIR=...".  This is a particular problem when
making a binary package, e.g. deb or rpm.

Here's a new test case that demonstrates the problem, followed by a
patch that incorporates it into the test suite.  Finally, there is a
patch that fixes the problem, adapted from a patch by Sam Couter
[c.f. http://bugs.debian.org/57087].  All of this applies to current
CVS head.

I hope this is suitable for inclusion.  Let me know if I can
help testing or fixing in any way.

Thanks,
-Steve


-------------- tests/depdemo-destdir.test --------------------------

#! /bin/sh
# depdemo-inst.test - try installing from the ../depdemo subdirectory

# Test script header.
need_prefix=yes
if test -z "$srcdir"; then
  srcdir=`echo "$0" | sed 's%/[^/]*$%%'`
  test "$srcdir" = "$0" && srcdir=.
  test "${VERBOSE+set}" != "set" && VERBOSE=yes
fi
. $srcdir/defs || exit 1

# Check that things are built.
if test -f ../depdemo/depdemo; then :
else
  echo "You must run depdemo-make.test before $0" 1>&2
  exit 77
fi

# Change to our build directory.
cd ../depdemo || exit 1

echo "= Running $make install in ../depdemo"
rm -rf _staging
mkdir _staging || exit 1
if $make install DESTDIR=`pwd`/_staging; then :
else
  rm -rf _staging
  exit 1
fi

status=0

echo "= Checking for installed libraries"

for l in libl1.la libl2.la libl3.la libl4.la; do
  if test -f _staging/$prefix/lib/$l; then :
  else
    echo "$0: cannot find library _staging/$prefix/lib/$l" 1>&2
    status=1
  fi
done

rm -rf _staging
exit $status

--------------------------------------------------------------------


Index: tests/Makefile.am
===================================================================
RCS file: /home/cvs/libtool/tests/Makefile.am,v
retrieving revision 1.31
diff -u -b -B -r1.31 Makefile.am
--- tests/Makefile.am   31 Jul 2002 20:15:28 -0000      1.31
+++ tests/Makefile.am   14 Sep 2002 18:46:07 -0000
@@ -17,14 +17,14 @@
        demo-static.test demo-make.test demo-exec.test \
        demo-inst.test demo-unst.test \
        depdemo-static.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test depdemo-unst.test \
+       depdemo-exec.test depdemo-inst.test depdemo-destdir.test 
depdemo-unst.test \
        mdemo-static.test mdemo-make.test mdemo-exec.test \
        mdemo-inst.test mdemo-unst.test \
        cdemo-conf.test cdemo-make.test cdemo-exec.test \
        demo-conf.test demo-make.test demo-exec.test \
        demo-inst.test demo-unst.test deplibs.test \
        depdemo-conf.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test depdemo-unst.test \
+       depdemo-exec.test depdemo-inst.test depdemo-destdir.test 
depdemo-unst.test \
        mdemo-conf.test mdemo-make.test mdemo-exec.test \
        mdemo-inst.test mdemo-unst.test dryrun.test \
        demo-nofast.test demo-make.test demo-exec.test \
@@ -32,12 +32,12 @@
        demo-pic.test demo-make.test demo-exec.test \
        demo-nopic.test demo-make.test demo-exec.test \
        depdemo-nofast.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test depdemo-unst.test \
+       depdemo-exec.test depdemo-inst.test depdemo-destdir.test 
depdemo-unst.test \
        cdemo-shared.test cdemo-make.test cdemo-exec.test \
        demo-shared.test demo-make.test demo-exec.test demo-inst.test \
        hardcode.test build-relink.test noinst-link.test demo-unst.test \
        depdemo-shared.test depdemo-make.test \
-       depdemo-exec.test depdemo-inst.test build-relink2.test \
+       depdemo-exec.test depdemo-inst.test depdemo-destdir.test 
build-relink2.test \
        depdemo-unst.test \
        mdemo-shared.test mdemo-make.test mdemo-exec.test \
        mdemo-inst.test mdemo-unst.test \



Index: ltmain.in
===================================================================
RCS file: /home/cvs/libtool/ltmain.in,v
retrieving revision 1.300
diff -u -b -B -r1.300 ltmain.in
--- ltmain.in   9 Sep 2002 18:26:34 -0000       1.300
+++ ltmain.in   14 Sep 2002 15:03:15 -0000
@@ -2253,7 +2253,11 @@
              add="-l$name"
            else
              # We cannot seem to hardcode it, guess we'll fake it.
+             if test "X$installed" = Xyes; then
              add_dir="-L$libdir"
+             else
+               add_dir="-L$DESTDIR$libdir"
+             fi
              add="-l$name"
            fi
 
@@ -4703,12 +4707,20 @@
        esac
 
        # Add the libdir to current_libdirs if it is the destination.
+       DESTDIR=
        if test "X$destdir" = "X$libdir"; then
          case "$current_libdirs " in
          *" $libdir "*) ;;
          *) current_libdirs="$current_libdirs $libdir" ;;
          esac
        else
+         case "$destdir" in
+           *"$libdir")
+           DESTDIR=`$echo "$destdir" | sed -e 's!'"$libdir"'$!!'`
+           if test "X$destdir" != "X$DESTDIR$libdir"; then
+             DESTDIR=
+           fi
+         esac
          # Note the libdir as a future libdir.
          case "$future_libdirs " in
          *" $libdir "*) ;;
@@ -4722,6 +4734,7 @@
 
        if test -n "$relink_command"; then
          $echo "$modename: warning: relinking \`$file'" 1>&2
+         export DESTDIR
          $show "$relink_command"
          if $run eval "$relink_command"; then :
          else
@@ -4729,6 +4742,7 @@
            continue
          fi
        fi
+        unset DESTDIR
 
        # See the names of the shared library.
        set dummy $library_names


-Steve




reply via email to

[Prev in Thread] Current Thread [Next in Thread]