The quick-fix guide to Slackware Package Management.3

In order to create a Slackware package, you will need to have the binary files for the package you want to create. Obviously this means you will need to either have the binary files already available in your system, or you will have to build the binary files from the source files. Here are the steps you need to follow to create a Slackware package:

create a directory tree
copy all the files related to the package into the appropriate directories in the directory tree.
run makepkg to create the Slackware package.

I would advice you to create a directory where you will keep your Slackware packages. For instance, something like /slackpack. This is where you will create your directory tree. /slackpack will simple contain the location on where the files in the package you are creating will be installed. For instance, foo.tgz will install the binary file foo in /usr/local/bin and a configuration file foorc in /usr/local/etc. Therefore, /slackpack will contain the following directories:


Understand? If not, look at it again and you will. The next step is to copy all the files to the directory
tree. So in this case, there are only two files to foo.tgz, and they are foo and foorc. We then copy the files to where they will be installed, in this case, /usr/local/bin and /usr/local/ etc respectively. When that is done with, we do the following:

root# cd /slackpack
root# makepkg foo.tgz

This will create a package called foo.tgz which contains the files foo and foorc which will be installed in /usr/local/bin and /usr/local/etc respectively.

As you can probably see, you will need to hunt around for the files and then to copy them to the created directory tree. An easier way to do this would be to build the package from source, and then have the built binaries installed into the directory tree. For instance, we have downloaded a source package called foo.tar.gz. We have already created a directory /slackpack it is currently empty. The first thing to do is to unpack the source file and then to build the source:

root# ./configure –prefix=/slackpack
root# make
root# make install

The line ./configure –prefix=/slackpack will cause make install to install all packages into /slackpack while at the same time, building the directory tree for you. So when you are done, just cd to /slackpack and run makepkg from within it, and it will automatically build the package for you. If the source package you build does not support the ./configure stage, then you will have to build and find out where the files will be installed in. Fortunately, most major source packages will require you to make use of the ./configure stage.

When you run makepkg two things will happen. First it will check to see if there are any symbolic links in the package you are creating. If there are, makepkg will recommend that a script be made and that all symbolic links are deleted. Do it if you want to. Secondly, it will as you if you want to change the permissions of the files to 755 and changing all ownerships to root. Unless some of the files need to retain special permissions for whatever reasons, go ahead and say yes to this question. Once you have finished all of these steps, your Slackware package is ready.

explodepkg is used to extract the contents of a package to the current directory. This is used mostly with makepkg. Basically if after you make a package, and then decide to make modifications to it, you can use explodepkg to unpack the package, modify it, and then rebuild it with makepkg.

As you have seen, the Slackware package managing system is extremely simple to understand and to use. It is advisable that you learn how to use it, and to create Slackware packages after building the binaries from the source package. It will be easier to keep track of them and to upgrade and uninstall them in future.

Leave a Reply

You must be logged in to post a comment.