source: npl/system/iptables/iptables.SlackBuild.orig @ 94a6f37

Last change on this file since 94a6f37 was 94a6f37, checked in by Edwin Eefting <edwin@datux.nl>, 6 years ago

iptables upgrade for kernel 4.9

  • Property mode set to 100644
File size: 4.1 KB
Line 
1#!/bin/bash
2
3# Copyright 2008, 2009, 2010, 2012, 2013, 2018  Patrick J. Volkerding, Sebeka, MN, USA
4# All rights reserved.
5#
6# Redistribution and use of this script, with or without modification, is
7# permitted provided that the following conditions are met:
8#
9# 1. Redistributions of this script must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11#
12#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
13#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
15#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
16#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
17#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
18#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
19#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
20#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
21#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22
23cd $(dirname $0) ; CWD=$(pwd)
24
25PKGNAM=iptables
26VERSION=${VERSION:-$(echo iptables-*.tar.?z | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
27BUILD=${BUILD:-1}
28
29NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
30
31# Automatically determine the architecture we're building on:
32if [ -z "$ARCH" ]; then
33  case "$( uname -m )" in
34    i?86) export ARCH=i586 ;;
35    arm*) export ARCH=arm ;;
36    # Unless $ARCH is already set, use uname -m for all other archs:
37       *) export ARCH=$( uname -m ) ;;
38  esac
39fi
40
41# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
42# the name of the created package would be, and then exit. This information
43# could be useful to other scripts.
44if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
45  echo "$PKGNAM-$VERSION-$ARCH-$BUILD.txz"
46  exit 0
47fi
48
49TMP=${TMP:-/tmp}
50PKG=$TMP/package-iptables
51
52if [ "$ARCH" = "i586" ]; then
53  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
54  LIBDIRSUFFIX=""
55elif [ "$ARCH" = "s390" ]; then
56  SLKCFLAGS="-O2"
57  LIBDIRSUFFIX=""
58elif [ "$ARCH" = "x86_64" ]; then
59  SLKCFLAGS="-O2 -fPIC"
60  LIBDIRSUFFIX="64"
61else
62  SLKCFLAGS="-O2"
63  LIBDIRSUFFIX=""
64fi
65
66rm -rf $PKG
67mkdir -p $TMP $PKG
68cd $TMP
69rm -rf iptables-$VERSION
70tar xvf $CWD/iptables-$VERSION.tar.?z || exit 1
71cd iptables-$VERSION || exit 1
72
73chown -R root:root .
74find . \
75 \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
76 -exec chmod 755 {} \; -o \
77 \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
78 -exec chmod 644 {} \;
79
80CFLAGS="$SLKCFLAGS" \
81./configure \
82  --prefix=/usr \
83  --libdir=/usr/lib${LIBDIRSUFFIX} \
84  --sysconfdir=/etc \
85  --mandir=/usr/man \
86  --docdir=/usr/doc/iptables-$VERSION \
87  --enable-devel \
88  --enable-libipq \
89  --enable-bpf-compiler \
90  --enable-nfsynproxy \
91  --disable-static \
92  --build=$ARCH-slackware-linux || exit 1
93
94make $NUMJOBS || make || exit 1
95make install DESTDIR=$PKG || exit 1
96
97# Don't ship .la files:
98rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
99
100find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
101  | cut -f 1 -d : | xargs strip --strip-debug 2> /dev/null
102
103# Compress and link manpages, if any:
104if [ -d $PKG/usr/man ]; then
105  ( cd $PKG/usr/man
106    for manpagedir in $(find . -type d -name "man*") ; do
107      ( cd $manpagedir
108        for eachpage in $( find . -type l -maxdepth 1) ; do
109          ln -s $( readlink $eachpage ).gz $eachpage.gz
110          rm $eachpage
111        done
112        gzip -9 *.?
113      )
114    done
115  )
116fi
117
118mkdir -p $PKG/usr/doc/iptables-$VERSION
119cp -a \
120  COPYING* INCOMPATIBILITIES INSTALL \
121  $PKG/usr/doc/iptables-$VERSION
122
123# If there's a ChangeLog, installing at least part of the recent history
124# is useful, but don't let it get totally out of control:
125if [ -r ChangeLog ]; then
126  DOCSDIR=$(echo $PKG/usr/doc/*-$VERSION)
127  cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
128  touch -r ChangeLog $DOCSDIR/ChangeLog
129fi
130
131mkdir -p $PKG/install
132cat $CWD/slack-desc > $PKG/install/slack-desc
133
134cd $PKG
135/sbin/makepkg -l y -c n $TMP/iptables-$VERSION-$ARCH-$BUILD.txz
136
Note: See TracBrowser for help on using the repository browser.