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