28-mar-2016: Welcome to our new server! Faster and less prone to crashing.

Welcome to the Slackware Documentation Project

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 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:

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: It's a good idea to include a link to the application's homepage too.

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

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.


In Other Languages
Translations of this page?:
QR Code
QR Code howtos:slackware_admin:building_a_package (generated for current page)