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

en: Tidyup updates & add new review
author Paul Issott <paul@slitaz.org>
date Fri Jun 27 23:34:05 2008 +0000 (2008-06-27)
parents ec780b182951
children 9e30e64c8198
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" />
pankso@21 9 <meta name="modified" content="2008-02-26 18:30: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@21 21 <a href="wok-tools.html">Wok &amp; Tools.</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
pankso@21 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
pankso@21 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
pankso@21 48 configure the package ($PACKAGE), it's version, it's category, 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>
pankso@21 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
pankso@21 64 used by tazpkg to manage dependencies or provide information about the package.
pankso@21 65 </p>
pankso@21 66 <p>
pankso@21 67 <code>$DEPENDS</code>: Set dependencies, there may be several dependencies
pankso@21 68 seperated by a space or on several lines. This variable is used mainly by
pankso@21 69 tazpkg when installing the package and tazwok to build large packages such
pankso@21 70 as Xorg. Example for Clex which depends on ncurses:
pankso@21 71 </p>
pankso@21 72 <pre class="script">
pankso@21 73 DEPENDS="ncurses"
pankso@21 74 </pre>
pankso@21 75 <p>
pankso@21 76 <code>$BUILD_DEPENDS</code>: Set compilation dependencies, again seperated
pankso@21 77 by a space or several lines. This variable is used by tazwok during the
pankso@21 78 cooking of a package. Example:
pankso@21 79 </p>
pankso@21 80 <pre class="script">
pankso@21 81 BUILD_DEPENDS="ncurses-dev"
pankso@21 82 </pre>
pankso@21 83 <p>
pankso@21 84 <code>$TARBALL</code> : The archive is a source with the extension (tar.gz,
pankso@21 85 tgz or tar.bz2). In general, the variables $PACKAGE and $VERSION are used to
pankso@21 86 just change the extension, it helps to upgrade the package without changing
pankso@21 87 the $VERSION variable. Generic example (see also $SOURCE example):
pankso@21 88 </p>
pankso@21 89 <pre class="script">
pankso@21 90 TARBALL="$PACKAGE-$VERSION.tar.gz"
pankso@21 91 </pre>
pankso@21 92 <p>
pankso@21 93 <code>$WEB_SITE</code> : The official website of the package. It may be that
pankso@21 94 some libraries have no website, in this case, there is no need to specify a
pankso@21 95 URL. Note tazwok and tazpkg both expect to find a URL with the complete HTTP:
pankso@21 96 </p>
pankso@21 97 <pre class="script">
pankso@21 98 WEB_SITE="http://www.clex.sk/"
pankso@21 99 </pre>
pankso@21 100 <p>
pankso@21 101 <code>$WGET_URL</code> : URL to download the source file. In general the
pankso@21 102 variable $TARBALL should be used to facilitate the updating of the package
pankso@21 103 without changing the $VERSION. Using a configuration file, tazwok also
pankso@21 104 configures by default 3 mirrors: $GNU_MIRROR for the GNU mirror, $SF_MIRROR
pankso@21 105 for SourceForge and XORG_MIRROR for mirroring the graphical server Xorg.
pankso@21 106 Example for Clex:
pankso@21 107 </p>
pankso@21 108 <pre class="script">
pankso@21 109 WGET_URL="http://www.clex.sk/download/$TARBALL"
pankso@21 110 </pre>
pankso@21 111 <p>
pankso@21 112 <code>$WANTED</code> : SliTaz packages normally depend on the compilation of
pankso@21 113 a source package. Sometimes the receipt of a package requires no compilation
pankso@21 114 of rules, then $WANTED is used to copy files from the source of another
pankso@21 115 package by using the variable $ src.
pankso@21 116 </p>
pankso@21 117 <p>
pankso@21 118 <code>$SOURCE</code> : It may be that the tazpkg package name differs from
pankso@21 119 the name of the source package. Example for Xorg packages, the name of tazpkg
pankso@21 120 library X11 is 'xorg-libX11' and the name of the package source is libX11.
pankso@21 121 $SOURCE allows you to use the variables $src and $_pkg during the cooking of
pankso@21 122 a package. It should be noted that in the case of libX11, the name of the
pankso@21 123 source archive becomes $SOURCE-$VERSION.tar.gz.
pankso@21 124 </p>
pankso@21 125
pankso@21 126 <h3>Variables used in functions</h3>
pankso@21 127 <p>
pankso@21 128 Tazwok configures several variables that facilitate the compilation and
pankso@21 129 construction of tazpkg packages. These variables are controlled automatically
pankso@21 130 by tazwok using the information contained in the receipt; they can be used
pankso@21 131 by the functions compile_rules and genpkg_rules described in the chapter
pankso@21 132 Functions.
pankso@21 133 </p>
pankso@21 134 <p>
pankso@21 135 <code>$src</code> : Defines the path to the directory of unarchived sources.
pankso@21 136 </p>
pankso@21 137 <p>
pankso@21 138 <code>$_pkg</code> : Defines the path to the binary compiles installed via
pankso@21 139 'make DESTDIR=$PWD/_pkg install'. This variable is used to copy the generated
pankso@21 140 files and create tazpkg packages.
pankso@21 141 </p>
pankso@21 142 <p>
pankso@21 143 <code>$fs</code> : Defines the path to the pseudo filesystem (fs) in each
pankso@21 144 package. The 'fs' of the package corresponds to the root of the system, a bit
pankso@21 145 like Clex will for example in $fs/usr/bin/clex, note the need to create the
pankso@21 146 necessary directories via function genpkg_rules() before copying the files.
pankso@21 147 </p>
pankso@21 148 <p>
pankso@21 149 <code>$CONFIGURE_ARGS</code> : This variable is defined in the Tazwok
pankso@21 150 configuration file (tazwok.conf), it allows you to specify generic optimization
pankso@21 151 arguments during construction of a package. Default is the i486 architecture.
pankso@21 152 </p>
pankso@21 153
pankso@21 154 <h3>Functions</h3>
pankso@21 155 <p>
pankso@21 156 A receipt may contain 4 functions. Tazwok knows how to deal with functions
pankso@21 157 containing compilation rules (compile_rules) and rules used to generate a
pankso@21 158 package (genpkg_rules). These functions may contain all sorts of GNU/Linux
pankso@21 159 standard commands, such as sed, awk, patch and variables automatically
pankso@21 160 configured.
pankso@21 161 </p>
pankso@21 162 <h4>compile_rules()</h4>
pankso@21 163 <p>
pankso@21 164 To compile a package you can use the variable $src to move (cd) in the
pankso@21 165 directory of sources and use $CONFIGURE_ARGS to include arguments from the
pankso@21 166 tazwok configuration file. To build the package you usually launch 'make'
pankso@21 167 without any arguments and to install the package into the directory _pkg,
pankso@21 168 it is necessary to use the command 'make DESTDIR=$PWD/_pkg install'. Generic
pankso@21 169 example:
pankso@21 170 </p>
pankso@21 171 <pre class="script">
pankso@21 172 # Rules to configure and make the package.
pankso@21 173 compile_rules()
pankso@21 174 {
pankso@21 175 cd $src
pankso@21 176 ./configure --prefix=/usr --infodir=/usr/share/info \
pankso@21 177 --mandir=/usr/share/man $CONFIGURE_ARGS
pankso@21 178 make
pankso@21 179 make DESTDIR=$PWD/_pkg install
pankso@21 180 }
pankso@21 181 </pre>
pankso@21 182 <h4>genpkg_rules()</h4>
pankso@21 183 <p>
pankso@21 184 To generate a tazkg package we must specify commands in the function
pankso@21 185 <code>genpkg_rules</code>. In this example we create a psuedo directory
pankso@21 186 <code>usr/</code> in the filesystem of the package, copy the whole
pankso@21 187 binary(s) and finally use strip to clean the files:
pankso@21 188 </p>
pankso@21 189 <pre class="script">
pankso@21 190 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@21 191 genpkg_rules()
pankso@21 192 {
pankso@21 193 mkdir -p $fs/usr
pankso@21 194 cp -a $_pkg/usr/bin $fs/usr
pankso@21 195 strip -s $fs/usr/bin/*
pankso@21 196 }
pankso@21 197 </pre>
pankso@21 198 <h4>pre_install() and post_install()</h4>
pankso@21 199 <p>
pankso@21 200 These 2 functions are initiated by tazpkg when installing the package. They
pankso@21 201 must be defined before generating the .tazpkg package with tazwok. If no rules
pankso@21 202 are given for these functions, they have no raison d'etre and can be removed.
hacker@59 203 Example using echo to display some text (no function should be empty):
pankso@21 204 </p>
pankso@21 205 <pre class="script">
pankso@21 206 # Pre and post install commands for Tazpkg.
pankso@21 207 pre_install()
pankso@21 208 {
pankso@21 209 echo "Processing pre-install commands..."
pankso@21 210 }
pankso@21 211 post_install()
pankso@21 212 {
pankso@21 213 echo "Processing post-install commands..."
pankso@21 214 }
pankso@21 215 </pre>
pankso@21 216
pankso@21 217 <!-- End of content -->
pankso@21 218 </div>
pankso@21 219
pankso@21 220 <!-- Footer. -->
pankso@21 221 <div id="footer">
pankso@21 222 <div class="footer-right"></div>
pankso@21 223 <a href="#top">Top of the page</a> |
pankso@21 224 <a href="index.html">Table of contents</a>
pankso@21 225 </div>
pankso@21 226
pankso@21 227 <div id="copy">
pankso@21 228 Copyright &copy; 2008 <a href="http://www.slitaz.org/en/">SliTaz</a> -
pankso@21 229 <a href="http://www.gnu.org/licenses/gpl.html">GNU General Public License</a>;<br />
pankso@21 230 Documentation is under
pankso@21 231 <a href="http://www.gnu.org/copyleft/fdl.html">GNU Free Documentation License</a>
pankso@21 232 and code is <a href="http://validator.w3.org/">valid xHTML 1.0</a>.
pankso@21 233 </div>
pankso@21 234
pankso@21 235 </body>
pankso@21 236 </html>