2010-05-11 20:00:31 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for SLOCcount
|
2010-05-13 00:25:34 +02:00
|
|
|
# Written by Aleksandar B. Samardzic <asamardzic@math.rs>
|
2010-05-11 20:00:31 +02:00
|
|
|
# Modified by the SlackBuilds.org project
|
2010-05-13 00:25:34 +02:00
|
|
|
# Updated for Slackware 13.0 by Heinz Wiesinger <pprkut@liwjatan.at>
|
2010-05-11 20:00:31 +02:00
|
|
|
|
|
|
|
PRGNAM=sloccount
|
|
|
|
VERSION=2.26
|
|
|
|
BUILD=${BUILD:-1}
|
|
|
|
TAG=${TAG:-_SBo}
|
2010-05-13 00:25:34 +02:00
|
|
|
|
2010-06-04 07:03:41 +02:00
|
|
|
# Automatically determine the architecture we're building on:
|
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
# Unless $ARCH is already set, use uname -m for all other archs:
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-11 20:00:31 +02:00
|
|
|
CWD=$(pwd)
|
|
|
|
TMP=${TMP:-/tmp/SBo}
|
|
|
|
PKG=$TMP/package-$PRGNAM
|
|
|
|
OUTPUT=${OUTPUT:-/tmp}
|
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:25:34 +02:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
2010-05-11 20:00:31 +02:00
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:25:34 +02:00
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-06-04 07:03:41 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
2010-05-11 20:00:31 +02:00
|
|
|
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 $PRGNAM-$VERSION
|
|
|
|
chown -R root:root .
|
|
|
|
chmod -R u+w,go+r-w,a-s .
|
|
|
|
|
2010-05-13 00:25:34 +02:00
|
|
|
make \
|
|
|
|
CC="gcc -Wall $SLKCFLAGS"
|
2010-05-11 20:00:31 +02:00
|
|
|
|
2010-05-13 00:25:34 +02:00
|
|
|
# avoid make install error
|
|
|
|
mkdir -p $PKG/usr/bin
|
2010-05-11 20:00:31 +02:00
|
|
|
|
2010-05-13 00:25:34 +02:00
|
|
|
make \
|
|
|
|
CC="gcc -Wall $SLKCFLAGS" \
|
|
|
|
PREFIX="$PKG/usr" \
|
|
|
|
MAN_DIR="$PKG/usr/man" \
|
|
|
|
DOC_DIR="$PKG/usr/doc/$PRGNAM-$VERSION" \
|
|
|
|
install
|
2010-05-11 20:00:31 +02:00
|
|
|
|
2010-05-13 00:25:34 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-11 20:00:31 +02:00
|
|
|
|
2010-05-13 00:25:34 +02:00
|
|
|
cp -a COPYING SOURCES $PKG/usr/doc/$PRGNAM-$VERSION
|
2010-05-11 20:00:31 +02:00
|
|
|
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
|
2010-05-13 00:25:34 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|