pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Initial commit of a new module that encapsulates al...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/139de6d14bca
branches:  trunk
changeset: 506226:139de6d14bca
user:      jlam <jlam%pkgsrc.org@localhost>
date:      Thu Jan 12 23:43:56 2006 +0000

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

 mk/bsd.pkg.mk                |   60 +++++++++-
 mk/platform/AIX.mk           |    9 +-
 mk/platform/BSDOS.mk         |    9 +-
 mk/platform/Darwin.mk        |    9 +-
 mk/platform/DragonFly.mk     |    9 +-
 mk/platform/FreeBSD.mk       |    9 +-
 mk/platform/IRIX.mk          |    9 +-
 mk/platform/Interix.mk       |    9 +-
 mk/platform/Linux.mk         |    9 +-
 mk/platform/NetBSD.mk        |    9 +-
 mk/platform/OSF1.mk          |    9 +-
 mk/platform/OpenBSD.mk       |    9 +-
 mk/platform/SunOS.mk         |    9 +-
 mk/platform/UnixWare.mk      |    9 +-
 mk/plist/bsd.plist.mk        |    7 +
 mk/plist/doc-compress        |  104 +++++++++++++++++++
 mk/plist/libtool-expand      |   86 +++++++++++++++
 mk/plist/plist-default.awk   |   43 +++++++
 mk/plist/plist-functions.awk |   59 ++++++++++
 mk/plist/plist-info.awk      |   93 +++++++++++++++++
 mk/plist/plist-libtool.awk   |   78 ++++++++++++++
 mk/plist/plist-man.awk       |  149 +++++++++++++++++++++++++++
 mk/plist/plist-subst.awk     |   66 ++++++++++++
 mk/plist/plist.mk            |  235 +++++++++++++++++++++++++++++++++++++++++++
 mk/plist/print-plist.mk      |  172 +++++++++++++++++++++++++++++++
 mk/plist/shlib-aout.awk      |  133 ++++++++++++++++++++++++
 mk/plist/shlib-dylib.awk     |  182 +++++++++++++++++++++++++++++++++
 mk/plist/shlib-elf.awk       |   48 ++++++++
 mk/plist/shlib-none.awk      |   54 +++++++++
 mk/plist/shlib-type          |   54 +++++++++
 30 files changed, 1721 insertions(+), 19 deletions(-)

diffs (truncated from 2292 to 300 lines):

diff -r 773a25d60d8e -r 139de6d14bca mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Thu Jan 12 23:37:31 2006 +0000
+++ b/mk/bsd.pkg.mk     Thu Jan 12 23:43:56 2006 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1787 2006/01/12 00:40:19 rillig Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1788 2006/01/12 23:43:56 jlam Exp $
 #
 # This file is in the public domain.
 #
@@ -93,6 +93,7 @@
 PKGNAME_NOREV=         ${PKGNAME}
 .endif
 
+.if !defined(_USE_PLIST_MODULE)
 ##### PLIST
 
 .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
@@ -120,6 +121,7 @@
 PLIST_SRC+=            ${PKGDIR}/PLIST.common_end
 .  endif
 .endif # !PLIST_SRC
+.endif # !_USE_PLIST_MODULE
 
 ##### Others
 
@@ -173,7 +175,9 @@
 DDIR=                  ${WRKDIR}/.DDIR
 DESCR=                 ${PKG_DB_TMPDIR}/+DESC
 DLIST=                 ${WRKDIR}/.DLIST
+.if !defined(_USE_PLIST_MODULE)
 PLIST=                 ${WRKDIR}/.PLIST
+.endif # !_USE_PLIST_MODULE
 
 # Files to create for versioning and build information
 BUILD_VERSION_FILE=    ${PKG_DB_TMPDIR}/+BUILD_VERSION
@@ -210,6 +214,7 @@
 PKG_FAIL_REASON+=      "This package doesn't support PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}."
 .endif
 
+.if !defined(_USE_PLIST_MODULE)
 .if (${PLIST_TYPE} != "dynamic") && (${PLIST_TYPE} != "static")
 PKG_FAIL_REASON+=      "PLIST_TYPE must be \`\`dynamic'' or \`\`static''."
 .endif
@@ -217,6 +222,7 @@
 .if (${PKG_INSTALLATION_TYPE} == "overwrite") && (${PLIST_TYPE} != "static")
 PKG_FAIL_REASON+=      "PLIST_TYPE must be \`\`static'' for \`\`overwrite'' packages."
 .endif
+.endif # !_USE_PLIST_MODULE
 
 # Check that we are using up-to-date pkg_* tools with this file.
 .if !defined(NO_PKGTOOLS_REQD_CHECK)
@@ -351,6 +357,7 @@
 PKG_FAIL_REASON+=      "DEPOT_SUBDIR may not be empty."
 .endif
 
+.if !defined(_USE_PLIST_MODULE)
 .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
 #
 # _PLIST_IGNORE_FILES basically mirrors the list of ignored files found
@@ -366,6 +373,7 @@
 _PLIST_IGNORE_FILES+=  ${PLIST_IGNORE_FILES}
 .endif
 BUILD_DEFS+=           _PLIST_IGNORE_FILES
+.endif # !_USE_PLIST_MODULE
 
 # Automatically increase process limit where necessary for building.
 _ULIMIT_CMD=           ${UNLIMIT_RESOURCES:@_lim_@${ULIMIT_CMD_${_lim_}};@}
@@ -472,6 +480,7 @@
 .  undef NO_PACKAGE
 .endif
 
+.if !defined(_USE_PLIST_MODULE)
 # Set PLIST_SUBST to substitute "${variable}" to "value" in PLIST
 PLIST_SUBST+=  OPSYS=${OPSYS:Q}                                        \
                OS_VERSION=${OS_VERSION:Q}                              \
@@ -499,6 +508,7 @@
                RM=${RM:Q}                                              \
                TRUE=${TRUE:Q}                                          \
                PKGMANDIR=${PKGMANDIR:Q}
+.endif # !_USE_PLIST_MODULE
 
 # Handle alternatives
 #
@@ -708,9 +718,11 @@
       !empty(PKG_SYSCONFBASE:M${PREFIX}/*)
 PKG_SYSCONFDEPOTBASE=  # empty
 PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFBASE}
+.    if !defined(_USE_PLIST_MODULE)
 .    if !empty(CONF_DEPENDS)
 _PLIST_IGNORE_FILES+=  ${PKG_SYSCONFDIR:S,^${PREFIX}/,,}
 .    endif
+.    endif # !_USE_PLIST_MODULE
 .  else
 PKG_SYSCONFDEPOTBASE=  ${PKG_SYSCONFBASE}/${DEPOT_SUBDIR}
 PKG_SYSCONFBASEDIR=    ${PKG_SYSCONFDEPOTBASE}/${PKGNAME}
@@ -1995,6 +2007,26 @@
        ${_PKG_SILENT}${_PKG_DEBUG}${RM} -f ${PKGFILE}
 .endif
 
+.if defined(_USE_PLIST_MODULE)
+_PLIST_REGEXP.info=    \
+       ^${INFO_DIR}/[^/]*\.info(-[0-9]+)?(\.gz)$$
+_PLIST_REGEXP.man=     \
+       ^([^/]*/)+(man[1-9ln]/[^/]*\.[1-9ln]|cat[1-9ln]/[^/]*\.[0-9])(\.gz)?$$
+
+_DOC_COMPRESS=                                                         \
+       ${SETENV} ECHO=${TOOLS_ECHO:Q}                                  \
+               EXPR=${TOOLS_EXPR:Q}                                    \
+               GZIP_CMD=${TOOLS_GZIP_CMD:Q}                            \
+               GUNZIP_CMD=${TOOLS_GUNZIP_CMD:Q}                        \
+               LN=${TOOLS_LN:Q}                                        \
+               LS=${TOOLS_LS:Q}                                        \
+               MANZ=${_MANZ:Q}                                         \
+               PKG_VERBOSE=${PKG_VERBOSE:Q}                            \
+               RM=${TOOLS_RM:Q}                                        \
+               TEST=${TOOLS_TEST:Q}                                    \
+       ${SH} ${.CURDIR}/../../mk/plist/doc-compress ${PREFIX:Q}
+.endif # _USE_PLIST_MODULE
+
 .PHONY: real-su-install
 real-su-install: ${MESSAGE}
 .if !defined(NO_PKG_REGISTER) && !defined(FORCE_PKG_REGISTER) &&       \
@@ -2099,6 +2131,12 @@
                # listed in the PLIST.                                  \
                #
        ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} ${PLIST}
+.if defined(_USE_PLIST_MODULE)
+       ${_PKG_SILENT}${_PKG_DEBUG}                                     \
+       ${ECHO_MSG} "${_PKGSRC_IN}> [Automatic manual page handling]";  \
+       ${CAT} ${PLIST} | ${GREP} -v "^@" |                             \
+       ${EGREP} ${_PLIST_REGEXP.man:Q} | ${_DOC_COMPRESS}
+.else # !_USE_PLIST_MODULE
        ${_PKG_SILENT}${_PKG_DEBUG}newmanpages=`${EGREP} -h             \
                '^([^@/]*/)*man/([^/]*/)?(man[1-9ln]/.*\.[1-9ln]|cat[1-9ln]/.*\.[0-9])(\.gz)?$$' \
                ${PLIST} 2>/dev/null || ${TRUE}`;                       \
@@ -2140,16 +2178,19 @@
                        fi;                                             \
                done;                                                   \
        fi
+.endif # _USE_PLIST_MODULE
 .if empty(CHECK_FILES:M[nN][oO])
        ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} check-files-post
 .endif
        ${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install-script
+.if !defined(_USE_PLIST_MODULE)
 .if ${_DO_SHLIB_CHECKS} == "yes"
 .  if ${PKG_INSTALLATION_TYPE} == "overwrite"
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
        ${MAKE} ${MAKEFLAGS} do-shlib-handling SHLIB_PLIST_MODE=0
 .  endif
 .endif
+.endif # !_USE_PLIST_MODULE
 .if defined(MESSAGE)
        @${ECHO_MSG} "${_PKGSRC_IN}> Please note the following:"
        @${ECHO_MSG} ""
@@ -2184,7 +2225,7 @@
 .endif
 
 
-
+.if !defined(_USE_PLIST_MODULE)
 # Do handling of shared libs for two cases:
 #
 # SHLIB_PLIST_MODE=1: when first called via the ${PLIST} target,
@@ -2425,7 +2466,7 @@
                esac;                                                   \
        fi
 .endif # SHLIB_HANDLING == "YES"
-
+.endif !_USE_PLIST_MODULE
 
 # Check if all binaries and shlibs find their needed libs
 # Must be run after "make install", so that files are installed, and
@@ -2468,7 +2509,7 @@
        fi
 .endif # NO_PKG_REGISTER
 
-
+.if !defined(_USE_PLIST_MODULE)
 .if !target(show-shlib-type)
 # Show the shared lib type being built: one of ELF, a.out, dylib, or none
 .PHONY: show-shlib-type
@@ -2497,7 +2538,7 @@
        @${ECHO} ${_OPSYS_SHLIB_TYPE}
 .  endif   # USE_LANGUAGES
 .endif
-
+.endif # !_USE_PLIST_MODULE
 
 .PHONY: acquire-extract-lock acquire-patch-lock acquire-tools-lock
 .PHONY: acquire-wrapper-lock acquire-configure-lock acquire-build-lock
@@ -3997,7 +4038,7 @@
                ${ECHO} "0";                                            \
        fi
 
-
+.if !defined(_USE_PLIST_MODULE)
 ###
 ### Automatic PLIST generation
 ###  - files & symlinks first
@@ -4171,6 +4212,7 @@
        done                                                            \
        | ${AWK} '${_PRINT_PLIST_AWK_SUBST} { print $$0; }'
 .endif # target(print-PLIST)
+.endif # !_USE_PLIST_MODULE
 
 # By default, all packages attempt to link into the views.
 .if ${PKG_INSTALLATION_TYPE} == "pkgviews"
@@ -4484,6 +4526,7 @@
 tags:
 .endif
 
+.if !defined(_USE_PLIST_MODULE)
 # generate ${PLIST} from ${PLIST_SRC} by:
 # - substituting for PLIST_SUBST entries
 # - fixing list of man-pages according to PKGMANDIR, MANZ, MANINSTALL.
@@ -4661,6 +4704,7 @@
                > ${PLIST};                                             \
          ${MAKE} ${MAKEFLAGS} do-shlib-handling                        \
                SHLIB_PLIST_MODE=1
+.endif # !_USE_PLIST_MODULE
 
 # generate ${MESSAGE} from ${MESSAGE_SRC} by substituting
 # for MESSAGE_SUBST entries
@@ -4694,6 +4738,10 @@
        ${ECHO} '${HOMEPAGE}'   >>${DESCR}
 .endif
 
+.if defined(_USE_PLIST_MODULE)
+.include "../../mk/plist/bsd.plist.mk"
+.endif # _USE_PLIST_MODULE
+
 .include "../../mk/subst.mk"
 
 #
diff -r 773a25d60d8e -r 139de6d14bca mk/platform/AIX.mk
--- a/mk/platform/AIX.mk        Thu Jan 12 23:37:31 2006 +0000
+++ b/mk/platform/AIX.mk        Thu Jan 12 23:43:56 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: AIX.mk,v 1.21 2005/12/04 01:44:30 joerg Exp $
+# $NetBSD: AIX.mk,v 1.22 2006/01/12 23:43:56 jlam Exp $
 #
 # Variable definitions for the AIX operating system.
 
@@ -42,8 +42,13 @@
 IMAKE_FILEMAN_DIR=     ${IMAKE_MAN_SOURCE_PATH}5
 IMAKE_GAMEMAN_DIR=     ${IMAKE_MAN_SOURCE_PATH}6
 IMAKE_MANNEWSUFFIX=    0
+.if defined(_USE_PLIST_MODULE)
+IMAKE_MANINSTALL?=     maninstall catinstall
+.endif
 
+.if !defined(_USE_PLIST_MODULE)
 _DO_SHLIB_CHECKS=      yes
+.endif
 .if exists(/usr/include/netinet6)
 _OPSYS_HAS_INET6=      yes     # IPv6 is standard
 .else
@@ -57,7 +62,9 @@
 _OPSYS_SHLIB_TYPE=     aixlib  # type of shared lib
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
 _PATCH_BACKUP_ARG?=    -b -V simple -z         # switch to patch(1) for backup suffix
+.if !defined(_USE_PLIST_MODULE)
 _PREFORMATTED_MAN_DIR= cat     # directory where catman pages are
+.endif
 _USE_GNU_GETTEXT=      no      # Don't use GNU gettext
 _USE_RPATH=            yes     # add rpath to LDFLAGS
 
diff -r 773a25d60d8e -r 139de6d14bca mk/platform/BSDOS.mk
--- a/mk/platform/BSDOS.mk      Thu Jan 12 23:37:31 2006 +0000
+++ b/mk/platform/BSDOS.mk      Thu Jan 12 23:43:56 2006 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: BSDOS.mk,v 1.16 2005/12/04 01:44:30 joerg Exp $
+# $NetBSD: BSDOS.mk,v 1.17 2006/01/12 23:43:57 jlam Exp $
 #
 # Variable definitions for the BSD/OS operating system.
 
@@ -47,8 +47,13 @@
 IMAKE_LIBMAN_DIR=      ${IMAKE_MAN_SOURCE_PATH}3
 IMAKE_FILEMAN_DIR=     ${IMAKE_MAN_SOURCE_PATH}5
 IMAKE_GAMEMAN_DIR=     ${IMAKE_MAN_SOURCE_PATH}6
+.if defined(_USE_PLIST_MODULE)
+IMAKE_MANINSTALL?=     maninstall catinstall
+.endif
 
+.if !defined(_USE_PLIST_MODULE)
 _DO_SHLIB_CHECKS=      yes     # fixup PLIST for shared libs/run ldconfig
+.endif
 .if exists(/usr/include/netinet6)
 _OPSYS_HAS_INET6=      yes     # IPv6 is standard
 .else
@@ -64,7 +69,9 @@
 _OPSYS_SHLIB_TYPE=     ELF/a.out       # shared lib type
 _PATCH_CAN_BACKUP=     yes     # native patch(1) can make backups
 _PATCH_BACKUP_ARG?=    -V simple -b -z # switch to patch(1) for backup suffix
+.if !defined(_USE_PLIST_MODULE)
 _PREFORMATTED_MAN_DIR= cat     # directory where catman pages are
+.endif
 _USE_GNU_GETTEXT=      no      # Don't use GNU gettext
 _USE_RPATH=            yes     # add rpath to LDFLAGS



Home | Main Index | Thread Index | Old Index