summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Bakken <ssb@php.net>2000-07-24 23:55:34 +0000
committerStig Bakken <ssb@php.net>2000-07-24 23:55:34 +0000
commitfbc947f43fc57ecfd35ec058bf3a9cee597d4353 (patch)
tree068b4c9d5c1a9ff7c168733a5a1eb857d327a81b
parent576b6e923679d1bbf5dc8098bc3b178f78f58166 (diff)
downloadphp-git-fbc947f43fc57ecfd35ec058bf3a9cee597d4353.tar.gz
* generate pear scripts properly with configure
-rw-r--r--configure.in19
-rw-r--r--pear/Makefile.in58
-rw-r--r--pear/PEAR/Installer.php26
-rw-r--r--pear/pear.in16
-rw-r--r--pear/php-config.in8
-rw-r--r--pear/phpize.in2
6 files changed, 73 insertions, 56 deletions
diff --git a/configure.in b/configure.in
index d10f4cb510..75d6bf38f6 100644
--- a/configure.in
+++ b/configure.in
@@ -542,7 +542,6 @@ if test "$PHP_DMALLOC" = "yes"; then
CPPFLAGS="$CPPFLAGS -DDMALLOC_FUNC_CHECK"
fi
-
PHP_ARG_ENABLE(pear,whether to install PEAR,
[ --disable-pear Do not install PEAR],yes)
@@ -550,8 +549,11 @@ if test "$PHP_PEAR" = "yes"; then
PEAR_DIR=pear
fi
-
-
+PHP_OUTPUT(pear/pear)
+PHP_OUTPUT(pear/run-tests)
+PHP_OUTPUT(pear/phpize)
+PHP_OUTPUT(pear/php-config)
+PHP_OUTPUT(pear/PEAR.php)
divert(5)
@@ -666,6 +668,7 @@ ZEND_MODULE_API_NO=`egrep '#define ZEND_MODULE_API_NO ' $srcdir/Zend/modules.h|s
EXTENSION_DIR="$prefix/lib/php/extensions/$PART1-$PART2-$ZEND_MODULE_API_NO"
PEAR_INSTALLDIR="$prefix/lib/php"
+
INCLUDE_PATH=".:$PEAR_INSTALLDIR"
AC_BUILD_RPATH
@@ -798,7 +801,15 @@ AC_OUTPUT([php4.spec Zend/Makefile
$PHP_OUTPUT_FILES
], [], [
-PHP_GEN_MAKEFILES
+if test "$CONFIG_FILES" = ""; then
+ PHP_GEN_MAKEFILES
+else
+ for file in $PHP_FAST_OUTPUT_FILES; do
+ if test "$file" = "$CONFIG_FILES"; then
+ PHP_GEN_MAKEFILE($file)
+ fi
+ done
+fi
if test ! -f $srcdir/ext/bcmath/number.c; then
echo "creating number.c"
diff --git a/pear/Makefile.in b/pear/Makefile.in
index 4f336f7fa3..8840ce1e2f 100644
--- a/pear/Makefile.in
+++ b/pear/Makefile.in
@@ -1,5 +1,9 @@
-install_targets = install-data-local install-headers install-build
+install_targets = \
+ install-data-local \
+ install-headers \
+ install-build \
+ install-programs
include $(top_srcdir)/build/rules.mk
@@ -7,7 +11,8 @@ peardir=$(PEAR_INSTALLDIR)
PEAR_SUBDIRS = \
DB \
- File
+ File \
+ PEAR
PEAR_FILES = \
DB.php \
@@ -52,32 +57,16 @@ BUILD_FILES = \
dynlib.m4 \
acinclude.m4
+bin_PROGRAMS = phpize php-config pear phpextdist
+
install-build:
- -@$(mkinstalldirs) $(builddir) $(bindir) && \
- (cd $(top_srcdir) && cp $(BUILD_FILES) $(builddir)) && \
- echo "creating phpize" && \
- sed \
- -e 's#@PREFIX@#$(prefix)#' \
- < $(srcdir)/phpize.in > $(bindir)/phpize.tmp && \
- chmod +x $(bindir)/phpize.tmp && \
- mv $(bindir)/phpize.tmp $(bindir)/phpize && \
- echo "creating php-config" && \
- sed \
- -e 's#@PREFIX@#$(prefix)#' \
- -e 's#@PHPINCLUDEDIR@#$(phpincludedir)#g' \
- -e 's#@EXTENSION_DIR@#$(EXTENSION_DIR)#g' \
- < $(srcdir)/php-config.in > $(bindir)/php-config.tmp && \
- chmod +x $(bindir)/php-config.tmp && \
- mv $(bindir)/php-config.tmp $(bindir)/php-config && \
- echo "creating pear" && \
- sed \
- -e 's#@PREFIX@#$(prefix)#' \
- -e 's#@EXTENSION_DIR@#$(EXTENSION_DIR)#g' \
- -e 's#@PEAR_INSTALLDIR@#$(PEAR_INSTALLDIR)#g' \
- < $(srcdir)/pear.in > $(bindir)/pear.tmp && \
- chmod +x $(bindir)/pear.tmp && \
- mv $(bindir)/pear.tmp $(bindir)/pear && \
- cp $(srcdir)/phpextdist $(bindir)/phpextdist
+ $(mkinstalldirs) $(builddir) $(bindir) && \
+ (cd $(top_srcdir) && cp $(BUILD_FILES) $(builddir))
+
+install-programs:
+ for prog in $(bin_PROGRAMS); do \
+ $(INSTALL) -m 755 $$prog $(bindir)/$$prog; \
+ done
HEADER_DIRS = \
/ \
@@ -100,3 +89,18 @@ install-headers:
(cd $(top_srcdir)/$$i && cp -p *.h $(phpincludedir)/$$i; \
cd $(top_builddir)/$$i && cp -p *.h $(phpincludedir)/$$i) 2>/dev/null || true; \
done
+
+run-tests: run-tests.in $(top_builddir)/config.status
+ (cd ..;CONFIG_FILES=pear/run-tests CONFIG_HEADERS= $(top_builddir)/config.status)
+
+pear: pear.in $(top_builddir)/config.status
+ (cd ..;CONFIG_FILES=pear/pear CONFIG_HEADERS= $(top_builddir)/config.status)
+
+phpize: phpize.in $(top_builddir)/config.status
+ (cd ..;CONFIG_FILES=pear/phpize CONFIG_HEADERS= $(top_builddir)/config.status)
+
+php-config: php-config.in $(top_builddir)/config.status
+ (cd ..;CONFIG_FILES=pear/php-config CONFIG_HEADERS= $(top_builddir)/config.status)
+
+PEAR.php: PEAR.php.in $(top_builddir)/config.status
+ (cd ..;CONFIG_FILES=pear/PEAR.php CONFIG_HEADERS= $(top_builddir)/config.status)
diff --git a/pear/PEAR/Installer.php b/pear/PEAR/Installer.php
index 24018264e2..25c99f46df 100644
--- a/pear/PEAR/Installer.php
+++ b/pear/PEAR/Installer.php
@@ -44,10 +44,10 @@ class PEAR_Installer extends PEAR {
var $pkgdir;
/** directory where PHP code files go */
- var $pear_phpdir = '/usr/local/lib/php';
+ var $pear_phpdir = PEAR_INSTALL_DIR;
/** directory where PHP extension files go */
- var $pear_extdir = '/usr/local/lib/php/extensions/debug-non-zts-20000609';
+ var $pear_extdir = PEAR_EXTENSION_DIR;
/** directory where documentation goes */
var $pear_docdir = '';
@@ -259,10 +259,6 @@ class PEAR_Installer extends PEAR {
xml_parser_free($xp);
- if ($this->pkginfo['pkgtype'] != "binary") {
- return new PEAR_Installer_Error("Invalid package: only binary packages supported yet.\n");
- }
-
return true;
}
@@ -274,6 +270,9 @@ class PEAR_Installer extends PEAR {
$this->current_element = $name;
switch ($name) {
case "Package":
+ if (strtolower($attribs["Type"]) != "binary") {
+ return new PEAR_Installer_Error("Invalid package: only binary packages supported yet.\n");
+ }
$this->pkginfo['pkgtype'] = strtolower($attribs["Type"]);
break;
}
@@ -291,8 +290,6 @@ class PEAR_Installer extends PEAR {
// {{{ char_handler()
function char_handler($xp, $data) {
- global $debug;
-
switch ($this->current_element) {
case "DestDir":
$this->destdir = trim($data);
@@ -318,7 +315,7 @@ class PEAR_Installer extends PEAR {
print "Error: could not mkdir $d\n";
break;
}
- if ($debug) print "[debug] created directory $d\n";
+ if ($this->debug) print "[debug] created directory $d\n";
break;
case "File":
if (!$this->pear_phpdir) {
@@ -330,7 +327,8 @@ class PEAR_Installer extends PEAR {
print "Error: failed to copy $this->pkgdir/$file to $d\n";
break;
}
- if ($debug) print "[debug] installed $d/$file\n";
+ $this->cacheUpdateFrom("$d/$file");
+ if ($this->debug) print "[debug] installed $d/$file\n";
break;
case "ExtDir":
if (!$this->pear_extdir) {
@@ -350,7 +348,7 @@ class PEAR_Installer extends PEAR {
print "Error: could not mkdir $d\n";
break;
}
- if ($debug) print "[debug] created directory $d\n";
+ if ($this->debug) print "[debug] created directory $d\n";
break;
case "ExtFile":
if (!$this->pear_extdir) {
@@ -362,7 +360,7 @@ class PEAR_Installer extends PEAR {
print "Error: failed to copy $this->pkgdir/$file to $d\n";
break;
}
- if ($debug) print "[debug] installed $d/$file\n";
+ if ($this->debug) print "[debug] installed $d/$file\n";
break;
case "DocDir":
if (!$this->pear_docdir) {
@@ -382,7 +380,7 @@ class PEAR_Installer extends PEAR {
print "Error: could not mkdir $d\n";
break;
}
- if ($debug) print "[debug] created directory $d\n";
+ if ($this->debug) print "[debug] created directory $d\n";
break;
case "DocFile":
if (!$this->pear_docdir) {
@@ -394,7 +392,7 @@ class PEAR_Installer extends PEAR {
print "Error: failed to copy $this->pkgdir/$file to $d\n";
break;
}
- if ($debug) {
+ if ($this->debug) {
print "[debug] installed $d/$file\n";
}
break;
diff --git a/pear/pear.in b/pear/pear.in
index b203a427fc..1ea5ad88e3 100644
--- a/pear/pear.in
+++ b/pear/pear.in
@@ -1,14 +1,10 @@
-#!/usr/local/bin/php -f
+#!@prefix@/bin/php -f
<?php // -*- C++ -*-
-error_reporting(1);
+require_once "PEAR.php";
+require_once "PEAR/Installer.php";
-// config section, should be read from php-config
-$debug = true;
-$pear_phpdir = "@PEAR_INSTALLDIR@";
-$pear_extdir = "@EXTENSION_DIR@";
-//$pear_extdir = ini_get("extension_dir");
-$pear_docdir = ""; // empty means don't install docs
+error_reporting(1);
$pkgfile = $argv[0];
@@ -16,4 +12,8 @@ if (!$pkgfile) {
die("Usage: pear <packagefile>\n");
}
+$p = new PEAR_Installer();
+$p->debug = true;
+$p->install($pkgfile);
+
?>
diff --git a/pear/php-config.in b/pear/php-config.in
index 4649251e12..ccd29e7c39 100644
--- a/pear/php-config.in
+++ b/pear/php-config.in
@@ -1,7 +1,11 @@
#! /bin/sh
-prefix='@PREFIX@'
-includes='-I@PHPINCLUDEDIR@ -I@PHPINCLUDEDIR@/main -I@PHPINCLUDEDIR@/Zend -I@PHPINCLUDEDIR@/TSRM'
+prefix='@prefix@'
+includedir='@includedir@/php'
+includes="-I$includedir -I$includedir/main -I$includedir/Zend"
+if test '@TSRM_DIR@' != ''; then
+ includes="$includes -I$includedir/TSRM"
+fi
extension_dir='@EXTENSION_DIR@'
case "$1" in
diff --git a/pear/phpize.in b/pear/phpize.in
index ac29166a7e..a7195b6a09 100644
--- a/pear/phpize.in
+++ b/pear/phpize.in
@@ -1,6 +1,6 @@
#! /bin/sh
-prefix='@PREFIX@'
+prefix='@prefix@'
phpdir="$prefix/lib/php/build"
builddir="`pwd`"
FILES_BUILD="dynlib.mk fastgen.sh library.mk ltlib.mk program.mk rules.mk rules_pear.mk shtool"