website view en/doc/cookbook/receipts.html @ rev 259
receipts: add tazwok generated variables
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Jan 25 11:45:39 2009 +0000 (2009-01-25) |
parents | 55fc4737abdd |
children | c4560318bd05 |
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="wok-tools.html">Wok & Tools.</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>$WANTED</code> : SliTaz packages normally depend on the compilation of
113 a source package. Sometimes the receipt of a package requires no compilation
114 of rules, then $WANTED is used to copy files from the source of another
115 package by using the variable $ src.
116 </p>
117 <p>
118 <code>$SOURCE</code> : It may be that the tazpkg package name differs from
119 the name of the source package. Example for Xorg packages, the name of tazpkg
120 library X11 is 'xorg-libX11' and the name of the package source is libX11.
121 $SOURCE allows you to use the variables $src and $_pkg during the cooking of
122 a package. It should be noted that in the case of libX11, the name of the
123 source archive becomes $SOURCE-$VERSION.tar.gz.
124 </p>
126 <h3>Variables used in functions</h3>
127 <p>
128 Tazwok configures several variables that facilitate the compilation and
129 construction of tazpkg packages. These variables are controlled automatically
130 by tazwok using the information contained in the receipt; they can be used
131 by the functions compile_rules and genpkg_rules described in the chapter
132 Functions.
133 </p>
134 <p>
135 <code>$src</code> : Defines the path to the directory of unarchived sources.
136 </p>
137 <p>
138 <code>$_pkg</code> : Defines the path to the compiled binaries installed via
139 'make DESTDIR=$PWD/_pkg install'. This variable is used to copy the generated
140 files and create tazpkg packages.
141 </p>
142 <p>
143 <code>$fs</code> : Defines the path to the pseudo filesystem (fs) in each
144 package. The 'fs' of the package corresponds to the root of the system, a bit
145 like Clex will for example be in $fs/usr/bin/clex. Note the need to create the
146 necessary directories via function genpkg_rules() before copying the files.
147 </p>
148 <p>
149 <code>$CONFIGURE_ARGS</code> : This variable is defined in the Tazwok
150 configuration file (tazwok.conf). It allows you to specify generic optimization
151 arguments during construction of a package. Default is the i486 architecture.
152 </p>
154 <h3>Functions</h3>
155 <p>
156 A receipt may contain 4 functions. Tazwok knows how to deal with functions
157 containing compilation rules (compile_rules) and rules used to generate a
158 package (genpkg_rules). These functions may contain all sorts of GNU/Linux
159 standard commands, such as sed, awk, patch and variables automatically
160 configured.
161 </p>
162 <h4>compile_rules()</h4>
163 <p>
164 To compile a package you can use the variable $src to move (cd) in the
165 directory of sources and use $CONFIGURE_ARGS to include arguments from the
166 tazwok configuration file. To build the package you usually launch 'make'
167 without any arguments, and to install the package into the directory _pkg,
168 it is necessary to use the command 'make DESTDIR=$PWD/_pkg install'. Generic
169 example:
170 </p>
171 <pre class="script">
172 # Rules to configure and make the package.
173 compile_rules()
174 {
175 cd $src
176 ./configure --prefix=/usr --infodir=/usr/share/info \
177 --mandir=/usr/share/man $CONFIGURE_ARGS
178 make
179 make DESTDIR=$PWD/_pkg install
180 }
181 </pre>
182 <h4>genpkg_rules()</h4>
183 <p>
184 To generate a tazkg package we must specify commands in the function
185 <code>genpkg_rules</code>. In this example we create a psuedo directory
186 <code>usr/</code> in the filesystem of the package, copy the whole
187 binary(s) and finally use strip to clean the files:
188 </p>
189 <pre class="script">
190 # Rules to gen a SliTaz package suitable for Tazpkg.
191 genpkg_rules()
192 {
193 mkdir -p $fs/usr
194 cp -a $_pkg/usr/bin $fs/usr
195 strip -s $fs/usr/bin/*
196 }
197 </pre>
198 <h4>pre_install() and post_install()</h4>
199 <p>
200 These 2 functions are initiated by tazpkg when installing the package. They
201 must be defined before generating the .tazpkg package with tazwok. If no rules
202 are given for these functions, they have no raison d'etre and can be removed.
203 Example using echo to display some text (no function should be empty):
204 </p>
205 <pre class="script">
206 # Pre and post install commands for Tazpkg.
207 pre_install()
208 {
209 echo "Processing pre-install commands..."
210 }
211 post_install()
212 {
213 echo "Processing post-install commands..."
214 }
215 </pre>
217 <!-- End of content -->
218 </div>
220 <!-- Footer. -->
221 <div id="footer">
222 <div class="footer-right"></div>
223 <a href="#top">Top of the page</a> |
224 <a href="index.html">Table of contents</a>
225 </div>
227 <div id="copy">
228 Copyright © 2008 <a href="http://www.slitaz.org/en/">SliTaz</a> -
229 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
230 Documentation is under
231 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
232 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
233 </div>
235 </body>
236 </html>