Table of Contents

处方

Tazwok 会根据处方编译生成Slitaz专用的安装包(.tazpkg). Tazpkg 也需要根据安装包里的处方(receipt)安装tazpkg包,或根据/var/lib/tazpkg/installed/XX下的处方(receipt)来卸载已安装的包.

每个处方都必须以这个注释开头:

# SliTaz package receipt 

变量

有五个变量必须包含并定义. 以以下内容为例

PACKAGE="clex"                       #包名称
VERSION="3.16"                       #版本号
CATEGORY="base-apps"                 #分类
SHORT_DESC="Text mode file manager." #简短的说明
MAINTAINER="pankso@slitaz.org"       #包维护者

变量 (可选)

以下变量是可选的.

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.

变量 (由Tazwok自动生成)

以下变量无需人工定义..Tazwok会在执行时自动身成..

Variables used in functions

Tazwok configures several variables that facilitate the compilation and construction of Tazpkg packages. These variables are controlled automatically by Tazwok 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. Tazwok 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 Tazwok configuration file. To build the package you usually launch 'make' without any arguments, and to install the package into the directory _pkg: it's necessary to use the command 'make DESTDIR=$PWD/_pkg 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=$PWD/_pkg 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 $_pkg/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 Tazwok. 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 Tazwok. 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..."
}

clean_wok()

This function helps to define additional commands to be run when cleaning the wok, it is useful to delete files or directories that are not supported by Tazwok:

# clean commands for Tazwok.
clean_wok()
{
	rm -rf $WOK/$PACKAGE/vim71
}