diff options
author | jlam <jlam@pkgsrc.org> | 2006-01-12 23:43:56 +0000 |
---|---|---|
committer | jlam <jlam@pkgsrc.org> | 2006-01-12 23:43:56 +0000 |
commit | dd1e85068eea1eec252d89741095566e06b4c8b7 (patch) | |
tree | 549e889f813ac3835ae3b1d7708def459c235461 /mk/plist/shlib-aout.awk | |
parent | cb3bdb2826ccb0db0e79327a5972b5e044b00b6f (diff) | |
download | pkgsrc-dd1e85068eea1eec252d89741095566e06b4c8b7.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/shlib-aout.awk')
-rw-r--r-- | mk/plist/shlib-aout.awk | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/mk/plist/shlib-aout.awk b/mk/plist/shlib-aout.awk new file mode 100644 index 00000000000..e98379cc0cc --- /dev/null +++ b/mk/plist/shlib-aout.awk @@ -0,0 +1,133 @@ +# $NetBSD: shlib-aout.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 is a filter that reads PLIST entries and strips out +# entries that match ELF library symlinks that aren't installed on a.out +# platforms. +# + +BEGIN { + LIBTOOL_EXPAND = ENVIRON["LIBTOOL_EXPAND"] + LIBTOOLIZE_PLIST = ENVIRON["LIBTOOLIZE_PLIST"] + PREFIX = ENVIRON["PREFIX"] + TEST = ENVIRON["TEST"] + nentries = 0 +} + +### +### Stored special PLIST commands, e.g. @comment, @exec, etc., verbatim +### in the entries array. +### +/^@/ { + entries[++nentries] = $0 + next +} + +### +### Record all of the library names associated with a libtool archive +### in the "ltnames" array. Also, record the libtool archive in the +### "entries" array. +### +(LIBTOOLIZE_PLIST ~ /[yY][eE][sS]/) && /.*\/[^\/]+\.la$/ { + entries[++nentries] = $0 + cmd = TEST " -f " PREFIX "/" $0 + if (system(cmd) == 0) { + cmd = "cd " PREFIX " && " LIBTOOL_EXPAND " " $0 + while (cmd | getline) { + ltnames[$0] = $0 + } + close(cmd) + } + next +} + +### +### Record all library symlinks derived from a shared library name in the +### "symlinks" array. Also, record the full shared library name in the +### "entries" array. +### +/.*\/lib[^\/]+\.so(\.[0-9]+)*$/ { + entries[++nentries] = $0 + while (sub("\.[0-9]+$", "")) { + symlinks[$0] = $0 + } + if (sub("-[^-]+\.so$", ".so")) { + symlinks[$0] = $0 + } + next +} + +### +### All other entries are stored verbatim in the entries array. +### +{ + entries[++nentries] = $0 +} + +### +### Print out the PLIST entries to standard output. +### +END { + # Drop valid library names associated with a libtool archive from + # the list of library symlinks that will be removed from the PLIST. + # + for (j in symlinks) { + for (k in ltnames) { + if (symlinks[j] == ltnames[k]) { + delete symlinks[j] + break + } + } + } + + # Remove PLIST entries which match a library symlink. + for (i in entries) { + for (j in symlinks) { + if (entries[i] == symlinks[j]) { + delete entries[i] + break + } + } + } + + # Output the PLIST entries in order. + for (i = 1; i <= nentries; i++) { + if (entries[i]) { + print entries[i] + } + } +} |