Rebuilding an RPM Package for a Different Architecture
S ometimes youâll find an RPM has been prepared that would be perfect for your systemâexcept that the RPM was built for a machine of a different architecture. This can be frustrating, but if you can obtain the source RPM, itâs a fairly simple matter to make a binary RPM that is tuned to your system.
How Do I Do That?
Assuming that you have set up your ~/.rpmmacros file (see Lab 5.7, âMaking Your Own RPM Packagesâ), simply obtain a source RPM file, and then execute
rpmbuild with the --rebuild
option:
$rpmbuild --rebuild
$rpmbuild --rebuild ImageMagick*.src.rpm
Installing ImageMagick-6.2.2.0-2.src.rpm Executing(%prep): /bin/sh -e /home/chris/rpm/tmp/rpm-tmp.32955 + umask 022 + cd /home/chris/rpm/tmp ...(Lines snipped)... Executing(--clean): /bin/sh -e /home/chris/rpm/tmp/rpm-tmp.88067 + umask 022 + cd /home/chris/rpm/tmp + rm -rf ImageMagick-6.2.2 + exit 0
The new RPM packages will be found in ~/rpm/RPMS/.
How Does It Work?
When rebuilding a package, rpmbuild performs the equivalent of a source package installation (rpm
-i
), followed by a build-all (rpmbuild
-ba
), and then deletes the source files.
What About...
...editing the spec file before rebuilding?
rpmbuildâs --rebuild
option is useful only for a direct rebuild without any changes. If you need to edit the spec file, install the source RPM, edit the spec file, and then build the RPM packages normally (see Lab 5.7, âMaking Your Own RPM Packagesâ).
Where Can I ...
Get Fedora Linux now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.