Building a Custom RPM
Sometimes the vendor provided RPM is not sufficient. Here’s directions of how to create a customized RPM:
Download the source RPM
Some sources:
- http://download.fedora.redhat.com/pub/
- ftp://download.fedora.redhat.com/pub/fedora/linux/releases/10/Everything/source/SRPMS/
- http://download.fedora.redhat.com/pub/epel/5/SRPMS/ (not everything)
$ wget ftp://download.fedora.redhat.com/pub/fedora/linux/development/source/SRPMS/python-2.5.1-24.fc9.src.rpmUnpack the source RPM into a local build directory
$ rpm --define '_topdir /home/chen23/mybuild' -ivh cracklib-2.8.12-2.src.rpm
Modify the specfile and/or add patches (use “/usr/local/” and add “-chen23” when possible)
sample changes to python.spec:
%define _prefix /usr/local %define _libdir /usr/local/lib64 %define _mandir /usr/local/man %define _docdir /usr/local/share/doc %define _bindir /usr/local/bin %define _includedir /usr/local/include Name: %{python}-chen23It is often necessary to change the setup portion to change the name, i.e.:
%setup -q -n cracklib-%{version}sample changes to Django.spec:
%define _prefix /usr/local %define _libdir /usr/local/lib64 %define _mandir /usr/local/man %define _bindir /usr/local/bin %define _includedir /usr/local/include %define __python /usr/local/bin/python BuildRequires: python-chen23-devel
Build new RPM
$ rpmbuild –define ‘_topdir /home/chen23/mybuild’ -ba python.spec