RPM PHP and PEAR Packages

MekBlalm

New Member
I'm trying to package a custom build of the latest PHP (5.3.3) with a set of pear packages. Unfortunately, the options given to do this don't seem to work. I'm posting the spec file as I see it should be. The version given doesn't actually fail, but it installs the PEAR packages in the wrong location. While they should go in /var/tmp/my_php-5.3.3-1-buildroot/usr/local/lib/php, but they end up in /var/tmp/my_php-5.3.3-1-buildroot/var/tmp/my_php-5.3.3-1-buildroot/usr/local/lib/php.You can also see where I had to hack the pearcmd.php script because it was completely ignoring the include_path setting the pear command passed it (derived from the PHP_PEAR_INSTALL_DIR environment variable). This could be completely wrong, but it's the only way I could get it to actually install anything at all.I have tried many other variations of this spec, but they all seem to "fail" in their own way. FYI, I've also tried using Pyrus, but it had similar issues (in addition to issues with non-PEAR2 packages).\[code\]%define PHP_PREFIX /usr/local%define CONF_PREFIX /home/config/php/conf%define APXS_PATH /usr/local/apache2/bin/apxs%define ORCL_PATH /usr/local/lib/oracle%define PHP %{PHP_PREFIX}/bin/php%define PEAR %{PHP_PREFIX}/bin/pear%define PEAR_ROOT %{PHP_PREFIX}/lib/php%define PHP_INSTALL $RPM_BUILD_ROOT%{PHP}%define PEAR_INSTALL $RPM_BUILD_ROOT%{PEAR}%define PEAR_ROOT_INSTALL $RPM_BUILD_ROOT%{PEAR_ROOT}%define PEARCMD %{PEAR_ROOT_INSTALL}/pearcmd.php%define PECLCMD %{PEAR_ROOT_INSTALL}/peclcmd.php%define _unpackaged_files_terminate_build 0Summary: my_php packageName: my_phpVersion: 5.3.3Release: 1License: The PHP License, Version 3.01Vendor: MePackager: Me <[email protected]>Group: Development/LanguagesBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootSource0: php-%{version}.tar.bz2Requires: my_httpd >= 2.2.0, oracle-instantclient >= 10.2.0.4BuildRequires: my_httpd >= 2.2.0Conflicts: php, php5%descriptionPHP, My style%prep%setup -q -n php-%{version}%buildLIB_DIR="lib"if [ "%{_arch}" == "x86_64" ]; then LIB_DIR="lib64"fi./configure \ --prefix=%{PHP_PREFIX} \ --with-libdir=${LIB_DIR} \ --with-pear \ --with-config-file-path=%{CONF_PREFIX} \ --with-apxs2=%{APXS_PATH} \ --with-oci8=instantclient,%{ORCL_PATH} \ --with-mysql \ --with-pgsql \ --enable-sockets \ --with-gd \ --enable-gd-native-ttf \ --with-freetype-dir \ --with-curl \ --with-bz2 \ --with-zlib-dir \ --enable-exif \ --with-ldap \ --with-gmp \ --with-xslmake cleanmake -j%installrm -rf $RPM_BUILD_ROOT# Don't try to change httpd.confsed -i.bak -e "s:&& \$(mkinstalldirs) '\$(INSTALL_ROOT)/.\+' \(&& %{APXS_PATH} .\+\)-S SYSCONFDIR='.\+' \(.\+\)-a \(.\+\):\1\2\3:" Makefile# Install PHP to rpm staging areamake INSTALL_ROOT=$RPM_BUILD_ROOT install# Modify *cmd.php to use correct include_pathsed -i.bak -e "s:'@'.'include_path'.'@':'%{PEAR_ROOT}':" %{PEARCMD}sed -i.bak -e "s:'@'.'include_path'.'@':'%{PEAR_ROOT}':" %{PECLCMD}# Install PEAR packages to rpm staging areaexport PHP_PEAR_PHP_BIN="%{PHP_INSTALL}"export PHP_PEAR_INSTALL_DIR="%{PEAR_ROOT_INSTALL}"%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/MDB2-beta%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/MDB2_Driver_oci8-beta%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/MDB2_Driver_pgsql-beta%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/MDB2_Driver_mysql-beta%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/Mail%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/Mail_Mime%{PEAR_INSTALL} install -P $RPM_BUILD_ROOT pear/Spreadsheet_Excel_Writer-beta# Revert *cmd.phpmv %{PEARCMD}.bak %{PEARCMD}mv %{PECLCMD}.bak %{PECLCMD}%files%defattr(-,root,root)/%cleanrm -rf $RPM_BUILD_DIR/php-%{version} $RPM_BUILD_ROOT\[/code\]Thanks for any help!
 
Back
Top