[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Supporting separate build roots
From: |
David Kaelbling |
Subject: |
Supporting separate build roots |
Date: |
Thu, 11 Apr 2002 15:27:06 -0400 |
SGI's internal build system has a feature that I really wish libtool
would support (or at least not break) -- building in a separate ROOT
environment. The idea is somewhat like doing "chroot $ROOT" before
starting a build -- all the headers, libraries, etc. live in a separate
tree, and by proper use of -nostdinc and -nostdlib only those files are
used. Whatever you have actually installed under /usr/ is immaterial.
This makes it a lot easier to get clean, reproducible builds.
Unfortunately libtool doesn't deal with this setup well. There are two
problems, both related to dependent libraries. libtool like to store
the absolute path to any dependent library. But if that path includes
$ROOT it's almost always meaningless off the build system. Second
libtool doesn't know to insert $ROOT into paths it is generating.
I have attached some diffs that make libtool 1.4a (at least the version
used by KDE 2.2) honor $ROOT properly. The code is slightly wrong in
that if a library is missing from $ROOT it will still find it in /usr,
but that seemed like the simplest work-around for finding uninstalled
helper libraries.
David
--
David KAELBLING <address@hidden> Silicon Graphics Computer Systems
1 Cabot Rd, suite 250; Hudson, MA 01749 781.839.2157, fax ...2357
--- ./admin/ltmain.sh Sat May 19 03:19:10 2001
+++ ../kdebase-2.2.2/./admin/ltmain.sh Tue Apr 2 14:32:37 2002
@@ -61,7 +61,7 @@
default_mode=
help="Try \`$progname --help' for more information."
magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
+mkdir="mkdir -p"
mv="mv -f"
rm="rm -f"
@@ -1838,6 +1838,18 @@
*) . ./$lib ;;
esac
+ if test -n "${ROOT}"; then
+ tmp_dependency_libs=
+ for deplib in $dependency_libs; do
+ case $deplib in
+ /*) if test -r $ROOT$deplib; then deplib="$ROOT$deplib"; fi;;
+ -L*) deplib=`echo "$deplib" | sed -e "s:-L/:-L${ROOT}/:g"`;;
+ esac
+ tmp_dependency_libs="$tmp_dependency_libs $deplib"
+ done
+ dependency_libs="$tmp_dependency_libs"
+ fi
+
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test $linkmode != prog && test $linkmode != lib; }; then
@@ -1915,7 +1927,7 @@
# Find the relevant object directory and library name.
if test "X$installed" = Xyes; then
- if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ if test ! -f "${ROOT}$libdir/$linklib" && test -f
"$abs_ladir/$linklib"; then
$echo "$modename: warning: library \`$lib' was moved." 1>&2
dir="$ladir"
absdir="$abs_ladir"
@@ -2138,7 +2150,11 @@
case $hardcode_action in
immediate | unsupported)
if test "$hardcode_direct" = no; then
- add="$dir/$linklib"
+ if test "$installed" = yes; then
+ add="${ROOT}$dir/$linklib"
+ else
+ add="$dir/$linklib"
+ fi
elif test "$hardcode_minus_L" = no; then
case $host in
*-*-sunos*) add_shlibpath="$dir" ;;
@@ -2317,7 +2333,7 @@
$echo "$modename: \`$deplib' is not a valid libtool
archive" 1>&2
exit 1
fi
- if test "$absdir" != "$libdir"; then
+ if test "$absdir" != "${ROOT}$libdir"; then
$echo "$modename: warning: \`$deplib' seems to be moved"
1>&2
fi
path="-L$absdir"
@@ -4313,6 +4329,13 @@
case $host,$output,$installed,$module,$dlname in
*cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
+
+ if test -n "${ROOT}"; then
+ tmp_dependency_libs=`echo ' ' $dependency_libs | sed -e "s:
${ROOT}: :g" -e "s:-L${ROOT}:-L:g"`
+ else
+ tmp_dependency_libs="$dependency_libs"
+ fi
+
$echo > $output "\
# $outputname - a libtool library file
# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
@@ -4330,7 +4353,7 @@
old_library='$old_library'
# Libraries that this one depends upon.
-dependency_libs='$dependency_libs'
+dependency_libs='$tmp_dependency_libs'
# Version information for $libname.
current=$current
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Supporting separate build roots,
David Kaelbling <=