summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjlam <jlam>2003-09-23 19:48:22 +0000
committerjlam <jlam>2003-09-23 19:48:22 +0000
commit779ffb77af35941547fdb62191264cf07a3cfdb8 (patch)
treef6fe7c6f6693bf9de79c811901304f7c7299c170 /mk
parenta2febaa3473bea6c28821ec795736fdf5d999759 (diff)
downloadpkgsrc-779ffb77af35941547fdb62191264cf07a3cfdb8.tar.gz
Do a better job of hiding unwanted libtool archives in a mixed
buildlink2/buildlink3 world. We "buildlink" libtool archives into ${BUILDLINK_DIR} and instruct libtool to find those *.la files before any other ones.
Diffstat (limited to 'mk')
-rw-r--r--mk/buildlink3/bsd.buildlink3.mk98
-rw-r--r--mk/buildlink3/libtool.sh83
2 files changed, 121 insertions, 60 deletions
diff --git a/mk/buildlink3/bsd.buildlink3.mk b/mk/buildlink3/bsd.buildlink3.mk
index 0ec46ff0832..56b94b51f06 100644
--- a/mk/buildlink3/bsd.buildlink3.mk
+++ b/mk/buildlink3/bsd.buildlink3.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink3.mk,v 1.16 2003/09/22 19:49:10 jlam Exp $
+# $NetBSD: bsd.buildlink3.mk,v 1.17 2003/09/23 19:48:22 jlam Exp $
#
# An example package buildlink3.mk file:
#
@@ -334,7 +334,8 @@ do-buildlink: buildlink-wrappers buildlink-${_BLNK_OPSYS}-wrappers
# to be symlinked into ${BUILDLINK_DIR}. By default for
# overwrite packages, BUILDLINK_FILES_CMD.<pkg> outputs the
# contents of the include and lib directories in the package
-# +CONTENTS.
+# +CONTENTS, and for pkgviews packages, it outputs any libtool
+# archives in lib directories.
#
# BUILDLINK_TRANSFORM.<pkg>
# sed arguments used to transform the name of the source filename
@@ -363,16 +364,20 @@ buildlink-${_pkg_}-cookie:
${_PKG_SILENT}${_PKG_DEBUG} \
${TOUCH} ${TOUCH_FLAGS} ${_BLNK_COOKIE.${_pkg_}}
-.if (${PKG_INSTALLATION_TYPE} == "pkgviews") && \
- !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
-BUILDLINK_FILES_CMD.${_pkg_}?= ${TRUE}
-.else
+. if (${PKG_INSTALLATION_TYPE} == "pkgviews") && \
+ !empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+BUILDLINK_FILES_CMD.${_pkg_}?= \
+ ${_BLNK_PKG_INFO.${_pkg_}} -f ${BUILDLINK_PKGNAME.${_pkg_}} | \
+ ${SED} -n '/File:/s/^[ ]*File:[ ]*//p' | \
+ ${GREP} 'lib.*/lib[^/]*\.la$$' | \
+ ${SED} "s,^,$${pkg_prefix},"
+. else
BUILDLINK_FILES_CMD.${_pkg_}?= \
${_BLNK_PKG_INFO.${_pkg_}} -f ${BUILDLINK_PKGNAME.${_pkg_}} | \
${SED} -n '/File:/s/^[ ]*File:[ ]*//p' | \
${GREP} '\(include.*/\|lib.*/lib[^/]*$$\)' | \
${SED} "s,^,$${pkg_prefix},"
-.endif
+. endif
${_BLNK_COOKIE.${_pkg_}}:
${_PKG_SILENT}${_PKG_DEBUG} \
@@ -416,7 +421,7 @@ ${_BLNK_COOKIE.${_pkg_}}:
case $$src in \
*.la) \
${CAT} $$src | \
- ${_BLNK_LT_ARCHIVE_FILTER} \
+ ${_BLNK_LT_ARCHIVE_FILTER.${_pkg_}} \
> $$dest; \
;; \
*) \
@@ -427,42 +432,57 @@ ${_BLNK_COOKIE.${_pkg_}}:
done; \
;; \
esac
-.endfor
-# _BLNK_LT_ARCHIVE_FILTER is a command-line filter for transforming
-# libtool archives (*.la) to allow libtool to properly interact with
-# buildlink at link time by linking against the libraries pointed to by
-# symlinks in ${BUILDLINK_DIR}. It achieves this in two ways:
+# _BLNK_LT_ARCHIVE_FILTER.${_pkg_} is a command-line filter used in
+# the previous target for transforming libtool archives (*.la) to
+# allow libtool to properly interact with # buildlink at link time by
+# linking against the libraries pointed to by symlinks in
+# ${BUILDLINK_DIR}.
+#
+_BLNK_LT_ARCHIVE_FILTER.${_pkg_}= \
+ ${AWK} '${_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}}'
+
+_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}= # empty
#
-# - Modifies the dependency_libs line by changing all full paths to
+# - Modify the dependency_libs line by changing all full paths to
# other *.la files into the canonical ${BUILDLINK_DIR} path.
#
-# - Modifies the libdir line to point to within ${BUILDLINK_DIR}.
+_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}+= \
+ /^dependency_libs=/ { \
+ line = $$0; \
+ line = gensub("/usr(/lib/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${DEPOTBASE}/[^/ ]*(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${X11BASE}(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_X11_DIR}\\1", "g", line); \
+ line = gensub("${LOCALBASE}(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("-L/usr/lib[^/ ]*[ ]*", "", "g", line); \
+ line = gensub("-L${X11BASE}/[^ ]*[ ]*", "", "g", line); \
+ line = gensub("-L${LOCALBASE}/[^ ]*[ ]*", "", "g", line); \
+ print line; \
+ next; \
+ }
+. if (${PKG_INSTALLATION_TYPE} == "overwrite") || \
+ empty(BUILDLINK_IS_DEPOT.${_pkg_}:M[yY][eE][sS])
+#
+# - Modify the libdir line to point to within ${BUILDLINK_DIR}.
# This prevents libtool from looking into the original directory
# for other *.la files.
#
-_BLNK_LT_ARCHIVE_FILTER= \
- ${AWK} ' \
- /^dependency_libs=/ { \
- line = $$0; \
- line = gensub("/usr(/lib/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
- line = gensub("${DEPOTBASE}/[^/ ]*(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
- line = gensub("${X11BASE}(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_X11_DIR}\\1", "g", line); \
- line = gensub("${LOCALBASE}(/[^ ]*/lib[^/ ]*\.la)", "${BUILDLINK_DIR}\\1", "g", line); \
- print line; \
- next; \
- } \
- /^libdir=/ { \
- line = $$0; \
- line = gensub("/usr(/lib/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
- line = gensub("${DEPOTBASE}/[^/ ]*(/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
- line = gensub("${X11BASE}(/[^ ]*)", "${BUILDLINK_X11_DIR}\\1", "g", line); \
- line = gensub("${LOCALBASE}(/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
- print line; \
- next; \
- } \
- { print } \
- '
+_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}+= \
+ /^libdir=/ { \
+ line = $$0; \
+ line = gensub("/usr(/lib/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${DEPOTBASE}/[^/ ]*(/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
+ line = gensub("${X11BASE}(/[^ ]*)", "${BUILDLINK_X11_DIR}\\1", "g", line); \
+ line = gensub("${LOCALBASE}(/[^ ]*)", "${BUILDLINK_DIR}\\1", "g", line); \
+ print line; \
+ next; \
+ }
+. endif
+#
+# - Leave all other lines alone.
+#
+_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}+= { print }
+.endfor
# Include any BUILDLINK_TARGETS provided in buildlink3.mk files in
# _BLNK_TARGETS.
@@ -923,9 +943,11 @@ _BLNK_CPPFLAGS= -I${BUILDLINK_DIR}/include
_BLNK_LDFLAGS= -L${BUILDLINK_DIR}/lib
_BLNK_WRAP_EXTRA_FLAGS.CC= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
_BLNK_WRAP_EXTRA_FLAGS.CXX= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
-_BLNK_WRAP_EXTRA_FLAGS.CPP= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
+_BLNK_WRAP_EXTRA_FLAGS.CPP= ${_BLNK_CPPFLAGS}
_BLNK_WRAP_EXTRA_FLAGS.FC= ${_BLNK_CPPFLAGS} ${_BLNK_LDFLAGS}
_BLNK_WRAP_EXTRA_FLAGS.LD= ${_BLNK_LDFLAGS}
+_BLNK_WRAP_EXTRA_FLAGS.LIBTOOL= ${_BLNK_LDFLAGS}
+_BLNK_WRAP_EXTRA_FLAGS.SHLIBTOOL= ${_BLNK_WRAP_EXTRA_FLAGS.LIBTOOL}
.PHONY: buildlink-wrappers
diff --git a/mk/buildlink3/libtool.sh b/mk/buildlink3/libtool.sh
index 2dc4bc265b5..f6057eb58e9 100644
--- a/mk/buildlink3/libtool.sh
+++ b/mk/buildlink3/libtool.sh
@@ -1,6 +1,6 @@
#!@BUILDLINK_SHELL@
#
-# $NetBSD: libtool.sh,v 1.3 2003/09/09 09:11:42 jlam Exp $
+# $NetBSD: libtool.sh,v 1.4 2003/09/23 19:48:23 jlam Exp $
Xsed='@SED@ -e 1s/^X//'
sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
@@ -34,10 +34,58 @@ BUILDLINK_DIR="@BUILDLINK_DIR@"
WRKDIR="@WRKDIR@"
WRKSRC="@WRKSRC@"
-cmd="@WRAPPEE@"
+mode=link
+prevopt=
+nonopt=
lafile=
-case "$1" in
-*install|*cp|*install-sh|*install.sh)
+for arg; do
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
+ esac
+ if $test -n "$prevopt"; then
+ case $prevopt in
+ --mode)
+ mode="$arg"
+ ;;
+ --fix-la|-o)
+ case $arg in
+ *.la) lafile="$arg" ;;
+ esac
+ ;;
+ esac
+ prevopt=
+ continue
+ fi
+ case $arg in
+ --mode|--fix-la|-o)
+ prevopt="$arg"
+ ;;
+ --mode=*)
+ mode="$optarg"
+ ;;
+ -*)
+ if $test -n "$nonopt"; then
+ case $arg in
+ -c) mode=compile ;;
+ esac
+ fi
+ ;;
+ *)
+ if $test -z "$nonopt"; then
+ nonopt="$arg"
+ case $arg in
+ *cc|*++|gcc*|*-gcc*|*CC) mode=link ;;
+ *install*|cp|mv) mode=install ;;
+ esac
+ fi
+ ;;
+ esac
+done
+
+cmd="@WRAPPEE@"
+case $mode in
+install)
arg="$1"; shift
. $libtool_do_install
;;
@@ -46,24 +94,15 @@ case "$1" in
arg="$1"; shift
case $arg in
--fix-la)
- case "$1" in
- *.la)
- lafile="$1"
- . $libtool_fix_la
- exit
- ;;
- esac
+ . $libtool_fix_la
+ exit
;;
- --mode|--mode=install)
- if $test "$arg" = "--mode=install" || \
- $test "$arg" = "--mode" -a "$1" = "install"; then
- . $libtool_do_install
- break
- fi
- ;;
- -o)
- case "$1" in
- *.la) lafile="$1" ;;
+ *cc|*++|gcc*|*-gcc*|*CC)
+ case $mode in
+ link)
+ cmd="$cmd $arg"
+ arg="@_BLNK_WRAP_EXTRA_FLAGS@"
+ ;;
esac
;;
*)
@@ -101,7 +140,7 @@ case "$1" in
# Reduce command length by not appending options that we've
# already seen to the command.
#
- case $arg in
+ case "$arg" in
-[DILR]*|-Wl,-R*|-Wl,-*,/*)
#
# These options are only ever useful the first time