Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:cookbook:receipt [2010/05/28 21:34] – linea | en:cookbook:receipt [2017/04/24 15:05] (current) – [Functions] hgt | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| - | This document describes the opportunities offered by the recipes used by Tazwok | + | This document describes the opportunities offered by the recipes used by Cookutils |
| - | <code># SliTaz package receipt </code> | + | <file bash># SliTaz package receipt </file> |
| ===== Variables ===== | ===== Variables ===== | ||
| Line 10: | Line 10: | ||
| The first 5 variables should always be present and defined. They respectively configure the package ($PACKAGE), its version, its category, provide a short description and the name of the maintainer. Example for the package, file manager Clex: | The first 5 variables should always be present and defined. They respectively configure the package ($PACKAGE), its version, its category, provide a short description and the name of the maintainer. Example for the package, file manager Clex: | ||
| - | <code> | + | <file bash> |
| PACKAGE=" | PACKAGE=" | ||
| VERSION=" | VERSION=" | ||
| Line 16: | Line 16: | ||
| SHORT_DESC=" | SHORT_DESC=" | ||
| MAINTAINER=" | MAINTAINER=" | ||
| - | </code> | + | </file> |
| ===== Variables (optional) ===== | ===== Variables (optional) ===== | ||
| - | Tazwok | + | Cookutils |
| - | * **$DEPENDS: | + | * **$DEPENDS: |
| - | <code> | + | <file bash> |
| - | * **$BUILD_DEPENDS: | + | * **$BUILD_DEPENDS: |
| - | <code> | + | <file bash> |
| * **$TARBALL :** The archive is a source with the extension (tar.gz, tgz or tar.bz2). In general, the variables $PACKAGE and $VERSION are used to just change the extension, it helps to upgrade the package without changing the $VERSION variable. Generic example (see also $SOURCE example): | * **$TARBALL :** The archive is a source with the extension (tar.gz, tgz or tar.bz2). In general, the variables $PACKAGE and $VERSION are used to just change the extension, it helps to upgrade the package without changing the $VERSION variable. Generic example (see also $SOURCE example): | ||
| - | <code> | + | <file bash> |
| + | * **$WEB_SITE :** The official website of the package. It may be that some libraries have no website, in this case, there is no need to specify a URL. Note Cookutils and Tazpkg both expect to find a URL with the complete HTTP: | ||
| - | * **$WEB_SITE :** The official website of the package. It may be that some libraries have no website, in this case, there is no need to specify a URL. Note Tazwok and Tazpkg both expect to find a URL with the complete HTTP: | + | <file bash> |
| - | <code> | + | |
| - | * **$WGET_URL :** URL to download the source file. In general the variable $TARBALL should be used to facilitate the updating of the package without changing the $VERSION. Using a configuration file, Tazwok | + | * **$WGET_URL :** URL to download the source file. In general the variable $TARBALL should be used to facilitate the updating of the package without changing the $VERSION. Using a configuration file, Cookutils |
| - | <code> | + | <file bash> |
| * **$CONFIG_FILES :** Some packages provide customized configuration files. The $CONFIG_FILES variable provides a list of these files that can be saved by the ' | * **$CONFIG_FILES :** Some packages provide customized configuration files. The $CONFIG_FILES variable provides a list of these files that can be saved by the ' | ||
| - | <code> | + | <file bash> |
| * **$SUGGESTED :** Lists useful packages without being essential. Also used to activate optional features. | * **$SUGGESTED :** Lists useful packages without being essential. Also used to activate optional features. | ||
| Line 51: | Line 51: | ||
| * **$WANTED :** SliTaz packages normally depend on the compilation of a source package. Sometimes the recipe of a package requires no compilation of rules, then $WANTED is used to copy files from the source of another package by using the variable $ src. | * **$WANTED :** SliTaz packages normally depend on the compilation of a source package. Sometimes the recipe of a package requires no compilation of rules, then $WANTED is used to copy files from the source of another package by using the variable $ src. | ||
| - | * **$SOURCE :** It may be that the Tazpkg package name differs from the name of the source package. Example for Xorg packages, the name of Tazpkg library X11 is ' | + | * **$SOURCE :** It may be that the Tazpkg package name differs from the name of the source package. Example for Xorg packages, the name of Tazpkg library X11 is ' |
| - | * **$PROVIDE :** Some packages offer the same functionality, | + | * **$PROVIDE :** Some packages offer the same functionality, |
| You can also define virtual packages with this variable. The lines // | You can also define virtual packages with this variable. The lines // | ||
| - | * **$SELF_INSTALL :** Certain packages use commands provided by the package itself in the post_install function. To install this package into a directory other than root and still be able to use these commands, the package must have been installed in / in earlier stages. The line: // | + | * **$SELF_INSTALL |
| - | ===== Variables generated by Tazwok | + | ===== Variables generated by Cookutils |
| - | + | Certain factors are known only during the cooking of a package or after the package has been cooked. | |
| - | Certain factors are known only during the cooking of a package or after the package has been cooked. | + | |
| * **$PACKED_SIZE :** Tazpkg file size. | * **$PACKED_SIZE :** Tazpkg file size. | ||
| Line 67: | Line 66: | ||
| * **$UNPACKED_SIZE :** Space taken up by the package after installation. | * **$UNPACKED_SIZE :** Space taken up by the package after installation. | ||
| - | * **$EXTRAVERSION :** Some packages have 2 different versions. This is in case of modules added to the Linux kernel, such as squashfs, because the module depends on the version of the kernel with which it was compiled. In this case $EXTRAVERSION contains the kernel version and Tazwok | + | * **$EXTRAVERSION :** Some packages have 2 different versions. This is in case of modules added to the Linux kernel, such as squashfs, because the module depends on the version of the kernel with which it was compiled. In this case $EXTRAVERSION contains the kernel version and Cookutils |
| ===== Variables used in functions ===== | ===== Variables used in functions ===== | ||
| - | + | Cookutils | |
| - | Tazwok | + | |
| * **$src :** Defines the path to the directory of unarchived sources. | * **$src :** Defines the path to the directory of unarchived sources. | ||
| - | * **$_pkg :** Defines the path to the compiled binaries installed via 'make DESTDIR=$PWD/ | + | * **$install |
| + | |||
| + | * **$_pkg :** Same as $install. | ||
| * **$fs :** Defines the path to the pseudo filesystem (fs) in each package. The ' | * **$fs :** Defines the path to the pseudo filesystem (fs) in each package. The ' | ||
| - | * **$CONFIGURE_ARGS :** This variable is defined in the Tazwok | + | * **$CONFIGURE_ARGS :** This variable is defined in the cookutils |
| + | |||
| + | * **$DESTDIR : ** Defines the path to install compiled binaries after the build via 'make DESTDIR=$DESTDIR install' | ||
| ===== Functions ===== | ===== Functions ===== | ||
| - | A recipe may contain 4 functions. | + | A recipe may contain 4 functions. |
| === compile_rules() === | === compile_rules() === | ||
| - | To compile a package you can use the variable $src to move (cd) in the directory of sources and use $CONFIGURE_ARGS to include arguments from the Tazwok | + | To compile a package you can use the variable $src to move (cd) in the directory of sources and use $CONFIGURE_ARGS to include arguments from the Cookutils |
| - | <code> | + | <file bash> |
| # Rules to configure and make the package. | # Rules to configure and make the package. | ||
| compile_rules() | compile_rules() | ||
| Line 99: | Line 100: | ||
| --mandir=/ | --mandir=/ | ||
| make | make | ||
| - | make DESTDIR=$PWD/ | + | make DESTDIR=$DESTDIR |
| } | } | ||
| - | </code> | + | </file> |
| === genpkg_rules()=== | === genpkg_rules()=== | ||
| - | To generate a tazkg package we must specify commands in the function genpkg_rules. In this example we create a psuedo directory | + | To generate a tazkg package we must specify commands in the function genpkg_rules. In this example we create a psuedo directory /usr in the filesystem of the package, copy the whole binary(s) and finally use strip to clean the files: |
| - | <code> | + | <file bash> |
| # Rules to gen a SliTaz package suitable for Tazpkg. | # Rules to gen a SliTaz package suitable for Tazpkg. | ||
| genpkg_rules() | genpkg_rules() | ||
| { | { | ||
| mkdir -p $fs/usr | mkdir -p $fs/usr | ||
| - | cp -a $_pkg/usr/bin $fs/usr | + | cp -a $install/usr/bin $fs/usr |
| strip -s $fs/ | strip -s $fs/ | ||
| } | } | ||
| - | </code> | + | </file> |
| === pre_install() and post_install()=== | === pre_install() and post_install()=== | ||
| - | These 2 functions are initiated by Tazpkg when installing the package. They must be defined before generating the .tazpkg package with Tazwok. If no rules are given for these functions, they have no raison d'etre and can be removed. Example using echo to display some text (no function should be empty): | + | These functions are initiated by Tazpkg when installing the package. They must be defined before generating the .tazpkg package with Cookutils. If no rules are given for these functions, they have no raison d'etre and can be removed. Example using echo to display some text (no function should be empty): |
| - | <code> | + | <file bash> |
| # Pre and post install commands for Tazpkg. | # Pre and post install commands for Tazpkg. | ||
| pre_install() | pre_install() | ||
| Line 131: | Line 132: | ||
| echo " | echo " | ||
| } | } | ||
| - | </code> | + | </file> |
| - | === clean_wok() === | + | === pre_remove() and post_remove() === |
| + | These functions are initiated by Tazpkg when removing the package. They must be defined before generating the .tazpkg package with Cookutils. If no rules are given for these functions, they have no raison d'etre and can be removed. Example using echo to display some text (no function should be empty): | ||
| - | This function helps to define additional commands to be run when cleaning the wok, it is useful to delete files or directories that are not supported by Tazwok. | + | <file bash> |
| - | + | # Pre and post remove | |
| - | <code> | + | pre_remove() |
| - | # clean commands for Tazwok. | + | |
| - | clean_wok() | + | |
| { | { | ||
| - | rm -rf $WOK/ | + | echo " |
| } | } | ||
| - | </code> | + | post_remove() |
| + | { | ||
| + | echo " | ||
| + | } | ||
| + | </file> | ||