source: npl/system/libmnl/libmnl.SlackBuild.orig

Last change on this file was a87727a, checked in by Edwin Eefting <edwin@datux.nl>, 4 years ago

conntrack_tools and deps

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