5.8. Rebuilding an RPM Package for a Different Architecture
S ometimes you'll find an RPM has been prepared that would be perfect for your systemexcept 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.
5.8.1. 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-188.8.131.52-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/.
5.8.2. 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.
5.8.3. What About...
184.108.40.206. ...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").
5.8.4. Where Can I Learn More?