From owner-freebsd-ports-bugs@FreeBSD.ORG Sun May 30 04:59:43 2004 Return-Path: Delivered-To: freebsd-ports-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EEFB816A4CE; Sun, 30 May 2004 04:59:43 -0700 (PDT) Received: from gw.xbsd.org (xbsd.org [81.56.254.23]) by mx1.FreeBSD.org (Postfix) with ESMTP id D491043D1D; Sun, 30 May 2004 04:59:27 -0700 (PDT) (envelope-from flz@xbsd.org) Received: by gw.xbsd.org (Postfix, from userid 201) id B74B1B1E; Sun, 30 May 2004 13:59:27 +0200 (CEST) Date: Sun, 30 May 2004 13:59:27 +0200 From: Florent Thoumie To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports-bugs@FreeBSD.org Message-ID: <20040530115927.GA38622@gw.xbsd.org> References: <20040525000247.ED5F6CD4@gw.xbsd.org> <200405250010.i4P0AGEO023012@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200405250010.i4P0AGEO023012@freefall.freebsd.org> User-Agent: Mutt/1.5.6i Subject: Re: ports/67151: Mk/bsd.port.mk - Add a way to handle PLIST_SUB like substitutions to a given file list. X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 30 May 2004 11:59:44 -0000 This is a new version of the patch. o Useless ${CAT} has been removed (thanks to eik's notice) o Now when using PORTDOCS comment style, each line beginning with "@comment " is deleted from the output. --- apply-slist.diff begins here --- --- bsd.port.mk.old Sun May 30 13:54:33 2004 +++ bsd.port.mk Sun May 30 13:53:44 2004 @@ -720,6 +720,17 @@ # (default: ${WRKDIR}/.PLIST.mktmp). # PLIST_SUB - List of "variable=value" pair for substitution in ${PLIST} # (default: see below). +# +# SUB_FILES - Files that should be passed through sed and redirected to ${WRKDIR}. +# - For each file specified in SUB_FILES, there must be a corresponding +# file in ${FILESDIR} whose suffix is ".in". For instance, +# if the Makefile specifies "SUB_FILES= pkg-message" then there must be +# a file called pkg-message.in in ${FILESDIR}. +# - The substitution process is the same as PLIST_FILES, as described +# below except that any line beginning with @comment is deleted. +# SUB_LIST - List of "variable=value" pair for substitution in ${SUB_FILES} +# (some pair are added by default: eg. PREFIX=${PREFIX}). +# # INSTALLS_SHLIB - If set, bsd.port.mk will automatically run ldconfig commands # from post-install and also add appropriate @exec/@unexec # directives to directories listed in LDCONFIG_DIRS. @@ -1208,6 +1219,8 @@ INSTALL_WRKSRC?=${WRKSRC} PLIST_SUB+= OSREL=${OSREL} PREFIX=%D LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} +SUB_LIST+= PREFIX=${PREFIX} LOCALBASE=${LOCALBASE} X11BASE=${X11BASE} \ + DATADIR=${DATADIR} DOCSDIR=${DOCSDIR} EXAMPLESDIR=${EXAMPLESDIR} .if defined(WITHOUT_CPU_CFLAGS) .if defined(_CPUCFLAGS) @@ -3496,7 +3509,7 @@ _INSTALL_DEP= build _INSTALL_SEQ= install-message check-conflicts \ run-depends lib-depends pre-install pre-install-script \ - generate-plist check-already-installed + apply-slist generate-plist check-already-installed _INSTALL_SUSEQ= check-umask install-mtree pre-su-install \ pre-su-install-script do-install post-install add-plist-info \ post-install-script add-plist-docs compress-man run-ldconfig fake-pkg \ @@ -4485,6 +4498,26 @@ @${ECHO_CMD} '" to run.' .endif .endif + +_SUB_LIST_TEMP= ${SUB_LIST:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} +.if !target(apply-slist) +apply-slist: +.if defined(SUB_FILES) +.for file in ${SUB_FILES} +.if !exists(${FILESDIR}/${file}.in) + @${ECHO_CMD} "** Missing ${FILESDIR}/${file}.in for ${PKGNAME}."; exit 1 +.else + @${SED} ${_SUB_LIST_TEMP} -e '/^@comment /d' ${FILESDIR}/${file}.in > ${WRKDIR}/${file} +.endif +.endfor +.for i in pkg-message pkg-install pkg-deinstall pkg-req +.if ${SUB_FILES:M${i}*}!="" +${i:S/-//:U}= ${WRKDIR}/${SUB_FILES:M${i}*} +.endif +.endfor +.endif +.endif + # Generate packing list. Also tests to make sure all required package # files exist. --- apply-slist.diff ends here ---