diff options
author | jlam <jlam@pkgsrc.org> | 2004-09-10 19:51:50 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2004-09-10 19:51:50 +0000 |
commit | 5073201af908ffcc303a3a184c6d544a84d694a1 (patch) | |
tree | 3fdaad46d2c93446b39ca1fc62fed7e50fe285bc | |
parent | 54c417c67d03bd6a526957aea3e0b6ad02fa8605 (diff) | |
download | pkgsrc-5073201af908ffcc303a3a184c6d544a84d694a1.tar.gz |
* 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.
-rw-r--r-- | mk/bsd.pkg.defaults.mk | 8 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 66 | ||||
-rwxr-xr-x | mk/scripts/print-la-libnames (renamed from mk/scripts/transform-la) | 48 |
3 files changed, 91 insertions, 31 deletions
diff --git a/mk/bsd.pkg.defaults.mk b/mk/bsd.pkg.defaults.mk index 3526aaf85b1..b0e6779f67e 100644 --- a/mk/bsd.pkg.defaults.mk +++ b/mk/bsd.pkg.defaults.mk @@ -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 @@ FETCH_RESUME_ARGS?= # empty # 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 --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index daac132f8a9..5a53f55ebf7 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -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 @@ BUILD_DEPENDS+= libtool-base>=${LIBTOOL_REQD}:../../devel/libtool-base 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} .if defined(BUILD_USES_MSGFMT) && \ (!exists(/usr/bin/msgfmt) || ${_USE_GNU_GETTEXT} == "yes") @@ -4494,6 +4489,37 @@ _PRINT_PLIST_COMMON_DIRS!= ${AWK} 'BEGIN { \ # 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 @@ print-PLIST: "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: ${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 @@ BEGIN { \ . 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_SCRIPT+= ${_PLIST_AWK_SUBST} # Generated entries for info files .if !empty(INFO_FILES) -_PLIST_AWK_SCRIPT+= ${_PLIST_AWK_INFO} +_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 @@ _GENERATE_PLIST= \ ${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 --git a/mk/scripts/transform-la b/mk/scripts/print-la-libnames index 1248bd3624c..647ea0d3c67 100755 --- a/mk/scripts/transform-la +++ b/mk/scripts/print-la-libnames @@ -1,4 +1,6 @@ -#!/bin/sh +# /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. @@ -35,25 +37,37 @@ # POSSIBILITY OF SUCH DAMAGE. # -PREFIX="$1"; shift +: ${ECHO=echo} +: ${GREP=grep} +: ${SORT=sort} -for la in $*; do - basedir=$(dirname $la) +for la +do + dir="${la%/*.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 - } + case $dir in + $la) dir= ;; + *) dir="$dir/" ;; + esac + case $la in + /*|./*) lapath="$la" ;; + *) lapath="./$la" ;; + esac - # 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 + 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 - - echo "$la" - for lib in $library_names $old_library; do - echo "$basedir/$lib" - done -done +done | ${SORT} -u |