Creating packages

From DeLi(cate) Linux Wikipedia
Jump to: navigation, search



Enable the repository main-devel. You may use delisetup for it.

Make sure gcc, make, binutils and all other development packages (e.g. uclibc-devel) installed.

Edit /etc/makepkg.conf and add your name and email address. You may also uncomment export PKGDEST=/home/username/packages to have all your built packages to reside in a single directory. Leave export CARCH="i386 alone since all we will be building for i386 (for now at least).

Getting started

Test the package by downloading the source of the package you'd like to create, compile and install. Because Delicate Linux uses Linux 2.4 and older packages, newer packages may not work. We always try to choose the latest version if it has no speed impact (Source) . Work backwards until a solution is found. Please be aware of any bugs in past (or current) versions of the package.


  1. Make a PKGBUILD file for your package
  2. Generate the MD5 sums by running makepkg -g
  3. Build the package by running makepkg
  4. Test your package by installing and executing

See the ArchWiki for more information on PKGBUILDs


This is a rough template of a PKGBUILD file

 # Maintainer: Your name <>
 # Thanks to:
 # Old Maintainer No 1 <>
 pkgdesc="Small desktop gadgets"
 depends=('curl' 'intltool' )
 build() {
 cd "${srcdir}/${pkgname}-${pkgver}"
 ./configure --prefix=/usr --host=$CHOST --build=$CHOST
 make DESTDIR=$pkgdir install
 install -D -m644 COPYING "$pkgdir/usr/share/licenses/wizzygadgets/COPYING"

The above template is mostly straightforward. backup= are files that should be handled with care when removing or upgrading packages. As per the makepkg man page, the depends array specifies the run-time dependencies and makedepends specifies the build-time dependencies.

If PKGBUILDs need to have certain commands executed pre/post install, pre/post upgrade or pre/post removal, a .install file needs to be created.

The exact time the script is run varies with each operation:

             script is run right before files are extracted.
             script is run right after files are extracted.
             script is run right before files are extracted.
             script is run after files are extracted.
             script is run right before files are removed.
             script is run right after files are removed.

Install script template:

             # arg 1:  the new package version
             pre_install() {
               #  do pre-install stuff here

             # arg 1:  the new package version
             post_install() {
               #  do post-install stuff here

             # arg 1:  the new package version
             # arg 2:  the old package version
             pre_upgrade() {
               #  do pre-upgrade stuff here

             # arg 1:  the new package version
             # arg 2:  the old package version
             post_upgrade() {
               #  do post-upgrade stuff here

             # arg 1:  the old package version
             pre_remove() {
               #  do pre-remove stuff here

             # arg 1:  the old package version
             post_remove() {
               #  do post-remove stuff here

             $op $*

Using PKGBUILDs from other distributions

In PKGBUILDs the full syntax isn't supported.

The PKGBUILD from Connochaetos (connos) will not work as is, even if you replace the --host and --build. The very first thing you need to do when using arch or connos pkgbuilds is to clone all entries from depends to makedepends, then replace all makedepends which have a corresponding devel subpackage in delicate with such subpackage, once this is done, you can continue.

Thanks to: old maintainer/contributor

Before you start using PKGBUILDs from other distributions, please, keep in mind our recent policy to keep the original maintainers/contributors from Arch/AUR PKGBUILDs in a "Thanks to:" section of the file header. We don't wanna steal their credits by simply removing their names ... the keywords "Maintainer" and "Contributor" should disappear, because we don't want to make people think, that these guys are also DeLi(cate) package maintainers ....

The header should look like this :

# Maintainer: delix
# Thanks to:
# Eric Belanger <>

Btw. it has no sense to remove their email address. It can be stolen by robots directly from the AUR page ... so ... you can let it there hopefully without worries ...

Enforcing CFLAGS=-march=i386

Even if a missing arch can lead to i386, it's always safer to specify it explicitly. It's better to patch the Makefile with ...

sed -i 's/CFLAGS=/CFLAGS=-march=i386 /g' Makefile

This i386 / i686 related stuff is not important in Arch, because i686 is backward compatible with i386. But it doesn't work the opposite way ... therefore we have to care about the target instruction set and change the PKGBUILDs taken from Arch's repository accordingly in order to force the i386 insruction set. FYI i386 builds are very often faster and smaller than i486 and i586 builds.... what a magic! Don't ask me why ... I couldn't believe that either ...

Source: tavvva in the thread "PKGBUILD files"

library names in archlinux and deli(cate)

arch library Deli(cate) name
gcc-libs gcc
glibc uclibc
libxfont libxft
xorg-font-utils font-util + xclients
xorg-font-util font-util
xorg-bdftopcf xclients
xorg-font-util xclients
xorg-mkfontdir xclients
xorg mkfontscale xclients
libx11 libX11


Dependency check by makepkg

The pacman's dependency check was removed and a real dependency generator was introduced. It tells you the real needs of the package to let you fix wrong or incomplete depends used for the pacman's dependency resolution

No standard dependency check from makepkg

The runtime dependency check from makepkg was removed, the depends are only checked when you try to install the package, so it skips depends when building the package. In fact you don't need the runtime deps when you're just building the package. When they are needed, then they should be pulled with the devel subpackage, so in most cases the dependency will have to be installed anyway, but this will help us to break loops when building subpackages.

makepkg -G does a new real dependeny check

If you made a package you can get the dependencies by using makepkg -G. See makepkg

Adding the md5sum to PKGBUILD the easy way

makepkg -g >> PKGBUILD

Have You noticed, that many of my PKGBUILDs have the md5sums at the bottom? :]


  1. ) be very careful when using the second variant .... if You type just one > sign, then Your PKGBUILD is lost !
  2. ) use it only when all the sources are already downloaded, otherwise You would generate a junk into Your PKGBUILD

How to implement or handle files from version control systems (CVS, SVN, GIT)

If the sources are not available in a tarball or zipped file and need to be exported from any version control system (CVS, SVN, GIT, ...), then a good practice is to put the commands leading to the source archive creation into a comments inside the PKGBUILD file.

Example for subversion:

# svn export animal-sniffer-1.6
# tar caf animal-sniffer-1.6.tar.gz animal-sniffer-1.6

Example for GIT:

# git clone git://
# cd jsoup
# git archive --prefix="jsoup-1.6.1/" --format=tar jsoup-1.6.1 | gzip > ../jsoup-1.6.1.tar.gz source=(jsoup-1.6.1.tar.gz)

The newly created tar.gz file is then put in the source list without any URL .... just the filename.

The md5sums will differ each time a new export is done ... but You could generate the md5sums at least for Your own files (like .desktop or icons). I will replace just the lines containing sums of the exported sources. That's perfectly acceptable in such cases.

Static libaries

If static libs can't be disabled, then they can be usually removed by the rm command after the build ... it's the most stupid way, but sometimes there's no other way ...

Improvements for the new menugenerator

** fixme ** Source Example (not working)

There are some improvements mostly in case of the new 'menugenerator'. So the PKGBUILD (oldstyle) will work, but to make a 100% PKGBUILD there must be a few lines added to it. One is for the desktop file, and a couple of icon files (16x16, 32x32 xpm and a png file). Those are the biggest changes. It's very userfriendly for new users :]

See also

Personal tools