]> granicus.if.org Git - php/commitdiff
* generate pear scripts properly with configure
authorStig Bakken <ssb@php.net>
Mon, 24 Jul 2000 23:55:34 +0000 (23:55 +0000)
committerStig Bakken <ssb@php.net>
Mon, 24 Jul 2000 23:55:34 +0000 (23:55 +0000)
configure.in
pear/Makefile.in
pear/PEAR/Installer.php
pear/pear.in
pear/php-config.in
pear/phpize.in

index d10f4cb510369ac78a902c5e0ac84307989f1eba..75d6bf38f6dd5b7e248549fe4dcb3ce1111e79f0 100644 (file)
@@ -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"
index 4f336f7fa30f12142b2dfd4de1379e947fd2422e..8840ce1e2fc1ab2eaa95e3af8a44cf1129534c2a 100644 (file)
@@ -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)
index 24018264e2a36f8f48961f0a78adda8f9c885899..25c99f46dfe6d0e4f271e2d10661fc970d1c84ed 100644 (file)
@@ -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;
index b203a427fc026cb691ae216e3c2e30b76dcd4e67..1ea5ad88e3adc51e1e763f0769de36f5862bed13 100644 (file)
@@ -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);
+
 ?>
index 4649251e12fd836c2d766b7e2af2724af5b2e782..ccd29e7c39dfe346b37c4536d9af4368ee5dd2c3 100644 (file)
@@ -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
index ac29166a7e01e60134857d518978feb793ffab7e..a7195b6a09516dc72437e7d00c10118849857b8e 100644 (file)
@@ -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"