summaryrefslogtreecommitdiff
path: root/system/pcp/pcp.SlackBuild
blob: 941f80a9d726bdc4d02944681cac041a84a77e06 (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
#!/bin/sh

# Slackware build script for pcp

# Roman Revyakin <rrevyakin@aconex.com> 
# ver 1.1 2009-10-06 
# Much modification by Robby Workman <rworkman@slackbuilds.org>

PRGNAM=pcp
VERSION=2.9.2
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

SRC_VERSION=${VERSION}-1

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

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

set -e

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

autoconf

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --datadir=/usr/share/$PRGNAM \
  --docdir=/usr/doc/$PRGNAM-$VERSION \
  --includedir=/usr/include/$PRGNAM \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --localstatedir=/var/lib/pcp \
  --sysconfdir=/etc \
  --mandir=/usr/man \
  --build=$ARCH-slackware-linux

# This should make the docs and init scripts go to the correct place
sed -i "s%=/usr/doc%=/usr/doc/$PRGNAM-$VERSION%g" src/include/pcp.conf
sed -i "s%=/etc/rc.d/init.d%=/etc/rc.d%g" src/include/pcp.conf

make
make install DIST_ROOT=$PKG

# Don't clobber the config file and init scripts on upgrades
# We'll leave them without the "rc." naming prefix since lots of docs and
# other support files depend on them named without it
mv $PKG/etc/pcp.conf $PKG/etc/pcp.conf.new
mv $PKG/etc/rc.d/pcp $PKG/etc/rc.d/pcp.new
mv $PKG/etc/rc.d/pmie $PKG/etc/rc.d/pmie.new
mv $PKG/etc/rc.d/pmproxy $PKG/etc/rc.d/pmproxy.new

# Install the init scripts non-executable by default
chmod 0644 $PKG/etc/rc.d/*

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

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

# Add the build script and postinstall setup doc to the package docs
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cat $CWD/README.SLACKWARE > $PKG/usr/doc/$PRGNAM-$VERSION/README.SLACKWARE

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

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