[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

This is an old revision of the document!


Building A Package

This is a rough outline for building Slackware packages. Some steps may not be neccessary, some steps might be missing. Use the discussion page for side-notes such as using slacktrack (when DESTDIR fails) and other utilities like checkinstall.

The good and decent way

Configure and compile the source as you usually do:

./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc
make

Make a temporary destination directory available:

mkdir /tmp/build

Install into the temporary directory:

make install DESTDIR=/tmp/build

Now strip libs/bins within the temporary directory:

strip -s /tmp/build/usr/lib/* /tmp/build/usr/bin/*

You also want to make sure that anything in <tt>/usr/man</tt> is gzipped before you make the package:

gzip -9 /tmp/build/usr/man/man?/*.?

Create the <tt>install</tt> directory, this is where the description and install script will be stored:

cd /tmp/build
mkdir install
cd install

One-liner (for the copy & paste people):

cd /tmp/build; mkdir install; cd install

Using a text editor (or a tool), create a file called slack-desc and fill it with the following contents:

slack-desc
       |-----handy-ruler------------------------------------------------------|
appname: appname (Short description of the application)
appname:      <this line is generally left blank>
appname: Description of application  -  this description should be fairly
appname: in-depth; in other words, make it clear what the package does (and 
appname: maybe include relevant links and/or instructions if there's room),
appname: but don't get too verbose.  
appname: This file can have a maximum of eleven (11) lines of text preceded by
appname: the "appname: " designation.  
appname:
appname: It's a good idea to include a link to the application's homepage too.
appname:

The “appname” string must *exactly* match the application name portion of the Slackware package (for example, a package titled “gaim-1.5-i486-1.tgz” must have a slack-desc file with the <appname> string of “gaim: ” rather than “Gaim: ” or “GAIM: ” or something else.

The first line must show the application name followed by a short description (enclosed in parentheses).

Create the actual package:

cd /tmp/build
makepkg ../app-version-arch-tag.tgz

(The dashes should appear as above, so if the version has a subversion like say “1.0 RC2” make sure you use 1.0_RC2 not 1.0-RC2. The arch should be something like “i486” for example. The tag should consist of the build number and your initals, e.g. 1zb for Zaphod Beeblebrox's first build, 2zb for his second build, etc. Official slackware packages have only numbers as tags.)

When prompted to recreate symbolic links, say <tt>yes</tt><br> When prompted to reset permissions, say <tt>no</tt>

Note: Using makepkg -l y -c n will give you the same behaviour as answering yes to the symlinks question, and no to the permissions question.

If all went well, you can now install the package. cd .. installpkg app-version-arch-tag.tgz

Specific tweaks

Perl info: perl packages comes with /usr/lib64/perl5/perllocal.pod and you probably don't want to overwrite the local version. Instead you could move the file to your package root/tmp and use the doinst.sh to append the new information to the old with something like “( cat /tmp/perllocal.pod » /usr/lib64/perl5/perllocal.pod )”.

The "I don't have time" way

Fortunately, Slackware are pretty flexible too. If you don't mind much about what is the source (beware!) that you're compiling you can burn some stages and do something like this:

./configure --prefix=/usr
make install DESTDIR=$(pwd)/PACKAGE
cd $(pwd)/PACKAGE
makepkg -l y -c n ../app-version-arch-tag.tgz
installpkg ../app-version-arch-tag.tgz

Of course, you will have a package without description, (probably) uncompressed man pages and unstripped binaries.

Sources

 howtos:slackware_admin:building_a_package ()