-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.SlackBuild
118 lines (89 loc) · 2.85 KB
/
demo.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
#!/bin/sh
PRGNAM=demo-package
VERSION=${VERSION:-1.0}
BUILD=${BUILD:-1}
TAG=${TAG:-_acs}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i486 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp/acs-slackbuild}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
cd $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz --strip-components=1
chown -R root:root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;
# apply patches to source
#patch -p1 < $CWD/files/6fe51a9a.patch
#patch -p1 < $CWD/files/55dd4d32.patch
#patch -p1 < $CWD/files/844ee7df.patch
# configure source
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--localstatedir=/var \
--mandir=/usr/man \
--docdir=/usr/doc/$PRGNAM-$VERSION \
--build=$ARCH-slackware-linux
# build source
make -j 4 all
make -j 4 install DESTDIR=$PKG
# install custom files
mkdir -p $PKG/etc/rc.d
mkdir -p $PKG/etc/logrotate.d
mkdir -p $PKG/etc/acs-packages/cof.d
mkdir -p $PKG/etc/acs-packages/symlink.d
mkdir -p $PKG/usr/share/snmp/mibs
cp $CWD/files/rc.package $PKG/etc/rc.d/rc.package.new
cp $CWD/files/package.logrotate $PKG/etc/logrotate.d/package
cp $CWD/files/package.cof $PKG/etc/cs-packages/cof.d/
cp $CWD/files/package.symlink $PKG/etc/cs-packages/symlink.d/
chmod 644 $PKG/etc/rc.d/rc.package.new
# move files to correct location
# clean up files
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
# copy documentation
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a AUTHOR CONTRIBUTORS COPYING ChangeLog README VERSION TODO \
$PKG/usr/doc/$PRGNAM-$VERSION
cp $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
cp $CWD/$PRGNAM.info $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.info
chown -R root:root $PKG/usr/doc/$PRGNAM-$VERSION
# install install scripts
mkdir -p $PKG/install
cp $CWD/slack-desc $PKG/install/slack-desc
cp $CWD/doinst.sh $PKG/install/doinst.sh
# make package
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
# end of build script