20 March 2011

Create RPM from source in openSUSE easily. Checkinstall

Being new to openSUSE, I searched for a took "like" checkinstall in Debian. But
openSUSE already has it! :) I'll show how to use it.

Firstly, install it:
$ sudo zypper in checkinstall

Now the whole process mainly looks like the following.

$ ./configure && make
######################################################################
# or 
# qmake 
# or whatever appopriate before doing make install.
######################################################################
$ sudo /usr/sbin/checkinstall
######################################################################
# ... checkinstall advices some settings
######################################################################
$ rpm -i /path/to/generated/rpm
Now let's build an RPM for KeePassX password manager:
$ cd /tmp
$ mkdir keepasx
$ cd keepasx
$ svn co https://keepassx.svn.sourceforge.net/svnroot/keepassx/trunk
$ cd trunk
$ qmake

######################################################################
# To install qmake:
# $ sudo zypper in libqt4-devel
######################################################################
$ sudo /usr/sbin/checkinstall
######################################################################
# Now I had some problems with uncreated directories... Had to issue:
# $ sudo mkdir /usr/share/keepassx /usr/share/mimelnk
# and repeat 
# $ sudo /usr/sbin/checkinstall
######################################################################

Now checkinstall should generate file like
$ /usr/src/packages/RPMS/x86_64/keepassx-0.4.3-1.x86_64.rpm
So may now install the RPM normally:
$ sudo rpm -i /usr/src/packages/RPMS/x86_64/keepassx-0.4.3-1.x86_64.rpm