-
Notifications
You must be signed in to change notification settings - Fork 18
/
daq.SlackBuild
125 lines (111 loc) · 3.63 KB
/
daq.SlackBuild
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/sh
#
# Slackware build script for daq
#
# Copyright 2011-2015 Corrado Franco (http://conraid.net)
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Latest version of this SlackBuild at http://slackers.it/repository
#
# Exit on most errors or unset variables
set -eu
# Set variables:
CWD=$(pwd)
PRGNAME=${PRGNAME:-daq}
PKGNAME=$(echo ${PRGNAME} | tr A-Z a-z)
VERSION=${VERSION:-2.0.5}
PKGVERSION=${VERSION//-/_}
BUILD=${BUILD:-1}
TAG=${TAG:-cf}
TMP=${TMP:-/tmp/pkg}
PKG=${TMP}/package-${PKGNAME}
PKGDOCDIR="${PKG}/usr/doc/${PKGNAME}-${PKGVERSION}"
# Insert document files in this variable
DOCFILES=" COPYING ChangeLog README"
# Automatically determine the architecture we're building on:
if [ -z ${ARCH:=""} ]; then
case "$( uname -m )" in
i?86) ARCH=i686 ;;
arm*) ARCH=arm ;;
# Unless ${ARCH} is already set, use uname -m for all other archs:
*) ARCH=$( uname -m ) ;;
esac
fi
# Set compiling FLAGS
case "${ARCH}" in
i486)
SLKCFLAGS="-O2 -march=i486 -mtune=i686"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
i686)
SLKCFLAGS="-O2 -march=i686 -fomit-frame-pointer"; CHOST="i486"
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
x86_64)
SLKCFLAGS="-O2 -fPIC -fomit-frame-pointer"; CHOST="x86_64"
SLKLDFLAGS="-L/lib64 -L/usr/lib64"; LIBDIRSUFFIX="64"
;;
*)
SLKCFLAGS="-O2"; CHOST=${ARCH}
SLKLDFLAGS=""; LIBDIRSUFFIX=""
;;
esac
# Extract source and prepare:
rm -rf ${PKG}
mkdir -p ${TMP} ${PKG}
cd ${TMP}
rm -rf ${PRGNAME}-${VERSION}
tar xvf ${CWD}/daq-${VERSION}.tar.gz
cd ${PRGNAME}-${VERSION}
# Make sure ownerships and permissions are sane:
chown -R root:root .
chmod -R u+w,go+r-w,a-s .
# Configure
LDFLAGS="${SLKLDFLAGS}" \
CFLAGS="${SLKCFLAGS}" \
CXXFLAGS="${SLKCFLAGS}" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--enable-ipv6 \
--enable-static=no \
--with-libpcap-includes=/usr/include \
--with-libpcap-libraries=/usr/lib${LIBDIRSUFFIX} \
--host=${CHOST}-slackware-linux \
--build=${CHOST}-slackware-linux
# Build and install:
make -j1
make DESTDIR=${PKG} install-strip
# If not using static-libs don't install the static libraries
# This has been bugged upstream
for LIB in libdaq_static libdaq_static_modules; do
rm ${PKG}/usr/lib${LIBDIRSUFFIX}/${LIB}.a
done
rm ${PKG}/usr/lib${LIBDIRSUFFIX}/libdaq_static*
# Add a documentation directory:
mkdir -p ${PKGDOCDIR}
cp -a ${DOCFILES} ${PKGDOCDIR} || true
# Add a slackbuild script:
install -Dm644 ${CWD}/${PKGNAME}.SlackBuild ${PKGDOCDIR}/${PKGNAME}.SlackBuild
# Add slack-desc
install -Dm644 ${CWD}/slack-desc ${PKG}/install/slack-desc
# Create package:
cd ${PKG}
/sbin/makepkg -l y -c n ${CWD}/${PKGNAME}-${PKGVERSION}-${ARCH}-${BUILD}${TAG}.txz