summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2012-06-10 07:17:36 +0200
committerRemi Collet <fedora@famillecollet.com>2012-06-10 07:17:36 +0200
commit0bf18fff7dff14f81c4ba0b16cab92b42b3861f7 (patch)
tree2bacbfde4baf2d3d0c98a1a9cad5137dab352db7
repo reorg
-rw-r--r--LICENSE-XML_RPC68
-rw-r--r--Makefile4
-rw-r--r--install-pear.php296
-rw-r--r--macros.pear35
-rw-r--r--pear.sh4
-rw-r--r--peardev.sh4
-rw-r--r--pecl.sh4
-rw-r--r--php-pear.spec350
-rw-r--r--relocate.php61
-rw-r--r--sources6
-rw-r--r--strip.php35
11 files changed, 867 insertions, 0 deletions
diff --git a/LICENSE-XML_RPC b/LICENSE-XML_RPC
new file mode 100644
index 0000000..3cc8b77
--- /dev/null
+++ b/LICENSE-XML_RPC
@@ -0,0 +1,68 @@
+--------------------------------------------------------------------
+ The PHP License, version 3.01
+Copyright (c) 1999 - 2010 The PHP Group. All rights reserved.
+--------------------------------------------------------------------
+
+Redistribution and use in source and binary forms, with or without
+modification, is permitted provided that the following conditions
+are met:
+
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ 3. The name "PHP" must not be used to endorse or promote products
+ derived from this software without prior written permission. For
+ written permission, please contact group@php.net.
+
+ 4. Products derived from this software may not be called "PHP", nor
+ may "PHP" appear in their name, without prior written permission
+ from group@php.net. You may indicate that your software works in
+ conjunction with PHP by saying "Foo for PHP" instead of calling
+ it "PHP Foo" or "phpfoo"
+
+ 5. The PHP Group may publish revised and/or new versions of the
+ license from time to time. Each version will be given a
+ distinguishing version number.
+ Once covered code has been published under a particular version
+ of the license, you may always continue to use it under the terms
+ of that version. You may also choose to use such covered code
+ under the terms of any subsequent version of the license
+ published by the PHP Group. No one other than the PHP Group has
+ the right to modify the terms applicable to covered code created
+ under this License.
+
+ 6. Redistributions of any form whatsoever must retain the following
+ acknowledgment:
+ "This product includes PHP software, freely available from
+ <http://www.php.net/software/>".
+
+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND
+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE PHP
+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
+--------------------------------------------------------------------
+
+This software consists of voluntary contributions made by many
+individuals on behalf of the PHP Group.
+
+The PHP Group can be contacted via Email at group@php.net.
+
+For more information on the PHP Group and the PHP project,
+please see <http://www.php.net>.
+
+PHP includes the Zend Engine, freely available at
+<http://www.zend.com>.
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..1e65467
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../common/Makefile
+
diff --git a/install-pear.php b/install-pear.php
new file mode 100644
index 0000000..1be987e
--- /dev/null
+++ b/install-pear.php
@@ -0,0 +1,296 @@
+<?php
+
+/* $Id$ */
+
+error_reporting(1803);
+
+if (ini_get('date.timezone') === '' && function_exists('date_default_timezone_set')) {
+ date_default_timezone_set('UTC');
+}
+
+$pear_dir = dirname(__FILE__);
+ini_set('include_path', '');
+if (function_exists('mb_internal_encoding')) {
+ mb_internal_encoding('ASCII');
+}
+set_time_limit(0);
+include_once 'PEAR.php';
+include_once 'PEAR/Installer.php';
+include_once 'PEAR/Registry.php';
+include_once 'PEAR/PackageFile.php';
+include_once 'PEAR/Downloader/Package.php';
+include_once 'PEAR/Frontend.php';
+$a = true;
+if (!PEAR::loadExtension('xml')) {
+ $a = false;
+ echo "[PEAR] xml extension is required\n";
+}
+if (!PEAR::loadExtension('pcre')) {
+ $a = false;
+ echo "[PEAR] pcre extension is required\n";
+}
+if (!$a) {
+ return -1;
+}
+
+$force = false;
+$install_files = array();
+array_shift($argv);
+$debug = false;
+for ($i = 0; $i < sizeof($argv); $i++) {
+ $arg = $argv[$i];
+ $bn = basename($arg);
+ if (preg_match('/package-(.*)\.xml$/', $bn, $matches) ||
+ preg_match('/([A-Za-z0-9_:]+)-.*\.(tar|tgz)$/', $bn, $matches)) {
+ $install_files[$matches[1]] = $arg;
+ } elseif ($arg == '-a') {
+ $cache_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '--force') {
+ $force = true;
+ } elseif ($arg == '-dp') {
+ $prefix = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-ds') {
+ $suffix = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-d') {
+ $with_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-b') {
+ $bin_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-c') {
+ $cfg_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-w') {
+ $www_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-p') {
+ $php_bin = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-o') {
+ $download_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '-t') {
+ $temp_dir = $argv[$i+1];
+ $i++;
+ } elseif ($arg == '--debug') {
+ $debug = 1;
+ } elseif ($arg == '--extremedebug') {
+ $debug = 2;
+ }
+}
+
+$config = PEAR_Config::singleton();
+
+if (PEAR::isError($config)) {
+ $locs = PEAR_Config::getDefaultConfigFiles();
+ die("ERROR: One of $locs[user] or $locs[system] is corrupt, please remove them and try again");
+}
+
+// make sure we use only default values
+$config_layers = $config->getLayers();
+foreach ($config_layers as $layer) {
+ if ($layer == 'default') continue;
+ $config->removeLayer($layer);
+}
+$keys = $config->getKeys();
+if ($debug) {
+ $config->set('verbose', 5, 'default');
+} else {
+ $config->set('verbose', 0, 'default');
+}
+// PEAR executables
+if (!empty($bin_dir)) {
+ $config->set('bin_dir', $bin_dir, 'default');
+}
+
+// Cache files
+if (!empty($cache_dir)) {
+ $config->set('cache_dir', $cache_dir, 'default');
+}
+
+// Config files
+if (!empty($cfg_dir)) {
+ $config->set('cfg_dir', $cfg_dir, 'default');
+}
+
+// Web files
+if (!empty($www_dir)) {
+ $config->set('www_dir', $www_dir, 'default');
+}
+
+// Downloaded files
+if (!empty($download_dir)) {
+ $config->set('download_dir', $download_dir, 'default');
+}
+
+// Temporary files
+if (!empty($temp_dir)) {
+ $config->set('temp_dir', $temp_dir, 'default');
+}
+
+// User supplied a dir prefix
+if (!empty($with_dir)) {
+ $ds = DIRECTORY_SEPARATOR;
+ $config->set('php_dir', $with_dir, 'default');
+ $config->set('doc_dir', $with_dir . $ds . 'doc', 'default');
+ $config->set('data_dir', $with_dir . $ds . 'data', 'default');
+ $config->set('test_dir', $with_dir . $ds . 'test', 'default');
+ if (empty($www_dir)) {
+ $config->set('www_dir', $with_dir . $ds . 'htdocs', 'default');
+ }
+ if (empty($cfg_dir)) {
+ $config->set('cfg_dir', $with_dir . $ds . 'cfg', 'default');
+ }
+ if (!is_writable($config->get('cache_dir'))) {
+ include_once 'System.php';
+ $cdir = System::mktemp(array('-d', 'pear'));
+ if (PEAR::isError($cdir)) {
+ $ui->outputData("[PEAR] cannot make new temporary directory: " . $cdir);
+ die(1);
+ }
+ $oldcachedir = $config->get('cache_dir');
+ $config->set('cache_dir', $cdir);
+ }
+}
+
+// PHP executable
+if (!empty($php_bin)) {
+ $config->set('php_bin', $php_bin);
+}
+
+// PHP prefix
+if (isset($prefix)) {
+ if ($prefix != 'a') {
+ if ($prefix[0] == 'a') {
+ $prefix = substr($prefix, 1);
+ }
+ $config->set('php_prefix', $prefix, 'system');
+ }
+}
+
+// PHP suffix
+if (isset($suffix)) {
+ if ($suffix != 'a') {
+ if ($suffix[0] == 'a') {
+ $suffix = substr($suffix, 1);
+ }
+ $config->set('php_suffix', $suffix, 'system');
+ }
+}
+
+/* Print PEAR Conf (useful for debuging do NOT REMOVE) */
+if ($debug) {
+ sort($keys);
+ foreach ($keys as $key) {
+ echo $key . ' ' .
+ $config->getPrompt($key) . ": " . $config->get($key, null, 'default') . "\n";
+ }
+ if ($debug == 2) { // extreme debugging
+ exit;
+ }
+}
+// end print
+
+$php_dir = $config->get('php_dir');
+$options = array();
+$options['upgrade'] = true;
+$install_root = getenv('INSTALL_ROOT');
+if (!empty($install_root)) {
+ $options['packagingroot'] = $install_root;
+ $reg = &new PEAR_Registry($options['packagingroot']);
+} else {
+ $reg = $config->getRegistry('default');
+}
+
+$ui = PEAR_Frontend::singleton('PEAR_Frontend_CLI');
+if (PEAR::isError($ui)) {
+ die($ui->getMessage());
+}
+$installer = new PEAR_Installer($ui);
+$pkg = new PEAR_PackageFile($config, $debug);
+
+foreach ($install_files as $package => $instfile) {
+ $info = $pkg->fromAnyFile($instfile, PEAR_VALIDATE_INSTALLING);
+ if (PEAR::isError($info)) {
+ if (is_array($info->getUserInfo())) {
+ foreach ($info->getUserInfo() as $err) {
+ $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err['message']));
+ }
+ }
+ $ui->outputData(sprintf("[PEAR] %s: %s", $package, $info->getMessage()));
+ continue;
+ }
+ $new_ver = $info->getVersion();
+ $downloaderpackage = new PEAR_Downloader_Package($installer);
+ $err = $downloaderpackage->initialize($instfile);
+ if (PEAR::isError($err)) {
+ $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
+ continue;
+ }
+ if ($reg->packageExists($package)) {
+ $old_ver = $reg->packageInfo($package, 'version');
+ if (version_compare($new_ver, $old_ver, 'gt')) {
+ $installer->setOptions($options);
+ $dp = array($downloaderpackage);
+ $installer->setDownloadedPackages($dp);
+ $err = $installer->install($downloaderpackage, $options);
+ if (PEAR::isError($err)) {
+ $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
+ continue;
+ }
+ $ui->outputData(sprintf("[PEAR] %-15s- upgraded: %s", $package, $new_ver));
+ } else {
+ if ($force) {
+ $options['force'] = true;
+ $installer->setOptions($options);
+ $dp = array($downloaderpackage);
+ $installer->setDownloadedPackages($dp);
+ $err = $installer->install($downloaderpackage, $options);
+ if (PEAR::isError($err)) {
+ $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
+ continue;
+ }
+ $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
+ } else {
+ $ui->outputData(sprintf("[PEAR] %-15s- already installed: %s", $package, $old_ver));
+ }
+ }
+ } else {
+ $options['nodeps'] = true;
+ $installer->setOptions($options);
+ $dp = array($downloaderpackage);
+ $installer->setDownloadedPackages($dp);
+ $err = $installer->install($downloaderpackage, $options);
+ if (PEAR::isError($err)) {
+ $ui->outputData(sprintf("[PEAR] %s: %s", $package, $err->getMessage()));
+ continue;
+ }
+ $ui->outputData(sprintf("[PEAR] %-15s- installed: %s", $package, $new_ver));
+ }
+ if ($package == 'PEAR') {
+ if (is_file($ufile = $config->getConfFile('user'))) {
+ $ui->outputData('Warning! a PEAR user config file already exists from ' .
+ 'a previous PEAR installation at ' .
+ "'$ufile'. You may probably want to remove it.");
+ }
+ $config->set('verbose', 1, 'default');
+ if (isset($oldcachedir)) {
+ $config->set('cache_dir', $oldcachedir);
+ }
+ $data = array();
+ foreach ($config->getKeys() as $key) {
+ $data[$key] = $config->get($key);
+ }
+ $cnf_file = $config->getConfFile('system');
+ if (!empty($install_root)) {
+ $cnf_file = $install_root . DIRECTORY_SEPARATOR . $cnf_file;
+ }
+ $config->writeConfigFile($cnf_file, 'system', $data);
+ $ui->outputData('Wrote PEAR system config file at: ' . $cnf_file);
+ $ui->outputData('You may want to add: ' . $config->get('php_dir') . ' to your php.ini include_path');
+ }
+}
+?>
diff --git a/macros.pear b/macros.pear
new file mode 100644
index 0000000..afcfd42
--- /dev/null
+++ b/macros.pear
@@ -0,0 +1,35 @@
+#
+# Define full path to pear/pecl commands to be used in scriptlets:
+#
+%__pear @BINDIR@/pear
+%__pecl @BINDIR@/pecl
+
+#
+# Define PEAR directories used in php-pear-* spec files
+#
+%pear_phpdir %(%{__pear} config-get php_dir 2> /dev/null || echo undefined)
+%pear_docdir %(%{__pear} config-get doc_dir 2> /dev/null || echo undefined)
+%pear_testdir %(%{__pear} config-get test_dir 2> /dev/null || echo undefined)
+%pear_datadir %(%{__pear} config-get data_dir 2> /dev/null || echo undefined)
+%pear_cfgdir %(%{__pear} config-get cfg_dir 2> /dev/null || echo undefined)
+%pear_wwwdir %(%{__pear} config-get www_dir 2> /dev/null || echo undefined)
+
+#
+# Define PECL directories used in php-pecl-* spec files:
+#
+%pecl_phpdir %(%{__pecl} config-get php_dir 2> /dev/null || echo undefined)
+%pecl_docdir %(%{__pecl} config-get doc_dir 2> /dev/null || echo undefined)
+%pecl_testdir %(%{__pecl} config-get test_dir 2> /dev/null || echo undefined)
+%pecl_datadir %(%{__pecl} config-get data_dir 2> /dev/null || echo undefined)
+
+#
+# Define XML directories to store package registration information:
+#
+%pear_xmldir %{pear_phpdir}/.pkgxml
+%pecl_xmldir %{pecl_phpdir}/.pkgxml
+
+#
+# Define macros to be used in scriplets for php-pecl-* spec files:
+#
+%pecl_install %{__pecl} install --nodeps --soft --force --register-only --nobuild
+%pecl_uninstall %{__pecl} uninstall --nodeps --ignore-errors --register-only
diff --git a/pear.sh b/pear.sh
new file mode 100644
index 0000000..f600f6d
--- /dev/null
+++ b/pear.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+export PHP_PEAR_SYSCONF_DIR=@CONFDIR@
+exec @BINDIR@/php -C -d include_path=@PEARDIR@ \
+ -d output_buffering=1 @PEARDIR@/pearcmd.php "$@"
diff --git a/peardev.sh b/peardev.sh
new file mode 100644
index 0000000..327bd47
--- /dev/null
+++ b/peardev.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+export PHP_PEAR_SYSCONF_DIR=@CONFDIR@
+exec @BINDIR@/php -d memory_limit="-1" -C -q -d include_path=@PEARDIR@ \
+ -d output_buffering=1 @PEARDIR@/pearcmd.php "$@"
diff --git a/pecl.sh b/pecl.sh
new file mode 100644
index 0000000..9cfa665
--- /dev/null
+++ b/pecl.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+export PHP_PEAR_SYSCONF_DIR=@CONFDIR@
+exec @BINDIR@/php -C -n -q -d include_path=@PEARDIR@ \
+ -d output_buffering=1 @PEARDIR@/peclcmd.php "$@"
diff --git a/php-pear.spec b/php-pear.spec
new file mode 100644
index 0000000..a8043f6
--- /dev/null
+++ b/php-pear.spec
@@ -0,0 +1,350 @@
+%{!?phpname: %{expand: %%global phpname php}}
+
+%if %{phpname} == php
+%global phpbindir %{_bindir}
+%global phpconfdir %{_sysconfdir}
+%global phpincldir %{_includedir}
+%global peardir %{_datadir}/pear
+%else
+%global phpbindir %{_bindir}/%{phpname}
+%global phpconfdir %{_sysconfdir}/%{phpname}
+%global phpincldir %{_includedir}/%{phpname}
+%global peardir %{_datadir}/%{phpname}/pear
+%endif
+
+
+%global xmlrpcver 1.5.4
+%global getoptver 1.3.0
+%global arctarver 1.3.7
+%global structver 1.0.4
+%global xmlutil 1.2.1
+
+Summary: PHP Extension and Application Repository framework
+Name: %{phpname}-pear
+Version: 1.9.1
+Release: 7%{?dist}
+Epoch: 1
+# PEAR, Archive_Tar, XML_Util are BSD
+# XML-RPC, Console_Getopt are PHP
+# Structures_Graph is LGPLv2+
+License: BSD and PHP and LGPLv2+
+Group: Development/Languages
+URL: http://pear.php.net/package/PEAR
+Source0: http://download.pear.php.net/package/PEAR-%{version}.tgz
+# wget http://svn.php.net/viewvc/pear/pear-core/trunk/install-pear.php?revision=287906&view=co -O install-pear.php
+Source1: install-pear.php
+Source2: relocate.php
+Source3: strip.php
+Source4: LICENSE-XML_RPC
+Source10: pear.sh
+Source11: pecl.sh
+Source12: peardev.sh
+Source13: macros.pear
+Source20: http://pear.php.net/get/XML_RPC-%{xmlrpcver}.tgz
+Source21: http://pear.php.net/get/Archive_Tar-%{arctarver}.tgz
+Source22: http://pear.php.net/get/Console_Getopt-%{getoptver}.tgz
+Source23: http://pear.php.net/get/Structures_Graph-%{structver}.tgz
+Source24: http://pear.php.net/get/XML_Util-%{xmlutil}.tgz
+
+BuildArch: noarch
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: %{phpname}-cli >= 5.1.0-1, %{phpname}-xml, gnupg
+
+Provides: %{phpname}-pear(Console_Getopt) = %{getoptver}
+Provides: %{phpname}-pear(Archive_Tar) = %{arctarver}
+Provides: %{phpname}-pear(PEAR) = %{version}
+Provides: %{phpname}-pear(Structures_Graph) = %{structver}
+Provides: %{phpname}-pear(XML_RPC) = %{xmlrpcver}
+Provides: %{phpname}-pear(XML_Util) = %{xmlutil}
+Obsoletes: %{phpname}-pear-XML-Util <= %{xmlutil}
+Provides: %{phpname}-pear-XML-Util = %{xmlutil}-%{release}
+Requires: %{phpname}-cli >= 5.1.0-1
+
+
+%description
+PEAR is a framework and distribution system for reusable PHP
+components. This package contains the basic PEAR components.
+
+%prep
+%setup -cT
+
+# Create a usable PEAR directory (used by install-pear.php)
+for archive in %{SOURCE0} %{SOURCE21} %{SOURCE22} %{SOURCE23} %{SOURCE24}
+do
+ tar xzf $archive --strip-components 1 || tar xzf $archive --strip-path 1
+ file=${archive##*/}
+ [ -f LICENSE ] && mv LICENSE LICENSE-${file%%-*}
+ [ -f README ] && mv README README-${file%%-*}
+done
+tar xzf %{SOURCE24} package.xml
+mv package.xml XML_Util.xml
+
+# apply patches on used PEAR during install
+# -- no patch
+
+%{__sed} -e "s:@BINDIR@:%{phpbindir}:;s:@PEARDIR@:%{peardir}:;s:@CONFDIR@:%{phpconfdir}:" %{SOURCE10} >pear.sh
+%{__sed} -e "s:@BINDIR@:%{phpbindir}:;s:@PEARDIR@:%{peardir}:;s:@CONFDIR@:%{phpconfdir}:" %{SOURCE11} >pecl.sh
+%{__sed} -e "s:@BINDIR@:%{phpbindir}:;s:@PEARDIR@:%{peardir}:;s:@CONFDIR@:%{phpconfdir}:" %{SOURCE12} >pdev.sh
+%{__sed} -e "s:@BINDIR@:%{phpbindir}:;s:@PEARDIR@:%{peardir}:;s:@CONFDIR@:%{phpconfdir}:" %{SOURCE13} >macros
+
+
+%build
+# This is an empty build section.
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+export PHP_PEAR_SYSCONF_DIR=%{phpconfdir}
+export PHP_PEAR_SIG_KEYDIR=%{phpconfdir}/pearkeys
+export PHP_PEAR_SIG_BIN=%{_bindir}/gpg
+export PHP_PEAR_INSTALL_DIR=%{peardir}
+
+# 1.4.11 tries to write to the cache directory during installation
+# so it's not possible to set a sane default via the environment.
+# The ${PWD} bit will be stripped via relocate.php later.
+export PHP_PEAR_CACHE_DIR=${PWD}%{_localstatedir}/cache/php-pear
+export PHP_PEAR_TEMP_DIR=/var/tmp
+
+install -d $RPM_BUILD_ROOT%{peardir} \
+ $RPM_BUILD_ROOT%{_localstatedir}/cache/php-pear \
+ $RPM_BUILD_ROOT%{_localstatedir}/www/html \
+ $RPM_BUILD_ROOT%{peardir}/.pkgxml \
+ $RPM_BUILD_ROOT%{_sysconfdir}/rpm \
+ $RPM_BUILD_ROOT%{phpconfdir}/pear
+
+export INSTALL_ROOT=$RPM_BUILD_ROOT
+
+%{phpbindir}/php -n -dmemory_limit=32M -dshort_open_tag=0 -dsafe_mode=0 \
+ -derror_reporting=E_ALL -ddetect_unicode=0 \
+ %{SOURCE1} -d %{peardir} \
+ -c %{phpconfdir}/pear \
+ -b %{phpbindir} \
+ -p %{phpbindir}/php \
+ -w %{_localstatedir}/www/html \
+ %{SOURCE0} %{SOURCE21} %{SOURCE22} %{SOURCE23} %{SOURCE24} %{SOURCE20}
+
+# Replace /usr/bin/* with simple scripts:
+install -m 755 pear.sh $RPM_BUILD_ROOT%{phpbindir}/pear
+install -m 755 pecl.sh $RPM_BUILD_ROOT%{phpbindir}/pecl
+install -m 755 pdev.sh $RPM_BUILD_ROOT%{phpbindir}/peardev
+
+# Sanitize the pear.conf
+%{phpbindir}/php -n %{SOURCE2} $RPM_BUILD_ROOT%{phpconfdir}/pear.conf $RPM_BUILD_ROOT |
+ %{phpbindir}/php -n %{SOURCE2} php://stdin $PWD > new-pear.conf
+%{phpbindir}/php -n %{SOURCE3} new-pear.conf ext_dir |
+ %{phpbindir}/php -n %{SOURCE3} php://stdin http_proxy > $RPM_BUILD_ROOT%{phpconfdir}/pear.conf
+
+%{phpbindir}/php -r "print_r(unserialize(substr(file_get_contents('$RPM_BUILD_ROOT%{phpconfdir}/pear.conf'),17)));"
+
+install -m 644 -c %{SOURCE4} LICENSE-XML_RPC
+
+install -m 644 -c macros $RPM_BUILD_ROOT%{_sysconfdir}/rpm/macros.%{name}
+
+# apply patches on installed PEAR tree
+pushd $RPM_BUILD_ROOT%{peardir}
+# -- no patch
+popd
+
+# Why this file here ?
+rm -rf $RPM_BUILD_ROOT/.depdb* $RPM_BUILD_ROOT/.lock $RPM_BUILD_ROOT/.channels $RPM_BUILD_ROOT/.filemap
+
+# Need for re-registrying XML_Util
+install -m 644 XML_Util.xml $RPM_BUILD_ROOT%{peardir}/.pkgxml/
+
+
+%check
+# Check that no bogus paths are left in the configuration, or in
+# the generated registry files.
+grep $RPM_BUILD_ROOT $RPM_BUILD_ROOT%{phpconfdir}/pear.conf && exit 1
+grep %{_libdir} $RPM_BUILD_ROOT%{phpconfdir}/pear.conf && exit 1
+grep '"/tmp"' $RPM_BUILD_ROOT%{phpconfdir}/pear.conf && exit 1
+grep /usr/local $RPM_BUILD_ROOT%{phpconfdir}/pear.conf && exit 1
+grep -rl $RPM_BUILD_ROOT $RPM_BUILD_ROOT && exit 1
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+rm new-pear.conf
+
+
+%triggerpostun -- %{phpname}-pear-XML-Util
+# re-register extension unregistered during postun of obsoleted php-pear-XML-Util
+%{phpbindir}/pear install --nodeps --soft --force --register-only %{peardir}/.pkgxml/XML_Util.xml >/dev/null || :
+
+
+%files
+%defattr(-,root,root,-)
+%{peardir}
+%{phpbindir}/*
+%config(noreplace) %{phpconfdir}/pear.conf
+%config %{_sysconfdir}/rpm/macros.%{name}
+%dir %{_localstatedir}/cache/php-pear
+%dir %{_localstatedir}/www/html
+%dir %{phpconfdir}/pear
+%doc README* LICENSE*
+
+
+%changelog
+* Mon Dec 27 2010 Remi Collet <rpms@famillecollet.com> 1:1.9.1-7
+- relocate using phpname macro
+
+* Sun Dec 12 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-6
+- update Console_Getopt to 1.3.0
+- don't require php-devel (#657812)
+- update install-pear.php
+
+* Tue Oct 26 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-5
+- update Structures_Graph to 1.0.4
+
+* Fri Sep 10 2010 Joe Orton <jorton@redhat.com> - 1:1.9.1-4
+- ship LICENSE file for XML_RPC
+
+* Fri Sep 10 2010 Joe Orton <jorton@redhat.com> - 1:1.9.1-3
+- require php-devel (without which pecl doesn't work)
+
+* Mon Jul 05 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-2
+- update to XML_RPC-1.5.4
+
+* Thu May 27 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.1-1
+- update to 1.9.1
+
+* Thu Apr 29 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.0-5
+- update to Archive_Tar-1.3.7 (only metadata fix)
+
+* Tue Mar 09 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.0-4
+- update to Archive_Tar-1.3.6
+
+* Sat Jan 16 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.0-3
+- update to XML_RPC-1.5.3
+- fix licenses (multiple)
+- provide bundled LICENSE files
+
+* Fri Jan 01 2010 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.0-2
+- update to Archive_Tar-1.3.5, Structures_Graph-1.0.3
+
+* Sat Sep 05 2009 Remi Collet <Fedora@FamilleCollet.com> 1:1.9.0-1
+- update to PEAR 1.9.0, XML_RPC 1.5.2
+
+* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.8.1-2
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
+
+* Sat May 30 2009 Remi Collet <Fedora@FamilleCollet.com> 1:1.8.1-1
+- update to 1.8.1
+- Update install-pear.php script (1.39)
+- add XML_Util
+
+* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:1.7.2-3
+- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
+
+* Sun May 18 2008 Remi Collet <Fedora@FamilleCollet.com> 1:1.7.2-2
+- revert to install-pear.php script 1.31 (for cfg_dir)
+
+* Sun May 18 2008 Remi Collet <Fedora@FamilleCollet.com> 1:1.7.2-1
+- update to 1.7.2
+- Update install-pear.php script (1.32)
+
+* Tue Mar 11 2008 Tim Jackson <rpm@timj.co.uk> 1:1.7.1-2
+- Set cfg_dir to be %%{_sysconfdir}/pear (and own it)
+- Update install-pear.php script
+- Add %%pear_cfgdir and %%pear_wwwdir macros
+
+* Sun Feb 3 2008 Remi Collet <Fedora@FamilleCollet.com> 1:1.7.1-1
+- update to 1.7.1
+
+* Fri Feb 1 2008 Remi Collet <Fedora@FamilleCollet.com> 1:1.7.0-1
+- update to 1.7.0
+
+* Thu Oct 4 2007 Joe Orton <jorton@redhat.com> 1:1.6.2-2
+- require php-cli not php
+
+* Sun Sep 9 2007 Remi Collet <Fedora@FamilleCollet.com> 1:1.6.2-1
+- update to 1.6.2
+- remove patches merged upstream
+- Fix : "pear install" hangs on non default channel (#283401)
+
+* Tue Aug 21 2007 Joe Orton <jorton@redhat.com> 1:1.6.1-2
+- fix License
+
+* Thu Jul 19 2007 Remi Collet <Fedora@FamilleCollet.com> 1:1.6.1-1
+- update to PEAR-1.6.1 and Console_Getopt-1.2.3
+
+* Thu Jul 19 2007 Remi Collet <Fedora@FamilleCollet.com> 1:1.5.4-5
+- new SPEC using install-pear.php instead of install-pear-nozlib-1.5.4.phar
+
+* Mon Jul 16 2007 Remi Collet <Fedora@FamilleCollet.com> 1:1.5.4-4
+- update macros.pear (without define)
+
+* Mon Jul 16 2007 Joe Orton <jorton@redhat.com> 1:1.5.4-3
+- add pecl_{un,}install macros to macros.pear (from Remi)
+
+* Fri May 11 2007 Joe Orton <jorton@redhat.com> 1:1.5.4-2
+- update to 1.5.4
+
+* Tue Mar 6 2007 Joe Orton <jorton@redhat.com> 1:1.5.0-3
+- add redundant build section (#226295)
+- BR php-cli not php (#226295)
+
+* Mon Feb 19 2007 Joe Orton <jorton@redhat.com> 1:1.5.0-2
+- update builtin module provides (Remi Collet, #226295)
+- drop patch 0
+
+* Thu Feb 15 2007 Joe Orton <jorton@redhat.com> 1:1.5.0-1
+- update to 1.5.0
+
+* Mon Feb 5 2007 Joe Orton <jorton@redhat.com> 1:1.4.11-4
+- fix Group, mark pear.conf noreplace (#226295)
+
+* Mon Feb 5 2007 Joe Orton <jorton@redhat.com> 1:1.4.11-3
+- use BuildArch not BuildArchitectures (#226925)
+- fix to use preferred BuildRoot (#226925)
+- strip more buildroot-relative paths from *.reg
+- force correct gpg path in default pear.conf
+
+* Thu Jan 4 2007 Joe Orton <jorton@redhat.com> 1:1.4.11-2
+- update to 1.4.11
+
+* Fri Jul 14 2006 Joe Orton <jorton@redhat.com> 1:1.4.9-4
+- update to XML_RPC-1.5.0
+- really package macros.pear
+
+* Thu Jul 13 2006 Joe Orton <jorton@redhat.com> 1:1.4.9-3
+- require php-cli
+- add /etc/rpm/macros.pear (Christopher Stone)
+
+* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1:1.4.9-2.1
+- rebuild
+
+* Mon May 8 2006 Joe Orton <jorton@redhat.com> 1:1.4.9-2
+- update to 1.4.9 (thanks to Remi Collet, #183359)
+- package /usr/share/pear/.pkgxml (#190252)
+- update to XML_RPC-1.4.8
+- bundle the v3.0 LICENSE file
+
+* Tue Feb 28 2006 Joe Orton <jorton@redhat.com> 1:1.4.6-2
+- set cache_dir directory, own /var/cache/php-pear
+
+* Mon Jan 30 2006 Joe Orton <jorton@redhat.com> 1:1.4.6-1
+- update to 1.4.6
+- require php >= 5.1.0 (#178821)
+
+* Fri Dec 30 2005 Tim Jackson <tim@timj.co.uk> 1:1.4.5-6
+- Patches to fix "pear makerpm"
+
+* Wed Dec 14 2005 Joe Orton <jorton@redhat.com> 1:1.4.5-5
+- set default sig_keydir to /etc/pearkeys
+- remove ext_dir setting from /etc/pear.conf (#175673)
+
+* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
+- rebuilt
+
+* Tue Dec 6 2005 Joe Orton <jorton@redhat.com> 1:1.4.5-4
+- fix virtual provide for PEAR package (#175074)
+
+* Sun Dec 4 2005 Joe Orton <jorton@redhat.com> 1:1.4.5-3
+- fix /usr/bin/{pecl,peardev} (#174882)
+
+* Thu Dec 1 2005 Joe Orton <jorton@redhat.com> 1:1.4.5-2
+- add virtual provides (#173806)
+
+* Wed Nov 23 2005 Joe Orton <jorton@redhat.com> 1.4.5-1
+- initial build (Epoch: 1 to allow upgrade from php-pear-5.x)
diff --git a/relocate.php b/relocate.php
new file mode 100644
index 0000000..8475b33
--- /dev/null
+++ b/relocate.php
@@ -0,0 +1,61 @@
+<?php
+
+#
+# relocate.php /path/to/file prefix
+#
+# Takes a file as input and a string prefix; reads
+# the file as a serialized data blob and strips PREFIX
+# from the beginning of each string value within the blob.
+# Serializes again and writes output to stdout.
+#
+
+$file = $_SERVER['argv'][1];
+$destdir = $_SERVER['argv'][2];
+
+$destdir_len = strlen($destdir);
+
+function relocate_string($value) {
+ global $destdir, $destdir_len;
+
+ if (strncmp($value, $destdir, $destdir_len) == 0) {
+ $value = substr($value, $destdir_len);
+ }
+ return $value;
+}
+
+function relocate_value($value) {
+ if (is_string($value)) {
+ $value = relocate_string($value);
+ } else if (is_array($value)) {
+ $value = relocate_array($value);
+ }
+
+ return $value;
+}
+
+function relocate_array($array) {
+ $result = array();
+
+ foreach ($array as $key => $value) {
+ if (is_string($key)) {
+ $key = relocate_string($key);
+ }
+ $result[$key] = relocate_value($value);
+ }
+
+ return $result;
+}
+
+$input = file_get_contents($file);
+
+# Special case for /etc/pear.conf.
+if (strncmp($input, "#PEAR_Config 0.9\n", 17) == 0) {
+ echo substr($input, 0, 17);
+ $s = substr($input, 17);
+} else {
+ $s = $input;
+}
+
+echo serialize(relocate_value(unserialize($s)));
+
+?> \ No newline at end of file
diff --git a/sources b/sources
new file mode 100644
index 0000000..9365117
--- /dev/null
+++ b/sources
@@ -0,0 +1,6 @@
+a40b15b38ef8a5239309c9faedfa123b Archive_Tar-1.3.7.tgz
+d8e9e8e5efc5a4afdc7e62b294b2655e Console_Getopt-1.3.0.tgz
+e301d2d81371327a96864a307b85509d PEAR-1.9.1.tgz
+b99c5e9ac348a2e81515ba16deb7ded3 Structures_Graph-1.0.4.tgz
+da0d1c21960a67bc76629db28d2c7755 XML_RPC-1.5.4.tgz
+b8d4efcdb11b308b179f7bb63043284f XML_Util-1.2.1.tgz
diff --git a/strip.php b/strip.php
new file mode 100644
index 0000000..5c5216b
--- /dev/null
+++ b/strip.php
@@ -0,0 +1,35 @@
+<?php
+
+#
+# strip.php /path/to/file key_name
+#
+# Takes a file as input and a string prefix; reads
+# the file as a serialized data blob and removes a
+# key with name key_name from the hash.
+# Serializes again and writes output to stdout.
+#
+
+$file = $_SERVER['argv'][1];
+$key = $_SERVER['argv'][2];
+
+function remove_key($array, $name) {
+ if (array_key_exists($name, $array)) {
+ unset($array[$name]);
+ }
+
+ return $array;
+}
+
+$input = file_get_contents($file);
+
+# Special case for /etc/pear.conf.
+if (strncmp($input, "#PEAR_Config 0.9\n", 17) == 0) {
+ echo substr($input, 0, 17);
+ $s = substr($input, 17);
+} else {
+ $s = $input;
+}
+
+echo serialize(remove_key(unserialize($s), $key));
+
+?> \ No newline at end of file