Revision 2 of 2026-11-25 18:54 UTC by tux, the current one. Current version - History

Receipt SliTaz 5.1

A SliTaz package is built by cook from a receipt: a small shell file that says where the source is, how to compile it and which files go into the package. This page takes a first receipt from the empty template to an installed package, with the habits of the wok. The reference is the Cookutils manual and its page on receipts v2; the Handbook shows the first commands in Build your own.

Before you start

As root, install cookutils and prepare /home/slitaz:

# spk-add cookutils
# cook setup

On x86_64, check that /etc/slitaz/cook.conf says ARCH="x86_64" (see the Handbook). cook setup makes an empty wok, enough for your own packages. To work on official packages, or to read hundreds of real receipts, clone the cooking wok instead (needs mercurial):

# cook setup --wok

A package in the wok

Each package is a directory of /home/slitaz/wok:

cook adds, while it works:

After a good cook only taz/ stays (KEEP_BUILD_TREE="yes" in cook.conf keeps the others). The source tarball goes to /home/slitaz/src, the package to /home/slitaz/packages, the log to /home/slitaz/log/<package>.log.

A first receipt

cook new makes the directory and an empty receipt:

# cook new hello

/home/slitaz/wok/hello/receipt is a v2 receipt:

# SliTaz package receipt v2.

PACKAGE="hello"
VERSION=""
CATEGORY=""
SHORT_DESC=""
MAINTAINER=""
LICENSE=""
WEB_SITE=""

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="$TARBALL"

BUILD_DEPENDS=""

# Rules to configure and make the package.
compile_rules()
{
	./configure $CONFIGURE_ARGS && make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	copy @std @dev
	DEPENDS=""
}

cook new hello --interactive asks for the fields one by one. Filled in for GNU Hello:

# SliTaz package receipt v2.

PACKAGE="hello"
VERSION="2.12"
CATEGORY="misc"
SHORT_DESC="The GNU Hello program."
MAINTAINER="you@example.org"
LICENSE="GPL3"
WEB_SITE="https://www.gnu.org/software/hello/"

TARBALL="$PACKAGE-$VERSION.tar.gz"
WGET_URL="https://ftp.gnu.org/gnu/$PACKAGE/$TARBALL"

BUILD_DEPENDS=""

# Rules to configure and make the package.
compile_rules()
{
	./configure --prefix=/usr $CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	copy @std
	DEPENDS=""
}

What to know about it:

Every other variable (PROVIDE, CONFIG_FILES, SUGGESTED, TAGS, COOKOPTS...) and every helper function is in the Cookutils manual. For a package built on i486 and x86_64, or only one of them, see Multi-arch.

Cook it

Check the syntax first: a receipt is a shell script.

# sh -n /home/slitaz/wok/hello/receipt
# cook hello --getsrc
# cook hello

--getsrc only downloads the source: a quick check of WGET_URL. The cook itself downloads the source if needed, installs the build dependencies in a throw-away layer, compiles, strips the binaries and packs. When the receipt has no checksum, the cook prints a TARBALL_SHA256="..." line: paste it into the receipt, and the next cooks check the tarball. Then, as root:

# spk-add /home/slitaz/packages/hello-2.12-x86_64.tazpkg
$ hello
Hello, world!

On i486 the file is hello-2.12.tazpkg. cook never installs what it builds: that is your call, and your test.

When it fails

Read the end of the log, not the first error you see:

# tail -40 /home/slitaz/log/hello.log

The "Debug information" block at the end tells the step that broke: compile_rules, or genpkg_rules when the files were not where the receipt looked for them. Then:

The usual causes:

Habits of the wok

Share it

When the package builds and works, post the receipt on the forum for review. A developer pushes it to the wok; the build host then cooks it on both architectures and publishes it on the mirror. See Contribute to SliTaz.