From 0125e6effec094242a6dde7aec9bc003c9d1ea1c Mon Sep 17 00:00:00 2001 From: jlam Date: Thu, 25 Oct 2007 22:00:39 +0000 Subject: * If PLIST_SRC is explicitly set to an empty value in a package Makefile, then automatically generate a PLIST that says "${PKGNAME} has no files". * If PLIST_SRC and GENERATE_PLIST are not set in a package Makefile, and no PLIST files exist, then fail during the package build with PKG_FAIL_REASON. * Remove "intentionally empty" PLISTs again. Now, the easy way to say that a package installs no files is to just add the following to the package Makefile: PLIST_SRC= # empty --- mk/plist/plist.mk | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'mk/plist') diff --git a/mk/plist/plist.mk b/mk/plist/plist.mk index 5dab832656a..533733145fe 100644 --- a/mk/plist/plist.mk +++ b/mk/plist/plist.mk @@ -1,4 +1,4 @@ -# $NetBSD: plist.mk,v 1.34 2007/10/25 17:49:45 jlam Exp $ +# $NetBSD: plist.mk,v 1.35 2007/10/25 22:02:18 jlam Exp $ # # This Makefile fragment handles the creation of PLISTs for use by # pkg_create(8). @@ -63,6 +63,20 @@ PLIST_SRC_DFLT+= ${PKGDIR}/PLIST .if exists(${PKGDIR}/PLIST.common_end) PLIST_SRC_DFLT+= ${PKGDIR}/PLIST.common_end .endif + +# +# If the following 3 conditions hold, then fail the package build: +# +# (1) The package doesn't set PLIST_SRC. +# (2) The package doesn't set GENERATE_PLIST. +# (3) There are no PLIST files. +# +.if !defined(PLIST_SRC) && !defined(GENERATE_PLIST) +. if !defined(PLIST_SRC_DFLT) || empty(PLIST_SRC_DFLT) +PKG_FAIL_REASON+= "Missing PLIST file or PLIST/GENERATE_PLIST definition." +. endif +.endif + PLIST_SRC?= ${PLIST_SRC_DFLT} # This is the path to the generated PLIST file. @@ -171,11 +185,11 @@ _SHLIB_AWKFILE.none= ${.CURDIR}/../../mk/plist/shlib-none.awk # that outputs contents for a PLIST to stdout and is appended to # the contents of ${PLIST_SRC}. # -.if empty(PLIST_SRC) && empty(GENERATE_PLIST) -PKG_FAIL_REASON+= "Missing PLIST file or GENERATE_PLIST definition." -.endif - +.if empty(PLIST_SRC) +GENERATE_PLIST?= ${ECHO} "@comment "${PKGNAME:Q}" has no files."; +.else GENERATE_PLIST?= ${TRUE}; +.endif .if ${PKG_INSTALLATION_TYPE} == "pkgviews" # -- cgit v1.2.3