summaryrefslogtreecommitdiff
path: root/libraries/rrdtool/rrdtool.SlackBuild
blob: 977f3e6f818c0429c2e81432abfdf321b72079d7 (plain)
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
#!/bin/sh

# Slackware build script for RRDTool

# Originally written by <youngmug@animeneko.net>
# Modified by the SlackBuilds.org team.
# Versions >= 1.4.2 maintained by Niels Horn <niels.horn@gmail.com>
# revision date: 2010/07/09

PRGNAM=rrdtool
VERSION=${VERSION:-1.4.4}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i486 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

PYTHON=$( python -c 'import sys; print sys.version[:3]' )
PERL=$( eval "$(perl -V:version)"; echo $version )

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  LIBDIRSUFFIX=""
  ARCHQUADLET=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
  ARCHQUADLET=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
  ARCHQUADLET=""
elif [ "$ARCH" = "arm" ]; then
  SLKCFLAGS="-O2 -march=armv4t"
  LIBDIRSUFFIX=""
  ARCHQUADLET="-gnueabi"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
  ARCHQUADLET=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $TMP/$PRGNAM-$VERSION
chown -R root:root .
chmod -R a-s,u+w,go+r-w .

# Correct hard-coded path to lua libs (thanks to pprkut for spotting this one!)
sed "s|/lib/lua|/lib${LIBDIRSUFFIX}/lua|g" -i configure

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
RRDDOCDIR=/usr/doc/$PRGNAM-$VERSION \
./configure \
  --prefix=/usr \
  --mandir=/usr/man \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --disable-static \
  --with-tcllib=/usr/lib${LIBDIRSUFFIX} \
  --build=$ARCH-slackware-linux$ARCHQUADLET \
  --with-perl-options='INSTALLDIRS=vendor' \
  --with-ruby-options="sitedir=\${DESTDIR}/usr/lib${LIBDIRSUFFIX}/ruby/vendor_ruby"

make

# Correct man paths in the Perl bindings.
sed -r -i 's|/usr/share/man|/usr/man|g' bindings/perl-piped/Makefile
sed -r -i 's|/usr/share/man|/usr/man|g' bindings/perl-shared/Makefile

make install DESTDIR=$PKG

find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

find $PKG/usr/man -type f -exec gzip -9 {} \;
for i in $(find $PKG/usr/man -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done

# Remove perllocal.pod and other special files that don't need to be installed,
# as they will overwrite what's already on the system.
find $PKG -name perllocal.pod \
  -o -name ".packlist" \
  -o -name "*.bs" \
  | xargs rm -f

# And remove the directory leftovers
rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/perl5/${PERL}
rm -rf $PKG/usr/lib${LIBDIRSUFFIX}/perl5/site_perl/${PERL}/$ARCH-linux/auto/RRDp

# Set correct permissions (mostly on the Perl bindings)
find $PKG -perm 444 -exec chmod 0644 {} \;
find $PKG -perm 555 -exec chmod 0755 {} \;

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a CHANGES CONTRIBUTORS COPYING COPYRIGHT NEWS README THREADS TODO \
  WIN32-BUILD-TIPS.txt $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}