Source code upload
[framework/connectivity/dnsmasq.git] / contrib / slackware-dnsmasq / dnsmasq.SlackBuild
1 #!/bin/sh
2 CWD=`pwd`
3 PKG=/tmp/package-dnsmasq
4
5 VERSION=2.24
6 ARCH=${ARCH:-i486}
7 BUILD=${BUILD:-1}
8
9 if [ "$ARCH" = "i386" ]; then
10   SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
11 elif [ "$ARCH" = "i486" ]; then
12   SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
13 elif [ "$ARCH" = "s390" ]; then
14   SLKCFLAGS="-O2"
15 elif [ "$ARCH" = "x86_64" ]; then
16   SLKCFLAGS="-O2"
17 fi
18
19 rm -rf $PKG
20 mkdir -p $PKG
21 cd /tmp
22 rm -rf dnsmasq-$VERSION
23 tar xzvf $CWD/dnsmasq-$VERSION.tar.gz
24 cd dnsmasq-$VERSION
25 zcat $CWD/dnsmasq.leasedir.diff.gz | patch -p1 --verbose --backup --suffix=.orig || exit
26 chown -R root.root .
27 make install-i18n PREFIX=/usr DESTDIR=$PKG MANDIR=/usr/man
28 chmod 755 $PKG/usr/sbin/dnsmasq
29 chown -R root.bin $PKG/usr/sbin
30 gzip -9 $PKG/usr/man/man8/dnsmasq.8
31 for f in $PKG/usr/share/man/*; do 
32    if [ -f $$f/man8/dnsmasq.8 ]; then 
33         gzip -9 $$f/man8/dnsmasq.8 ; 
34    fi 
35 done
36 gzip -9 $PKG/usr/man/*/man8/dnsmasq.8
37 mkdir -p $PKG/var/state/dnsmasq
38 ( cd $PKG
39   find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
40   find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
41 )
42 mkdir $PKG/etc
43 cat dnsmasq.conf.example > $PKG/etc/dnsmasq.conf.new
44 mkdir $PKG/etc/rc.d
45 zcat $CWD/rc.dnsmasq.gz > $PKG/etc/rc.d/rc.dnsmasq.new
46 mkdir -p $PKG/usr/doc/dnsmasq-$VERSION
47 cp -a \
48   CHANGELOG COPYING FAQ UPGRADING_to_2.0 doc.html setup.html \
49   $PKG/usr/doc/dnsmasq-$VERSION
50 mkdir -p $PKG/install
51 cat $CWD/slack-desc > $PKG/install/slack-desc
52 zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh
53
54 cd $PKG
55 makepkg -l y -c n ../dnsmasq-$VERSION-$ARCH-$BUILD.tgz
56