source: npl/system/libnftnl/libnftnl.SlackBuild.orig @ 892871d

Last change on this file since 892871d 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: 3.7 KB
RevLine 
[94a6f37]1#!/bin/bash
[6a55355]2
[94a6f37]3# Copyright 2014, 2018  Patrick J. Volkerding, Sebeka, Minnesota, USA
[6a55355]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
[94a6f37]23cd $(dirname $0) ; CWD=$(pwd)
24
[6a55355]25PKGNAM=libnftnl
[94a6f37]26VERSION=${VERSION:-$(echo $PKGNAM-*.tar.lz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
[6a55355]27BUILD=${BUILD:-1}
28
[94a6f37]29NUMJOBS=${NUMJOBS:-" -j$(expr $(nproc) + 1) "}
[6a55355]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
[94a6f37]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
[6a55355]49if [ "$ARCH" = "i586" ]; then
50  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
51  LIBDIRSUFFIX=""
52elif [ "$ARCH" = "s390" ]; then
53  SLKCFLAGS="-O2"
54  LIBDIRSUFFIX=""
55elif [ "$ARCH" = "x86_64" ]; then
56  SLKCFLAGS="-O2 -fPIC"
57  LIBDIRSUFFIX="64"
58else
59  SLKCFLAGS="-O2"
60  LIBDIRSUFFIX=""
61fi
62
63TMP=${TMP:-/tmp}
64PKG=$TMP/package-$PKGNAM
65
66rm -rf $PKG
67mkdir -p $TMP $PKG
68
69cd $TMP
70rm -rf $PKGNAM-$VERSION
[94a6f37]71tar xf $CWD/$PKGNAM-$VERSION.tar.lz || exit 1
[6a55355]72cd $PKGNAM-$VERSION || exit 1
73
74chown -R root:root .
75find . \
76  \( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
77  -exec chmod 755 {} \; -o \
78  \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
79  -exec chmod 644 {} \;
80
81CFLAGS="$SLKCFLAGS" \
82CXXFLAGS="$SLKCFLAGS" \
83./configure \
84  --prefix=/usr \
85  --libdir=/usr/lib${LIBDIRSUFFIX} \
86  --sysconfdir=/etc \
87  --localstatedir=/var \
88  --mandir=/usr/man \
89  --docdir=/usr/doc/$PKGNAM-$VERSION \
90  --disable-static \
91  --build=$ARCH-slackware-linux || exit 1
92
93make $NUMJOBS || make || exit 1
94make install DESTDIR=$PKG || exit 1
95
96rm -f $PKG/usr/lib${LIBDIRSUFFIX}/*.la
97
98find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \
99  grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
100
101# Compress and if needed symlink the man pages:
102if [ -d $PKG/usr/man ]; then
103  ( cd $PKG/usr/man
104    for manpagedir in $(find . -type d -name "man*") ; do
105      ( cd $manpagedir
106        for eachpage in $( find . -type l -maxdepth 1) ; do
107          ln -s $( readlink $eachpage ).gz $eachpage.gz
108          rm $eachpage
109        done
110        gzip -9 *.?
111      )
112    done
113  )
114fi
115
116mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
[94a6f37]117cp -a COPYING*  $PKG/usr/doc/$PKGNAM-$VERSION
[6a55355]118
119mkdir -p $PKG/install
120cat $CWD/slack-desc > $PKG/install/slack-desc
121
122cd $PKG
123/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
Note: See TracBrowser for help on using the repository browser.