Note: This is an example which using PCRE SOURCE RPM package.
Since I downloaded PHP 5.3.1 and compiled manually by enable the configure option:
And PHP 5.3.x includes PCRE support built in; however, the yum package for PCRE is not built with Unicode support; so, need to download the rpm and patched according to this page:
This is needed for Unicode regexp support, so we can do input validation in a variety of character sets.
By default, at least on a Red Hat box, rpm uses /usr/src/redhat as the location of the %_topdir macro, which specifies where most of the work involved in building an RPM takes place.
You can and should change this; it is a good idea to make this a directory that you can write to with a non-privileged account, to avoid compiling and building packages as root.
A lot of commands get executed when building a package. Sometimes things go wrong. If you're root, important things may be damaged. A big mess may be made. I once (foolishly) rebuilt a proftpd package as root, and the "make install" stage blew up and left newly compiled files all over the place, whereas if I'd been a regular user, I'd have simply gotten a bunch of "permission denied" messages.
- Anyway, the macro is easily changed by adding something like the following to ~/.rpmmacros:
# Path to top of build area
- If you have never worked on RPMs in this manner, you will need to create a few directories in which to work. I use a sub-directory in my homedir:
#> mkdir -p ~/src/rpm
#> cd ~/src/rpm
#> mkdir BUILD RPMS SOURCES SPECS SRPMS
#> mkdir RPMS/i86 RPMS/noarch RPMS/athlon
- Download the PCRE Source RPM, and install it:
#> wget ftp://ftp.pbone.net/mirror/ftp.redhat.com/pub/redhat/linux/enterprise/5Server/en/os/SRPMS/pcre-6.6-2.el5_1.7.src.rpm
#>rpm -ivh pcre-6.6-2.el5_1.7.src.rpm
Then install the following package from iso image if you didn't install them during the 1st time OS installation:
#> rpm -ivh beecrypt-4.1.2-10.1.1.x86_64.rpm rpm-libs-220.127.116.11-18.el5.x86_64.rpm rpm-18.104.22.168-18.el5.x86_64.rpm elfutils-0.137-3.el5.x86_64.rpm elfutils-libs-0.137-3.el5.x86_64.rpm rpm-build-22.214.171.124-18.el5.rf.x86_64.rpm
- Rebuild the PCRE RPM package and reinstall the new PCRE RPM package:
opened up the ~/src/rpm/SPECS/pcre.spec file and found the following line:
changed it to include the Unicode properties option:
%configure --enable-utf8 --enable-unicode-properties
Then saved and closed the file.
- Rebuils the PCR RPM package:
#> rpmbuild -ba ~/src/rpm/SPECS/pcre.spec
#> rpm -Uvh RPMS/x86_64/pcre-6.6-2.7.x86_64.rpm RPMS/x86_64/pcre-devel-6.6-2.7.x86_64.rpm –-force
- Then run pcretest program, and you should see "Unicode properties support" shown in the result.
$ pcretest -C
PCRE version 6.6 06-Feb-2006
No Unicode properties support
Newline character is LF
Internal link size = 2
POSIX malloc threshold = 10
Default match limit = 10000000
Default recursion depth limit = 10000000
Match recursion uses stack
I also found a very helpful guide that details this process out very nicely: How to patch and rebuild an RPM package.