pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk/buildlink3 Do a better job of hiding unwanted libto...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/928c374d290a
branches:  trunk
changeset: 461924:928c374d290a
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Tue Sep 23 19:48:22 2003 +0000

description:
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:

 mk/buildlink3/bsd.buildlink3.mk |  98 +++++++++++++++++++++++++---------------
 mk/buildlink3/libtool.sh        |  83 +++++++++++++++++++++++++---------
 2 files changed, 121 insertions(+), 60 deletions(-)

diffs (269 lines):

diff -r a00867b8b88d -r 928c374d290a mk/buildlink3/bsd.buildlink3.mk
--- a/mk/buildlink3/bsd.buildlink3.mk   Tue Sep 23 19:33:14 2003 +0000
+++ b/mk/buildlink3/bsd.buildlink3.mk   Tue Sep 23 19:48:22 2003 +0000
@@ -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 @@
 #      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 @@
        ${_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 @@
                        case $$src in                                   \
                        *.la)                                           \
                                ${CAT} $$src |                          \
-                               ${_BLNK_LT_ARCHIVE_FILTER}              \
+                               ${_BLNK_LT_ARCHIVE_FILTER.${_pkg_}}     \
                                > $$dest;                               \
                                ;;                                      \
                        *)                                              \
@@ -427,42 +432,57 @@
                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}.
 #
-#     -        Modifies the dependency_libs line by changing all full paths to
+_BLNK_LT_ARCHIVE_FILTER.${_pkg_}=      \
+       ${AWK} '${_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}}'
+
+_BLNK_LT_ARCHIVE_FILTER_AWK_SCRIPT.${_pkg_}=   # empty
+#
+#     -        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_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 -r a00867b8b88d -r 928c374d290a mk/buildlink3/libtool.sh
--- a/mk/buildlink3/libtool.sh  Tue Sep 23 19:33:14 2003 +0000
+++ b/mk/buildlink3/libtool.sh  Tue Sep 23 19:48:22 2003 +0000
@@ -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 @@
 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 @@
                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 @@
                # 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



Home | Main Index | Thread Index | Old Index