pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk * Do the *.la expansion within the current _PLIST_A...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/c31bd0a950f0
branches:  trunk
changeset: 480483:c31bd0a950f0
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Fri Sep 10 19:51:50 2004 +0000

description:
* Do the *.la expansion within the current _PLIST_AWK_SCRIPT framework.
  We no longer require that LIBTOOL_LA_FILES be defined in the package
  Makefile, and the libtool archives should once again be listed in the
  PLIST.

* Add a new yes/no variable "LIBTOOLIZE_PLIST" to control whether to
  have bsd.pkg.mk automatically expand *.la files in PLISTs into the
  true library names represented by the libtool archives.

* Rename the "transform-la" script to "print-la-libnames" which more
  correctly reflects its function.

Many thanks to Todd Vierling for the original implementation and for
his contructive comments on how to improve the changes in this commit.

diffstat:

 mk/bsd.pkg.defaults.mk       |   8 ++++-
 mk/bsd.pkg.mk                |  70 +++++++++++++++++++++++++++++++++---------
 mk/scripts/print-la-libnames |  73 ++++++++++++++++++++++++++++++++++++++++++++
 mk/scripts/transform-la      |  59 -----------------------------------
 4 files changed, 135 insertions(+), 75 deletions(-)

diffs (288 lines):

diff -r b92a601412d4 -r c31bd0a950f0 mk/bsd.pkg.defaults.mk
--- a/mk/bsd.pkg.defaults.mk    Fri Sep 10 19:47:43 2004 +0000
+++ b/mk/bsd.pkg.defaults.mk    Fri Sep 10 19:51:50 2004 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.defaults.mk,v 1.279 2004/09/01 02:21:29 uebayasi Exp $
+# $NetBSD: bsd.pkg.defaults.mk,v 1.280 2004/09/10 19:51:50 jlam Exp $
 #
 
 # A file providing defaults for pkgsrc and the packages collection.
@@ -255,6 +255,12 @@
 # Default: -R
 # Possible: depends on your FETCH_CMD value.
 
+LIBTOOLIZE_PLIST?=     no
+# This determines whether to expand libtool archives in PLISTs into the
+# represented library names.
+# Possible: yes, no
+# Default: no
+
 PKG_INSTALLATION_PREFS?= overwrite pkgviews
 # This is a whitespace-separated list of installation types to try when
 # building a package, in order of preference.
diff -r b92a601412d4 -r c31bd0a950f0 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Fri Sep 10 19:47:43 2004 +0000
+++ b/mk/bsd.pkg.mk     Fri Sep 10 19:51:50 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1495 2004/09/01 00:10:58 schmonz Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1496 2004/09/10 19:51:50 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -407,12 +407,7 @@
 CONFIGURE_ENV+=                LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
 MAKE_ENV+=             LIBTOOL="${LIBTOOL} ${LIBTOOL_FLAGS}"
 LIBTOOL_OVERRIDE?=     libtool */libtool */*/libtool
-.if defined(LIBTOOL_LA_FILES)
-_DUMP_LIBTOOL_LA_FILES=        ${SH} ../../mk/scripts/transform-la ${PREFIX} ${LIBTOOL_LA_FILES}
-_FILTER_LIBTOOL_LA_FILES=| ${GREP} -vxF `${_DUMP_LIBTOOL_LA_FILES} | ${SED} -e 's,^,-e ,'`
-.endif
-.endif
-_DUMP_LIBTOOL_LA_FILES?=${TRUE}
+.endif
 
 .if defined(BUILD_USES_MSGFMT) && \
     (!exists(/usr/bin/msgfmt) || ${_USE_GNU_GETTEXT} == "yes")
@@ -4494,6 +4489,37 @@
 # XXX will fail for data files that were copied using tar (e.g. emacs)!
 # XXX should check $LOCALBASE and $X11BASE, and add @cwd statements
 
+_PRINT_PLIST_FILES_CMD=        \
+       ${FIND} ${PREFIX}/. -xdev -newer ${EXTRACT_COOKIE} \! -type d -print
+_PRINT_PLIST_DIRS_CMD= \
+       ${FIND} ${PREFIX}/. -xdev -newer ${EXTRACT_COOKIE} -type d -print
+_PRINT_LA_LIBNAMES=    ${.CURDIR}/../../mk/scripts/print-la-libnames
+
+.if !empty(LIBTOOLIZE_PLIST:M[yY][eE][sS])
+_PRINT_PLIST_LIBTOOLIZE_FILTER?=                                       \
+       (                                                               \
+         if ${TEST} -d ${WRKDIR}; then                                 \
+               tmpdir="${WRKDIR}";                                     \
+         else                                                          \
+               tmpdir="$${TMPDIR-/tmp}";                               \
+         fi;                                                           \
+         fileslist="$$tmpdir/print.plist.files.$$$$";                  \
+         libslist="$$tmpdir/print.plist.libs.$$$$";                    \
+         while read file; do                                           \
+               case $$file in                                          \
+               *.la)                                                   \
+                       ${SH} ${_PRINT_LA_LIBNAMES} $$file >> $$libslist; \
+                       ;;                                              \
+               esac;                                                   \
+               ${ECHO} "$$file";                                       \
+         done > $$fileslist;                                           \
+         ${GREP} -hvxF "`${SORT} -u $$libslist`" "$$fileslist";        \
+         ${RM} -f "$$fileslist" "$$libslist";                          \
+       )
+.else
+_PRINT_PLIST_LIBTOOLIZE_FILTER?=       ${CAT}
+.endif
+
 .PHONY: print-PLIST
 .if !target(print-PLIST)
 print-PLIST:
@@ -4505,8 +4531,8 @@
        "a.out")        genlinks=1 ;;                                   \
        *)              genlinks=0 ;;                                   \
        esac;                                                           \
-       ${FIND} ${PREFIX}/. -xdev -newer ${EXTRACT_COOKIE} \! -type d -print\
-        ${_FILTER_LIBTOOL_LA_FILES}                                    \
+       ${_PRINT_PLIST_FILES_CMD}                                       \
+        | ${_PRINT_PLIST_LIBTOOLIZE_FILTER}                            \
         | ${SORT}                                                      \
         | ${AWK} '                                                     \
                { sub("${PREFIX}/\\./", ""); }                          \
@@ -4534,7 +4560,7 @@
                ${PRINT_PLIST_AWK}                                      \
                { print $$0; }'
        ${_PKG_SILENT}${_PKG_DEBUG}\
-       for i in `${FIND} ${PREFIX}/. -xdev -newer ${EXTRACT_COOKIE} -type d -print\
+       for i in `${_PRINT_PLIST_DIRS_CMD}                              \
                        | ${SORT} -r                                    \
                        | ${AWK} '                                      \
                                /emul\/linux\/proc/ { next; }           \
@@ -4925,6 +4951,20 @@
 .  endif
 .endif
 
+# plist awk pattern-action statement to expand libtool archives into
+# shared and/or static libraries.
+#
+.if ${PLIST_TYPE} == "dynamic"
+_PLIST_AWK_LIBTOOL?=   # empty
+.else
+.  if !empty(LIBTOOLIZE_PLIST:M[yY][eE][sS])
+_PLIST_AWK_LIBTOOL?=                                                   \
+/\.la$$/ {                                                             \
+       system("cd ${PREFIX} && ${SH} ${_PRINT_LA_LIBNAMES} " $$0)      \
+}
+.  endif
+.endif
+
 # _PLIST_AWK_SCRIPT hold the complete awk script for plist target.
 #
 _PLIST_AWK_SCRIPT=     '
@@ -4934,8 +4974,10 @@
 _PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_SUBST}
 # Generated entries for info files
 .if !empty(INFO_FILES)
-_PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_INFO}
-.endif
+_PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_INFO}
+.endif
+# Expand libtool archives
+_PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_LIBTOOL}
 # Strip the '.gz' suffixes on man entries
 _PLIST_AWK_SCRIPT+=    ${_PLIST_AWK_STRIP_MANZ}
 # Deal with MANINSTALL and man entries
@@ -4979,9 +5021,7 @@
                ${SED} -e "s|^${PREFIX}/|@unexec ${RMDIR} -p %D/|"      \
                       -e "s,$$, 2>/dev/null || ${TRUE},";
 .else
-_GENERATE_PLIST=       ${_DUMP_LIBTOOL_LA_FILES}; \
-                       ${CAT} ${_PLIST_SRC}; \
-                       ${GENERATE_PLIST}
+_GENERATE_PLIST=       ${CAT} ${_PLIST_SRC}; ${GENERATE_PLIST}
 .endif
 
 .PHONY: plist
diff -r b92a601412d4 -r c31bd0a950f0 mk/scripts/print-la-libnames
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/scripts/print-la-libnames      Fri Sep 10 19:51:50 2004 +0000
@@ -0,0 +1,73 @@
+# /bin/sh
+#
+# $NetBSD: print-la-libnames,v 1.1 2004/09/10 19:51:51 jlam Exp $
+#
+# Copyright (c) 2004 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Todd Vierling.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+#    must display the following acknowledgement:
+#        This product includes software developed by the NetBSD
+#        Foundation, Inc. and its contributors.
+# 4. Neither the name of The NetBSD Foundation nor the names of its
+#    contributors may be used to endorse or promote products derived
+#    from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+: ${ECHO=echo}
+: ${GREP=grep}
+: ${SORT=sort}
+
+for la
+do
+       dir="${la%/*.la}"
+       library_names=
+       old_library=
+
+       case $dir in
+       $la)    dir= ;;
+       *)      dir="$dir/" ;;
+       esac
+       case $la in
+       /*|./*) lapath="$la" ;;
+       *)      lapath="./$la" ;;
+       esac
+
+       if [ -r "$lapath" ] && \
+          ${GREP} -q "libtool library file" "$lapath"; then
+               . "$lapath"
+               if [ "$installed" = "no" ]; then
+                       ${ECHO} 1>&2 "$0: \`$lapath' was not properly installed"
+                       exit 1
+               fi
+               for lib in $library_names $old_library; do
+                       ${ECHO} "$dir$lib"
+               done
+       else
+               ${ECHO} 1>&2 "$0: cannot read libtool archive \`$lapath'"
+               exit 1
+       fi
+done | ${SORT} -u
diff -r b92a601412d4 -r c31bd0a950f0 mk/scripts/transform-la
--- a/mk/scripts/transform-la   Fri Sep 10 19:47:43 2004 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2004 The NetBSD Foundation, Inc.
-# All rights reserved.
-#
-# This code is derived from software contributed to The NetBSD Foundation
-# by Todd Vierling.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-#    notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-#    notice, this list of conditions and the following disclaimer in the
-#    documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-#    must display the following acknowledgement:
-#        This product includes software developed by the NetBSD
-#        Foundation, Inc. and its contributors.
-# 4. Neither the name of The NetBSD Foundation nor the names of its
-#    contributors may be used to endorse or promote products derived
-#    from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
-# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
-# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
-# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-PREFIX="$1"; shift
-
-for la in $*; do
-       basedir=$(dirname $la)
-       library_names=
-       old_library=
-
-       # the .la file is itself a Bourne-compatible script
-       . $PREFIX/$la || {
-               echo "$0: cannot read libtool archive $PREFIX/$la" >&2; exit 1
-       }
-
-       # catch where libtool's install wrapper was not properly used
-       if [ "$installed" = "no" ]; then
-               echo "$0: library $PREFIX/$la was not properly installed" >&2; exit 1
-       fi
-
-       echo "$la"
-       for lib in $library_names $old_library; do
-               echo "$basedir/$lib"
-       done
-done



Home | Main Index | Thread Index | Old Index