9 Nov 2014

src2pkg - linux package maker

Almost every Linux distribution comes with a good package manager from where the user can install-update-remove desired applications. But inevitably there comes a time when the need to compile an application from the source arises. The usual route to compile an application goes something like this,

source -> uncompress -> ./configure -> make -> make install

The main disadvantage of this method is it becomes very hard to keep track of the installed packages and files. Uninstalling a package cleanly can sometimes becomes nightmarish. That's where src2pkg comes into play.

src2pkg is a nifty little application for creating installable Linux software packages that can be installed or removed using the distribution package manager. It means that you can install a package created by src2pkg from the source via dpkg, yum, installpkg according to the distribution you are running. You can remove the installed package the same way via dpkg, yum, removepkg. This ensures that nothing unnecessary is left behind when you remove a package. Your package manager takes care of that.
Installing src2pkg is very easy. Binary packages are available for Debian-Ubuntu, Fedora-RHEL, Slackware-Salix, Puppy Linux, and SliTaz. You can download src2pkg for Slackware-Salix from here,

Download src2pkg for Slackware

For other Distributions you can get your Distribution specific binaries from here,

Download src2pkg

After you have installed src2pkg you need to run the following command as root. Don't use sudo.

src2pkg --setup

If you encounter error regarding 'Tar', Install 'byacc' and run 'src2pkg --setup' again and follow the onscreen instruction. If you get an error regarding 'Fuse', then install 'libfuse-dev' and run 'src2pkg --setup' again.

After you have successfully setup src2pkg you can use it to create packages from their source. I'll give you a little example. I want to install 'cplay' in Slackware. cplay is a nice command line audio player. First I'll create a directory named 'Sources' in my home directory where I'll be keeping the packages installed from the source. In the 'Sources' directory I'll create a subdirectory named 'cplay'. Next I'll open terminal and change the working directory to 'cplay',

cd ~/Sources/cplay

Next I'm going to use wget to download cplay source package. You can use any other method to download it and then copy it to 'cplay' directory.

wget -c --content-disposition --no-check-certificate http://ftp.de.debian.org/debian/pool/main/c/cplay/cplay_1.49.orig.tar.gz

Once the download has completed it is time to run src2pkg to create the package. There are tons of options that you can use while creating the package but we are going to keep it simple here.

src2pkg -CWD -C cplay_1.49.orig.tar.gz

Hit 'Enter' button and src2pkg will take care of everything. Once it has done it's job it will create a Slackware installable package 'cplay-1.49-i486-1.txz' in 'cplay' directory and all I've to do to install cplay is,

installpkg cplay-1.49-i486-1.txz

If for some reason I want to remove cplay all I've to do is,

removepkg cplay

Before running src2pkg make sure you have installed build requirements mentioned in the source package. If your system doesn't have necessary packages and libraries src2pkg won't be able to create the package.

That's it from me. For more information and getting the most out of src2pkg I suggest you to read the following document,

src2pkg Tutorial

As always suggestion, comment, critique are welcome.


1 comment:

Unknown said...

Mp3 Manager Zortam Mp3 Media Studio is all-in-one Mp3 application suite. It has several modules such us Zortam Mp3 Auto Tagger, Mp3 Organizer, ID3 Tag Editor, Mp3 Player, Mp3 Normalizer, CD Ripper, Mp3 to Wav converter. With Zortam Mp3 Media Studio you can batch auto tag your Mp3 files using Zortam database. Batch auto tag process download Cover Art, Lyrics and other metadata and automatically tags your Mp3 files.