Notes: Rebuiling RPM packages with mockWed 22 May 2019
DISCLAIMER: this is not meant to be coherent post. Sorry. Just notes for future reference.
Given a source RPM package in order to rebuild it I use following tools. For detailed description about what and why I suggest looking at the RPM Packaging Guide first (really nice resource for first-time packagers!).
Installing needed tools on Centos 7 (and other RHEL derivatives, btw RHEL8 shouldn't change this) would look like this:
sudo yum install -y epel-release sudo yum install -y rpm-build rpmdevtools mock yum-utils
Now for standard rebuiling we need to setup the correct directory structure:
$ rpmdev-setuptreeo $ tree -L 1 ~/rpmbuild /home/vagrant/rpmbuild/ |-- BUILD |-- RPMS |-- SOURCES |-- SPECS `-- SRPMS 5 directories, 0 files
Now when we have a source package we need to unpack it in correct
subdirectiories, if the package is called
command looks like this:
rpm --install llvm3.9-3.9.1-7.el7.src.rpm
This will put all files in correct places for you. Note: no need for superuser privilages (unless you're building as root, but that is discouraged).
Next step is to take care of the dependencies for the package we are building:
sudo yum-builddep ~/rpmbuild/SPECS/llvm3.9.spec
Now for a rebuild:
rpmbuild -ba ~/rpmbuild/SPECS/llvm3.9.spec
If it doesn't work try installing
@buildsys-build. This will install all
needed compilers and standard (in terms of C/C++) build tools.