# HG changeset patch # User Aleksej Bobylev # Date 1509293326 -7200 # Node ID c13b693c75c8f68c1295787ad79a3741b2d56297 # Parent 03374082dafa91a8f7b02514840aa002286cf781 Update doc/receipts-v2.md with examples (still wip); lighttpd/index.cgi: fix CMake listings beginning with '--' diff -r 03374082dafa -r c13b693c75c8 doc/receipts-v2.md --- a/doc/receipts-v2.md Sat Oct 28 16:04:43 2017 +0300 +++ b/doc/receipts-v2.md Sun Oct 29 18:08:46 2017 +0200 @@ -7,7 +7,9 @@ In order to switch to version 2, you must specify 'v2' in the first line of the receipt: - # SliTaz package receipt v2. +```bash +# SliTaz package receipt v2. +``` You can write the single receipt v2 to compile, for example `attr` sources and then make two packages: `attr` and `attr-dev` using compiled files. Next we will @@ -16,18 +18,21 @@ You must specify all the names of *split packages* that must be created after the compilation in the SPLIT variable. Example for our `attr` receipt: - SPLIT="attr-dev" +```bash +SPLIT="attr-dev" +``` You must specify rules to generate each package inside the genpkg_rules(). Example for package `attr`: - genpkg_rules() - { - case $PACKAGE in - attr) copy @std ;; - attr-dev) copy @dev ;; - esac - } +```bash +genpkg_rules() { + case $PACKAGE in + attr) copy @std ;; + attr-dev) copy @dev ;; + esac +} +``` Here, in every rule you can: @@ -43,7 +48,7 @@ put single space between the quotes: `DEPENDS=" "`. * define the two-in-one CAT variable for *split packages*. Variable format: - ``` + ```bash CAT="category|addition" ``` @@ -53,7 +58,7 @@ definition for the "dev" packages. In this case it will be implicitly defined as: - ``` + ```bash CAT="development|development files" ``` * define some other variables, like COOKOPTS. @@ -107,49 +112,109 @@ * `file` - file name without the slash in the end. Both patterns `@std` and `@dev` are meta-patterns making the most common actions -extremely simple. +extremely simple. Here all files are divided into three types: standard, +development and all the others (documentation, translations, etc). You may put +`@std` into "standard" package, `@dev` into "developer" package, not packaging +any documentation, man pages, translations, BASH completion, etc... In the `folder/` and `file` forms of the patterns you can use the asterisk (`*`) symbol meaning any number of any characters. Some examples (executed on the chroot with the "busybox" package installed): + Pattern | Result +-----------|-------------------------------------------------------------------- +` bin/ `|`/bin`
`/usr/bin` +` *bin/ `|`/bin`
`/sbin`
`/usr/bin`
`/usr/sbin`
`/var/www/cgi-bin` +`/usr/bin/`|`/usr/bin` +` usr/bin/`|`/usr/bin` +` r/bin/`|` ` +` cat `|`/bin/cat` +` *.sh `|`/lib/libtaz.sh`
`/sbin/mktazdevs.sh`
`/usr/bin/gettext.sh`
`/usr/bin/httpd_helper.sh`
`/usr/lib/slitaz/httphelper.sh`
`/usr/lib/slitaz/libpkg.sh`
`/var/www/cgi-bin/cgi-env.sh` +` pt* `|`/dev/pts`
`/usr/share/locale/pt_BR`
`/usr/share/locale/pt_BR/LC_MESSAGES` +`/bin/*.sh`|`/usr/bin/gettext.sh`
`/usr/bin/httpd_helper.sh` +`/lib/*.sh`|`/lib/libtaz.sh`
`/usr/lib/slitaz/httphelper.sh`
`/usr/lib/slitaz/libpkg.sh` + +Also, `copy()` understands the `@rm` pattern. It does not copy anything, but it +removes already copied files that have already been packed. + +### Some more examples of using `copy()` + +If your package used only for development purposes (like automake, flex, vala +and some other), you may use the next commant to put all the files you want +to pack into one package: + +```bash +copy @std @dev ``` - Pattern | Result -===========|==================================================================== - bin/ | /bin - | /usr/bin ------------|-------------------------------------------------------------------- - *bin/ | /bin - | /sbin - | /usr/bin - | /usr/sbin - | /var/www/cgi-bin ------------|-------------------------------------------------------------------- - /usr/bin/ | /usr/bin ------------|-------------------------------------------------------------------- - usr/bin/ | /usr/bin ------------|-------------------------------------------------------------------- - r/bin/ | -===========|==================================================================== - cat | /bin/cat ------------|-------------------------------------------------------------------- - *.sh | /lib/libtaz.sh - | /sbin/mktazdevs.sh - | /usr/bin/gettext.sh - | /usr/bin/httpd_helper.sh - | /usr/lib/slitaz/httphelper.sh - | /usr/lib/slitaz/libpkg.sh - | /var/www/cgi-bin/cgi-env.sh ------------|-------------------------------------------------------------------- - pt* | /dev/pts - | /usr/share/locale/pt_BR - | /usr/share/locale/pt_BR/LC_MESSAGES ------------|-------------------------------------------------------------------- - /bin/*.sh | /usr/bin/gettext.sh - | /usr/bin/httpd_helper.sh ------------|-------------------------------------------------------------------- - /lib/*.sh | /lib/libtaz.sh - | /usr/lib/slitaz/httphelper.sh - | /usr/lib/slitaz/libpkg.sh + +In most cases, the package breaks up into "main" and "dev" packages. In this +case, your code might look like this: + +```bash +PACKAGE="my-package" +SPLIT="my-package-dev" + +genpkg_rules() { + case $PACKAGE in + my-package) + copy @std + DEPENDS="your-package" + ;; + *-dev) + copy @dev + ;; + esac +} ``` + +In the following example, a package can contain libraries (which can be used by +other programs) and executables that use these libraries. We need to split +`@std` into two parts: libraries and executable files. This can be done in few +ways. + +```bash +PACKAGE="my-pkg" +# We omit "my-pkg" in the $SPLIT, then it is implicit in the first place +SPLIT="my-pkg-bin my-pkg-dev" +genpkg_rules() { + case $PACKAGE in + my-pkg) copy *.so*;; # (1) copy all the libs + *-bin) copy bin/;; # (2) copy all the execs from /usr/bin/ + *-dev) copy @dev;; # (3) copy development files + esac +} +``` + +```bash +# If package contains some more files outside the /bin/ (for example, configs), +# that we want to pack with the "bin" package: +PACKAGE="my-pkg" +SPLIT="my-pkg-bin my-pkg-dev" +genpkg_rules() { + case $PACKAGE in + my-pkg) copy *.so*;; # (1) copy all the libs + *-bin) copy @std @rm;; # (2) copy standard (binaries and configs, etc), + # then remove already packed (libs) + *-dev) copy @dev;; # (3) copy development files + esac +} +``` + +```bash +# Pack two different libraries into two packages, and the rest into third +# package: +PACKAGE="my-pkg" +# We explicitly specified all the packages, therefore they will be processed +# in the specified order +SPLIT="my-pkg-lib1 my-pkg-lib2 my-pkg my-pkg-dev" +genpkg_rules() { + case $PACKAGE in + *-lib1) copy lib-cli.so*;; # (1) copy first libraries + *-lib2) copy lib-gui.so*;; # (2) copy second libraries + my-pkg) copy @std @rm;; # (3) copy all the standard files, + # then remove already packed (libs) + *-dev) copy @dev;; # (4) copy development files + esac +} +``` diff -r 03374082dafa -r c13b693c75c8 lighttpd/index.cgi --- a/lighttpd/index.cgi Sat Oct 28 16:04:43 2017 +0300 +++ b/lighttpd/index.cgi Sun Oct 29 18:08:46 2017 +0200 @@ -550,7 +550,7 @@ s|\[39m||; s|\[1m||g; s|\[0m||g" \ -e "s|^+.*|\0|; - s|^-.*|\0|; /----/s|||" + s|^-.*|\0|; /----/s|||; /^-- /s|||;" ;; files)