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:
--with-pcre-regex=/usr
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:
http://gaarai.com/2009/01/31/unicode-support-on-centos-52-with-php-and-pcre/
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.
Why?
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
%_topdir /home/you/src/rpm - 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/i[3456]86 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-4.4.2.3-18.el5.x86_64.rpm rpm-4.4.2.3-18.el5.x86_64.rpm elfutils-0.137-3.el5.x86_64.rpm elfutils-libs-0.137-3.el5.x86_64.rpm rpm-build-4.4.2.3-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:%configure --enable-utf8
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
Compiled with
UTF-8 support
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.
No comments :
Post a Comment