KissCount/tools/package.sh

57 lines
1.7 KiB
Bash
Executable File

#!/bin/bash
DATE=`date +%d.%m.%Y`
[ -z "$ARCH" ] && ARCH=`${HOST}gcc -dumpmachine | cut -d- -f1`
VERSION=`cat src/controller/KissCount.hpp | grep APP_VERSION | cut -d\" -f2`
DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}"
FILE="$DIR.tar.bz2"
# Debian packaging
DEB_DIR="kisscount-${VERSION}"
DEBEMAIL=soutade@gmail.com
DEBFULLNAME="Grégory Soutadé"
export DEBEMAIL DEBFULLNAME
[ -f "$FILE" ] && rm -f "$FILE"
[ -d "$DIR" ] && rm -rf "$DIR"
rm -rf "$DIR"
mkdir "$DIR"
if [ "$1" == "clean" ] ; then
make clean
fi
make || (echo "Compilation failed" ; exit 1)
cp -r kc ressources TODO CONTRIBUTORS COPYING README* www install.sh "$DIR"
rm -rf "$DIR"/ressources/po/*
cp -r ressources/po/*.qm "$DIR/ressources/po/" # Copy only QM files
find "$DIR" -type f -executable -exec ${HOST}strip \{\} \;
tar -jcf "$FILE" "$DIR"
rm -rf "$DIR"
# Debian packaging
if [ -d "debian" ] ; then
DEB_FILE="kisscount_${VERSION}-1_${ARCH}.deb"
rm -rf "$DEB_DIR" "$DEB_FILE"
mkdir "$DEB_DIR"
cp -r kc.1 kc debian README* ChangeLog TODO CONTRIBUTORS COPYING ressources "$DEB_DIR"
rm -rf "$DEB_DIR/ressources/po/*"
cp -r ressources/po/*.qm "$DEB_DIR"/ressources/po/ # Copy only QM files
cd "$DEB_DIR"
${HOST}strip kc
mv debian/Makefile .
[ ! -d src ] && ln -s ../src
[ ! -d lib ] && ln -s ../lib
#sed -i s/i686/$ARCH/g debian/control
#dh_make -f "../$DEB_FILE" --copyright gpl3 --email $DEBEMAIL -s
[ "${ARCH}" == "x86_64" ] && ARCH="amd64"
[ "${ARCH}" == "i686" ] && ARCH="i386"
debuild -us -uc -b -i -a${ARCH} || (cd - ; exit 1)
cd -
rm -rf "$DEB_DIR" "$DEB_FILE".changes "$DEB_FILE".build
fi
if [ -z "$DEB_FILE" ] ; then
echo "Packaged into $FILE !"
else
echo "Packaged into $FILE and $DEB_FILE !"
fi