diff options
30 files changed, 1721 insertions, 19 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index d4190dd1431..d2fd8f22845 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -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?= ${DISTNAME} PKGNAME_NOREV= ${PKGNAME} .endif +.if !defined(_USE_PLIST_MODULE) ##### PLIST .if ${PKG_INSTALLATION_TYPE} == "pkgviews" @@ -120,6 +121,7 @@ PLIST_SRC+= ${PKGDIR}/PLIST PLIST_SRC+= ${PKGDIR}/PLIST.common_end . endif .endif # !PLIST_SRC +.endif # !_USE_PLIST_MODULE ##### Others @@ -173,7 +175,9 @@ PKG_DB_TMPDIR= ${WRKDIR}/.pkgdb 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+= "PKG_INSTALLATION_TYPE must be \`\`pkgviews'' or \`\`overwrite 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 @@ PKG_FAIL_REASON+= "PLIST_TYPE must be \`\`dynamic'' or \`\`static''." .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 @@ BUILD_DEFS+= PKG_OPTIONS 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+= *[~\#] *.OLD *.orig *,v # scratch config files _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 @@ SCRIPTS_ENV+= ${INSTALL_MACROS} . 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 @@ PLIST_SUBST+= OPSYS=${OPSYS:Q} \ RM=${RM:Q} \ TRUE=${TRUE:Q} \ PKGMANDIR=${PKGMANDIR:Q} +.endif # !_USE_PLIST_MODULE # Handle alternatives # @@ -708,9 +718,11 @@ PKG_SYSCONFBASEDIR= ${PKG_SYSCONFBASE} !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 @@ delete-package: ${_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 @@ real-su-install: ${MESSAGE} # 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 @@ real-su-install: ${MESSAGE} 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 @@ real-su-install: ${MESSAGE} .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 @@ do-shlib-handling: 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 @@ check-shlibs: 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 @@ show-shlib-type: @${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 @@ print-pkg-size-depends: ${ECHO} "0"; \ fi - +.if !defined(_USE_PLIST_MODULE) ### ### Automatic PLIST generation ### - files & symlinks first @@ -4171,6 +4212,7 @@ print-PLIST: 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 @@ depend: 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}: > ${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 @@ ${DESCR}: ${DESCR_SRC} ${ECHO} '${HOMEPAGE}' >>${DESCR} .endif +.if defined(_USE_PLIST_MODULE) +.include "../../mk/plist/bsd.plist.mk" +.endif # _USE_PLIST_MODULE + .include "../../mk/subst.mk" # diff --git a/mk/platform/AIX.mk b/mk/platform/AIX.mk index 86ca8aee9b0..6c233499baf 100644 --- a/mk/platform/AIX.mk +++ b/mk/platform/AIX.mk @@ -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_LIBMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}3 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_PTHREAD_AUTO= no # -lpthread needed for pthreads _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 --git a/mk/platform/BSDOS.mk b/mk/platform/BSDOS.mk index 54975678e2c..057d0c22cee 100644 --- a/mk/platform/BSDOS.mk +++ b/mk/platform/BSDOS.mk @@ -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_MAN_DIR= ${IMAKE_MAN_SOURCE_PATH}1 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_PTHREAD_AUTO= no # -lpthread needed for pthreads _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 diff --git a/mk/platform/Darwin.mk b/mk/platform/Darwin.mk index 44a788a62a5..7f4768ef533 100644 --- a/mk/platform/Darwin.mk +++ b/mk/platform/Darwin.mk @@ -1,4 +1,4 @@ -# $NetBSD: Darwin.mk,v 1.15 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: Darwin.mk,v 1.16 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the Darwin operating system. @@ -52,8 +52,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 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.if defined(_USE_PLIST_MODULE) +IMAKE_MANINSTALL?= maninstall catinstall +.endif +.if !defined(_USE_PLIST_MODULE) _DO_SHLIB_CHECKS= yes # on installation, fixup PLIST for shared libs +.endif .if ${OS_VERSION:R} >= 6 _OPSYS_HAS_INET6= yes # IPv6 is standard .else @@ -69,7 +74,9 @@ _OPSYS_COMPILER_RPATH_FLAG= -L # compiler flag to pass rpaths to linker _OPSYS_SHLIB_TYPE= dylib # 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= no # don't add rpath to LDFLAGS diff --git a/mk/platform/DragonFly.mk b/mk/platform/DragonFly.mk index dcc697ce223..46aab24a835 100644 --- a/mk/platform/DragonFly.mk +++ b/mk/platform/DragonFly.mk @@ -1,4 +1,4 @@ -# $NetBSD: DragonFly.mk,v 1.23 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: DragonFly.mk,v 1.24 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the DragonFly operating system. @@ -48,8 +48,13 @@ IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.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 @@ -63,7 +68,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _OPSYS_SHLIB_TYPE= ELF # shared lib type _PATCH_CAN_BACKUP= yes # native patch(1) can make backups _PATCH_BACKUP_ARG?= -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 --git a/mk/platform/FreeBSD.mk b/mk/platform/FreeBSD.mk index 725d879e9ec..3831ccf09a1 100644 --- a/mk/platform/FreeBSD.mk +++ b/mk/platform/FreeBSD.mk @@ -1,4 +1,4 @@ -# $NetBSD: FreeBSD.mk,v 1.15 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: FreeBSD.mk,v 1.16 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the FreeBSD operating system. @@ -44,8 +44,13 @@ IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.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 @@ -59,7 +64,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _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 # 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 --git a/mk/platform/IRIX.mk b/mk/platform/IRIX.mk index 04a3e3f9bc5..2a2d06f48aa 100644 --- a/mk/platform/IRIX.mk +++ b/mk/platform/IRIX.mk @@ -1,4 +1,4 @@ -# $NetBSD: IRIX.mk,v 1.20 2005/12/08 01:12:56 jschauma Exp $ +# $NetBSD: IRIX.mk,v 1.21 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the IRIX operating system. @@ -40,8 +40,13 @@ IMAKE_LIBMAN_DIR?= ${IMAKE_MAN_SOURCE_PATH}3/X11 IMAKE_FILEMAN_DIR?= ${IMAKE_MAN_SOURCE_PATH}5/X11 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6/X11 IMAKE_MANNEWSUFFIX?= z +.if defined(_USE_PLIST_MODULE) +IMAKE_MANINSTALL?= maninstall +.endif +.if !defined(_USE_PLIST_MODULE) _DO_SHLIB_CHECKS= yes # fixup PLIST for shared libs +.endif .if exists(/usr/include/netinet6) _OPSYS_HAS_INET6= yes # IPv6 is standard .else @@ -60,7 +65,9 @@ _PATCH_BACKUP_ARG?= -b -V simple -z # switch to patch(1) for backup suffix .else _PATCH_CAN_BACKUP= no # native patch(1) can make backups .endif +.if !defined(_USE_PLIST_MODULE) _PREFORMATTED_MAN_DIR= man # directory where catman pages are +.endif _USE_GNU_GETTEXT= no # Don't use GNU gettext _USE_RPATH= yes # add rpath to LDFLAGS diff --git a/mk/platform/Interix.mk b/mk/platform/Interix.mk index c44df2767d3..9623569ed22 100644 --- a/mk/platform/Interix.mk +++ b/mk/platform/Interix.mk @@ -1,4 +1,4 @@ -# $NetBSD: Interix.mk,v 1.47 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: Interix.mk,v 1.48 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the Interix operating system. @@ -125,8 +125,13 @@ IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.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 @@ -141,7 +146,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _OPSYS_SHLIB_TYPE= ELF # shared lib type - not exactly true, but near enough _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= yes # gettext not in base system _USE_RPATH= yes # add rpath to LDFLAGS diff --git a/mk/platform/Linux.mk b/mk/platform/Linux.mk index 5afdc7ee9b9..a8891d46276 100644 --- a/mk/platform/Linux.mk +++ b/mk/platform/Linux.mk @@ -1,4 +1,4 @@ -# $NetBSD: Linux.mk,v 1.21 2006/01/10 16:58:04 christos Exp $ +# $NetBSD: Linux.mk,v 1.22 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the Linux operating system. @@ -46,9 +46,14 @@ IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.if defined(_USE_PLIST_MODULE) +IMAKE_MANINSTALL?= maninstall catinstall +.endif IMAKE_TOOLS= gmake # extra tools required when we use imake +.if !defined(_USE_PLIST_MODULE) _DO_SHLIB_CHECKS= no # on installation, fixup PLIST for shared libs +.endif .if exists(/usr/include/netinet6) || exists(/usr/include/linux/in6.h) _OPSYS_HAS_INET6= yes # IPv6 is standard .else @@ -62,7 +67,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _OPSYS_SHLIB_TYPE= ELF # shared lib type _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 --git a/mk/platform/NetBSD.mk b/mk/platform/NetBSD.mk index 7706009b6a1..44bf20e5214 100644 --- a/mk/platform/NetBSD.mk +++ b/mk/platform/NetBSD.mk @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.mk,v 1.17 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: NetBSD.mk,v 1.18 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the NetBSD operating system. @@ -60,8 +60,13 @@ IMAKE_KERNMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}4 IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}5 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MISCMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}7 +.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 @@ -75,7 +80,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _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 # 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 --git a/mk/platform/OSF1.mk b/mk/platform/OSF1.mk index fca4f399342..8b47b0989c7 100644 --- a/mk/platform/OSF1.mk +++ b/mk/platform/OSF1.mk @@ -1,4 +1,4 @@ -# $NetBSD: OSF1.mk,v 1.10 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: OSF1.mk,v 1.11 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the OSF1 operating system. @@ -47,8 +47,13 @@ IMAKE_LIBMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}3 IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}4 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MANNEWSUFFIX= 1 +.if defined(_USE_PLIST_MODULE) +IMAKE_MANINSTALL?= maninstall catinstall +.endif +.if !defined(_USE_PLIST_MODULE) _DO_SHLIB_CHECKS= yes # fixup PLIST +.endif .if exists(/usr/include/netinet/ip6.h) _OPSYS_HAS_INET6= yes # IPv6 is standard .else @@ -63,7 +68,9 @@ _OPSYS_RPATH_NAME= -rpath, # name of symbol in rpath directive to linker _OPSYS_SHLIB_TYPE= COFF # 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= yes # Don't use GNU gettext _USE_RPATH= yes # add rpath to LDFLAGS diff --git a/mk/platform/OpenBSD.mk b/mk/platform/OpenBSD.mk index 2f5493342a9..7ef9bc5b867 100644 --- a/mk/platform/OpenBSD.mk +++ b/mk/platform/OpenBSD.mk @@ -1,4 +1,4 @@ -# $NetBSD: OpenBSD.mk,v 1.20 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: OpenBSD.mk,v 1.21 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the OpenBSD operating system. @@ -46,8 +46,13 @@ IMAKE_MAN_DIR= ${IMAKE_MAN_SOURCE_PATH}1 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 @@ -65,7 +70,9 @@ _PATCH_BACKUP_ARG?= -V simple -z # switch to patch(1) for backup suffix .else _PATCH_BACKUP_ARG?= -V simple -b # switch to patch(1) for backup suffix .endif +.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 --git a/mk/platform/SunOS.mk b/mk/platform/SunOS.mk index 67694d27714..9abf4020792 100644 --- a/mk/platform/SunOS.mk +++ b/mk/platform/SunOS.mk @@ -1,4 +1,4 @@ -# $NetBSD: SunOS.mk,v 1.20 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: SunOS.mk,v 1.21 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the SunOS/Solaris operating system. @@ -47,8 +47,13 @@ IMAKE_LIBMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}3 IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}4 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.if defined(_USE_PLIST_MODULE) +IMAKE_MANINSTALL?= maninstall +.endif +.if !defined(_USE_PLIST_MODULE) _DO_SHLIB_CHECKS= yes # fixup PLIST for shared libs +.endif .if exists(/usr/include/netinet/ip6.h) _OPSYS_HAS_INET6= yes # IPv6 is standard .else @@ -62,7 +67,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _OPSYS_SHLIB_TYPE= ELF # shared lib type _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= man # directory where catman pages are +.endif _USE_GNU_GETTEXT= yes # Use GNU gettext _USE_RPATH= yes # add rpath to LDFLAGS diff --git a/mk/platform/UnixWare.mk b/mk/platform/UnixWare.mk index 20f4eb86ce3..5dd4862531d 100644 --- a/mk/platform/UnixWare.mk +++ b/mk/platform/UnixWare.mk @@ -1,4 +1,4 @@ -# $NetBSD: UnixWare.mk,v 1.18 2005/12/04 01:44:30 joerg Exp $ +# $NetBSD: UnixWare.mk,v 1.19 2006/01/12 23:43:57 jlam Exp $ # # Variable definitions for the UnixWare 7 operating system. @@ -39,8 +39,13 @@ IMAKE_LIBMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}3 IMAKE_FILEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}4 IMAKE_GAMEMAN_DIR= ${IMAKE_MAN_SOURCE_PATH}6 IMAKE_MANNEWSUFFIX= ${IMAKE_MAN_SUFFIX} +.if defined(_USE_PLIST_MODULE) +IMAKE_MANINSTALL?= maninstall +.endif +.if !defined(_USE_PLIST_MODULE) _DO_SHLIB_CHECKS= yes # fixup PLIST for shared libs +.endif .if exists(/usr/include/netinet/in6.h) _OPSYS_HAS_INET6= yes # IPv6 is standard .else @@ -54,7 +59,9 @@ _OPSYS_PTHREAD_AUTO= no # -lpthread needed for pthreads _OPSYS_SHLIB_TYPE= ELF # shared lib type _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= man # directory where catman pages are +.endif _USE_GNU_GETTEXT= yes # Use GNU gettext # # The native linker for UnixWare doesn't really support an option to pass diff --git a/mk/plist/bsd.plist.mk b/mk/plist/bsd.plist.mk new file mode 100644 index 00000000000..376069c959b --- /dev/null +++ b/mk/plist/bsd.plist.mk @@ -0,0 +1,7 @@ +# $NetBSD: bsd.plist.mk,v 1.1 2006/01/12 23:43:57 jlam Exp $ +# +# This Makefile fragment is included by bsd.pkg.mk and provides all +# PLIST-related variables and targets. + +.include "../../mk/plist/plist.mk" +.include "../../mk/plist/print-plist.mk" diff --git a/mk/plist/doc-compress b/mk/plist/doc-compress new file mode 100755 index 00000000000..5f40a460fc4 --- /dev/null +++ b/mk/plist/doc-compress @@ -0,0 +1,104 @@ +#!/bin/sh +# +# $NetBSD: doc-compress,v 1.1 2006/01/12 23:43:57 jlam Exp $ +# +# This script is derived from software contributed to The NetBSD Foundation +# by Alistair Crooks. +# +# This script compresses or decompresses files listed in standard input. +# It handles symlinks by recreating the symlinks to point to the +# compressed or uncompressed targets. +# + +: ${ECHO=echo} +: ${EXPR=expr} +: ${GZIP_CMD=gzip} +: ${GUNZIP_CMD=gunzip} +: ${LN=ln} +: ${LS=ls} +: ${RM=rm} +: ${TEST=test} + +self="${0##*/}" + +usage() { + ${ECHO} 1>&2 "usage: $self [-v] [-z] prefix" +} + +case "$MANZ" in +[yY][eE][sS]) compress=yes ;; +*) compress=no ;; +esac +case "$PKG_VERBOSE" in +"") verbose=no ;; +*) verbose=yes ;; +esac +prefix=/nonexistent + +# Process optional arguments +while ${TEST} $# -gt 0; do + case "$1" in + -v) verbose=yes; shift ;; + -z) compress=yes; shift ;; + --) shift; break ;; + -*) ${ECHO} 1>&2 "$self: unknown option -- ${1#-}" + usage + exit 1 + ;; + *) break ;; + esac +done + +${TEST} $# -gt 0 || { usage; exit 1; } + +# Process required arguments +prefix="$1" + +while read file; do + file="${file%.gz}" + path="$prefix/$file" + pathgz="$path.gz" + case "$compress" in + yes) + # If compressed pages were requested and we find an + # uncompressed page, then compress it, but if it was + # a symlink, then remove it and create a "compressed" + # symlink by symlinking to the compressed target. + # + if ${TEST} -h "$path"; then + target=`${LS} -l $path` + target="${target##*-> }" + ${RM} -f $pathgz + ${LN} -s $target.gz $pathgz + ${RM} -f $path + ${TEST} "$verbose" = no || + ${ECHO} "Symlinking: $file" + elif ${TEST} -f "$path"; then + ${GZIP_CMD} $path + ${TEST} "$verbose" = no || + ${ECHO} "Compressing: $file" + fi + ;; + no) + # If uncompressed pages were requested and we find a + # compressed page, then decompress it, but if it was + # a symlink, then remove it and create an "uncompressed" + # symlink by symlinking to the uncompressed target. + # + if ${TEST} -h "$pathgz"; then + target=`${LS} -l $pathgz` + target="${target##*-> }" + target="${target%.gz}" + ${RM} -f $path + ${LN} -s $target $path + ${RM} -f $pathgz + ${TEST} "$verbose" = no || + ${ECHO} "Symlinking: $file.gz" + elif ${TEST} -f "$pathgz"; then + ${GUNZIP_CMD} $pathgz + ${TEST} "$verbose" = no || + ${ECHO} "Decompressing: $file.gz" + fi + ;; + esac +done diff --git a/mk/plist/libtool-expand b/mk/plist/libtool-expand new file mode 100755 index 00000000000..b1a353afe85 --- /dev/null +++ b/mk/plist/libtool-expand @@ -0,0 +1,86 @@ +# /bin/sh +# +# $NetBSD: libtool-expand,v 1.1 2006/01/12 23:43:57 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} +: ${TEST=test} + +self="${0##*/}" + +usage() { + ${ECHO} 1>&2 "usage: $self archive ..." +} + +${TEST} $# -gt 0 || { usage; exit 1; } + +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 ${TEST} -r "$lapath" -a ! -h "$lapath"; then + if ${GREP} -q "libtool library file" "$lapath"; then + . "$lapath" + if ${TEST} "$installed" = "no"; then + ${ECHO} 1>&2 "$self: \`$lapath' was not properly installed" + exit 1 + fi + for lib in $library_names $old_library; do + libpath="$dir$lib" + if ${TEST} ! -f "$libpath"; then + ${ECHO} 1>&2 "$self: \`$libpath' was not found" + fi + ${ECHO} "$libpath" + done + fi + else + ${ECHO} 1>&2 "$self: cannot read libtool archive \`$lapath'" + fi +done | ${SORT} -u diff --git a/mk/plist/plist-default.awk b/mk/plist/plist-default.awk new file mode 100644 index 00000000000..5b80ab9a858 --- /dev/null +++ b/mk/plist/plist-default.awk @@ -0,0 +1,43 @@ +# $NetBSD: plist-default.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. + +### +### By default, print the PLIST entry. +### +{ + print_entry($0) + next +} diff --git a/mk/plist/plist-functions.awk b/mk/plist/plist-functions.awk new file mode 100644 index 00000000000..9c422b08561 --- /dev/null +++ b/mk/plist/plist-functions.awk @@ -0,0 +1,59 @@ +# $NetBSD: plist-functions.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. + +### +### join(array, start, end, separator) concatenates an array of strings +### with a separator and returns the concatenated string. It is the +### inverse of the built-in split() function. +### +function join(array, start, end, separator, result, i) { + result = array[start] + for (i = start + 1; i <= end; i++) + result = result separator array[i] + return result +} + +### +### print_entry(entry) prints the entry to standard output. If avoids +### printing out duplicate entries by caching ones that have previously +### been printed. +### +function print_entry(entry) { + if (entries[entry] == "") { + entries[entry] = entry + print entry + } +} diff --git a/mk/plist/plist-info.awk b/mk/plist/plist-info.awk new file mode 100644 index 00000000000..b36575bf201 --- /dev/null +++ b/mk/plist/plist-info.awk @@ -0,0 +1,93 @@ +# $NetBSD: plist-info.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 *.info file 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: +### +### INFO_DIR is the ${PREFIX}-relative path to the installed info pages. +### +### LS is the path to the "ls" binary. +### +### MANZ is a yes/no variable that determines whether the info pages +### should be recorded as compressed or not. +### +### 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 { + INFO_DIR = ENVIRON["INFO_DIR"] + LS = ENVIRON["LS"] + MANZ = ENVIRON["MANZ"] + PREFIX = ENVIRON["PREFIX"] + TEST = ENVIRON["TEST"] +} + +### +### Ignore *.info-1, *.info-2, etc. files in the PLIST as we get the +### list of installed *.info-[0-9]* files below. +### +/^[^@]/ && /^info\/[^\/]*\.info-[0-9]+(\.gz)?$/ { + next +} + +### +### For each info page entry, print all of the installed info sub-pages +### associated with that entry. +### +/^[^@]/ && /^info\/[^\/]*\.info(\.gz)?$/ { + sub("^info/", INFO_DIR "/") + cmd = TEST " -f " PREFIX "/" $0 + if (system(cmd) == 0) { + sub("\.gz$", "") + cmd = "cd " PREFIX " && " LS " -1 " $0 "*" + while (cmd | getline) { + #if ((MANZ ~ /[yY][eE][sS]/) && ($0 !~ /\.gz$/)) { + # $0 = $0 ".gz" + #} else if ((MANZ !~ /[yY][eE][sS]/) && ($0 ~ /\.gz$/)) { + # sub("\.gz$", "") + #} + print_entry($0) + } + close(cmd) + } + next +} 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 +} diff --git a/mk/plist/plist-man.awk b/mk/plist/plist-man.awk new file mode 100644 index 00000000000..1676b416d2c --- /dev/null +++ b/mk/plist/plist-man.awk @@ -0,0 +1,149 @@ +# $NetBSD: plist-man.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 man page 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: +### +### IMAKE_INSTALL specifies how imake-using packages install man pages. +### Valid values are: +### +### no value the package doesn't use imake +### maninstall the package installed man pages +### catinstall the package installed catman pages +### +### Both "maninstall" and "catinstall" may be specified. +### +### MANINSTALL specifies if man pages are installed by the package. +### Valid values are: +### +### maninstall the package installed man pages +### catinstall the package installed catman pages +### +### Both "maninstall" and "catinstall" may be specified. +### +### MANZ is a yes/no variable that determines whether the man pages +### should be recorded as compressed or not. +### +### PKGMANDIR is the ${PREFIX}-relative path to the installed man pages. +### +BEGIN { + IMAKE_MANINSTALL = ENVIRON["IMAKE_MANINSTALL"] + MANINSTALL = ENVIRON["MANINSTALL"] + MANZ = ENVIRON["MANZ"] + PKGMANDIR = ENVIRON["PKGMANDIR"] +} + +### +### Canonicalize man page entries by stripping any ".gz" suffixes. +### +/^[^@]/ && \ +/^([^\/]*\/)+(man[1-9ln]\/[^\/]*\.[1-9ln]|cat[1-9ln]\/[^\/]*\.[0-9])\.gz$/ { + sub("\.gz$", "") +} + +### +### Rewrite "imake-installed" catman pages as man pages if imake only +### supports man pages. +### +(IMAKE_MANINSTALL == "maninstall") && /^[^@]/ && \ +/^([^\/]*\/)+cat[1-9ln]\/[^\/]*\.[0-9ln]$/ { + n = split($0, components, "/") + sub("cat", "man", components[n-1]) + section = substr(components[n-1], 4, 1) + sub("[0-9ln]$", section, components[n]) + $0 = join(components, 1, n, "/") + delete components +} +(IMAKE_MANINSTALL == "maninstall") && \ +/^@dirrm ([^\/]*\/)+cat[1-9ln]/ { + next +} + +### +### Rewrite "imake-installed" man pages as catman pages if imake only +### supports catman pages. +### +(IMAKE_MANINSTALL == "catinstall") && /^[^@]/ && \ +/^([^\/]*\/)+man[1-9ln]\/[^\/]*\.[0-9ln]$/ { + n = split($0, components, "/") + sub("man", "cat", components[n-1]) + section = "0" + sub("[0-9ln]$", section, components[n]) + $0 = join(components, 1, n, "/") + delete components +} +(IMAKE_MANINSTALL == "catinstall") && \ +/^@dirrm ([^\/]*\/)+man[1-9ln]/ { + next +} + +### +### If MANINSTALL doesn't contain "maninstall", then strip out man page +### entries from the PLIST, and similarly for "catinstall" and catman page +### entries. +### +(MANINSTALL !~ /catinstall/) && /^[^@]/ && \ +/^([^\/]*\/)+cat[1-9ln]\/[^\/]*\.[0-9ln]$/ { + next +} +(MANINSTALL !~ /maninstall/) && /^[^@]/ && \ +/^([^\/]*\/)+man[1-9ln]\/[^\/]*\.[0-9ln]$/ { + next +} + +### +### Append ".gz" to the end of man page entries if compressed pages are +### requested. +### +(MANZ ~ /[yY][eE][sS]/) && /^[^@]/ && \ +/^([^\/]*\/)+(man[1-9ln]\/[^\/]*\.[1-9ln]|cat[1-9ln]\/[^\/]*\.[0-9])$/ { + $0 = $0 ".gz" +} + +### +### Convert man/ to ${PKGMANDIR}/ for all man and catman page entries. +### +/^[^@]/ && \ +/^man\/([^\/]*\/)?(man[1-9ln]\/[^\/]*\.[1-9ln]|cat[1-9ln]\/[^\/]*\.[0-9])/ { + sub("^man/", PKGMANDIR "/") +} +/^@dirrm man\/([^\/]*\/)?(man[1-9ln]|cat[1-9ln])/ { + sub("^@dirrm man/", "@dirrm " PKGMANDIR "/") +} diff --git a/mk/plist/plist-subst.awk b/mk/plist/plist-subst.awk new file mode 100644 index 00000000000..66b84aa7cd8 --- /dev/null +++ b/mk/plist/plist-subst.awk @@ -0,0 +1,66 @@ +# $NetBSD: plist-subst.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. + +### +### Build an array "substitute" of <regexp, value> pairs, that may be used +### to do variable substitutions in PLIST entries. The variables which +### will be substituted are passed in the environment variable +### PLIST_SUBST_VARS, and the named variables should be found in the +### shell environment. +### +BEGIN { + PLIST_SUBST_VARS = ENVIRON["PLIST_SUBST_VARS"] + + split(PLIST_SUBST_VARS, vars, " ") + for (i in vars) { + value = ENVIRON[vars[i]] + var = vars[i] + sub("^PLIST_", "", var) + regexp = "\\${" var "}" + substitute[regexp] = value + } + delete vars +} + +### +### For each entry, replace all ${...} variables with their respective +### values taken from the environment. +### +{ + for (regexp in substitute) { + gsub(regexp, substitute[regexp]) + } +} diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk new file mode 100644 index 00000000000..4575bb309cb --- /dev/null +++ b/mk/plist/plist.mk @@ -0,0 +1,235 @@ +# $NetBSD: plist.mk,v 1.1 2006/01/12 23:43:57 jlam Exp $ +# +# This Makefile fragment handles the creation of PLISTs for use by +# pkg_create(8). +# +# The following variables affect +# +# PLIST_TYPE specifies whether the generated PLIST is derived +# automatically from the installed files, or if the PLIST entries +# are listed in files. Valid values are "dynamic" and "static", +# and the default value is "static". +# +# PLIST_SRC is the source file(s) for the generated PLIST file. By +# default, its value is constructed from the PLIST.* files within +# the package directory. +# +# GENERATE_PLIST is a sequence of commands, terminating in a semicolon, +# that outputs contents for a PLIST to stdout and is appended to +# the contents of ${PLIST_SRC}. +# + +.if ${PKG_INSTALLATION_TYPE} == "pkgviews" +PLIST_TYPE?= dynamic +.endif +PLIST_TYPE?= static + +###################################################################### + +# PLIST_SRC is the source file for the generated PLIST file. If PLIST_SRC +# is not explicitly defined, then build one up from various PLIST.* files +# that are present in the package directory. The order goes (if the files +# are present): +# +# PLIST.common +# PLIST.${OPSYS} (e.g., PLIST.NetBSD) +# PLIST.${MACHINE_ARCH} (e.g,, PLIST.macppc) +# PLIST.${OPSYS}-${MACHINE_ARCH} (e.g., PLIST.NetBSD-macppc) +# PLIST +# PLIST.common_end +# +.if !defined(PLIST_SRC) +. if exists(${PKGDIR}/PLIST.common) +PLIST_SRC+= ${PKGDIR}/PLIST.common +. endif +. if exists(${PKGDIR}/PLIST.${OPSYS}) +PLIST_SRC+= ${PKGDIR}/PLIST.${OPSYS} +. endif +. if exists(${PKGDIR}/PLIST.${MACHINE_ARCH:C/i[3-6]86/i386/g}) +PLIST_SRC+= ${PKGDIR}/PLIST.${MACHINE_ARCH:C/i[3-6]86/i386/g} +. endif +. if exists(${PKGDIR}/PLIST.${OPSYS}-${MACHINE_ARCH:C/i[3-6]86/i386/g}) +PLIST_SRC+= ${PKGDIR}/PLIST.${OPSYS}-${MACHINE_ARCH:C/i[3-6]86/i386/ +g} +. endif +. if exists(${PKGDIR}/PLIST) +PLIST_SRC+= ${PKGDIR}/PLIST +. endif +. if exists(${PKGDIR}/PLIST.common_end) +PLIST_SRC+= ${PKGDIR}/PLIST.common_end +. endif +.endif # !PLIST_SRC + +# This is the path to the generated PLIST file. +PLIST= ${WRKDIR}/.PLIST + +###################################################################### + +.if (defined(USE_IMAKE) || !empty(USE_TOOLS:Mimake)) +_IMAKE_MANINSTALL= # empty +.else +_IMAKE_MANINSTALL= ${IMAKE_MANINSTALL} +.endif + +_LIBTOOL_EXPAND= \ + ${SETENV} ECHO=${TOOLS_ECHO:Q} GREP=${TOOLS_GREP:Q} \ + SORT=${TOOLS_SORT:Q} TEST=${TOOLS_TEST:Q} \ + ${SH} ${.CURDIR}/../../mk/plist/libtool-expand + +# _PLIST_AWK_ENV holds the shell environment passed to the awk script +# that does post-processing of the PLIST. See the individual *.awk +# scripts for information on each of the variable set in the environment. +# +_PLIST_AWK_ENV+= IMAKE_MANINSTALL=${_IMAKE_MANINSTALL:Q} +_PLIST_AWK_ENV+= INFO_DIR=${INFO_DIR:Q} +_PLIST_AWK_ENV+= LIBTOOLIZE_PLIST=${LIBTOOLIZE_PLIST:Q} +_PLIST_AWK_ENV+= LS=${TOOLS_LS:Q} +_PLIST_AWK_ENV+= MANINSTALL=${MANINSTALL:Q} +_PLIST_AWK_ENV+= MANZ=${_MANZ:Q} +_PLIST_AWK_ENV+= PKGMANDIR=${PKGMANDIR:Q} +_PLIST_AWK_ENV+= PREFIX=${PREFIX:Q} +_PLIST_AWK_ENV+= LIBTOOL_EXPAND=${_LIBTOOL_EXPAND:Q} +_PLIST_AWK_ENV+= TEST=${TOOLS_TEST:Q} + +# PLIST_SUBST contains package-settable "${variable}" to "value" +# substitutions for PLISTs +# +PLIST_SUBST+= OPSYS=${OPSYS:Q} \ + OS_VERSION=${OS_VERSION:Q} \ + MACHINE_ARCH=${MACHINE_ARCH:Q} \ + MACHINE_GNU_ARCH=${MACHINE_GNU_ARCH:Q} \ + MACHINE_GNU_PLATFORM=${MACHINE_GNU_PLATFORM:Q} \ + LN=${LN:Q} \ + LOWER_VENDOR=${LOWER_VENDOR:Q} \ + LOWER_OPSYS=${LOWER_OPSYS:Q} \ + LOWER_OS_VERSION=${LOWER_OS_VERSION:Q} \ + PKGBASE=${PKGBASE:Q} \ + PKGNAME=${PKGNAME_NOREV:Q} \ + PKGLOCALEDIR=${PKGLOCALEDIR:Q} \ + PKGVERSION=${PKGVERSION:C/nb[0-9]*$//} \ + LOCALBASE=${LOCALBASE:Q} \ + VIEWBASE=${VIEWBASE:Q} \ + X11BASE=${X11BASE:Q} \ + X11PREFIX=${X11PREFIX:Q} \ + SVR4_PKGNAME=${SVR4_PKGNAME:Q} \ + CHGRP=${CHGRP:Q} \ + CHMOD=${CHMOD:Q} \ + CHOWN=${CHOWN:Q} \ + MKDIR=${MKDIR:Q} \ + RMDIR=${RMDIR:Q} \ + RM=${RM:Q} \ + TRUE=${TRUE:Q} \ + PKGMANDIR=${PKGMANDIR:Q} + +# Pass the PLIST_SUBST substitutions to the subst.awk script by prepending +# PLIST_" to all of the variable names and adding them into the environment. +# +_PLIST_AWK_ENV+= ${PLIST_SUBST:S/^/PLIST_/} +_PLIST_AWK_ENV+= PLIST_SUBST_VARS=${PLIST_SUBST:S/^/PLIST_/:C/=.*//:M*:Q} + +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-functions.awk +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-subst.awk +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-info.awk +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-man.awk +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-libtool.awk +_PLIST_AWK+= -f ${.CURDIR}/../../mk/plist/plist-default.awk + +_PLIST_SHLIB_AWK= -f ${_SHLIB_AWKFILE.${SHLIB_TYPE}} +_SHLIB_AWKFILE.COFF= ${.CURDIR}/../../mk/plist/shlib-none.awk +_SHLIB_AWKFILE.ELF= ${.CURDIR}/../../mk/plist/shlib-elf.awk +_SHLIB_AWKFILE.aixlib= ${.CURDIR}/../../mk/plist/shlib-none.awk +_SHLIB_AWKFILE.a.out= ${.CURDIR}/../../mk/plist/shlib-aout.awk +_SHLIB_AWKFILE.dylib= ${.CURDIR}/../../mk/plist/shlib-dylib.awk +_SHLIB_AWKFILE.none= ${.CURDIR}/../../mk/plist/shlib-none.awk + +# SHLIB_TYPE is the type of shared library supported by the platform. +SHLIB_TYPE= ${_SHLIB_TYPE_cmd:sh} +_SHLIB_TYPE_cmd= \ + ${SETENV} CC=${CC:Q} ECHO=${TOOLS_ECHO:Q} \ + FILE_CMD=${TOOLS_FILE_CMD:Q} MKDIR=${TOOLS_MKDIR:Q} \ + RM=${TOOLS_RM:Q} TEST=${TOOLS_TEST:Q} \ + ${SH} ${.CURDIR}/../../mk/plist/shlib-type ${_OPSYS_SHLIB_TYPE:Q} + +.if !target(show-shlib-type) +.PHONY: show-shlib-type +show-shlib-type: + @${ECHO} ${SHLIB_TYPE:Q} +.endif + +###################################################################### + +# GENERATE_PLIST is a sequence of commands, terminating in a semicolon, +# that outputs contents for a PLIST to stdout and is appended to +# the contents of ${PLIST_SRC}. +# +GENERATE_PLIST?= ${TRUE}; + +# XXX Generate info page entries for each of the listed INFO_FILES. +# XXX This section should go away after info file listings have been +# XXX pushed into the PLISTs. +# XXX +.if defined(INFO_FILES) && !empty(INFO_FILES) +. for _file_ in ${INFO_FILES} +_INFO_GENERATE_PLIST+= ${ECHO} "info/"${_file_:Q}; +. endfor +.else +_INFO_GENERATE_PLIST= ${TRUE}; +.endif + +.if ${PKG_INSTALLATION_TYPE} == "pkgviews" +# +# _PLIST_IGNORE_FILES basically mirrors the list of ignored files found +# in pkg_views(1). It's used by the dynamic PLIST generator to skip +# adding the named files to the PLIST. +# +_PLIST_IGNORE_FILES+= +* # package metadata files +_PLIST_IGNORE_FILES+= info/dir +. if defined(INFO_DIR) && empty(INFO_DIR:Minfo) +_PLIST_IGNORE_FILES+= ${INFO_DIR}/dir +. endif +_PLIST_IGNORE_FILES+= *[~\#] *.OLD *.orig *,v # scratch config files +. if !empty(CONF_DEPENDS) +_PLIST_IGNORE_FILES+= ${PKG_SYSCONFDIR:S,^${PREFIX}/,,} +. endif +_PLIST_IGNORE_FILES+= ${PLIST_IGNORE_FILES} +.endif +BUILD_DEFS+= _PLIST_IGNORE_FILES + +.if ${PLIST_TYPE} == "dynamic" +_PLIST_IGNORE_CMD= \ + ( while read i; do \ + ignore=no; \ + for p in ${_PLIST_IGNORE_FILES}; do \ + case "$$i" in \ + $$p) ignore=yes; break ;; \ + esac; \ + done; \ + [ "$$ignore" = "yes" ] || ${ECHO} "$$i"; \ + done ) +_GENERATE_PLIST= \ + ${FIND} ${PREFIX} \! -type d -print | ${SORT} | \ + ${SED} -e "s|^${PREFIX}/||" | \ + ${_PLIST_IGNORE_CMD}; \ + ${FIND} ${PREFIX} -type d -print | ${SORT} -r | \ + ${GREP} -v "^${PREFIX}$$" | \ + ${_PLIST_IGNORE_CMD} | \ + ${SED} -e "s|^${PREFIX}/|@unexec ${RMDIR} -p %D/|" \ + -e "s,$$, 2>/dev/null || ${TRUE},"; +.else +_GENERATE_PLIST= { ${_INFO_GENERATE_PLIST} }; \ + ${CAT} ${PLIST_SRC}; \ + ${GENERATE_PLIST} +.endif + +.PHONY: plist +plist: ${PLIST} + +.if ${PLIST_TYPE} == "static" +${PLIST}: ${PLIST_SRC} +.endif +${PLIST}: + ${_PKG_SILENT}${_PKG_DEBUG} \ + { ${_GENERATE_PLIST} } | \ + ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_AWK} | \ + ${SETENV} ${_PLIST_AWK_ENV} ${AWK} ${_PLIST_SHLIB_AWK} \ + > ${PLIST} diff --git a/mk/plist/print-plist.mk b/mk/plist/print-plist.mk new file mode 100644 index 00000000000..f3c6dcf5ab8 --- /dev/null +++ b/mk/plist/print-plist.mk @@ -0,0 +1,172 @@ +# $$etBSD$ + +### +### Automatic PLIST generation +### - files & symlinks first +### - @dirrm statements last +### - empty directories are handled properly +### - dirs from mtree files are excluded +### - substitute for platform or package specifics substrings +### +### Usage: +### - make install +### - make print-PLIST | brain >PLIST +### + +_PRINT_PLIST_AWK_SUBST={ \ + gsub(/${OPSYS}/, "$${OPSYS}"); \ + gsub(/${OS_VERSION:S/./\./g}/, "$${OS_VERSION}"); \ + gsub(/${MACHINE_GNU_PLATFORM}/, "$${MACHINE_GNU_PLATFORM}"); \ + gsub(/${MACHINE_ARCH}/, "$${MACHINE_ARCH}"); \ + gsub(/${MACHINE_GNU_ARCH}/, "$${MACHINE_GNU_ARCH}"); +.if !empty(LOWER_VENDOR) +_PRINT_PLIST_AWK_SUBST+= gsub(/${LOWER_VENDOR}/, "$${LOWER_VENDOR}"); +.endif +_PRINT_PLIST_AWK_SUBST+= \ + gsub(/${LOWER_OS_VERSION:S/./\./g}/, "$${LOWER_OS_VERSION}"); \ + gsub(/${LOWER_OPSYS}/, "$${LOWER_OPSYS}"); \ + gsub(/${PKGNAME_NOREV}/, "$${PKGNAME}"); \ + gsub(/${PKGVERSION:S/./\./g:C/nb[0-9]*$$//}/, "$${PKGVERSION}");\ + gsub(/${PKGLOCALEDIR}\/locale/, "$${PKGLOCALEDIR}/locale"); \ + gsub("^${PKGMANDIR}\/", "man/"); \ +} + +_PRINT_PLIST_AWK_IGNORE= ($$0 ~ /emul\/linux\/proc/) +_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^info\/dir$$/) +.if defined(INFO_DIR) && empty(INFO_DIR:Minfo) +_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^${INFO_DIR:S|/|\\/|g}\/dir$$/) +.endif +.if !empty(INFO_FILES) +. for _f_ in ${INFO_FILES} +_PRINT_PLIST_AWK_IGNORE+= || ($$0 ~ /^${INFO_DIR:S|/|\\/|g}\/${_f_:S|+|\+|g}(-[0-9]+)?(\.gz)?$$/) +. endfor +.endif + +# Common (system) directories not to generate @dirrm statements for +# Reads MTREE_FILE and generate awk statements that will +# sort out which directories NOT to include into the PLIST @dirrm list +.if make(print-PLIST) +_PRINT_PLIST_COMMON_DIRS!= ${AWK} 'BEGIN { \ + i=0; \ + stack[i]="${PREFIX}" ; \ + cwd=""; \ + } \ + ! ( /^\// || /^\#/ || /^$$/ ) { \ + if ( $$1 == ".." ){ \ + i=i-1; \ + cwd = stack[i]; \ + } else if ( $$1 == "." ){ \ + } else { \ + stack[i] = cwd ; \ + if ( i == 0 ){ \ + cwd = $$1 ; \ + } else { \ + cwd = cwd "\\/" $$1 ; \ + } \ + print "/^" cwd "$$$$/ { next; }"; \ + i=i+1 ; \ + } \ + } \ + END { print "{ print $$$$0; }"; } \ + ' <${MTREE_FILE} +.endif + +# scan $PREFIX for any files/dirs modified since the package was extracted +# will emit "@exec mkdir"-statements for empty directories +# 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 + +.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) \ + ${_LIBTOOL_EXPAND} $$file >> $$libslist; \ + ;; \ + esac; \ + ${ECHO} "$$file"; \ + done > $$fileslist; \ + if ${TEST} -f "$$libslist"; then \ + ${GREP} -hvxF "`${SORT} -u $$libslist`" "$$fileslist"; \ + else \ + ${CAT} "$$fileslist"; \ + fi; \ + ${RM} -f "$$fileslist" "$$libslist"; \ + ) +.else +_PRINT_PLIST_LIBTOOLIZE_FILTER?= ${CAT} +.endif + +.PHONY: print-PLIST +.if !target(print-PLIST) +print-PLIST: + ${_PKG_SILENT}${_PKG_DEBUG}\ + ${ECHO} '@comment $$'NetBSD'$$' + ${_PKG_SILENT}${_PKG_DEBUG}\ + shlib_type=`${MAKE} ${MAKEFLAGS} show-shlib-type`; \ + case $$shlib_type in \ + "a.out") genlinks=1 ;; \ + *) genlinks=0 ;; \ + esac; \ + ${_PRINT_PLIST_FILES_CMD} \ + | ${_PRINT_PLIST_LIBTOOLIZE_FILTER} \ + | ${SORT} \ + | ${AWK} ' \ + { sub("${PREFIX}/\\./", ""); } \ + ${_PRINT_PLIST_AWK_IGNORE} { next; } \ + ${_PRINT_PLIST_AWK_SUBST} \ + /^@/ { print $$0; next } \ + /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+\.[0-9]+$$/ { \ + print $$0; \ + sub("\\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + sub("\\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + sub("\\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + next; \ + } \ + /.*\/lib[^\/]+\.so\.[0-9]+\.[0-9]+$$/ { \ + print $$0; \ + sub("\\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + sub("\\.[0-9]+$$", ""); \ + if ('$$genlinks') print $$0; \ + next; \ + } \ + ${PRINT_PLIST_AWK} \ + { print $$0; }' + ${_PKG_SILENT}${_PKG_DEBUG}\ + for i in `${_PRINT_PLIST_DIRS_CMD} \ + | ${SORT} -r \ + | ${AWK} ' \ + /emul\/linux\/proc/ { next; } \ + /${PREFIX:S|/|\\/|g}\/\.$$/ { next; } \ + { sub("${PREFIX}/\\\\./", ""); } \ + { sub("^${PKGMANDIR}/", "man/"); } \ + ${_PRINT_PLIST_COMMON_DIRS}'` ; \ + do \ + if [ `${LS} -la ${PREFIX}/$$i | ${WC} -l` = 3 ]; then \ + ${ECHO} @exec \$${MKDIR} %D/$$i | ${AWK} ' \ + ${PRINT_PLIST_AWK} \ + { print $$0; }' ; \ + fi ; \ + ${ECHO} @dirrm $$i | ${AWK} ' \ + ${PRINT_PLIST_AWK} \ + { print $$0; }' ; \ + done \ + | ${AWK} '${_PRINT_PLIST_AWK_SUBST} { print $$0; }' +.endif # target(print-PLIST) 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] + } + } +} diff --git a/mk/plist/shlib-dylib.awk b/mk/plist/shlib-dylib.awk new file mode 100644 index 00000000000..1c99c37a026 --- /dev/null +++ b/mk/plist/shlib-dylib.awk @@ -0,0 +1,182 @@ +# $NetBSD: shlib-dylib.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 transforms +# and expands entries that match ELF library into the appropriate Mach-O +# dylib names. +# + +BEGIN { + LIBTOOL_EXPAND = ENVIRON["LIBTOOL_EXPAND"] + LIBTOOLIZE_PLIST = ENVIRON["LIBTOOLIZE_PLIST"] + PREFIX = ENVIRON["PREFIX"] + TEST = ENVIRON["TEST"] + nentries = 0 +} + +### +### add_dylib(lib) adds the named "lib" to the PLIST entries list and +### to the dylibs list if we haven't already seen it. +### +function add_dylib(lib) { + if (dylibs[lib] == "") { + dylibs[lib] = lib + entries[++nentries] = lib + } +} + +### +### 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 +} + +### +### Convert each ELF shlib entry into a dylib entry. Also, record all +### dylib names that can be derived from this entry as dylibs. +### +/.*\/lib[^\/]+\.so(\.[0-9]+)+$/ { + lib = $0; sub("\.so\.", ".", lib); sub("\.so$", "", lib) + lib = lib ".dylib" + add_dylib(lib) + while (sub("\.[0-9]+$", "")) { + lib = $0; sub("\.so\.", ".", lib); sub("\.so$", "", lib) + lib = lib ".dylib" + add_dylib(lib) + } + if (sub("\.so$", "")) { + lib = $0 ".dylib" + add_dylib(lib) + } + if (sub("-([0-9.]+)$", "")) { + lib = $0 ".dylib" + add_dylib(lib) + } + next +} + +### +### If the ".so" file actually exists, then it's a dynamically loadable +### module, so the entry should stay. Convert it into a dylib name as +### well and record it as a dylib. +### +/.*\/lib[^\/]+\.so$/ { + cmd = TEST " -f " PREFIX "/" $0 + if (system(cmd) == 0) { + entries[++nentries] = $0 + } + lib = $0; sub("\.so$", "", lib) + lib = lib ".dylib" + add_dylib(lib) + if (sub("-([0-9.]+)$", "")) { + lib = $0 ".dylib" + add_dylib(lib) + } + 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 dylibs that will be removed from the PLIST. + # + for (j in dylibs) { + for (k in ltnames) { + if (dylibs[j] == ltnames[k]) { + delete dylibs[j] + break + } + } + } + + # Remove dylib entries that *do* exist on the filesystem from the + # list of dylibs that will be removed from the PLIST. + # + for (j in dylibs) { + cmd = TEST " -f " PREFIX "/" dylibs[j] + if (system(cmd) == 0) { + delete dylibs[j] + } + } + + # Remove PLIST entries that match a non-existent dylib. + for (i in entries) { + for (j in dylibs) { + if (entries[i] == dylibs[j]) { + delete entries[i] + break + } + } + } + + # Output the PLIST entries in order. + for (i = 1; i <= nentries; i++) { + if (entries[i]) { + print entries[i] + } + } +} diff --git a/mk/plist/shlib-elf.awk b/mk/plist/shlib-elf.awk new file mode 100644 index 00000000000..e29b766e48b --- /dev/null +++ b/mk/plist/shlib-elf.awk @@ -0,0 +1,48 @@ +# $NetBSD: shlib-elf.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 null filter that reads PLIST entries from standard +# input and writes them to standard output. No action is necessary because +# PLISTs are always ELF-centric. +# + +### +### All entries are output verbatim. +### +{ + print +} diff --git a/mk/plist/shlib-none.awk b/mk/plist/shlib-none.awk new file mode 100644 index 00000000000..5d2c2b1d2e9 --- /dev/null +++ b/mk/plist/shlib-none.awk @@ -0,0 +1,54 @@ +# $NetBSD: shlib-none.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 comments out +# entries that match ELF library symlinks. +# + +### +### Comment out shared library entries. +### +/^[^@]/ && /.*\/lib[^\/]+\.so(\.[0-9]+)*$/ { + $0 = "@comment No shared objects - " $0 +} + +### +### All other entries are output verbatim. +### +{ + print +} diff --git a/mk/plist/shlib-type b/mk/plist/shlib-type new file mode 100755 index 00000000000..62b68974fbb --- /dev/null +++ b/mk/plist/shlib-type @@ -0,0 +1,54 @@ +# /bin/sh +# +# $NetBSD: shlib-type,v 1.1 2006/01/12 23:43:57 jlam Exp $ +# +# This code is derived from software contributed to The NetBSD Foundation +# by Alistair Crooks. +# +# This script returns the the library format for the platform. If the +# library format is "ELF/a.out", then a small program is cmopiled to +# determine the correct object format (either ELF or a.out). +# + +: ${CC=cc} +: ${ECHO=echo} +: ${FILE_CMD=file} +: ${RM=rm} +: ${MKDIR=mkdir} +: ${TEST=test} +: ${TMPDIR=/tmp} + +self="${0##*/}" + +usage() { + ${ECHO} 1>&2 "usage: $self libformat" +} + +${TEST} $# -gt 0 || { usage; exit 1; } + +sotype=none +case "$1" in +ELF/a.out) + tmpdir="${TMPDIR}/shlib-type.$$" + umask 077 && ${MKDIR} "$tmpdir" + if ${TEST} -d "$tmpdir"; then + cd $tmpdir + ${ECHO} "int main() { return(0); }" > a.c + ${CC} ${CFLAGS} a.c -o a.out >/dev/null 2>&1 + if ${TEST} -f "a.out"; then + case `${FILE_CMD} a.out` in + *ELF*dynamically*) sotype="ELF" ;; + *shared*library*) sotype="a.out" ;; + *dynamically*) sotype="a.out" ;; + esac + fi + ${RM} -fr "$tmpdir" + fi + ;; +*) + sotype="$1" + ;; +esac +${ECHO} $sotype + +exit 0 |