How to make packages for Fatdog64

To make a binary package, first download the source code you want to compile and read any README or INSTALL text files for information on how to compile. Typically it goes like this:

./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --localstatedir=/var
The usual next step usually mentioned in package's README is "make install" but doing this will immediately install the application to your system, but does not package it in a format that you can re-use later (e.g. installing it in another machine).

Instead, what you want is to collect the files that would be installed, and turn these loose files into a package. There are a few ways of doing so.
  1. Traditional autoconf method, using make install DESTDIR=/tmp/xxx
  2. Traditional Puppy method, using new2dir
  3. Using paco -lp and paco2pkg
  4. Using Fatdog's sandbox
  5. Using Fatdog's native pkgbuild system

The FAQ will only discuss the first three. The other two will only be discussed briefly.

1. Using make install with DESTDIR

This is a method which is usually supported by many applications that are configured using GNU autoconf method.

Instead of running "make install", you run "make install DESTDIR=/tmp/xxx".

Adding "DESTDIR=/tmp/xxx" to "make install" simply tells the build system to install the files as usual to "/tmp/xxx" location instead of the usual root "/" location. Thus, for example, a file that will usually be installed to /usr/bin/myprogram will instead be installed to /tmp/xxx/usr/bin/myprogram.

The end result - all the program installed files will be collected under "/tmp/xxx".

Once you have done this, it is a simple matter to "cd" to that directory ("cd /tmp/xxx"), and then run makepkg in it, like this:
cd /tmp/xxx
makepkg -c n -l n /path/to/where/you/want/to/keep/the/package-version-x86_64-1.txz

If you want to get fancy, you can add descriptions to your program by adding a slack-desc file, which can be generated by the slackdesc program. It can be done this way:
cd /tmp/xxx
slackdesc "package" "version" "summary" "long description" "URL source"
makepkg -c n -l n /path/to/where/you/want/to/keep/the/package-version-x86_64-1.txz
The package name and the version you specify in slackdesc must match exactly with the name that you will give to your package in makepkg.

The downside of this approach is that not all packages supports the DESTDIR method, and some that claim they do, sometimes behave weirdly if you install them using DESTDIR.

2. Using new2dir

The traditional Puppy method to collect files to be installed is to use new2dir make install (instead of just "make install"). Once you have run this, two things will happen:
  1. The program will be installed as usual
  2. The files that are installed are also copied to a directory usually called ../<app name>-x86_64.
After new2dir has finished, you can cd to the directory and run makepkg as described earlier (with slackdesc if you wish).
cd <app name>-x86_64
makepkg -c n -l n /path/to/where/you/want/to/keep/the/package-version-x86_64-1.txz

The method has the benefit that it will work with larger number of applications; and it will not have the oddities that DESTDIR sometimes does. But this method is not fool-proof - some installed files may not be captured by new2dir. This is rare, but usually happens for e.g. python programs.

This method has the disadvantage that the program you are trying to package is actually installed to your system.

3. Using paco -lp and paco2pkg

paco is program to perform installation file capture, just like new2dir. (The website for paco used to be here, but unfortunately when the author of paco deprecated paco in favour of a new program called "porg" that is identical in purpose to paco, he also took down the website. With very minor changes, however, information for porg is also applicable for paco).

To use paco, you run "paco -lp package-version -- make install" instead of just "make install".

After paco finishes, the package will be installed as normal but paco will keep a record of what files have been installed. The next step is to ensure you have a directory called "/archive/repo" as the output of the package will be stored there; then you just need to run "paco2pkg package-version" which will create the "/archive/repo/package-version-x86_64-1paco.txz" - ready for use.

Using paco has the benefit that it works with even more packages (even for programs where new2dir traditionally fails), and even though you still have to install the program when you try to package it, paco has the ability to uninstall the package that it installed using paco -lp (use "paco -r package-version" command). Of course, uninstall this after you create the package, not before.

paco is a very versatile tool. It has a lot more features that can be covered here. For example, it can create pacoballs (using the pacoball command) which is a complete package on its own; pacoballs can be installed or uninstalled. Paco can actually function as a full-fledged package manager on by itself (and at one point, I did consider to use paco instead of slackware-style packages).

4. Using Fatdog sandbox

The idea is to build the packages using Fatdog sandbox, and the install as usual (with "make install"). When you are done, use "" to extract the modified files to a directory; and then you just run "makepkg" from within this directory. Obviously clear the unneeded files first (the source tarball, etc).

5. Using Fatdog native pkgbuild system.

Fatdog's pkgbuild system expands on the idea of using Fatdog sandbox to build and capture installed packages, and doing it automatically. This is called "native" as Fatdog all Fatdog base packages are built using this system.

The system is "recipe" driven, you need to give the pkgbuild system a "recipe" on how to build the package (a recipe is just a list of commands that you usually use to build a package, e.g. the "configure" and "make" and "make install" stuff). The build system will then executes the recipe (building the package as it goes), and automatically collect the files, strip them (see below), and package the result into a nice Fatdog package at the end of it. As a bonus, your recipe is also included in the package so you can always rebuild the package again, in exactly the same manner, in the future.

Fatdog pkgbuild system is located in /usr/src/pkgbuild. It comes with samples. Put your own recipe in localpkg directory. The "pkg" directory contains the recipes used to create all Fatdog packages.


Whatever your chosen packaging method is, it is a good idea to strip all of the binaries and any libraries to make them smaller. To do that you cd to the folder that contains any binaries or libraries and do:

strip --strip-unneeded *

before you run makepkg. This will make them smaller. You can also delete any thing else that is not needed (e.g. locale directories if you're going for English-only package, templates, documentations, etc).