RPM compilation (step by step)

(A) Environment:

We are here taking the example of freetype, php and memory cache rpm packages:

Old specs:

freetype-2.2.1-21.el5_3

php-5.2.13-1.virt (and all the packages related of same version)

php-xcache-1.3.0-1.virt & php-pecl-memcache-2.2.5-2.virt

Updated(expected) Specs:

freetype-2.3.12-21.2.virt

php-5.2.14-2.virt (and all the packages related of same version)

php-xcache-1.3.0-2.virt & php-pecl-memcache-2.2.5-2.virt

(B) Procedure & Precautions:

1) The source packages should be from genuine regional sites.

e.g I downloaded freetype-2.2.21.src.rpm from Centos regional site (http://centos.mirrors.skynet.be/pub/centos/5.5/os/SRPMS/).

2) After extracting the src rpm packages, you will see respective tar packages (e.g freetype-2.2.1.tar.gz, freetype-devel-2.2.1.tar.gz etc.). Just replace that particular package with updated one.

3) Afterwards, extract every package (say freetype-2.2.1.tar.gz) and patch all the files with exact destination specified in .spec file in the root directory. Then exclude all the patch files out which have failed or shown confliction (either not compatible to this updated package or they are already patched). Then delete all the extracted packages (say freetype-2.2.1)

This spec file is basically the file that tells the rpm program where everything is, where to put everything, and any other scripts or commands that need to be run.

4)* *Place all the genuine patch files and the unpatched tar packages separately.

5)* *If you receive any ‘rpath_error’ related error then execute the rpm build command with QA_RPATHS=$[ 0x0001|howto:0x0010 ] prefix:

# QA_RPATHS=$[ 0x0001|howto:0x0010 ] rpmbuild -ba freetype.spec

6)* *Always remember whenever you are about to update some package then firstly check how many packages interact with this particular package and how severe its impact on environment after updation. I mean after this updation, other co-related packages might need upgradation or recompilation such that they could become compatible to updated version.

NOTE: Don’t ever perform anything forcefully because sometimes you usually unaware of its future effect.

(C) Common commands:

1) To extract a src rpm:

# rpm2cpio freetype-2.2.1-21.el5_2.src.rpm | cpio -idmv

2) How to install rpm-build utility (vital): # yum groupinstall “Development Tools”
# yum install rpmdevtools

# useradd makerpm

3) How to setup directory hierarchy to build rpms:

su – makerpm
rpmdev-setuptree
(It create five folders under rpmbuild folder which is locate at home directory) SPEC: contain spec file (manual).
SOURCES: * *contain packages, patches etc. except spec file (manual).

BUILD: is the directory where all building occurs by rpm-build command (after execution).

RPMS: is where RPM will put all binary RPMs when built (after execution).

SRPMS: is where all source RPMs will be put (after execution).

4) To build a rpm:

# su – makerpm

# cd rpmbuild/SPECS

# rpmbuild –ba freetype.spec

Note: There shouldn’t be any type of error during execution.

5) *To customize your .spec file:*

You can modify the spec file to behave the build according to your requirement (ie if you want gd support in freetype and in spec file gd support is disabled then you can modify to –enable-gd depending upon the package standards).

Although there are some certain changes:

i) You need to increase the release no. in every modification.

ii) You need to update the package “Version”.

iii) And most important, remove the entries of excludes patches.

(D) Steps for updating freetype:

a) First of all get the src rpm package and extract it.

b) Then replace the tar packages with desired updated packages. And extract them.

c) Now, perform the patch import process on the account of spec file and exclude the corrupted as well as the duplicate one.

d) Remove the extracted packages such that only legitimate patches as well as the intact tar packages should lie inside the directory.

e) Now move the modified spec file to “/home/makerpm/rpmbuild/SPECS” and rest of the content to “/home/makerpm/rpmbuild/SOURCES”

f) Now to produce your coveted rpm package, execute the “rpmbuild –ba freetype.spec” at “/home/makerpm/rpmbuild/SPECS”

g) Consequently, you can get the output rpm packages at “/home/makerpm/rpmbuild/RPMS” and srpms at “/home/makerpm/rpmbuild/RPMS”.

h)* *Now you should have all the freetype packages with updated versions (in my case it is “2.3.12-21.2.virt”)

(E) Steps for updating PHP:

a) Remove the build root directory after storing the RPMS and SRPMS folder:

# rm –rf /home/makerpm/rpmbuild

b) Perform [howto:(D) a-g ] steps and get the updated rpm packages.

c)* *Now you should have all the PHP packages with updated versions (in my case it is “5.2.14-2.virt”)

(F) Steps for updating dependent packages:

a) Repeat [howto:(E) a-b] steps.

Now you should have all the above rpms dependent packages with updated versions (in my case “php-xcache-1.3.0-2.virt” and “php-pecl-memcache-2.2.5-2.virt”)

(G) Updating all the build rpm packages at client end:

a) Execute this command:

rpm –Uvh php*.rpm

(A) Environment:

We are here taking the example of freetype, php and memory cache rpm packages:

Old specs:

freetype-2.2.1-21.el5_3

php-5.2.13-1.virt (and all the packages related of same version)

php-xcache-1.3.0-1.virt & php-pecl-memcache-2.2.5-2.virt

Updated(expected) Specs:

freetype-2.3.12-21.2.virt

php-5.2.14-2.virt (and all the packages related of same version)

php-xcache-1.3.0-2.virt & php-pecl-memcache-2.2.5-2.virt

(B) Procedure & Precautions:

1) The source packages should be from genuine regional sites.

e.g I downloaded freetype-2.2.21.src.rpm from Centos regional site (http://centos.mirrors.skynet.be/pub/centos/5.5/os/SRPMS/).

2) After extracting the src rpm packages, you will see respective tar packages (e.g freetype-2.2.1.tar.gz, freetype-devel-2.2.1.tar.gz etc.). Just replace that particular package with updated one.

3) Afterwards, extract every package (say freetype-2.2.1.tar.gz) and patch all the files with exact destination specified in .spec file in the root directory. Then exclude all the patch files out which have failed or shown confliction (either not compatible to this updated package or they are already patched). Then delete all the extracted packages (say freetype-2.2.1)

This spec file is basically the file that tells the rpm program where everything is, where to put everything, and any other scripts or commands that need to be run.

4)* *Place all the genuine patch files and the unpatched tar packages separately.

5)* *If you receive any ‘rpath_error’ related error then execute the rpm build command with QA_RPATHS=$[ 0x0001|howto:0x0010 ] prefix:

# QA_RPATHS=$[ 0x0001|0x0010 ] rpmbuild -ba freetype.spec

6)* *Always remember whenever you are about to update some package then firstly check how many packages interact with this particular package and how severe its impact on environment after updation. I mean after this updation, other co-related packages might need upgradation or recompilation such that they could become compatible to updated version.

NOTE: Don’t ever perform anything forcefully because sometimes you usually unaware of its future effect.

(C) Common commands:

1) To extract a src rpm:

# rpm2cpio freetype-2.2.1-21.el5_2.src.rpm | cpio –idmv

2) How to install rpm-build utility (vital): # yum groupinstall “Development Tools”
# yum groupinstall “Development Tools”
# useradd makerpm

3) How to setup directory hierarchy to build rpms:

su – makerpm
rpmdev-setuptree
(It create five folders under rpmbuild folder which is locate at home directory) SPEC: contain spec file (manual).
SOURCES: * *contain packages, patches etc. except spec file (manual).

BUILD: is the directory where all building occurs by rpm-build command (after execution).

RPMS: is where RPM will put all binary RPMs when built (after execution).

SRPMS: is where all source RPMs will be put (after execution).

4) To build a rpm:

# su – makerpm

# cd rpmbuild/SPECS

# rpmbuild –ba freetype.spec

Note: There shouldn’t be any type of error during execution.

5) *To customize your .spec file:*

You can modify the spec file to behave the build according to your requirement (ie if you want gd support in freetype and in spec file gd support is disabled then you can modify to –enable-gd depending upon the package standards).

Although there are some certain changes:

i) You need to increase the release no. in every modification.

ii) You need to update the package “Version”.

iii) And most important, remove the entries of excludes patches.

(D) Steps for updating freetype:

a) First of all get the src rpm package and extract it.

b) Then replace the tar packages with desired updated packages. And extract them.

c) Now, perform the patch import process on the account of spec file and exclude the corrupted as well as the duplicate one.

d) Remove the extracted packages such that only legitimate patches as well as the intact tar packages should lie inside the directory.

e) Now move the modified spec file to “/home/makerpm/rpmbuild/SPECS” and rest of the content to “/home/makerpm/rpmbuild/SOURCES”

f) Now to produce your coveted rpm package, execute the “rpmbuild –ba freetype.spec” at “/home/makerpm/rpmbuild/SPECS”

g) Consequently, you can get the output rpm packages at “/home/makerpm/rpmbuild/RPMS” and srpms at “/home/makerpm/rpmbuild/RPMS”.

h)* *Now you should have all the freetype packages with updated versions (in my case it is “2.3.12-21.2.virt”)

(E) Steps for updating PHP:

a) Remove the build root directory after storing the RPMS and SRPMS folder:

# rm –rf /home/makerpm/rpmbuild

b) Perform [howto:(D) a-g ] steps and get the updated rpm packages.

c)* *Now you should have all the PHP packages with updated versions (in my case it is “5.2.14-2.virt”)

(F) Steps for updating dependent packages:

a) Repeat [howto:(E) a-b] steps.

Now you should have all the above rpms dependent packages with updated versions (in my case “php-xcache-1.3.0-2.virt” and “php-pecl-memcache-2.2.5-2.virt”)

(G) Updating all the build rpm packages at client end:

a) Execute this command:

rpm –Uvh php*.rpm

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *

three × 1 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>