Building A Package

From SlackWiki
Revision as of 10:29, 9 December 2011 by Merge-delete (talk | contribs)
Jump to navigation Jump to search


Intro

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 /usr/man is gzipped before you make the package:

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

Create the install directory, this is where the description and install script will be stored:

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:

   |-----handy-ruler------------------------------------------------------|
app: Application Name
(Short/Brief description)
app:
app: Enter a description of the package you are building.
app: All 11 "app:" lines must be present
app: "app" needs to be your application name.
app: The handy-ruler is there to help you, these lines should not exceed
app: 79 characters.
app:
app:
app:
app:

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 yes
When prompted to reset permissions, say no

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


# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|' on
# the right side marks the last column you can put a character in.  You must make
# exactly 11 lines for the formatting to be correct.  It's 

also customary to

# leave one space after the ':'.

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.


For more information, also see the pages on SlackBuild_Scripts and Different_Approach_To_Buildscripts.