3 # Slackware build script for mailcheck
5 # Copyright 2017 Maximilian Friederdorff
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 # set up some variables for the build process
23 if [ "$TMP" = "" ]; then
28 VERSION=${VERSION:-1.91.2}
31 # Detect the architecture
32 if [ -z "$ARCH" ]; then
33 case "$( uname -m )" in
34 i?86) export ARCH=i586 ;;
35 arm*) export ARCH=arm ;;
36 # Unless $ARCH is already set, use uname -m for all other archs:
37 *) export ARCH=$( uname -m ) ;;
41 if [ "$ARCH" = "i486" ]; then
42 SLKCFLAGS="-O2 -march=i486 -mtune=i686"
43 elif [ "$ARCH" = "x86_64" ]; then
47 NUMJOBS=${NUMJOBS:-" -j4 "}
52 # Clean build location in case of previous build attempts
55 rm -rf $TMP/$APP-$VERSION
60 tar -zxvf $CWD/${APP}_${VERSION}.tar.gz || exit 1
61 cd $APP-$VERSION || exit 1
63 # Ensure ownership and permissions are consistant
65 chmod -R u+w,go+r-w,a-s .
70 make install prefix=$PKG || exit
72 # Install documentation
73 mkdir -p $PKG/usr/doc/$APP-$VERSION
74 cp -a COPYING mailcheckrc mailcheck.1 $PKG/usr/doc/$APP-$VERSION
75 find $PKG/usr/doc/$APP-$VERSION -type f -exec chmod 644 {} \;
76 cat $CWD/$APP.SlackBuild > $PKG/usr/doc/$APP-$VERSION/$APP.SlackBuild
78 # Install slack-desc file
80 cat $CWD/slack-desc > $PKG/install/slack-desc
82 # Strip some libraries and binaries
84 find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
85 find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
88 # Compress man pages if they exist
89 if [ -d $PKG/usr/man ]; then
91 find . -type f -exec gzip -9 {} \;
92 for i in $(find . -type l) ; do ln -s $(readlink $i).gz $i.gz ; rm $i ; done
96 # Compress info pages if they exist (and remove the dir file)
97 if [ -d $PKG/usr/info ]; then
98 gzip -9 $PKG/usr/info/*.info
99 rm -f $PKG/usr/info/dir
104 /sbin/makepkg -l y -c n $TMP/$APP-$PKG_VERSION-$ARCH-$BUILD.tgz