head	1.23;
access;
symbols
	pkgsrc-2013Q2:1.23.0.50
	pkgsrc-2013Q2-base:1.23
	pkgsrc-2012Q4:1.23.0.48
	pkgsrc-2012Q4-base:1.23
	pkgsrc-2011Q4:1.23.0.46
	pkgsrc-2011Q4-base:1.23
	pkgsrc-2011Q2:1.23.0.44
	pkgsrc-2011Q2-base:1.23
	pkgsrc-2009Q4:1.23.0.42
	pkgsrc-2009Q4-base:1.23
	pkgsrc-2008Q4:1.23.0.40
	pkgsrc-2008Q4-base:1.23
	pkgsrc-2008Q3:1.23.0.38
	pkgsrc-2008Q3-base:1.23
	cube-native-xorg:1.23.0.36
	cube-native-xorg-base:1.23
	pkgsrc-2008Q2:1.23.0.34
	pkgsrc-2008Q2-base:1.23
	pkgsrc-2008Q1:1.23.0.32
	pkgsrc-2008Q1-base:1.23
	pkgsrc-2007Q4:1.23.0.30
	pkgsrc-2007Q4-base:1.23
	pkgsrc-2007Q3:1.23.0.28
	pkgsrc-2007Q3-base:1.23
	pkgsrc-2007Q2:1.23.0.26
	pkgsrc-2007Q2-base:1.23
	pkgsrc-2007Q1:1.23.0.24
	pkgsrc-2007Q1-base:1.23
	jlam-pkgviews:1.23.0.22
	jlam-pkgviews-base:1.23
	pkgsrc-2006Q4:1.23.0.20
	pkgsrc-2006Q4-base:1.23
	pkgsrc-2006Q3:1.23.0.18
	pkgsrc-2006Q3-base:1.23
	pkgsrc-2006Q2:1.23.0.16
	pkgsrc-2006Q2-base:1.23
	pkgsrc-2006Q1:1.23.0.14
	pkgsrc-2006Q1-base:1.23
	pkgsrc-2005Q4:1.23.0.12
	pkgsrc-2005Q4-base:1.23
	pkgsrc-2005Q3:1.23.0.10
	pkgsrc-2005Q3-base:1.23
	pkgsrc-2005Q2:1.23.0.8
	pkgsrc-2005Q2-base:1.23
	pkgsrc-2005Q1:1.23.0.6
	pkgsrc-2005Q1-base:1.23
	pkgsrc-2004Q4:1.23.0.4
	pkgsrc-2004Q4-base:1.23
	pkgsrc-2004Q3:1.23.0.2
	pkgsrc-2004Q3-base:1.23
	pkgsrc-2004Q2:1.22.0.6
	pkgsrc-2004Q2-base:1.22
	pkgsrc-2004Q1:1.22.0.4
	pkgsrc-2004Q1-base:1.22
	pkgsrc-2003Q4:1.22.0.2
	pkgsrc-2003Q4-base:1.22
	pkgviews-base:1.18
	pkgviews-mk:1.18.0.6
	pkgviews:1.18.0.4
	pkgviews-mk-base:1.21
	netbsd-1-6-1:1.18.0.2
	netbsd-1-6-1-base:1.18
	buildlink2-base:1.1
	buildlink2:1.1.0.2;
locks; strict;
comment	@# @;


1.23
date	2004.07.06.22.49.18;	author wiz;	state dead;
branches;
next	1.22;

1.22
date	2003.09.02.06.59.51;	author jlam;	state Exp;
branches;
next	1.21;

1.21
date	2003.08.31.08.56.39;	author jlam;	state Exp;
branches;
next	1.20;

1.20
date	2003.08.31.06.07.33;	author jlam;	state Exp;
branches;
next	1.19;

1.19
date	2003.08.27.12.57.52;	author jlam;	state Exp;
branches;
next	1.18;

1.18
date	2003.01.24.12.09.16;	author jlam;	state Exp;
branches
	1.18.4.1
	1.18.6.1;
next	1.17;

1.17
date	2003.01.07.07.34.08;	author jlam;	state Exp;
branches;
next	1.16;

1.16
date	2003.01.06.09.06.09;	author jlam;	state Exp;
branches;
next	1.15;

1.15
date	2003.01.06.04.30.12;	author jlam;	state Exp;
branches;
next	1.14;

1.14
date	2002.12.26.17.08.56;	author jlam;	state Exp;
branches;
next	1.13;

1.13
date	2002.12.22.19.02.44;	author jlam;	state Exp;
branches;
next	1.12;

1.12
date	2002.10.30.00.23.00;	author jlam;	state Exp;
branches;
next	1.11;

1.11
date	2002.10.01.09.51.22;	author jlam;	state Exp;
branches;
next	1.10;

1.10
date	2002.09.28.23.46.42;	author jlam;	state Exp;
branches;
next	1.9;

1.9
date	2002.09.24.08.37.53;	author jlam;	state Exp;
branches;
next	1.8;

1.8
date	2002.09.23.23.51.28;	author jlam;	state Exp;
branches;
next	1.7;

1.7
date	2002.09.23.23.49.01;	author jlam;	state Exp;
branches;
next	1.6;

1.6
date	2002.09.23.22.32.08;	author jlam;	state Exp;
branches;
next	1.5;

1.5
date	2002.09.20.00.59.48;	author jlam;	state Exp;
branches;
next	1.4;

1.4
date	2002.09.18.02.14.35;	author jlam;	state Exp;
branches;
next	1.3;

1.3
date	2002.09.16.19.55.57;	author jlam;	state Exp;
branches;
next	1.2;

1.2
date	2002.08.22.08.21.29;	author jlam;	state Exp;
branches;
next	1.1;

1.1
date	2002.06.21.21.43.20;	author jlam;	state dead;
branches
	1.1.2.1;
next	;

1.18.4.1
date	2003.01.24.12.09.16;	author jlam;	state dead;
branches;
next	1.18.4.2;

1.18.4.2
date	2003.01.24.12.09.17;	author jlam;	state Exp;
branches;
next	;

1.18.6.1
date	2003.08.27.12.57.03;	author jlam;	state Exp;
branches;
next	1.18.6.2;

1.18.6.2
date	2003.08.30.07.57.58;	author jlam;	state Exp;
branches;
next	1.18.6.3;

1.18.6.3
date	2003.09.02.03.09.51;	author jlam;	state Exp;
branches;
next	;

1.1.2.1
date	2002.06.21.21.43.20;	author jlam;	state Exp;
branches;
next	;


desc
@@


1.23
log
@Retire buildlink2, now that all packages using it have been converted to
buildlink3.
@
text
@# $NetBSD: libtool-fix-la,v 1.22 2003/09/02 06:59:51 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 $test -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 $test $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 $test $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 $test -z "$deps" && $test -z "$relink" || \
	   @@EGREP@@ "^#.*modified by buildlink2" $lafile >/dev/null 2>&1; then
		:
	else
		@@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 buildlink2." >> $lafile
		@@RM@@ ${lafile}.tmp
		$echo "==> Fixed $lafile" >> $wrapperlog
	fi
	if $test -z "$laifile" || $test ! -f "$laifile" || \
	   @@EGREP@@ "^#.*modified by buildlink2" $laifile >/dev/null 2>&1; then
		:
	else
		@@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)
				;;
			-R*)
				# skip all -R* options... rpath info shouldn't
				# go into the dependency_libs line.
				;;
			-L*)
				case "$i" in
				-L${BUILDLINK_DIR}|-L${BUILDLINK_DIR}/*)
					;;
				-L${BUILDLINK_X11_DIR}|-L${BUILDLINK_X11_DIR}/*)
					;;
				-L@@WRKSRC@@|-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 $test -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
		if $test "$libdir" != "${BUILDLINK_DIR}/.tmp/inst" && \
		   @@EGREP@@ "${BUILDLINK_X11_DIR}|${BUILDLINK_DIR}" $laifile >/dev/null 2>&1; then
			$echo "==> [buildlink2] Error: buildlink2 leakage into $laifile" >> $wrapperlog
			$echo "==> [buildlink2] Error: buildlink2 leakage into $laifile" 1>&2
			wrapper_result=1
		fi
	fi
fi
@


1.22
log
@Merge pkgviews-mk branch into the HEAD by running:

	cd pkgsrc/mk
	cvs update -Pd -A
	cvs update -Pd -j pkgviews-mk-base -j pkgviews-mk
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.18.6.3 2003/09/02 03:09:51 jlam Exp $
@


1.21
log
@Don't allow -R* options in dependency_libs -- rpath info shouldn't be in
there.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.20 2003/08/31 06:07:33 jlam Exp $
@


1.20
log
@Strip bare -L${BUILDLINK_DIR}, -L${BUILDLINK_X11_DIR} and -L${WRKSRC}, as
well as stripping -L to subdirs of these directories from dependency_libs
lines in *.lai files.  This corrects the changes in revision 1.18 of this
file and restores some functionality accidentally removed in version 1.19
of this file.  Should fix the subversion buildlink/libtool problem
reported on tech-pkg@@.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.19 2003/08/27 12:57:52 jlam Exp $
d146 4
@


1.19
log
@Correct the glob so that we actually match -L${BUILDLINK_DIR}/* and
-L${BUILDLINK_X11_DIR} and discard them.  (from pkgviews-mk).
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.18 2003/01/24 12:09:16 jlam Exp $
d149 1
a149 1
				-L${BUILDLINK_DIR}/*|-L${BUILDLINK_X11_DIR}/*)
d151 3
a153 1
				-L@@WRKSRC@@/*)
@


1.18
log
@Strip bare "-L${BUILDLINK_DIR}" (note there is no trailing "/lib") from
dependency_libs definitions in *.lai files.  This should remove another
instance that can cause "buildlink2 leakage" into installed files under
${LOCALBASE}.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.17 2003/01/07 07:34:08 jlam Exp $
d149 1
a149 1
				-L${BUILDLINK_DIR}|-L${BUILDLINK_X11_DIR})
@


1.18.4.1
log
@file libtool-fix-la was added on branch pkgviews on 2003-01-24 12:09:17 +0000
@
text
@d1 193
@


1.18.4.2
log
@Strip bare "-L${BUILDLINK_DIR}" (note there is no trailing "/lib") from
dependency_libs definitions in *.lai files.  This should remove another
instance that can cause "buildlink2 leakage" into installed files under
${LOCALBASE}.
@
text
@a0 193
# $NetBSD: libtool-fix-la,v 1.18 2003/01/24 12:09:16 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 $test -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 $test $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 $test $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 $test -z "$deps" && $test -z "$relink" || \
	   @@EGREP@@ "^#.*modified by buildlink2" $lafile >/dev/null 2>&1; then
		:
	else
		@@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 buildlink2." >> $lafile
		@@RM@@ ${lafile}.tmp
		$echo "==> Fixed $lafile" >> $wrapperlog
	fi
	if $test -z "$laifile" || $test ! -f "$laifile" || \
	   @@EGREP@@ "^#.*modified by buildlink2" $laifile >/dev/null 2>&1; then
		:
	else
		@@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${BUILDLINK_DIR}|-L${BUILDLINK_X11_DIR})
					;;
				-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 $test -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
		if $test "$libdir" != "${BUILDLINK_DIR}/.tmp/inst" && \
		   @@EGREP@@ "${BUILDLINK_X11_DIR}|${BUILDLINK_DIR}" $laifile >/dev/null 2>&1; then
			$echo "==> [buildlink2] Error: buildlink2 leakage into $laifile" >> $wrapperlog
			$echo "==> [buildlink2] Error: buildlink2 leakage into $laifile" 1>&2
			wrapper_result=1
		fi
	fi
fi
@


1.18.6.1
log
@Correct the glob so that we actually match -L${BUILDLINK_DIR}/* and
-L${BUILDLINK_X11_DIR} and discard them.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.18 2003/01/24 12:09:16 jlam Exp $
d149 1
a149 1
				-L${BUILDLINK_DIR}/*|-L${BUILDLINK_X11_DIR}/*)
@


1.18.6.2
log
@Sync to HEAD.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.19 2003/08/27 12:57:52 jlam Exp $
@


1.18.6.3
log
@Sync to HEAD before merging back.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.21 2003/08/31 08:56:39 jlam Exp $
a146 4
			-R*)
				# skip all -R* options... rpath info shouldn't
				# go into the dependency_libs line.
				;;
d149 1
a149 3
				-L${BUILDLINK_DIR}|-L${BUILDLINK_DIR}/*)
					;;
				-L${BUILDLINK_X11_DIR}|-L${BUILDLINK_X11_DIR}/*)
d151 1
a151 1
				-L@@WRKSRC@@|-L@@WRKSRC@@/*)
@


1.17
log
@Don't complain about (correct) .buildlink leakage in the fake libtool
archive case.  Also output errors to stderr, not stdout (duh!).
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.16 2003/01/06 09:06:09 jlam Exp $
d149 2
@


1.16
log
@Catch buildlink2 leakage as soon as it happens during the build process.
This will hopefully prevent leakage from ever happening unnoticed.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.15 2003/01/06 04:30:12 jlam Exp $
d184 2
a185 1
		if @@EGREP@@ "${BUILDLINK_X11_DIR}|${BUILDLINK_DIR}" $laifile >/dev/null 2>&1; then
d187 1
a187 1
			$echo "==> [buildlink2] Error: buildlink2 leakage into $laifile"
@


1.15
log
@Some changes for Bourne shells that don't match NetBSD's feature-set:

	if ! test ...; then ...; fi

becomes:

	if test ! ...; then ...; fi

and

	if ! command; then ...; fi

becomes:

	if command; then :; else ...; fi

This fixes PR 19690 by Frank Cusack <fcusack@@fcusack.com>.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.14 2002/12/26 17:08:56 jlam Exp $
d184 5
@


1.14
log
@Rewrite wrapper scripts so that it is possible to add wrapper-specific
logic and caching in a more natural way.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.13 2002/12/22 19:02:44 jlam Exp $
d106 4
a109 2
	if $test -n "$deps" || $test -n "$relink" && \
	   ! @@EGREP@@ "^#.*modified by buildlink2" $lafile >/dev/null 2>&1; then
d134 4
a137 2
	if $test -n "$laifile" && $test -f "$laifile" && \
	   ! @@EGREP@@ "^#.*modified by buildlink2" $laifile >/dev/null 2>&1; then
@


1.13
log
@The buildlink2 problems on non-NetBSD platform seem to be related to
correct manipulation of variables containing values with escaped
metacharacters by the shell.  The new code only does partial caching, which
doesn't cache "special" arguments that contain escaped metacharacters or
other oddly quoted values.  On certain platforms listed in _BLNK_CACHE_ALL
in bsd.buildlink2.mk, we do full caching, which has enormous speed benefits
since it avoids an extra sed invocation per "special" argument.

Known working platforms:

	MacOS X 10.1.5 (schmonz)
	MacOS X 10.2 (grant)
	NetBSD 1.6 [full caching] (jlam)
	OpenBSD (cjep)
	Solaris 8 (grant)
	Solaris 9 (salo)
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.12 2002/10/30 00:23:00 jlam Exp $
d19 1
a19 1
if @@TEST@@ -f $lafile; then
d47 1
a47 1
			if @@TEST@@ $fixla -gt 0; then
d92 1
a92 1
			if @@TEST@@ $fixla -gt 0; then
d106 1
a106 1
	if @@TEST@@ -n "$deps" || @@TEST@@ -n "$relink" && \
d109 1
a109 1
		if @@TEST@@ -n "$deps"; then
d111 3
a113 3
			@@CAT@@ ${lafile}.blsav | @@SED@@ -e '/^dependency_libs=/,$d'
			@@ECHO@@ "dependency_libs='$deps'"
			@@CAT@@ ${lafile}.blsav | @@SED@@ -e '1,/^dependency_libs=/d'
d116 1
a116 1
			@@CAT@@ ${lafile}.blsav > ${lafile}.tmp
d118 1
a118 1
		if @@TEST@@ -n "$relink"; then
d120 3
a122 3
			@@CAT@@ ${lafile}.tmp | @@SED@@ -e '/^relink_command=/,$d'
			@@ECHO@@ "relink_command='$relink'"
			@@CAT@@ ${lafile}.tmp | @@SED@@ -e '1,/^relink_command=/d'
d125 1
a125 1
			@@CAT@@ ${lafile}.tmp > $lafile
d127 2
a128 2
		@@ECHO@@ >> $lafile
		@@ECHO@@ "# This file has been modified by buildlink2." >> $lafile
d130 1
a130 1
		@@ECHO@@ "==> Fixed $lafile" >> $wrapperlog
d132 1
a132 1
	if @@TEST@@ -n "$laifile" && @@TEST@@ -f "$laifile" && \
d166 1
a166 1
		if @@TEST@@ -z "$lexist"; then
d172 5
a176 5
			@@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."
d179 1
a179 1
		@@ECHO@@ "==> Fixed $laifile" >> $wrapperlog
@


1.12
log
@Move the sed command in _BLNK_{,UN}TRANSFORM_SED into a sed command files
.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.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.11 2002/10/01 09:51:22 jlam Exp $
d19 1
a19 1
if [ -f $lafile ]; then
d47 1
a47 1
			if [ $fixla -gt 0 ]; then
d92 1
a92 1
			if [ $fixla -gt 0 ]; then
d106 1
a106 1
	if [ -n "$deps" -o -n "$relink" ] && \
d109 1
a109 1
		if [ -n "$deps" ]; then
d118 1
a118 1
		if [ -n "$relink" ]; then
d132 1
a132 1
	if [ -n "$laifile" ] && [ -f "$laifile" ] && \
d166 1
a166 1
		if [ -z "$lexist" ]; then
@


1.11
log
@Really, really fix the problem I was trying to fix with rev 1.6.  I want
to only add -Ldir/.libs for *.la files that are not named with absolute
paths or named with an absolute path starting with ${WRKSRC}.  This should
fix the problem with converting kdebase3 to buildlink2.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.10 2002/09/28 23:46:42 jlam Exp $
d135 1
a135 4
			@@_BLNK_UNTRANSFORM_SED.1@@ \
			@@_BLNK_UNTRANSFORM_SED.2@@ \
			@@_BLNK_UNTRANSFORM_SED.3@@ \
			@@_BLNK_UNTRANSFORM_SED.4@@ \
@


1.10
log
@* Split _BLNK_TRANSFORM_SED into 4 variables, as even with 3 it was
  overflowing the make variable size limit.

* Rename _BLNK_WRAP_ENV to _BLNK_WRAP_SETENV, and use _BLNK_WRAP_ENV to
  set the shell environment for the wrappee.  Allow BUILDLINK_WRAPPER_ENV
  to add to the shell environment.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.9 2002/09/24 08:37:53 jlam Exp $
d33 1
d36 12
a47 1
			./*|../*|@@WRKSRC@@/*)
d53 1
a53 2
				;;
			esac
d78 1
d81 12
a92 1
			./*|../*|@@WRKSRC@@/*)
d98 1
a98 2
				;;
			esac
@


1.9
log
@Use |, not : to separate case conditions.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.8 2002/09/23 23:51:28 jlam Exp $
d116 1
@


1.8
log
@For completeness, also allow for ./* when naming uninstalled libtool
archives, and also do the special handling for dependency_libs.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.7 2002/09/23 23:49:01 jlam Exp $
d69 1
a69 1
			./*:../*|@@WRKSRC@@/*)
@


1.7
log
@Also add -L*/.libs for *.la that start with "../", which is also quite
common when referring to an uninstalled libtool archive.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.6 2002/09/23 22:32:08 jlam Exp $
d35 1
a35 1
			@@WRKSRC@@/*)
d69 1
a69 1
			../*|@@WRKSRC@@/*)
@


1.6
log
@The previous commit of libtool-fix-la let a lot of references to the build
directory escape into the installed *.la files.  Fix this by only adding
-L*/.libs if the *.la file is uninstalled, and by filtering out references
to ${WRKSRC}.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.5 2002/09/20 00:59:48 jlam Exp $
d69 1
a69 1
			@@WRKSRC@@/*)
@


1.5
log
@Fix problem with linking against uninstalled libtool archives that in turn
depend on other uninstalled libtool archives.  During the relinking process
the newly installed libraries weren't being found.  We now insert the
appropriate -Ldir flags to allow them to be found in the uninstalled
locations.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.4 2002/09/18 02:14:35 jlam Exp $
d34 8
a41 4
			case "$deps" in
			*"-L$ltlibsdir "*) ;;
			*"-L$ltlibsdir") ;;
			*) deps="$deps -L$ltlibsdir" ;;
d68 8
a75 4
			case "$relink" in
			*"-L$ltlibsdir "*) ;;
			*"-L$ltlibsdir") ;;
			*) relink="$relink -L$ltlibsdir" ;;
d124 10
a133 4
				case "$L" in
				*"$i "*) ;;
				*"$i") ;;
				*) L="$L $i" ;;
@


1.4
log
@Split up the UNTRANSFORM variables into *.{1,2,3} so that they won't
exceed any maximum length on values stored in a variable.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.3 2002/09/16 19:55:57 jlam Exp $
d22 25
d76 1
a76 1
	if [ -n "$relink" ] && \
d79 12
a90 2
		(
			@@CAT@@ ${lafile}.blsav | @@SED@@ -e '/^relink_command=/,$d'
d92 8
a99 4
			@@CAT@@ ${lafile}.blsav | @@SED@@ -e '1,/^relink_command=/d'
			@@ECHO@@
			@@ECHO@@ "# This file has been modified by buildlink2."
		) > $lafile
@


1.3
log
@Change the way that we note when a libtool file has been fixed by
buildlink2.  We used to create a timestamp file in the .libs directory.
Now, we add a line to the *.la and *.lai file that directly notes that it
has been "modified by buildlink2".  This makes it easier to debug problems
caused by using the wrong libtool during either a build or install by
checking if the *.la or *.lai files have the "modified by buildlink2" line.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.2 2002/08/22 08:21:29 jlam Exp $
d66 3
@


1.2
log
@Merge pkgsrc/mk from the buildlink2 branch back into the main trunk.
@
text
@d1 1
a1 1
# $NetBSD: libtool-fix-la,v 1.1.2.1 2002/06/21 21:43:20 jlam Exp $
d19 1
a19 1
if [ ! -f $latimestamp ]; then
d51 2
a52 1
	if [ -n "$relink" ]; then
d58 2
d63 2
a64 1
	if [ -n "$laifile" ] && [ -f "$laifile" ]; then
d99 2
a104 1
	@@TOUCH@@ $latimestamp
@


1.1
log
@file libtool-fix-la was initially added on branch buildlink2.
@
text
@d1 100
@


1.1.2.1
log
@* Split the libtool script into a main script and a helper script.  The
  helper script is separated to prevent parsing until its needed.  Also
  specially handle the --mode=install case for libtool as we don't really
  care to cache the arguments in those cases.

* Use a more correct strategy for properly quoting and caching arguments
  in the wrapper scripts.  This fixes building php4, kdelibs2, and imlib.
@
text
@a0 100
# $NetBSD$
#
# 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 $latimestamp ]; then
	. ${ladir}/${labase}.la

	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)
			ltlibsdir=`@@DIRNAME@@ $i`/.libs
			case "$relink" in
			*"-L$ltlibsdir "*) ;;
			*"-L$ltlibsdir") ;;
			*) relink="$relink -L$ltlibsdir" ;;
			esac
			relink="${relink} $i"
			;;
		*)
			relink="${relink} $i"
			;;
		esac
	done
	if [ -n "$relink" ]; then
		@@MV@@ -f $lafile ${lafile}.blsav
		(
			@@CAT@@ ${lafile}.blsav | @@SED@@ -e '/^relink_command=/,$d'
			@@ECHO@@ "relink_command='$relink'"
			@@CAT@@ ${lafile}.blsav | @@SED@@ -e '1,/^relink_command=/d'
		) > $lafile
		@@ECHO@@ "==> Fixed $lafile" >> $wrapperlog
	fi
	if [ -n "$laifile" ] && [ -f "$laifile" ]; then
		@@SED@@	@@_BLNK_WRAP_LT_UNTRANSFORM_SED@@ \
			$laifile > ${laifile}.tmp
		. ${laifile}.tmp
		L=; l=; lexist=; prev=
		for i in ${dependency_libs}; do
			case "$i" in
			$prev)
				;;
			-L*)
				case "$L" in
				*"$i "*) ;;
				*"$i") ;;
				*) L="$L $i" ;;
				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'
		) > ${laifile}
		@@RM@@ -f ${laifile}.tmp
		@@ECHO@@ "==> Fixed $laifile" >> $wrapperlog
	fi
	@@TOUCH@@ $latimestamp
fi
@

