diff options
-rw-r--r-- | mk/buildlink3/bsd.buildlink3.mk | 5 | ||||
-rw-r--r-- | mk/buildlink3/libtool-fix-la | 59 | ||||
-rw-r--r-- | mk/buildlink3/libtool-post-cache | 17 | ||||
-rw-r--r-- | mk/buildlink3/libtool-post-logic | 30 | ||||
-rw-r--r-- | mk/buildlink3/libtool.sh | 5 |
5 files changed, 76 insertions, 40 deletions
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk index 5c1be922ddf..5191152bb61 100644 --- a/mk/buildlink3/bsd.buildlink3.mk +++ b/mk/buildlink3/bsd.buildlink3.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.buildlink3.mk,v 1.133 2004/03/29 06:05:10 jlam Exp $ +# $NetBSD: bsd.buildlink3.mk,v 1.134 2004/03/30 17:25:19 jlam Exp $ # # An example package buildlink3.mk file: # @@ -1377,9 +1377,12 @@ _BLNK_WRAPPER_TRANSFORM_SED.${_wrappee_}= \ -e "s|@BUILDLINK_SHELL@|${BUILDLINK_SHELL}|g" \ -e "s|@WRKDIR@|${WRKDIR}|g" \ -e "s|@WRKSRC@|${WRKSRC}|g" \ + -e "s|@BASENAME@|${BASENAME:Q}|g" \ -e "s|@CAT@|${CAT:Q}|g" \ + -e "s|@DIRNAME@|${DIRNAME:Q}|g" \ -e "s|@ECHO@|${ECHO:Q}|g" \ -e "s|@EXPR@|${EXPR:Q}|g" \ + -e "s|@PWD_CMD@|${PWD_CMD:Q}|g" \ -e "s|@SED@|${SED:Q}|g" \ -e "s|@TEST@|${TEST:Q}|g" \ -e "s|@TOUCH@|${TOUCH:Q}|g" \ diff --git a/mk/buildlink3/libtool-fix-la b/mk/buildlink3/libtool-fix-la index 86d5ef6baa6..58b222f6afb 100644 --- a/mk/buildlink3/libtool-fix-la +++ b/mk/buildlink3/libtool-fix-la @@ -1,4 +1,4 @@ -# $NetBSD: libtool-fix-la,v 1.3 2004/03/13 03:41:13 uebayasi Exp $ +# $NetBSD: libtool-fix-la,v 1.4 2004/03/30 17:25:19 jlam Exp $ # # For *.la files, in the "relink_command" line, we make the following # replacements: @@ -129,37 +129,36 @@ if $test -f $lafile; then ;; esac done - if $test -z "$deps" && $test -z "$relink" || \ - @EGREP@ "^#.*modified by buildlink3" $lafile >/dev/null 2>&1; then - : + # + # Save the orignal .la file produced by libtool as + # .la.blsav, and create the new one with a signature. + # + @MV@ -f $lafile ${lafile}.blsav + if $test -n "$deps"; then + ( + $cat ${lafile}.blsav | @SED@ -e '/^dependency_libs=/,$d' + $echo "dependency_libs='$deps'" + $cat ${lafile}.blsav | @SED@ -e '1,/^dependency_libs=/d' + ) > ${lafile}.tmp else - # Save the orignal .la file produced by libtool as - # .la.blsav, and create the new one with a signature. - # - @MV@ -f $lafile ${lafile}.blsav - if $test -n "$deps"; then - ( - $cat ${lafile}.blsav | @SED@ -e '/^dependency_libs=/,$d' - $echo "dependency_libs='$deps'" - $cat ${lafile}.blsav | @SED@ -e '1,/^dependency_libs=/d' - ) > ${lafile}.tmp - else - $cat ${lafile}.blsav > ${lafile}.tmp - fi - if $test -n "$relink"; then - ( - $cat ${lafile}.tmp | @SED@ -e '/^relink_command=/,$d' - $echo "relink_command='$relink'" - $cat ${lafile}.tmp | @SED@ -e '1,/^relink_command=/d' - ) > $lafile - else - $cat ${lafile}.tmp > $lafile - fi - $echo >> $lafile - $echo "# This file has been modified by buildlink3." >> $lafile - @RM@ ${lafile}.tmp - $echo "==> Fixed $lafile" >> $wrapperlog + $cat ${lafile}.blsav > ${lafile}.tmp + fi + if $test -n "$relink"; then + ( + $cat ${lafile}.tmp | @SED@ -e '/^relink_command=/,$d' + $echo "relink_command='$relink'" + $cat ${lafile}.tmp | @SED@ -e '1,/^relink_command=/d' + ) > $lafile + else + $cat ${lafile}.tmp > $lafile fi + $echo >> $lafile + $echo "# Directory that this library was built in:" >> $lafile + $echo "buildlibdir='"`cd .; $pwd`"'" >> $lafile + $echo >> $lafile + $echo "# This file has been modified by buildlink3." >> $lafile + @RM@ ${lafile}.tmp + $echo "==> Fixed $lafile" >> $wrapperlog # # Fix up any .lai files (libtool archives that will be installed). # diff --git a/mk/buildlink3/libtool-post-cache b/mk/buildlink3/libtool-post-cache index ebb93ec9f42..395267c3be7 100644 --- a/mk/buildlink3/libtool-post-cache +++ b/mk/buildlink3/libtool-post-cache @@ -1,12 +1,19 @@ -# $NetBSD: libtool-post-cache,v 1.2 2003/09/02 06:59:57 jlam Exp $ +# $NetBSD: libtool-post-cache,v 1.3 2004/03/30 17:25:19 jlam Exp $ # # This file implements the default action of the "libtool" private -# cache, and tells the libtool wrapper to skip the common cache lookup -# for all directories and library args that may reference a locally -# linked libtool archive; the appropriate action will be taken instead -# by libtool-post-logic. +# cache. +# Skip the common cache lookup for all directories and library args that +# may reference a locally-linked libtool archive. +# -L.|-L./*|-L..*|-L[!/]*|-L${WRKSRC}*|-l*) skipcache=yes ;; + +# Skip the common cache lookup for all libtool archives that reference a +# locally-linked libtool archive. +# +./*.la|../*.la|[!/]*.la|${WRKSRC}/*.la) + skipcache=yes + ;; esac diff --git a/mk/buildlink3/libtool-post-logic b/mk/buildlink3/libtool-post-logic index df6d5761686..73501e41e54 100644 --- a/mk/buildlink3/libtool-post-logic +++ b/mk/buildlink3/libtool-post-logic @@ -1,4 +1,6 @@ -# $NetBSD: libtool-post-logic,v 1.3 2003/09/19 22:49:22 jlam Exp $ +# $NetBSD: libtool-post-logic,v 1.4 2004/03/30 17:25:19 jlam Exp $ + +case $arg in # # Workaround software authors that don't follow the libtool # documentation and link against uninstalled libtool archives with: @@ -13,8 +15,7 @@ # directories that are mentioned in -L* arguments to to libtool # wrapper, and checking to see if <dir>/libfoo.la exists when we see # "-lfoo" on the libtool command line. - -case $arg in +# -L.|-L./*|-L..*|-L[!/]*|-L${WRKSRC}*) case $fixlibpath in yes) @@ -44,6 +45,11 @@ case $arg in for dir in $rellpath; do la="$dir/lib$lib.la" if $test -f "$la"; then + ldir=`cd $dir; $pwd` + buildlibdir=`. $la; $echo $buildlibdir` + if $test "$ldir" != "$buildlibdir"; then + la="$buildlibdir/lib$lib.la" + fi $echo "*** [buildlink3] Warning: libtool replaced $arg with $la" >> $wrapperlog $echo "*** [buildlink3] Warning: libtool replaced $arg with $la" 1>&2 arg="$la" @@ -55,4 +61,22 @@ case $arg in esac addtoprivatecache=yes ;; + +# Replace all references to locally-linked libtool archives with the full +# paths to the archives in $buildlibdir if $buildlibdir differs from the +# referenced directory. This makes linking against a symlinked local +# libtool archive possible. +# +./*.la|../*.la|[!/]*.la|${WRKSRC}/*.la) + labase=`$basename $arg` + ladir=`$dirname $arg` + ldir=`cd $ladir; $pwd` + buildlibdir=`. $ladir/$labase; $echo $buildlibdir` + if $test "$ldir" != "$buildlibdir"; then + arg="$buildlibdir/$labase" + $echo "*** [buildlink3] Warning: libtool replaced $ladir/$labase with $arg" >> $wrapperlog + $echo "*** [buildlink3] Warning: libtool replaced $ladir/$labase with $arg" 1>&2 + fi + addtoprivatecache=yes + ;; esac diff --git a/mk/buildlink3/libtool.sh b/mk/buildlink3/libtool.sh index 69db002a346..60f070bcfa6 100644 --- a/mk/buildlink3/libtool.sh +++ b/mk/buildlink3/libtool.sh @@ -1,6 +1,6 @@ #!@BUILDLINK_SHELL@ # -# $NetBSD: libtool.sh,v 1.16 2004/03/13 03:41:13 uebayasi Exp $ +# $NetBSD: libtool.sh,v 1.17 2004/03/30 17:25:19 jlam Exp $ Xsed='@SED@ -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' @@ -30,9 +30,12 @@ updatecache="${BUILDLINK_UPDATE_CACHE-yes}" cacheall="${BUILDLINK_CACHE_ALL-no}" reorder="${BUILDLINK_REORDER-no}" +basename="@BASENAME@" cat="@CAT@" +dirname="@DIRNAME@" echo="@ECHO@" expr="@EXPR@" +pwd="@PWD_CMD@" test="@TEST@" BUILDLINK_DIR="@BUILDLINK_DIR@" |