Rebuild php: An easier way?

Japheth Cleaver cleaver at ixpres.net
Tue Jun 22 18:52:04 UTC 2004


Get the Source RPM and rebuild from that? In the process, you'll see the 
specific build requirements and can yum them.


Here's how I did it to deal with mysql4 problems (shared-compat didn't work 
for me).

1) Make a RPM user to rebuild with
         useradd rpmbuild; su rpmbuild; cd /home/rpmbuild;
         echo "%_topdir  /home/rpmbuild/rpm" > .rpmmacros
         echo "%_tmppath /home/rpmbuild/rpm/tmp" >> .rpmmacros
         mkdir rpm; cd rpm;
         mkdir SPECS SOURCES BUILD RPMS SRPMS tmp
         cd ..

2) Download the latest Source RPM from a mirror (apparently 
http://fedora.mirrors.redwire.net/updates/1/SRPMS/php-4.3.6-1.3.src.rpm)
         rpmbuild --recompile php-4.3.6-1.3.src.rpm

3) grep BuildRequires rpm/SPECS/php.spec
    yum install anything you don't already have. Or just



3) vi rpm/SPECS/php.spec


         edit configure/spec file as needed
         opt: rename the package it creates

4)      rpmbuild -ba php.spec

At 10:47 AM 6/22/2004, Bert Buckley - Uniq Software/Systems wrote:

>I am using FC1. The distributed version of php does not
>include support for libmcrypt, so I want to rebuild php
>--with-mcrypt.
>
>However, I also need gd, jpeg, mysql, and png. So, in order
>to rebuild php, I have to download, untar, configure, make and
>install packages for php, lib png, lib jpeg, mysql, gd, freetype2,
>at least.  I even have to reinstall apache, since apxs is needed
>for the php build.
>
>Yes, I can do this, but is there an easier way?  These packages
>all come with FC1, but there is no source, and if I try to
>configure and make php without these, various errors of the
>sort 'can't find suchandsuch.h' will occur.
>
>By the way, a public thanks to those of you out there who have
>taken the time to answer other questions in the past, for me
>and for others. It certainly is appreciated.
>
>Am I missing something simple?
>
>Thanks
>
>Bert
>Bert Buckley                   Uniq Software/Systems


I'd grab the php Source RPM and rebuild from there. In the process, you can 
view the BuildRequires of the spec file and do a yum install of everything 
you need. The process I used is below, but here's the command line to 
install/update everything it thinks it needs. Give it this (on one line), 
answer yes, and go fix a snack.

yum install bzip2-devel curl-devel db4-devel expat-devel freetype-devel 
gd-devel gdbm-devel gmp-devel aspell-devel httpd-devel libjpeg-devel 
libpng-devel pam-devel libstdc++-devel ncurses-devel openssl-devel 
zlib-devel pcre-devel bzip2 perl libtool krb5-devel libc-client-devel 
cyrus-sasl-devel openldap-devel mysql-devel postgresql-devel unixODBC-devel 
freetds-devel mhash-devel net-snmp-devel elfutils-devel libxslt-devel 
libxml2-devel


When it's done, you should be able to rebuild using your tweaked php SRPM 
easily. Here's how I did it to deal with mysql4 problems (since 
MySQL-shared-compat didn't work for me). Decide if you want to rename the 
package to something other than "php" though. If you don't edit your yum 
settings, otherwise your custom-built package will get clobbered the next 
time an update php rpm comes out.



1) Make a RPM user to rebuild with
         useradd rpmbuild; su rpmbuild; cd /home/rpmbuild;
         echo "%_topdir  /home/rpmbuild/rpm" > .rpmmacros
         echo "%_tmppath /home/rpmbuild/rpm/tmp" >> .rpmmacros
         mkdir -p rpm/{SPECS,SOURCES,BUILD,RPMS,SRPMS,tmp}


2) Download the latest Source RPM from a mirror (i.e., 
http://fedora.mirrors.redwire.net/updates/1/SRPMS/php-4.3.6-1.3.src.rpm)
         rpmbuild --recompile php-4.3.6-1.3.src.rpm

3) 'grep BuildRequires rpm/SPECS/php.spec' and yum "install" anything you 
don't already have. (above)

4) vi rpm/SPECS/php.spec

         edit configure/spec file as needed
         optionally rename the package(s) it creates

5) rpmbuild -ba php.spec

6) rpm -i rpm/RPMS/i386/packagenamehere



HTH,

Japheth "J.C." Cleaver
cleaver at ixpres.net
cleaver at rohan.sdsu.edu 





More information about the fedora-list mailing list