f0f05619c5
.transform.sed and .untransform.sed that are generated by a new gen-transform.sh shell script. This avoids all of the silliness with exceeding the length of the value of a make variable that brought about breaking the original _BLNK_TRANSFORM_SED into _BLNK_TRANSFORM_SED.[1-4]. It's also vastly easier to understand the gen-transform.sh script as opposed to the juxtaposition of make and sed regular expressions, a.k.a. massive eyesores, that were in bsd.buildlink.mk. Also fix the directory protection scheme so that it might actually work if the pkgsrc directory is a subdirectory of /usr/pkg (${LOCALBASE}). Lastly, filter out /usr/X11R6 (${X11BASE}) if the package doesn't define USE_X11. This should catch packages that use X11 without announcing it, and avoids one way you can circumvent buildlink2.
181 lines
3.7 KiB
Text
181 lines
3.7 KiB
Text
# $NetBSD: libtool-fix-la,v 1.12 2002/10/30 00:23:00 jlam Exp $
|
|
#
|
|
# For *.la files, in the "relink_command" line, we make the following
|
|
# replacements:
|
|
#
|
|
# "libfoo.la" -> "-L./.libs libfoo.la"
|
|
# "dirpath/libfoo.la" -> "-Ldirpath/.libs libfoo.la"
|
|
#
|
|
# This allows the libraries to be found within ${WRKSRC} during relinking.
|
|
# We rely on the proper rpath settings to be set by libtool.
|
|
#
|
|
# For the *.lai files, in the "dependency_libs" line, we remove redundant
|
|
# -Ldir and -llib options.
|
|
|
|
labase=`@BASENAME@ $lafile .la`
|
|
ladir=`@DIRNAME@ $lafile`
|
|
latimestamp=${ladir}/.${labase}.la.timestamp
|
|
laifile=${ladir}/.libs/${labase}.lai
|
|
if [ -f $lafile ]; then
|
|
. ${ladir}/${labase}.la
|
|
|
|
deps=
|
|
for i in ${dependency_libs}; do
|
|
case "$i" in
|
|
-L*)
|
|
case "$deps" in
|
|
*"$i "*) ;;
|
|
*"$i") ;;
|
|
*) deps="${deps} $i" ;;
|
|
esac
|
|
;;
|
|
*.la)
|
|
fixla=0
|
|
ltlibsdir=`@DIRNAME@ $i`/.libs
|
|
case "$ltlibsdir" in
|
|
/*)
|
|
# fix if an absolute path in ${WRKSRC}
|
|
case "$ltlibsdir" in
|
|
@WRKSRC@/*) fixla=1 ;;
|
|
esac
|
|
;;
|
|
*)
|
|
# fix all relative paths
|
|
fixla=1
|
|
;;
|
|
esac
|
|
if [ $fixla -gt 0 ]; then
|
|
case "$deps" in
|
|
*"-L$ltlibsdir "*) ;;
|
|
*"-L$ltlibsdir") ;;
|
|
*) deps="$deps -L$ltlibsdir" ;;
|
|
esac
|
|
fi
|
|
deps="${deps} $i"
|
|
;;
|
|
*)
|
|
deps="${deps} $i"
|
|
;;
|
|
esac
|
|
done
|
|
|
|
relink=
|
|
for i in ${relink_command}; do
|
|
case "$i" in
|
|
-I*|-D*)
|
|
;;
|
|
-L*)
|
|
case "$relink" in
|
|
*"$i "*) ;;
|
|
*"$i") ;;
|
|
*) relink="${relink} $i" ;;
|
|
esac
|
|
;;
|
|
$lafile)
|
|
relink="${relink} $i"
|
|
;;
|
|
*.la)
|
|
fixla=0
|
|
ltlibsdir=`@DIRNAME@ $i`/.libs
|
|
case "$ltlibsdir" in
|
|
/*)
|
|
# fix if an absolute path in ${WRKSRC}
|
|
case "$ltlibsdir" in
|
|
@WRKSRC@/*) fixla=1 ;;
|
|
esac
|
|
;;
|
|
*)
|
|
# fix all relative paths
|
|
fixla=1
|
|
;;
|
|
esac
|
|
if [ $fixla -gt 0 ]; then
|
|
case "$relink" in
|
|
*"-L$ltlibsdir "*) ;;
|
|
*"-L$ltlibsdir") ;;
|
|
*) relink="$relink -L$ltlibsdir" ;;
|
|
esac
|
|
fi
|
|
relink="${relink} $i"
|
|
;;
|
|
*)
|
|
relink="${relink} $i"
|
|
;;
|
|
esac
|
|
done
|
|
if [ -n "$deps" -o -n "$relink" ] && \
|
|
! @EGREP@ "^#.*modified by buildlink2" $lafile >/dev/null 2>&1; then
|
|
@MV@ -f $lafile ${lafile}.blsav
|
|
if [ -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 [ -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 buildlink2." >> $lafile
|
|
@RM@ ${lafile}.tmp
|
|
@ECHO@ "==> Fixed $lafile" >> $wrapperlog
|
|
fi
|
|
if [ -n "$laifile" ] && [ -f "$laifile" ] && \
|
|
! @EGREP@ "^#.*modified by buildlink2" $laifile >/dev/null 2>&1; then
|
|
@SED@ @_BLNK_WRAP_LT_UNTRANSFORM_SED@ \
|
|
@_BLNK_UNTRANSFORM_SED@ \
|
|
$laifile > ${laifile}.tmp
|
|
. ${laifile}.tmp
|
|
L=; l=; lexist=; prev=
|
|
for i in ${dependency_libs}; do
|
|
case "$i" in
|
|
$prev)
|
|
;;
|
|
-L*)
|
|
case "$i" in
|
|
-L@WRKSRC@/*)
|
|
;;
|
|
*)
|
|
case "$L" in
|
|
*"$i "*) ;;
|
|
*"$i") ;;
|
|
*) L="$L $i" ;;
|
|
esac
|
|
;;
|
|
esac
|
|
;;
|
|
-l*)
|
|
lexist=1
|
|
l="$l $i"
|
|
;;
|
|
*)
|
|
l="$l $i"
|
|
;;
|
|
esac
|
|
prev="$i"
|
|
done
|
|
if [ -z "$lexist" ]; then
|
|
L=
|
|
fi
|
|
deps="$L$l"
|
|
@MV@ -f $laifile ${laifile}.blsav
|
|
(
|
|
@CAT@ ${laifile}.tmp | @SED@ -e '/^dependency_libs=/,$d'
|
|
@ECHO@ "dependency_libs='$deps'"
|
|
@CAT@ ${laifile}.tmp | @SED@ -e '1,/^dependency_libs=/d'
|
|
@ECHO@
|
|
@ECHO@ "# This file has been modified by buildlink2."
|
|
) > ${laifile}
|
|
@RM@ -f ${laifile}.tmp
|
|
@ECHO@ "==> Fixed $laifile" >> $wrapperlog
|
|
fi
|
|
fi
|