Skip to content
Browse files

* generate pear scripts properly with configure

  • Loading branch information...
1 parent 576b6e9 commit fbc947f43fc57ecfd35ec058bf3a9cee597d4353 Stig Bakken committed
Showing with 73 additions and 56 deletions.
  1. +15 −4 configure.in
  2. +31 −27 pear/Makefile.in
  3. +12 −14 pear/PEAR/Installer.php
  4. +8 −8 pear/pear.in
  5. +6 −2 pear/php-config.in
  6. +1 −1 pear/phpize.in
View
19 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"
View
58 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)
View
26 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 @@ function install($pkgfile) {
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 @@ function start_handler($xp, $name, $attribs) {
$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 @@ function end_handler($xp, $name) {
// {{{ char_handler()
function char_handler($xp, $data) {
- global $debug;
-
switch ($this->current_element) {
case "DestDir":
$this->destdir = trim($data);
@@ -318,7 +315,7 @@ function char_handler($xp, $data) {
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 @@ function char_handler($xp, $data) {
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 @@ function char_handler($xp, $data) {
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 @@ function char_handler($xp, $data) {
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 @@ function char_handler($xp, $data) {
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 @@ function char_handler($xp, $data) {
print "Error: failed to copy $this->pkgdir/$file to $d\n";
break;
}
- if ($debug) {
+ if ($this->debug) {
print "[debug] installed $d/$file\n";
}
break;
View
16 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);
+
?>
View
8 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
View
2 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"

0 comments on commit fbc947f

Please sign in to comment.
Something went wrong with that request. Please try again.