| 1 | == Benaming package == |
| 2 | Je noemt je package pear_PEARCOMPONENT. |
| 3 | PEARCOMPONENT is in dit voorbeeld Mail_Mime. |
| 4 | |
| 5 | == Pear source code == |
| 6 | |
| 7 | Download de sourcecode van de laatste stable release van pear.php.net: |
| 8 | {{{ |
| 9 | http://download.pear.php.net/package/Mail_Mime-1.5.2.tgz |
| 10 | }}} |
| 11 | |
| 12 | == Algemeen Slackbuild script == |
| 13 | Je hoeft niks aan te passen aan het script. Script moet alleen de juiste naam krijgen. In dit geval dus pear_Mail_Mime.SlackBuild: |
| 14 | {{{ |
| 15 | #!/bin/bash |
| 16 | #Gebruik deze file als voorbeeld. Plaats de source tar.gz file in de zelfde directory als deze slackbuild |
| 17 | #Met de NEED en DEP opties is het mogelijk om build dependencies aan te geven. |
| 18 | #Voor de meeste packages hoeft er verder niks aan de variabellen veranderd te worden. |
| 19 | ##################################### Build dependency info: |
| 20 | |
| 21 | |
| 22 | #######Essential package info. |
| 23 | #Change these if autodetection fails. |
| 24 | |
| 25 | #Name of the Syn-3 package that we are going to create |
| 26 | NAME=`basename $0|sed 's/.SlackBuild//'` |
| 27 | |
| 28 | #Archive of the sourcefiles to unpack |
| 29 | SRC_ARC=`ls *.tgz` |
| 30 | |
| 31 | #Version of the sourcefiles |
| 32 | VER=`echo $SRC_ARC| sed 's/.*-//g' | sed 's/\.tar\..*$//g'` |
| 33 | |
| 34 | #Directory of the sourcefiles to build (after optional unpacking) |
| 35 | SRC_DIR=`echo $SRC_ARC| sed 's/\.tar\..*$//g'` |
| 36 | |
| 37 | #Architecture that the created binaries run on. |
| 38 | #Use noarch for scripts. |
| 39 | ARCH=noarch |
| 40 | |
| 41 | |
| 42 | ########Build and create the pacakge. |
| 43 | |
| 44 | mkdir -p /tmp/pkg/home/system/peartmp |
| 45 | cp $SRC_ARC /tmp/pkg/home/system/peartmp || exit 1 |
| 46 | |
| 47 | mkdir -p /tmp/pkg/etc/postinst.d |
| 48 | cp post.php_pear /tmp/pkg/etc/postinst.d || exit 1 |
| 49 | chmod +x /tmp/pkg/etc/postinst.d/* || exit 1 |
| 50 | |
| 51 | #make main package |
| 52 | syn3_makepkg /tmp/pkg $NAME $VER $ARCH || exit 1 |
| 53 | }}} |
| 54 | |
| 55 | == Post install file == |
| 56 | De postinstall is algemeen en moet altijd de naam post.php_pear krijgen: |
| 57 | {{{ |
| 58 | #!/bin/bash |
| 59 | |
| 60 | #install all pear packages from /home/system/peartmp: |
| 61 | for PKG in /home/system/peartmp/*; do |
| 62 | /usr/php5/bin/pear install -O -f $PKG || exit 1; |
| 63 | /usr/bin/pear install -O -f $PKG || exit 1; |
| 64 | rm $PKG || exit 1 |
| 65 | done |
| 66 | |
| 67 | exit 0 |
| 68 | }}} |