generate the PLIST for Pear packages using a helper PHP script, which
can use directly Pear facilities to acquire the necessary information
This commit is contained in:
parent
ca4b3c701c
commit
b7be5da54f
2 changed files with 58 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
||||||
# $NetBSD: pear.mk,v 1.4 2004/04/02 21:54:49 jdolecek Exp $
|
# $NetBSD: pear.mk,v 1.5 2004/04/03 04:39:47 jdolecek Exp $
|
||||||
#
|
#
|
||||||
# This Makefile fragment is intended to be included by packages that build
|
# This Makefile fragment is intended to be included by packages that build
|
||||||
# and install pear packages.
|
# and install pear packages.
|
||||||
|
@ -33,25 +33,16 @@ MASTER_SITES+= ${MASTER_SITE_PEAR_PACKAGE}
|
||||||
PEAR_CMD= ${PREFIX}/bin/pear
|
PEAR_CMD= ${PREFIX}/bin/pear
|
||||||
PEAR_LIB= lib/php
|
PEAR_LIB= lib/php
|
||||||
|
|
||||||
_PEAR_PKG= ${DISTNAME:C/-.*//}
|
# whether @dirrm for baseinstalldir should be included in PLIST
|
||||||
|
PEAR_DIRRM_BASEDIR?= # empty
|
||||||
|
|
||||||
# Changed to not use :tl modifier since that's currently NetBSD 1.6-only
|
# Dynamic PLIST, generated via a helper PHP script, which parses the package
|
||||||
_PEAR_PKG_LC!= ${ECHO} ${_PEAR_PKG} | ${TR} '[A-Z]' '[a-z]'
|
# XML config file.
|
||||||
|
|
||||||
# Dynamic PLIST
|
|
||||||
# The package.xml 'parsing' is a bit crude, but enough for now. Eventually
|
|
||||||
# should write a small PHP script for this, using real XML parser.
|
|
||||||
PEAR_GENERATE_PLIST= \
|
PEAR_GENERATE_PLIST= \
|
||||||
${ECHO} "@comment The following lines are automatically generated"; \
|
${ECHO} "@comment The following lines are automatically generated"; \
|
||||||
${ECHO} "${PEAR_LIB}/.registry/${_PEAR_PKG_LC}.reg"; \
|
PEAR_LIB="${PEAR_LIB}" WRKSRC="${WRKSRC}" \
|
||||||
${FGREP} '<file role="php"' ${WRKDIR}/package.xml | ${SED} -e 's,.*<file role="php",<,' -e 's,<.*baseinstalldir="\([^"]*\)",\1/<,' -e 's,<.* name=",,' -e 's,".*,,' -e "s,^/*,${PEAR_LIB}/,"; \
|
PEAR_DIRRM_BASEDIR="${PEAR_DIRRM_BASEDIR}" \
|
||||||
${FGREP} '<file role="php"' ${WRKDIR}/package.xml | ${SED} -e 's,.*<file role="php",<,' -e 's,<.*baseinstalldir="\([^"]*\)",\1/<,' -e 's,<.* name=",,' -e 's,".*,,' -e 's,//*,/,g' -e 's,/[^/]*$$,,' | ${FGREP} '/' | ${SORT} -ru | ${SED} -e "s,^,@dirrm ${PEAR_LIB},"; \
|
${PREFIX}/bin/php ${PKGDIR}/../../www/php4/pear_plist.php;
|
||||||
${FGREP} '<file role="doc"' ${WRKDIR}/package.xml | ${SED} -e 's,.*<file role="doc",<,' -e 's,<.*baseinstalldir="\([^"]*\)",\1/<,' -e 's,<.* name=",,' -e 's,".*,,' -e "s,^/*,${PEAR_LIB}/doc/${_PEAR_PKG}/,"; \
|
|
||||||
${FGREP} '<file role="doc"' ${WRKDIR}/package.xml | ${SED} -e 's,.*<file role="doc",<,' -e 's,<.*baseinstalldir="\([^"]*\)",\1/<,' -e 's,<.* name=",,' -e 's,".*,,' -e 's,//*,/,g' -e 's,/[^/]*$$,,' | ${FGREP} '/' | ${SORT} -ru | ${SED} -e "s,^,@dirrm ${PEAR_LIB}/doc/${_PEAR_PKG},"; \
|
|
||||||
${FGREP} -q '<file role="doc"' ${WRKDIR}/package.xml && echo "@dirrm ${PEAR_LIB}/doc/${_PEAR_PKG}"; \
|
|
||||||
${FGREP} '<file role="test"' ${WRKDIR}/package.xml | ${SED} -e 's,.*<file role="test",<,' -e 's,<.*baseinstalldir="\([^"]*\)",\1/<,' -e 's,<.* name=",,' -e 's,".*,,' -e "s,^/*,${PEAR_LIB}/test/${_PEAR_PKG}/,"; \
|
|
||||||
${FGREP} '<file role="test"' ${WRKDIR}/package.xml | ${SED} -e 's,.*<file role="test",<,' -e 's,<.*baseinstalldir="\([^"]*\)",\1/<,' -e 's,<.* name=",,' -e 's,".*,,' -e 's,//*,/,g' -e 's,/[^/]*$$,,' | ${FGREP} '/' | ${SORT} -ru | ${SED} -e "s,^,@dirrm ${PEAR_LIB}/test/${_PEAR_PKG},"; \
|
|
||||||
${FGREP} -q '<file role="test"' ${WRKDIR}/package.xml && echo "@dirrm ${PEAR_LIB}/test/${_PEAR_PKG}";
|
|
||||||
GENERATE_PLIST+= ${PEAR_GENERATE_PLIST}
|
GENERATE_PLIST+= ${PEAR_GENERATE_PLIST}
|
||||||
|
|
||||||
NO_BUILD= # defined
|
NO_BUILD= # defined
|
||||||
|
|
50
www/php4/pear_plist.php
Normal file
50
www/php4/pear_plist.php
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
# $NetBSD: pear_plist.php,v 1.1 2004/04/03 04:39:47 jdolecek Exp $
|
||||||
|
# Parses package XML file and outputs appropriate PLIST
|
||||||
|
|
||||||
|
$PEAR_LIB = getenv('PEAR_LIB');
|
||||||
|
$WRKSRC = getenv('WRKSRC');
|
||||||
|
$PEAR_DIRRM_BASEDIR = getenv('PEAR_DIRRM_BASEDIR');
|
||||||
|
$dirrm = array();
|
||||||
|
|
||||||
|
include_once "PEAR/Common.php";
|
||||||
|
$obj = &new PEAR_Common;
|
||||||
|
$info = $obj->infoFromAny("$WRKSRC/package.xml");
|
||||||
|
$pkg = $info['package'];
|
||||||
|
|
||||||
|
// output list of package files, in same order as specified in package
|
||||||
|
echo "$PEAR_LIB/.registry/".strtolower($pkg).".reg\n";
|
||||||
|
foreach($info['filelist'] as $f => $v) {
|
||||||
|
switch($v['role']) {
|
||||||
|
case 'test':
|
||||||
|
case 'doc':
|
||||||
|
$prefix = "$v[role]/$pkg/";
|
||||||
|
$dirrm["$v[role]/$pkg"] = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'php':
|
||||||
|
default:
|
||||||
|
if (!empty($v['baseinstalldir']) && $v['baseinstalldir'] != '/') {
|
||||||
|
$prefix = $v['baseinstalldir'] . '/';
|
||||||
|
|
||||||
|
if ($PEAR_DIRRM_BASEDIR)
|
||||||
|
$dirrm[$v['baseinstalldir']] = true;
|
||||||
|
} else
|
||||||
|
$prefix = '';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
echo "{$PEAR_LIB}/{$prefix}{$f}\n";
|
||||||
|
|
||||||
|
while(($f = dirname($f)) && $f != '.')
|
||||||
|
$dirrm["{$prefix}{$f}"] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// output @dirrm directives, in reverse order so that deeper
|
||||||
|
// directories are removed first
|
||||||
|
$dirrm = array_keys($dirrm);
|
||||||
|
rsort($dirrm);
|
||||||
|
foreach($dirrm as $dir)
|
||||||
|
echo "@dirrm {$PEAR_LIB}/$dir\n";
|
||||||
|
?>
|
Loading…
Reference in a new issue