Build your own

Every SliTaz package and image is built from plain shell recipes, with tools installed on SliTaz itself. This chapter gives the first steps; the tool manuals have the details, and the developer pages of the website explain how the project works: the wok, the build host, Mercurial and how to contribute.

Packages with cookutils

Cookutils builds packages from receipts kept in the wok, /home/slitaz/wok. It is on SliTaz Core and Firefox x86_64; elsewhere install it:

# spk-add cookutils
# grep ^ARCH /etc/slitaz/cook.conf    # must match your system
# cook setup                 # directories and build tools
# cook setup --wok           # also clone the official wok (needs mercurial)
# cook new mypkg             # new receipt in /home/slitaz/wok/mypkg/
# nano /home/slitaz/wok/mypkg/receipt
# cook mypkg
# spk-add /home/slitaz/packages/mypkg-1.0-x86_64.tazpkg

On x86_64, check that ARCH="x86_64" is set in /etc/slitaz/cook.conf: the 5.1 package ships i486 there. The build log is /home/slitaz/log/mypkg.log. cook doctor checks the build environment and cook-tui is a text-mode front-end. Settings are in /etc/slitaz/cook.conf. On a running system, cook works in a throw-away layer on top of the system: build dependencies installed for the cook are gone when it ends, and nothing is installed on the system until you do it.

The receipt

A receipt is a shell file with a few variables and functions:

# SliTaz package receipt.

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"

DEPENDS=""
BUILD_DEPENDS=""

compile_rules()
{
	./configure --prefix=/usr &&
	make && make DESTDIR=$DESTDIR install
}

genpkg_rules()
{
	mkdir -p $fs/usr
	cp -a $install/usr/bin $fs/usr
}

compile_rules builds and installs into $install, genpkg_rules copies what belongs to the package into $fs. The Cookutils manual describes all variables, the receipt v2 format with split packages, and cooker, the build bot.

Building in a chroot

To build in a clean system that does not depend on what is installed on yours, use a chroot. tazdev creates and enters one:

# spk-add slitaz-dev-tools
# tazdev gen-chroot --arch=x86_64 \
	--mirror=https://mirror.slitaz.org/x86_64/cooking/packages/
# tazdev chroot --arch=x86_64

Leaving the chroot shell unmounts it. For i486, use --arch=i486 and the i486 mirror. To build SliTaz packages from another GNU/Linux distribution, use tazlab (spk-add tazlab on SliTaz).

Live images with tazlito

A flavor describes an image: a package list, files added to the root file system and to the CD, and a receipt. The official flavors are in the flavors repository. To build an i486 image from a flavor with tazlito, on an i486 system or chroot:

# spk-add mercurial
# mkdir -p /home/slitaz/$(cat /etc/slitaz-release)
# cd /home/slitaz/$(cat /etc/slitaz-release)
# hg clone https://hg.slitaz.org/flavors
# tazlito pack-flavor core
# tazlito get-flavor core
# tazlito gen-distro

Edit the flavor (packages.list, rootfs/) before packing it to make your own. tazlito gen-iso rebuilds the image after changing the tree in distro/, and tazlito clean-distro removes it. See the Tazlito manual.

Tazlito builds the official i486 images. The x86_64 hybrid BIOS and UEFI images are built with a newer tool, metier, not packaged yet.

Remaster a live system

From an i486 live system you have customized (packages, settings, files in /home), tazlito can write a new image of it:

# tazlito writeiso lzma my-slitaz

The kernel and boot files are taken from the live media, which must be mounted on /media/cdrom.