summaryrefslogtreecommitdiff
path: root/mk/plist/plist-libtool.awk
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2006-01-12 23:43:56 +0000
committerjlam <jlam@pkgsrc.org>2006-01-12 23:43:56 +0000
commit8e0e10d3faa21afcadcb62ad06e910bae8750a48 (patch)
tree549e889f813ac3835ae3b1d7708def459c235461 /mk/plist/plist-libtool.awk
parent30e5711ea4afb02f54e4eeba5cf1abc88bbaec78 (diff)
downloadpkgsrc-8e0e10d3faa21afcadcb62ad06e910bae8750a48.tar.gz
Initial commit of a new module that encapsulates all of the code
for manipulating PLISTs. This module is not used by default pending more widespread testing -- currently the variable _USE_PLIST_MODULE must be defined in /etc/mk.conf to enable its use. The main features of the new PLIST module are: (1) Splits out the PLIST-handling code from bsd.pkg.mk into a separate "plist" module. (2) Splits out giant, multi-line awk scripts stored in make variables into separate awk scripts that may be joined together to post-process PLISTs. Each of these awk scripts consolidates the processing for one set of files, e.g., man pages, info pages, etc., and is more easily commented than a make variable. (3) Splits out the print-PLIST code from the regular PLIST code since they have no common pieces (print-plist.mk vs. plist.mk). (4) Completely re-implements the shared-library handling to be more efficient. Along the way, this also fixes a problem for Mac OS X users where the PLISTs incorrectly contained absolute paths. (5) Completely re-implements the info-file handling so that we can migrate from INFO_FILES definitions to just adding info/foo.info entries in the static PLISTs. (6) Adds commented-out support for automatically compressed or decompressed info page entries based on the value of MANZ. These changes will be activated after texinfo.mk has been replaced by something that is built using the more modern primitives now available in pkgsrc. (7) Move the file compression logic into a separate script "doc-compress" that compresses or decompresses files while minding symlinks. This script is now called by bsd.pkg.mk to do the "autmoatic man page handling". In the future, it will also handle the "automatic info page handling" and possible others. In general, the idea is to move stuff out of the Makefiles and into separate files where we don't need to worry about quoting rules and where each file can have a separate history of commits. This simplifies the makefile logic (especially in terms of readability) and also simplifies maintenance of the code.
Diffstat (limited to 'mk/plist/plist-libtool.awk')
-rw-r--r--mk/plist/plist-libtool.awk78
1 files changed, 78 insertions, 0 deletions
diff --git a/mk/plist/plist-libtool.awk b/mk/plist/plist-libtool.awk
new file mode 100644
index 00000000000..8120f9e54f2
--- /dev/null
+++ b/mk/plist/plist-libtool.awk
@@ -0,0 +1,78 @@
+# $NetBSD: plist-libtool.awk,v 1.1 2006/01/12 23:43:57 jlam Exp $
+#
+# Copyright (c) 2006 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# 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.
+
+### This awk script handles libtool archive entries in PLISTs. This script
+### requires the following scripts to be included:
+###
+### plist-functions.awk (print_entry)
+###
+### Certain environment variables must be set prior to running this script:
+###
+### LIBTOOL_EXPAND is the path to the script that prints out the
+### actual library files associated with a libtool archive file.
+###
+### LIBTOOLIZE_PLIST is a yes/no variable indicating whether to expand
+### *.la files in the PLIST into the corresponding real libraries.
+###
+### PREFIX is the installation prefix of the the package.
+###
+### TEST is the command used for shell tests, e.g. shell test built-in or
+### the path to a "test" binary.
+###
+
+BEGIN {
+ LIBTOOL_EXPAND = ENVIRON["LIBTOOL_EXPAND"]
+ LIBTOOLIZE_PLIST = ENVIRON["LIBTOOLIZE_PLIST"]
+ PREFIX = ENVIRON["PREFIX"]
+ TEST = ENVIRON["TEST"]
+}
+
+###
+### Expand libtool archives into the list of corresponding shared and/or
+### static libraries.
+###
+(LIBTOOLIZE_PLIST ~ /[yY][eE][sS]/) && /^[^@].*\.la$/ {
+ print_entry($0)
+ cmd = TEST " -f " PREFIX "/" $0
+ if (system(cmd) == 0) {
+ cmd = "cd " PREFIX " && " LIBTOOL_EXPAND " " $0
+ while (cmd | getline) {
+ print_entry($0)
+ }
+ close(cmd)
+ }
+ next
+}