How to create a binary RPM package out of Python 2.7.2 sources for installation into a non-standard prefix such as /opt/python27?
Assume the following builds correctly.
wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar zxvf Python-2.7.2.tgz
cd Python-2.7.2
./configure --prefix=/opt/python27 --enable-shared
make
make test
sudo make install
Instead of the last command I'd like to build a binary RPM.
RPMs are built using rpmbuild from a .spec file. As an example, look at python.spec from Fedora.
If you don't need to build from sources then try rpm's --relocate switch on a pre-built RPM for your distribution:
rpm -i --relocate /usr=/opt/python27 python-2.7.rpm
It's probably a bit late to respond now, but I was trying to do something similar and I didn't want to use --relocate because my package was not made to install anywhere except into /opt.
The way I did it was add the following two lines:
Prefix: /opt
%define _prefix /opt/
Don't forget that you also need to update your %files section to reflect that it is now installing in /opt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.