website view en/doc/cookbook/receipts.html @ rev 342

en/cookbook: Add Build host info and howto
author Christophe Lincoln <pankso@slitaz.org>
date Sat Mar 28 01:15:01 2009 +0100 (2009-03-28)
parents 36cbe8e18d75
children 899738fd03f9
line source
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4 <head>
5 <title>SliTaz Cookbook (en) - Receipts</title>
6 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
7 <meta name="description" content="slitaz English cookbook" />
8 <meta name="expires" content="never" />
9 <meta name="modified" content="2008-07-16 21:45:00" />
10 <meta name="publisher" content="www.slitaz.org" />
11 <meta name="author" content="Christophe Lincoln"/>
12 <link rel="shortcut icon" href="favicon.ico" />
13 <link rel="stylesheet" type="text/css" href="book.css" />
14 </head>
15 <body bgcolor="#ffffff">
17 <!-- Header and quick navigation -->
18 <div id="header">
19 <div align="right" id="quicknav">
20 <a name="top"></a>
21 <a href="build-host.html">Build Host</a> |
22 <a href="index.html">Table of contents</a>
23 </div>
24 <h1><font color="#3E1220">SliTaz Cookbook (en)</font></h1>
25 </div>
27 <!-- Content. -->
28 <div id="content">
29 <div class="content-right"></div>
32 <h2><font color="#df8f06">Receipts</font></h2>
34 <p>
35 This document describes the opportunities offered by the receipt used by
36 Tazwok to compile and generate packages for SliTaz and Tazpkg through
37 <a href="wok-tools.html">The wok and tools</a>. The receipt for a package is
38 also used by Tazpkg to install/uninstall and provide information about a
39 .tazpkg package. Each receipt begins with a comment in English:
40 </p>
41 <pre class="script">
42 # SliTaz package receipt.
43 </pre>
45 <h3>Variables</h3>
46 <p>
47 The first 5 variables should always be present and defined. They respectively
48 configure the package ($PACKAGE), its version, its category, provide a short
49 description and the name of the maintainer. Example for the package, file
50 manager Clex:
51 </p>
52 <pre class="script">
53 PACKAGE="clex"
54 VERSION="3.16"
55 CATEGORY="base-apps"
56 SHORT_DESC="Text mode file manager."
57 MAINTAINER="pankso@slitaz.org"
58 </pre>
60 <h3>Variables (optional)</h3>
61 <p>
62 Tazwok also knows how to use various optional variables. It can, for example,
63 use the name of another source package. There are also variables that are
64 used by Tazpkg to manage dependencies or provide information about the package.
65 </p>
66 <p>
67 <code>$DEPENDS</code>: Set dependencies, there may be several dependencies
68 seperated by a space or on several lines. This variable is used mainly by
69 Tazpkg when installing the package and Tazwok to build large packages such
70 as Xorg. Example for Clex which depends on ncurses:
71 </p>
72 <pre class="script">
73 DEPENDS="ncurses"
74 </pre>
75 <p>
76 <code>$BUILD_DEPENDS</code>: Set compilation dependencies, again seperated
77 by a space or several lines. This variable is used by Tazwok during the
78 cooking of a package. Example:
79 </p>
80 <pre class="script">
81 BUILD_DEPENDS="ncurses-dev"
82 </pre>
83 <p>
84 <code>$TARBALL</code> : The archive is a source with the extension (tar.gz,
85 tgz or tar.bz2). In general, the variables $PACKAGE and $VERSION are used to
86 just change the extension, it helps to upgrade the package without changing
87 the $VERSION variable. Generic example (see also $SOURCE example):
88 </p>
89 <pre class="script">
90 TARBALL="$PACKAGE-$VERSION.tar.gz"
91 </pre>
92 <p>
93 <code>$WEB_SITE</code> : The official website of the package. It may be that
94 some libraries have no website, in this case, there is no need to specify a
95 URL. Note Tazwok and Tazpkg both expect to find a URL with the complete HTTP:
96 </p>
97 <pre class="script">
98 WEB_SITE="http://www.clex.sk/"
99 </pre>
100 <p>
101 <code>$WGET_URL</code> : URL to download the source file. In general the
102 variable $TARBALL should be used to facilitate the updating of the package
103 without changing the $VERSION. Using a configuration file, Tazwok also
104 configures by default 3 mirrors: $GNU_MIRROR for the GNU mirror, $SF_MIRROR
105 for SourceForge and XORG_MIRROR for mirroring the graphical server Xorg.
106 Example for Clex:
107 </p>
108 <pre class="script">
109 WGET_URL="http://www.clex.sk/download/$TARBALL"
110 </pre>
111 <p>
112 <code>$CONFIG_FILES</code> : Some packages provide customized
113 configuration files. The $CONFIG_FILES variable provides a list of these
114 files that can be saved by the 'tazpkg repack-config' command.
115 These files are not overwritten when reinstalling the package if they already
116 exist and the package can be successfully recreated with 'tazpkg repack',
117 (even if they have been modified since). Netatalk for example:
118 </p>
119 <pre class="script"> CONFIG_FILES="/etc/netatalk/AppleVolumes.* /etc/netatalk/*.conf"
120 </pre>
121 <p>
122 <code>$SUGGESTED</code> : Lists useful packages without being essential.
123 Also used to activate optional features.
124 </p>
125 <p>
126 <code>$WANTED</code> : SliTaz packages normally depend on the compilation of
127 a source package. Sometimes the receipt of a package requires no compilation
128 of rules, then $WANTED is used to copy files from the source of another
129 package by using the variable $ src.
130 </p>
131 <p>
132 <code>$SOURCE</code> : It may be that the Tazpkg package name differs from
133 the name of the source package. Example for Xorg packages, the name of Tazpkg
134 library X11 is 'xorg-libX11' and the name of the package source is libX11.
135 $SOURCE allows you to use the variables $src and $_pkg during the cooking of
136 a package. It should be noted that in the case of libX11, the name of the
137 source archive becomes $SOURCE-$VERSION.tar.gz.
138 </p>
139 <p>
140 <code>$PROVIDE</code> : Some packages offer the same functionality, for
141 instance the web server was at first lighttpd, now apache is available.
142 All packages dependent on a web server refer to lighttpd.
143 The <code>$PROVIDE="apache"</code> variable in the apache receipt says
144 that packages dependent on lighttpd do not need to install the lighttpd
145 package if apache is already on the system. Some packages may vary according
146 to the webserver you choose, ie. the php package is dependent on lighttpd,
147 as is php-apache on apache. The <code>PROVIDE="php:apache"</code> in the
148 apache receipt says that you must install php-apache instead of php, if
149 apache is already on the system. Therefore each package dependent on php
150 will install either php-apache or php according to the webserver on the
151 system. This variable also chooses packages compiled with different options.
152 The <code>PROVIDE="epdfview:cups"</code> in the epdfview-cups receipt allows
153 you to install epdfview with printer support via cups if cups is already on
154 the system.
155 </p>
156 <p>
157 You can also define virtual packages with this variable.
158 The lines <code>PROVIDE="libgl"</code> in the mesa package and
159 <code>PROVIDE="libgl:nvidia"</code> in the nvidia-glx package, define that
160 libgl is an optimized version when the nvidia package is installed.
161 </p>
163 <h3>Variables automatically generated by Tazwok</h3>
164 <p>
165 Certain factors are known only during the cooking of
166 a package or after the package has been cooked. Tazwok
167 will add them to the receipt automatically.
168 </p>
169 <p>
170 <code>$PACKED_SIZE</code> : Tazpkg file size.
171 </p>
172 <p>
173 <code>$UNPACKED_SIZE</code> : Space taken up by the package after
174 installation.
175 </p>
176 <p>
177 <code>$EXTRAVERSION</code> : Some packages have 2 different versions.
178 This is in case of modules added to the Linux kernel, such as squashfs,
179 because the module depends on the version of the kernel with which it was
180 compiled. In this case $EXTRAVERSION contains the kernel version and Tazwok
181 determines the module from the contents of /lib/modules.
182 </p>
184 <h3>Variables used in functions</h3>
185 <p>
186 Tazwok configures several variables that facilitate the compilation and
187 construction of Tazpkg packages. These variables are controlled automatically
188 by Tazwok using the information contained in the receipt; they can be used
189 by the functions compile_rules and genpkg_rules described in the chapter
190 Functions.
191 </p>
192 <p>
193 <code>$src</code> : Defines the path to the directory of unarchived sources.
194 </p>
195 <p>
196 <code>$_pkg</code> : Defines the path to the compiled binaries installed via
197 'make DESTDIR=$PWD/_pkg install'. This variable is used to copy the generated
198 files and create Tazpkg packages.
199 </p>
200 <p>
201 <code>$fs</code> : Defines the path to the pseudo filesystem (fs) in each
202 package. The 'fs' of the package corresponds to the root of the system, a bit
203 like Clex will for example be in $fs/usr/bin/clex. Note the need to create the
204 necessary directories via function genpkg_rules() before copying the files.
205 </p>
206 <p>
207 <code>$CONFIGURE_ARGS</code> : This variable is defined in the Tazwok
208 configuration file (tazwok.conf). It allows you to specify generic optimization
209 arguments during construction of a package. Default is the i486 architecture.
210 </p>
212 <h3>Functions</h3>
213 <p>
214 A receipt may contain 4 functions. Tazwok knows how to deal with functions
215 containing compilation rules (compile_rules) and rules used to generate a
216 package (genpkg_rules). These functions may contain all sorts of GNU/Linux
217 standard commands, such as sed, awk, patch and variables automatically
218 configured.
219 </p>
220 <h4>compile_rules()</h4>
221 <p>
222 To compile a package you can use the variable $src to move (cd) in the
223 directory of sources and use $CONFIGURE_ARGS to include arguments from the
224 Tazwok configuration file. To build the package you usually launch 'make'
225 without any arguments, and to install the package into the directory _pkg,
226 it is necessary to use the command 'make DESTDIR=$PWD/_pkg install'. Generic
227 example:
228 </p>
229 <pre class="script">
230 # Rules to configure and make the package.
231 compile_rules()
232 {
233 cd $src
234 ./configure --prefix=/usr --infodir=/usr/share/info \
235 --mandir=/usr/share/man $CONFIGURE_ARGS
236 make
237 make DESTDIR=$PWD/_pkg install
238 }
239 </pre>
240 <h4>genpkg_rules()</h4>
241 <p>
242 To generate a tazkg package we must specify commands in the function
243 <code>genpkg_rules</code>. In this example we create a psuedo directory
244 <code>usr/</code> in the filesystem of the package, copy the whole
245 binary(s) and finally use strip to clean the files:
246 </p>
247 <pre class="script">
248 # Rules to gen a SliTaz package suitable for Tazpkg.
249 genpkg_rules()
250 {
251 mkdir -p $fs/usr
252 cp -a $_pkg/usr/bin $fs/usr
253 strip -s $fs/usr/bin/*
254 }
255 </pre>
256 <h4>pre_install() and post_install()</h4>
257 <p>
258 These 2 functions are initiated by Tazpkg when installing the package. They
259 must be defined before generating the .tazpkg package with Tazwok. If no rules
260 are given for these functions, they have no raison d'etre and can be removed.
261 Example using echo to display some text (no function should be empty):
262 </p>
263 <pre class="script">
264 # Pre and post install commands for Tazpkg.
265 pre_install()
266 {
267 echo "Processing pre-install commands..."
268 }
269 post_install()
270 {
271 echo "Processing post-install commands..."
272 }
273 </pre>
274 <h4>clean_wok()</h4>
275 <p>
276 This function helps to define additional commands to be run when cleaning the wok,
277 it is useful to delete files or directories that are not supported by Tazwok.
278 </p>
279 <pre class="script"># clean commands for Tazwok.
280 clean_wok()
281 {
282 rm -rf $WOK/$PACKAGE/vim71
283 }
284 </pre>
286 <!-- End of content -->
287 </div>
289 <!-- Footer. -->
290 <div id="footer">
291 <div class="footer-right"></div>
292 <a href="#top">Top of the page</a> |
293 <a href="index.html">Table of contents</a>
294 </div>
296 <div id="copy">
297 Copyright &copy; 2008 <a href="http://www.slitaz.org/en/">SliTaz</a> -
298 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
299 Documentation is under
300 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
301 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
302 </div>
304 </body>
305 </html>