About three years ago I had posted a general guide on how to create RPM packages. According to that guide the RPM building environment was prepared using the handy utility rpmdev-setuptree (part of the rpmdevtools package in Fedora). This post describes the manual preparation of the RPM building environment.
As an unprivileged user create the following directory tree:
mkdir ~/rpmbuild \ ~/rpmbuild/BUILD \ ~/rpmbuild/RPMS \ ~/rpmbuild/SOURCES \ ~/rpmbuild/SPECS \ ~/rpmbuild/SRPMS
Now, create the file ~/.rpmmacros and put the following basic macros in it:
%_topdir %(echo $HOME)/rpmbuild %_smp_mflags -j3 %__arch_install_post /usr/lib/rpm/check-rpaths /usr/lib/rpm/check-buildroot
The %_topdir macro is set to the path of the root directory of your RPM building environment,
/home/[user]/rpmbuild in this case.
The %_smp_mflags macro usually contains only the -j (–jobs) option for the make command, which defines the number of jobs (make commands) that may run simultaneously. Usually, this is set to the number of CPU cores plus one. So, on a dual core CPU, the smp flags are set to -j3.
The %__arch_install_post macro contains various checks that should be run on the files in the BUILDROOT location. I trust Fedora guys and use the defaults check-rpaths and check-buildroot on Fedora and CentOS. This macro is optional.
All macros that are set in ~/.rpmmacros override the system-wide macros that have been set in other locations. To check which paths are checked for macro files, enter the following command:
rpm --showrc | grep macrofiles
The following command shows the current configuration for RPM building:
All the available macros can be found in /usr/lib/rpm/macros.
Manually Prepare the RPM Building Environment by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2009 - Some Rights Reserved