97 lines
2.5 KiB
Bash
Executable file
97 lines
2.5 KiB
Bash
Executable file
#!/bin/sh
|
|
set -x
|
|
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
VERSION=$(date +"%Y.%m.%d_%H.%M")
|
|
|
|
BUILD=1
|
|
|
|
ARCH=$(uname -m)
|
|
LIBSUFFIX=$(echo $ARCH | grep -o 64)
|
|
|
|
TAG=cyco
|
|
OUTPUT=/tmp
|
|
TMP=/tmp/$TAG
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
|
|
|
|
PREFIX=/usr
|
|
|
|
# Cleaning
|
|
cd $TMP
|
|
rm -fr $PRGNAM-$VERSION
|
|
rm -fr $PKG
|
|
|
|
# Fetching sources
|
|
if [ ! -e $REPOSITORY ] ; then
|
|
git clone http://github.com/clear-code/cutter.git $REPOSITORY
|
|
else
|
|
( cd $REPOSITORY
|
|
git pull
|
|
)
|
|
fi
|
|
cp -R $REPOSITORY $TMP/$PRGNAM-$VERSION
|
|
|
|
# Preparation
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
chown -R root:root .
|
|
find . \
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
-exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
|
|
# Configuration
|
|
[ ! -e configure ] && ./autogen.sh #autoreconf
|
|
./configure \
|
|
--prefix=$PREFIX \
|
|
--mandir=$PREFIX/man \
|
|
--infodir=$PREFIX/info \
|
|
--libdir=$PREFIX/lib$LIBSUFFIX \
|
|
--libexecdir=$PREFIX/libexec \
|
|
--docdir=$PREFIX/doc/$PRGNAM
|
|
|
|
# Building
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
make libdir=$PREFIX/lib$LIBSUFFIX
|
|
|
|
# Installation
|
|
make install DESTDIR=$PKG libdir=$PREFIX/lib$LIBSUFFIX
|
|
|
|
# Cleaning
|
|
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
|
|
|
|
find $PKG$PREFIX/man -type f -name "*.?" -exec gzip -9 {} \;
|
|
find $PKG$PREFIX/info -name "dir" -exec rm {} \;
|
|
find $PKG$PREFIX/info -type f -exec gzip -9 {} \;
|
|
|
|
chown -R root:root .
|
|
find . \
|
|
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
|
|
-exec chmod 755 {} \; -o \
|
|
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
|
|
-exec chmod 644 {} \;
|
|
|
|
# Packaging
|
|
cat <<EOF > $PKG/install/slack-desc
|
|
$PRGNAM: $PRGNAM (Unit Testing Framework for C and C++)
|
|
$PRGNAM:
|
|
$PRGNAM: Cutter is a xUnit family Unit Testing Framework for C and C++.
|
|
$PRGNAM:
|
|
$PRGNAM: This is a list of features of Cutter:
|
|
$PRGNAM: * easy to write tests.
|
|
$PRGNAM: * outputs result with useful format for debugging.
|
|
$PRGNAM: * tests are built as shared libraries.
|
|
$PRGNAM:
|
|
$PRGNAM: http://cutter.sourceforge.net/
|
|
$PRGNAM:
|
|
EOF
|
|
|
|
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
|
|
makepkg -l n -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz
|