Table of Contents

Recipes

This document describes the opportunities offered by the recipes used by Cookutils to compile and generate packages for SliTaz and Tazpkg through the wok and tools. The recipe for a package is also used by Tazpkg to install/uninstall and provide information about a .tazpkg package. Each recipe begins with a comment in English:

# SliTaz package receipt 

Variables

The first 5 variables should always be present and defined. They respectively configure the package ($PACKAGE), its version, its category, provide a short description and the name of the maintainer. Example for the package, file manager Clex:

PACKAGE="clex"
VERSION="3.16"
CATEGORY="base-apps"
SHORT_DESC="Text mode file manager."
MAINTAINER="pankso@slitaz.org"

Variables (optional)

Cookutils also knows how to use various optional variables. It can, for example, use the name of another source package. There are also variables that are used by Tazpkg to manage dependencies or provide information about the package.

DEPENDS="ncurses"
BUILD_DEPENDS="ncurses-dev"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="http://www.clex.sk/"
WGET_URL="http://www.clex.sk/download/$TARBALL"
CONFIG_FILES="/etc/netatalk/AppleVolumes.* /etc/netatalk/*.conf"

You can also define virtual packages with this variable. The lines PROVIDE=“libgl” in the mesa package and PROVIDE=“libgl:nvidia” in the nvidia-glx package, define that libgl is an optimized version when the nvidia package is installed.

Variables generated by Cookutils

Certain factors are known only during the cooking of a package or after the package has been cooked. Cookutils will add them to the recipe automatically.

Variables used in functions

Cookutils configures several variables that facilitate the compilation and construction of Tazpkg packages. These variables are controlled automatically by cookutils using the information contained in the recipe; they can be used by the functions compile_rules and genpkg_rules described in the chapter Functions.

Functions

A recipe may contain 4 functions. Cookutils knows how to deal with functions containing compilation rules (compile_rules) and rules used to generate a package (genpkg_rules). These functions may contain all sorts of GNU/Linux standard commands, such as sed, awk, patch and variables automatically configured.

compile_rules()

To compile a package you can use the variable $src to move (cd) in the directory of sources and use $CONFIGURE_ARGS to include arguments from the Cookutils configuration file. To build the package you usually launch 'make' without any arguments, and to install the package into the directory $DESTDIR: it's necessary to use the command make DESTDIR=$DESTDIR install. Generic example:

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	./configure --prefix=/usr --infodir=/usr/share/info \
	--mandir=/usr/share/man $CONFIGURE_ARGS
	make
	make DESTDIR=$DESTDIR install (or simply make install)
}

genpkg_rules()

To generate a tazkg package we must specify commands in the function genpkg_rules. In this example we create a psuedo directory /usr in the filesystem of the package, copy the whole binary(s) and finally use strip to clean the files:

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr
	cp -a $install/usr/bin $fs/usr
	strip -s $fs/usr/bin/*
}

pre_install() and post_install()

These functions are initiated by Tazpkg when installing the package. They must be defined before generating the .tazpkg package with Cookutils. If no rules are given for these functions, they have no raison d'etre and can be removed. Example using echo to display some text (no function should be empty):

# Pre and post install commands for Tazpkg.
pre_install()
{
	echo "Processing pre-install commands..."
}
post_install()
{
	echo "Processing post-install commands..."
}

pre_remove() and post_remove()

These functions are initiated by Tazpkg when removing the package. They must be defined before generating the .tazpkg package with Cookutils. If no rules are given for these functions, they have no raison d'etre and can be removed. Example using echo to display some text (no function should be empty):

# Pre and post remove commands for Tazpkg.
pre_remove()
{
	echo "Processing pre-remove commands..."
}
post_remove()
{
	echo "Processing post-remove commands..."
}