website diff en/doc/cookbook/receipts.html @ rev 21
Add the first 2 page to the English Cookbook (Thanks Paul!)
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Apr 12 03:04:41 2008 +0200 (2008-04-12) |
parents | |
children | 55fc4737abdd |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/en/doc/cookbook/receipts.html Sat Apr 12 03:04:41 2008 +0200 1.3 @@ -0,0 +1,236 @@ 1.4 +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 1.5 + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 1.6 +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 1.7 +<head> 1.8 + <title>SliTaz Cookbook (en) - Receipts</title> 1.9 + <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" /> 1.10 + <meta name="description" content="slitaz English cookbook" /> 1.11 + <meta name="expires" content="never" /> 1.12 + <meta name="modified" content="2008-02-26 18:30:00" /> 1.13 + <meta name="publisher" content="www.slitaz.org" /> 1.14 + <meta name="author" content="Christophe Lincoln"/> 1.15 + <link rel="shortcut icon" href="favicon.ico" /> 1.16 + <link rel="stylesheet" type="text/css" href="book.css" /> 1.17 +</head> 1.18 +<body bgcolor="#ffffff"> 1.19 + 1.20 +<!-- Header and quick navigation --> 1.21 +<div id="header"> 1.22 +<div align="right" id="quicknav"> 1.23 + <a name="top"></a> 1.24 + <a href="wok-tools.html">Wok & Tools.</a> | 1.25 + <a href="index.html">Table of contents</a> 1.26 +</div> 1.27 +<h1><font color="#3E1220">SliTaz Cookbook (en)</font></h1> 1.28 +</div> 1.29 + 1.30 +<!-- Content. --> 1.31 +<div id="content"> 1.32 +<div class="content-right"></div> 1.33 + 1.34 + 1.35 +<h2><font color="#df8f06">Receipts</font></h2> 1.36 + 1.37 +<p> 1.38 +This document describes the opportunities offered by the receipt used by 1.39 +Tazwok to compile and generate packages for SliTaz and tazpkg through 1.40 +<a href="wok-tools.html">The wok and tools</a>. The receipt for a package is 1.41 +also used by tazpkg to install/uninstall and provide information about a 1.42 +.tazpkg package. Each receipt begins with a comment in English: 1.43 +</p> 1.44 +<pre class="script"> 1.45 +# SliTaz package receipt. 1.46 +</pre> 1.47 + 1.48 +<h3>Variables</h3> 1.49 +<p> 1.50 +The first 5 variables should always be present and defined. They respectively 1.51 +configure the package ($PACKAGE), it's version, it's category, a short 1.52 +description and the name of the maintainer. Example for the package, file 1.53 +manager Clex: 1.54 +</p> 1.55 +<pre class="script"> 1.56 +PACKAGE="clex" 1.57 +VERSION="3.16" 1.58 +CATEGORY="base-apps" 1.59 +SHORT_DESC="Text mode file manager." 1.60 +MAINTAINER="pankso@slitaz.org" 1.61 +</pre> 1.62 + 1.63 +<h3>Variables (optional)</h3> 1.64 +<p> 1.65 +Tazwok also knows how to use various optional variables, it can for example 1.66 +use the name of another source package. There are also variables that are 1.67 +used by tazpkg to manage dependencies or provide information about the package. 1.68 +</p> 1.69 +<p> 1.70 +<code>$DEPENDS</code>: Set dependencies, there may be several dependencies 1.71 +seperated by a space or on several lines. This variable is used mainly by 1.72 +tazpkg when installing the package and tazwok to build large packages such 1.73 +as Xorg. Example for Clex which depends on ncurses: 1.74 +</p> 1.75 +<pre class="script"> 1.76 +DEPENDS="ncurses" 1.77 +</pre> 1.78 +<p> 1.79 +<code>$BUILD_DEPENDS</code>: Set compilation dependencies, again seperated 1.80 +by a space or several lines. This variable is used by tazwok during the 1.81 +cooking of a package. Example: 1.82 +</p> 1.83 +<pre class="script"> 1.84 +BUILD_DEPENDS="ncurses-dev" 1.85 +</pre> 1.86 +<p> 1.87 +<code>$TARBALL</code> : The archive is a source with the extension (tar.gz, 1.88 +tgz or tar.bz2). In general, the variables $PACKAGE and $VERSION are used to 1.89 +just change the extension, it helps to upgrade the package without changing 1.90 +the $VERSION variable. Generic example (see also $SOURCE example): 1.91 +</p> 1.92 +<pre class="script"> 1.93 +TARBALL="$PACKAGE-$VERSION.tar.gz" 1.94 +</pre> 1.95 +<p> 1.96 +<code>$WEB_SITE</code> : The official website of the package. It may be that 1.97 +some libraries have no website, in this case, there is no need to specify a 1.98 +URL. Note tazwok and tazpkg both expect to find a URL with the complete HTTP: 1.99 +</p> 1.100 +<pre class="script"> 1.101 +WEB_SITE="http://www.clex.sk/" 1.102 +</pre> 1.103 +<p> 1.104 +<code>$WGET_URL</code> : URL to download the source file. In general the 1.105 +variable $TARBALL should be used to facilitate the updating of the package 1.106 +without changing the $VERSION. Using a configuration file, tazwok also 1.107 +configures by default 3 mirrors: $GNU_MIRROR for the GNU mirror, $SF_MIRROR 1.108 +for SourceForge and XORG_MIRROR for mirroring the graphical server Xorg. 1.109 +Example for Clex: 1.110 +</p> 1.111 +<pre class="script"> 1.112 +WGET_URL="http://www.clex.sk/download/$TARBALL" 1.113 +</pre> 1.114 +<p> 1.115 +<code>$WANTED</code> : SliTaz packages normally depend on the compilation of 1.116 +a source package. Sometimes the receipt of a package requires no compilation 1.117 +of rules, then $WANTED is used to copy files from the source of another 1.118 +package by using the variable $ src. 1.119 +</p> 1.120 +<p> 1.121 +<code>$SOURCE</code> : It may be that the tazpkg package name differs from 1.122 +the name of the source package. Example for Xorg packages, the name of tazpkg 1.123 +library X11 is 'xorg-libX11' and the name of the package source is libX11. 1.124 +$SOURCE allows you to use the variables $src and $_pkg during the cooking of 1.125 +a package. It should be noted that in the case of libX11, the name of the 1.126 +source archive becomes $SOURCE-$VERSION.tar.gz. 1.127 +</p> 1.128 + 1.129 +<h3>Variables used in functions</h3> 1.130 +<p> 1.131 +Tazwok configures several variables that facilitate the compilation and 1.132 +construction of tazpkg packages. These variables are controlled automatically 1.133 +by tazwok using the information contained in the receipt; they can be used 1.134 +by the functions compile_rules and genpkg_rules described in the chapter 1.135 +Functions. 1.136 +</p> 1.137 +<p> 1.138 +<code>$src</code> : Defines the path to the directory of unarchived sources. 1.139 +</p> 1.140 +<p> 1.141 +<code>$_pkg</code> : Defines the path to the binary compiles installed via 1.142 +'make DESTDIR=$PWD/_pkg install'. This variable is used to copy the generated 1.143 +files and create tazpkg packages. 1.144 +</p> 1.145 +<p> 1.146 +<code>$fs</code> : Defines the path to the pseudo filesystem (fs) in each 1.147 +package. The 'fs' of the package corresponds to the root of the system, a bit 1.148 +like Clex will for example in $fs/usr/bin/clex, note the need to create the 1.149 +necessary directories via function genpkg_rules() before copying the files. 1.150 +</p> 1.151 +<p> 1.152 +<code>$CONFIGURE_ARGS</code> : This variable is defined in the Tazwok 1.153 +configuration file (tazwok.conf), it allows you to specify generic optimization 1.154 +arguments during construction of a package. Default is the i486 architecture. 1.155 +</p> 1.156 + 1.157 +<h3>Functions</h3> 1.158 +<p> 1.159 +A receipt may contain 4 functions. Tazwok knows how to deal with functions 1.160 +containing compilation rules (compile_rules) and rules used to generate a 1.161 +package (genpkg_rules). These functions may contain all sorts of GNU/Linux 1.162 +standard commands, such as sed, awk, patch and variables automatically 1.163 +configured. 1.164 +</p> 1.165 +<h4>compile_rules()</h4> 1.166 +<p> 1.167 +To compile a package you can use the variable $src to move (cd) in the 1.168 +directory of sources and use $CONFIGURE_ARGS to include arguments from the 1.169 +tazwok configuration file. To build the package you usually launch 'make' 1.170 +without any arguments and to install the package into the directory _pkg, 1.171 +it is necessary to use the command 'make DESTDIR=$PWD/_pkg install'. Generic 1.172 +example: 1.173 +</p> 1.174 +<pre class="script"> 1.175 +# Rules to configure and make the package. 1.176 +compile_rules() 1.177 +{ 1.178 + cd $src 1.179 + ./configure --prefix=/usr --infodir=/usr/share/info \ 1.180 + --mandir=/usr/share/man $CONFIGURE_ARGS 1.181 + make 1.182 + make DESTDIR=$PWD/_pkg install 1.183 +} 1.184 +</pre> 1.185 +<h4>genpkg_rules()</h4> 1.186 +<p> 1.187 +To generate a tazkg package we must specify commands in the function 1.188 +<code>genpkg_rules</code>. In this example we create a psuedo directory 1.189 +<code>usr/</code> in the filesystem of the package, copy the whole 1.190 +binary(s) and finally use strip to clean the files: 1.191 +</p> 1.192 +<pre class="script"> 1.193 +# Rules to gen a SliTaz package suitable for Tazpkg. 1.194 +genpkg_rules() 1.195 +{ 1.196 + mkdir -p $fs/usr 1.197 + cp -a $_pkg/usr/bin $fs/usr 1.198 + strip -s $fs/usr/bin/* 1.199 +} 1.200 +</pre> 1.201 +<h4>pre_install() and post_install()</h4> 1.202 +<p> 1.203 +These 2 functions are initiated by tazpkg when installing the package. They 1.204 +must be defined before generating the .tazpkg package with tazwok. If no rules 1.205 +are given for these functions, they have no raison d'etre and can be removed. 1.206 +Example using echo to display some text (no function should be empty). 1.207 +</p> 1.208 +<pre class="script"> 1.209 +# Pre and post install commands for Tazpkg. 1.210 +pre_install() 1.211 +{ 1.212 + echo "Processing pre-install commands..." 1.213 +} 1.214 +post_install() 1.215 +{ 1.216 + echo "Processing post-install commands..." 1.217 +} 1.218 +</pre> 1.219 + 1.220 +<!-- End of content --> 1.221 +</div> 1.222 + 1.223 +<!-- Footer. --> 1.224 +<div id="footer"> 1.225 + <div class="footer-right"></div> 1.226 + <a href="#top">Top of the page</a> | 1.227 + <a href="index.html">Table of contents</a> 1.228 +</div> 1.229 + 1.230 +<div id="copy"> 1.231 + Copyright © 2008 <a href="http://www.slitaz.org/en/">SliTaz</a> - 1.232 + <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br /> 1.233 + Documentation is under 1.234 + <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a> 1.235 + and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>. 1.236 +</div> 1.237 + 1.238 +</body> 1.239 +</html>