cookutils annotate doc/receipts-v2.md @ rev 960

cookiso: learn about 'next'; modules/compressor: fix IFS again.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Aug 26 11:51:39 2017 +0300 (2017-08-26)
parents 4402dabf5734
children c13b693c75c8
rev   line source
al@906 1 Brief info about SliTaz receipts v2
al@906 2 ===================================
al@906 3
al@906 4 Version 2 was developed as an extension of the receipts in order to facilitate
al@906 5 the maintenance of packages by small forces.
al@906 6
al@906 7 In order to switch to version 2, you must specify 'v2' in the first line of the
al@906 8 receipt:
al@906 9
al@906 10 # SliTaz package receipt v2.
al@906 11
al@906 12 You can write the single receipt v2 to compile, for example `attr` sources and
al@906 13 then make two packages: `attr` and `attr-dev` using compiled files. Next we will
al@906 14 call `attr` the *main package*, while `attr-dev` -- the *split package*.
al@906 15
al@906 16 You must specify all the names of *split packages* that must be created after
al@906 17 the compilation in the SPLIT variable. Example for our `attr` receipt:
al@906 18
al@906 19 SPLIT="attr-dev"
al@906 20
al@906 21 You must specify rules to generate each package inside the genpkg_rules().
al@906 22 Example for package `attr`:
al@906 23
al@906 24 genpkg_rules()
al@906 25 {
al@906 26 case $PACKAGE in
al@906 27 attr) copy @std ;;
al@906 28 attr-dev) copy @dev ;;
al@906 29 esac
al@906 30 }
al@906 31
al@906 32 Here, in every rule you can:
al@906 33
al@906 34 * use the `copy()` function or other methods to copy specified files from
al@906 35 $install to $fs.
al@906 36 * define the DEPENDS variable for specified package; you may omit this
al@906 37 definition, then it will mean the following:
paul@911 38 * for the *main package*: it doesn't depend on any package;
al@906 39 * for the *split packages*: it depends exclusively on *main package*.
al@906 40 Note, receipt is the shell script with all its restrictions: there's no
al@906 41 difference if you define empty DEPENDS variable or not define it at all.
al@906 42 Here's the small trick: if you really want to define empty dependency,
al@906 43 put single space between the quotes: `DEPENDS=" "`.
al@906 44 * define the two-in-one CAT variable for *split packages*. Variable format:
al@906 45
al@906 46 ```
al@906 47 CAT="category|addition"
al@906 48 ```
al@906 49
al@906 50 Where `category` is just the choosed category for the specified *split
al@906 51 package*. And `addition` you will find in the brackets at the end of
al@906 52 short description of the specified *split package*. You may omit this
al@906 53 definition for the "dev" packages. In this case it will be implicitly
al@906 54 defined as:
al@906 55
al@906 56 ```
al@906 57 CAT="development|development files"
al@906 58 ```
al@906 59 * define some other variables, like COOKOPTS.
al@906 60
al@906 61
al@906 62 Long descriptions
al@906 63 -----------------
al@906 64
al@906 65 You may provide `description.txt` for the *main package* and/or
al@906 66 `description.package-name.txt` for any of the *split package*.
al@906 67
al@906 68
al@906 69 `post_install()` and friends
al@906 70 ----------------------------
al@906 71
al@906 72 You may define one of the following functions:
al@906 73
al@906 74 * `pre_install()`;
al@906 75 * `post_install()`;
al@906 76 * `pre_remove()`;
al@906 77 * `post_remove()`.
al@906 78
al@906 79 These functions may be defined for every of *main* or *split package*, so
al@906 80 you need to extend function name with underscore (`_`) and the package name.
al@906 81 Like this for `cookutils` package:
al@906 82
al@906 83 post_install_cookutils()
al@906 84
al@906 85 Attention! You should know that some characters that are valid in package names
paul@911 86 are not allowed in function names. Please, substitute each symbol that doesn't
paul@911 87 belong to the intervals `A-Z, a-z, 0-9` by yet another underscore (`_`).
al@906 88 Example for `coreutils-disk`:
al@906 89
al@906 90 post_install_coreutils_disk()
al@906 91
al@912 92
al@912 93 Function `copy()`
al@912 94 -----------------
al@912 95
al@912 96 It's the flexible tool allowing you to copy files and folders from `$install` to
al@912 97 `$fs` using patterns. All files are copied with the folder structure preserved:
al@912 98
al@912 99 $install/my/folder/ -> $fs/my/folder/
al@912 100 $install/my/system/file -> $fs/my/system/file
al@912 101
al@912 102 Now `copy()` understands 4 main forms of patterns:
al@912 103
al@912 104 * `@std` - all the "standard" files;
al@912 105 * `@dev` - all the "developer" files;
al@912 106 * `folder/` - append folder name in question by slash;
al@912 107 * `file` - file name without the slash in the end.
al@912 108
al@912 109 Both patterns `@std` and `@dev` are meta-patterns making the most common actions
al@912 110 extremely simple.
al@912 111
al@912 112 In the `folder/` and `file` forms of the patterns you can use the asterisk (`*`)
al@912 113 symbol meaning any number of any characters.
al@912 114
al@912 115 Some examples (executed on the chroot with the "busybox" package installed):
al@912 116
al@912 117 ```
al@912 118 Pattern | Result
al@912 119 ===========|====================================================================
al@912 120 bin/ | /bin
al@912 121 | /usr/bin
al@912 122 -----------|--------------------------------------------------------------------
al@912 123 *bin/ | /bin
al@912 124 | /sbin
al@912 125 | /usr/bin
al@912 126 | /usr/sbin
al@912 127 | /var/www/cgi-bin
al@912 128 -----------|--------------------------------------------------------------------
al@912 129 /usr/bin/ | /usr/bin
al@912 130 -----------|--------------------------------------------------------------------
al@912 131 usr/bin/ | /usr/bin
al@912 132 -----------|--------------------------------------------------------------------
al@912 133 r/bin/ |
al@912 134 ===========|====================================================================
al@912 135 cat | /bin/cat
al@912 136 -----------|--------------------------------------------------------------------
al@912 137 *.sh | /lib/libtaz.sh
al@912 138 | /sbin/mktazdevs.sh
al@912 139 | /usr/bin/gettext.sh
al@912 140 | /usr/bin/httpd_helper.sh
al@912 141 | /usr/lib/slitaz/httphelper.sh
al@912 142 | /usr/lib/slitaz/libpkg.sh
al@912 143 | /var/www/cgi-bin/cgi-env.sh
al@912 144 -----------|--------------------------------------------------------------------
al@912 145 pt* | /dev/pts
al@912 146 | /usr/share/locale/pt_BR
al@912 147 | /usr/share/locale/pt_BR/LC_MESSAGES
al@912 148 -----------|--------------------------------------------------------------------
al@912 149 /bin/*.sh | /usr/bin/gettext.sh
al@912 150 | /usr/bin/httpd_helper.sh
al@912 151 -----------|--------------------------------------------------------------------
al@912 152 /lib/*.sh | /lib/libtaz.sh
al@912 153 | /usr/lib/slitaz/httphelper.sh
al@912 154 | /usr/lib/slitaz/libpkg.sh
al@912 155 ```