[cc2b9e2] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | #NEED:git |
---|
| 4 | ##DEP:ndpi |
---|
| 5 | #DEP:libpcap |
---|
| 6 | #DEP:sqlite |
---|
| 7 | #DEP:mysql56 |
---|
| 8 | #DEP:glib2 |
---|
| 9 | #DEP:libxml2 |
---|
| 10 | #DEP:rrdtool |
---|
| 11 | #NEED:groff |
---|
| 12 | #DEP:zlib |
---|
| 13 | #DEP:curl |
---|
| 14 | ##DEP:drv_pf_ring |
---|
| 15 | |
---|
| 16 | #######Essential package info. |
---|
| 17 | #Change these if autodetection fails. |
---|
| 18 | |
---|
| 19 | #Name of the Syn-3 package that we are going to create |
---|
| 20 | NAME=`basename $0|sed 's/.SlackBuild//'` |
---|
| 21 | |
---|
| 22 | #git clone http://github.com/ntop/ntopng.git || exit 1 |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | #Archive of the sourcefiles to unpack |
---|
| 26 | #SRC_ARC=`ls *.tar.* *.zip 2>/dev/null` |
---|
| 27 | SRC_ARC=ntopng-dev.zip |
---|
| 28 | |
---|
| 29 | #Version of the sourcefiles |
---|
| 30 | VER=`echo $SRC_ARC| sed 's/.*-//g' | sed 's/\.tar\..*$//g' | sed 's/\.zip$//g'` |
---|
| 31 | #VER=`cd ntopng; git describe --tags|sed 's/-/_/g'` |
---|
| 32 | |
---|
| 33 | #Architecture that the created binaries run on. |
---|
| 34 | #Use noarch for scripts. |
---|
| 35 | ARCH=`uname -m` |
---|
| 36 | |
---|
| 37 | #from this point on, exit on errors: |
---|
| 38 | set -e |
---|
| 39 | |
---|
| 40 | ########Build and create the pacakge. |
---|
| 41 | #Uncomment the stuff that you dont want or need |
---|
| 42 | |
---|
| 43 | #Unpack source |
---|
| 44 | #(uncomment if not needed) |
---|
| 45 | syn3_unpack $SRC_ARC |
---|
| 46 | |
---|
| 47 | #Directory where the sourcefiles are unpacked. |
---|
| 48 | #(you might have to adjust this if autodetection fails) |
---|
| 49 | SRC_DIR=`ls -c|head -1` |
---|
| 50 | #SRC_DIR=ntopng |
---|
| 51 | |
---|
| 52 | #apply patches |
---|
| 53 | #patch -p1 -d $SRC_DIR < no_zc.patch || exit 1 |
---|
| 54 | |
---|
| 55 | pushd $SRC_DIR |
---|
| 56 | |
---|
| 57 | #AUTOMAKE: Configure |
---|
| 58 | #Some usefull stuff you sometimes need to set: |
---|
| 59 | #export LDFLAGS="-L/usr/X11/lib/ -L/usr/lib/mysql/" |
---|
| 60 | #export LD_LIBRARY_PATH=/usr/lib/mysql |
---|
| 61 | #export VPATH=$LD_LIBRARY_PATH |
---|
| 62 | #export CFLAGS="-std=c89" |
---|
| 63 | #export CFLAGS="-fgnu89-inline" #If "multiple definition of `foo'" Also see http://gcc.gnu.org/gcc-4.3/porting_to.html |
---|
| 64 | |
---|
| 65 | #get ndpi sources |
---|
| 66 | pushd .. |
---|
| 67 | #git clone http://github.com/ntop/nDPI.git |
---|
| 68 | unzip nDPI-dev.zip |
---|
| 69 | mv nDPI-dev nDPI |
---|
| 70 | #git clone -b 1.8 https://github.com/ntop/nDPI.git |
---|
| 71 | cd nDPI |
---|
| 72 | ./autogen.sh |
---|
| 73 | make $MAKE_OPTS |
---|
| 74 | popd |
---|
| 75 | |
---|
| 76 | |
---|
| 77 | MAKE_OPTS="" |
---|
| 78 | ./autogen.sh |
---|
| 79 | ./configure --prefix=/usr || exit 1 |
---|
| 80 | |
---|
| 81 | #AUTOMAKE: Compile |
---|
| 82 | make $MAKE_OPTS || exit 1 |
---|
| 83 | |
---|
| 84 | #AUTOMAKE: Test (optional) |
---|
| 85 | if grep ^test: Makefile; then |
---|
| 86 | make pkgconfigdir=/usr/lib/pkgconfig $MAKE_OPTS install || exit 1 |
---|
| 87 | make $MAKE_OPTS test || exit 1 |
---|
| 88 | elif grep ^check: Makefile; then |
---|
| 89 | make pkgconfigdir=/usr/lib/pkgconfig $MAKE_OPTS install || exit 1 |
---|
| 90 | make $MAKE_OPTS check || exit 1 |
---|
| 91 | fi |
---|
| 92 | |
---|
| 93 | #AUTOMAKE: Install |
---|
| 94 | mkdir -p /tmp/pkg &>/dev/null |
---|
| 95 | make pkgconfigdir=/usr/lib/pkgconfig install_prefix=/tmp/pkg DESTDIR=/tmp/pkg INSTALL_ROOT=/tmp/pkg install_root=/tmp/pkg $MAKE_OPTS install || exit 1 |
---|
| 96 | popd |
---|
| 97 | |
---|
| 98 | #strip bins and other stuff |
---|
| 99 | syn3_strip /tmp/pkg || exit 1 |
---|
| 100 | |
---|
| 101 | #move development stuff and create seperate development package |
---|
| 102 | syn3_move_dev /tmp/pkg /tmp/pkgdev || exit 1 |
---|
| 103 | syn3_makepkg /tmp/pkgdev $NAME""_dev $VER $ARCH || exit 1 |
---|
| 104 | |
---|
| 105 | #make main package |
---|
| 106 | syn3_makepkg /tmp/pkg $NAME $VER $ARCH || exit 1 |
---|
| 107 | |
---|
| 108 | |
---|
| 109 | |
---|