diff options
author | jdolecek <jdolecek@pkgsrc.org> | 2004-11-01 19:55:57 +0000 |
---|---|---|
committer | jdolecek <jdolecek@pkgsrc.org> | 2004-11-01 19:55:57 +0000 |
commit | 83b52ca2e6f53fdd85395d42c906044502e3c79c (patch) | |
tree | 1508499c23c75b13b3d4909b3b79bf912e9507d7 /lang | |
parent | 165d0caf976e031c1c2e2c7d4b14f466d74ec7ea (diff) | |
download | pkgsrc-83b52ca2e6f53fdd85395d42c906044502e3c79c.tar.gz |
use shared pear package support framework for both php4 & php5; based on
the former php4 version
Diffstat (limited to 'lang')
-rw-r--r-- | lang/php/pear.mk (renamed from lang/php5/pear.mk) | 23 | ||||
-rw-r--r-- | lang/php/pear_plist.php | 50 |
2 files changed, 62 insertions, 11 deletions
diff --git a/lang/php5/pear.mk b/lang/php/pear.mk index 3d0be51e661..1c075a1fff7 100644 --- a/lang/php5/pear.mk +++ b/lang/php/pear.mk @@ -1,4 +1,4 @@ -# $NetBSD: pear.mk,v 1.2 2004/10/30 05:46:21 grant Exp $ +# $NetBSD: pear.mk,v 1.1 2004/11/01 19:55:57 jdolecek Exp $ # # This Makefile fragment is intended to be included by packages that build # and install pear packages. @@ -15,9 +15,8 @@ _PEAR_PACKAGE_MK= # defined USE_BUILDLINK3= YES -BUILDLINK_DEPMETHOD.php5= full -.include "../../lang/php5/buildlink3.mk" +.include "../../mk/bsd.prefs.mk" EXTRACT_SUFX= .tgz @@ -31,25 +30,27 @@ MASTER_SITES+= ${MASTER_SITE_PEAR_PACKAGE} PEAR_CMD= ${PREFIX}/bin/pear PEAR_LIB= lib/php -_PEAR_PKG= ${DISTNAME:C/-.*//:tl} +# whether @dirrm for baseinstalldir should be included in PLIST +PEAR_DIRRM_BASEDIR?= # empty -# 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. +# Dynamic PLIST, generated via a helper PHP script, which parses the package +# XML config file. PEAR_GENERATE_PLIST= \ ${ECHO} "@comment The following lines are automatically generated"; \ - ${ECHO} "${PEAR_LIB}/.registry/${_PEAR_PKG}.reg"; \ - ${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}/,"; \ - ${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}/,"; + PEAR_LIB="${PEAR_LIB}" WRKSRC="${WRKSRC}" \ + PEAR_DIRRM_BASEDIR="${PEAR_DIRRM_BASEDIR}" \ + ${PREFIX}/bin/php ${PKGDIR}/../../lang/php/pear_plist.php; GENERATE_PLIST+= ${PEAR_GENERATE_PLIST} NO_BUILD= # defined post-extract: @cd ${WRKSRC} && ${LN} -s ${WRKDIR}/package.xml - cd ${WRKSRC} && ${PEAR_CMD} package-validate package.xml do-install: cd ${WRKSRC} && ${PEAR_CMD} install package.xml +.include "../../lang/php/phpversion.mk" +.include "${PHPPKGSRCDIR}/buildlink3.mk" + .endif # _PEAR_PACKAGE_MK diff --git a/lang/php/pear_plist.php b/lang/php/pear_plist.php new file mode 100644 index 00000000000..682a6a22ec4 --- /dev/null +++ b/lang/php/pear_plist.php @@ -0,0 +1,50 @@ +<?php +# $NetBSD: pear_plist.php,v 1.1 2004/11/01 19:55:57 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"; +?> |