[480e6a7] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # Slackware build script for ebtables |
---|
| 4 | |
---|
| 5 | # Copyright 2011, mario <mario@slackverse.org> |
---|
| 6 | # All rights reserved. |
---|
| 7 | # |
---|
| 8 | # Redistribution and use of this script, with or without modification, is |
---|
| 9 | # permitted provided that the following conditions are met: |
---|
| 10 | # |
---|
| 11 | # 1. Redistributions of this script must retain the above copyright |
---|
| 12 | # notice, this list of conditions and the following disclaimer. |
---|
| 13 | # |
---|
| 14 | # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED |
---|
| 15 | # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
---|
| 16 | # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO |
---|
| 17 | # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
---|
| 18 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 19 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
---|
| 20 | # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
---|
| 21 | # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
---|
| 22 | # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
---|
| 23 | # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 24 | |
---|
| 25 | PKGNAM=ebtables |
---|
| 26 | VERSION=${VERSION:-2.0.10} |
---|
| 27 | BUILD=${BUILD:-1} |
---|
| 28 | |
---|
| 29 | if [ -z "$ARCH" ]; then |
---|
| 30 | case "$( uname -m )" in |
---|
| 31 | i?86) ARCH=i486 ;; |
---|
| 32 | arm*) ARCH=arm ;; |
---|
| 33 | *) ARCH=$( uname -m ) ;; |
---|
| 34 | esac |
---|
| 35 | fi |
---|
| 36 | |
---|
| 37 | CWD=$(pwd) |
---|
| 38 | TMP=${TMP:-/tmp} |
---|
| 39 | PKG=$TMP/package-$PKGNAM |
---|
| 40 | |
---|
| 41 | if [ "$ARCH" = "i486" ]; then |
---|
| 42 | SLKCFLAGS="-O2 -march=i486 -mtune=i686" |
---|
| 43 | LIBDIRSUFFIX="" |
---|
| 44 | elif [ "$ARCH" = "i686" ]; then |
---|
| 45 | SLKCFLAGS="-O2 -march=i686 -mtune=i686" |
---|
| 46 | LIBDIRSUFFIX="" |
---|
| 47 | elif [ "$ARCH" = "x86_64" ]; then |
---|
| 48 | SLKCFLAGS="-O2 -fPIC" |
---|
| 49 | LIBDIRSUFFIX="64" |
---|
| 50 | else |
---|
| 51 | SLKCFLAGS="-O2" |
---|
| 52 | LIBDIRSUFFIX="" |
---|
| 53 | fi |
---|
| 54 | |
---|
| 55 | rm -rf $PKG |
---|
| 56 | mkdir -p $TMP $PKG |
---|
| 57 | cd $TMP |
---|
| 58 | rm -rf $PKGNAM-v$VERSION-4 |
---|
| 59 | tar xvf $CWD/$PKGNAM-v$VERSION-4.tar.xz || exit 1 |
---|
| 60 | cd $PKGNAM-v$VERSION-4 || exit 1 |
---|
| 61 | chown -R root:root . |
---|
| 62 | find . \ |
---|
| 63 | \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \ |
---|
| 64 | -exec chmod 755 {} \; -o \ |
---|
| 65 | \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ |
---|
| 66 | -exec chmod 644 {} \; |
---|
| 67 | |
---|
| 68 | # Set our CFLAGS and avoid a "warning-as-error" that breaks build |
---|
| 69 | sed -i \ |
---|
| 70 | -e "s|-fPIC -O3|${SLKCFLAGS}|" \ |
---|
| 71 | -e "s|-Wunused|-Wno-error=unused-but-set-variable|" \ |
---|
| 72 | Makefile |
---|
| 73 | |
---|
| 74 | make -j 4 || exit 1 |
---|
| 75 | |
---|
| 76 | make install \ |
---|
| 77 | DESTDIR=$PKG \ |
---|
| 78 | LIBDIR=/usr/lib${LIBDIRSUFFIX} \ |
---|
| 79 | MANDIR=/usr/man \ |
---|
| 80 | BINDIR=/usr/sbin \ |
---|
| 81 | ETCDIR=/etc \ |
---|
| 82 | INITDIR=/etc/rc.d/init.d \ |
---|
| 83 | SYSCONFIGDIR=/etc/sysconfig || exit 1 |
---|
| 84 | |
---|
| 85 | find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ |
---|
| 86 | | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true |
---|
| 87 | |
---|
| 88 | find $PKG/usr/man -type f -exec gzip -9 {} \; |
---|
| 89 | for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done |
---|
| 90 | |
---|
| 91 | mv $PKG/etc/ethertypes $PKG/etc/ethertypes.new |
---|
| 92 | |
---|
| 93 | # Remove Red Hat junk: |
---|
| 94 | rm -rf $PKG/etc/rc.d $PKG/etc/sysconfig |
---|
| 95 | |
---|
| 96 | mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION |
---|
| 97 | cp -a COPYING* ChangeLog INSTALL THANKS $PKG/usr/doc/$PKGNAM-$VERSION |
---|
| 98 | |
---|
| 99 | mkdir -p $PKG/install |
---|
| 100 | cat $CWD/slack-desc > $PKG/install/slack-desc |
---|
| 101 | zcat $CWD/doinst.sh.gz > $PKG/install/doinst.sh |
---|
| 102 | |
---|
| 103 | cd $PKG |
---|
| 104 | /sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz |
---|