summaryrefslogtreecommitdiff
path: root/lang/php
diff options
context:
space:
mode:
authorjdolecek <jdolecek>2004-11-01 19:55:57 +0000
committerjdolecek <jdolecek>2004-11-01 19:55:57 +0000
commit8f2f3b67cb64fdb2d8aae99be559615eb1d27ae0 (patch)
tree1508499c23c75b13b3d4909b3b79bf912e9507d7 /lang/php
parentc622e098716310fc95a268365a3aad642ede295d (diff)
downloadpkgsrc-8f2f3b67cb64fdb2d8aae99be559615eb1d27ae0.tar.gz
use shared pear package support framework for both php4 & php5; based on
the former php4 version
Diffstat (limited to 'lang/php')
-rw-r--r--lang/php/pear.mk56
-rw-r--r--lang/php/pear_plist.php50
2 files changed, 106 insertions, 0 deletions
diff --git a/lang/php/pear.mk b/lang/php/pear.mk
new file mode 100644
index 00000000000..1c075a1fff7
--- /dev/null
+++ b/lang/php/pear.mk
@@ -0,0 +1,56 @@
+# $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.
+#
+# If you don't know what pear is, you can visit: http://pear.php.net/
+#
+# PEAR_CMD this is the actual script to execute to install the
+# package.
+#
+# PEAR_LIB directory under ${PREFIX} where Pear modules are installed
+#
+
+.if !defined(_PEAR_PACKAGE_MK)
+_PEAR_PACKAGE_MK= # defined
+
+USE_BUILDLINK3= YES
+
+.include "../../mk/bsd.prefs.mk"
+
+EXTRACT_SUFX= .tgz
+
+PKGNAME= pear-${DISTNAME}
+CATEGORIES+= www
+
+MASTER_SITE_PEAR_PACKAGE+= \
+ http://pear.php.net/get/
+MASTER_SITES+= ${MASTER_SITE_PEAR_PACKAGE}
+
+PEAR_CMD= ${PREFIX}/bin/pear
+PEAR_LIB= lib/php
+
+# whether @dirrm for baseinstalldir should be included in PLIST
+PEAR_DIRRM_BASEDIR?= # empty
+
+# 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"; \
+ 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
+
+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";
+?>