website annotate en/doc/cookbook/receipts.html @ rev 547

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