2010-08-06 22:03:53 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
DATE=`date +%d.%m.%Y`
|
2011-04-24 12:39:40 +02:00
|
|
|
[ -z "$ARCH" ] && ARCH=`${HOST}gcc -dumpmachine | cut -d- -f1`
|
2012-02-28 09:34:33 +01:00
|
|
|
VERSION=`cat src/controller/KissCount.hpp | grep APP_VERSION | cut -d\" -f2`
|
2010-12-03 19:21:08 +01:00
|
|
|
DIR="KissCount_build_${VERSION}_${DATE}_${ARCH}"
|
2010-08-06 22:03:53 +02:00
|
|
|
FILE="$DIR.tar.bz2"
|
2011-03-07 09:06:37 +01:00
|
|
|
|
|
|
|
# Debian packaging
|
2011-03-05 12:26:35 +01:00
|
|
|
DEB_DIR="kisscount-${VERSION}"
|
|
|
|
DEBEMAIL=soutade@gmail.com
|
|
|
|
DEBFULLNAME="Grégory Soutadé"
|
|
|
|
export DEBEMAIL DEBFULLNAME
|
2010-08-06 22:03:53 +02:00
|
|
|
|
2012-02-28 09:34:33 +01:00
|
|
|
[ -f "$FILE" ] && rm -f "$FILE"
|
|
|
|
[ -d "$DIR" ] && rm -rf "$DIR"
|
2012-06-07 19:48:52 +02:00
|
|
|
rm -rf "$DIR"
|
2012-02-28 09:34:33 +01:00
|
|
|
mkdir "$DIR"
|
2010-08-20 21:33:59 +02:00
|
|
|
if [ "$1" == "clean" ] ; then
|
2010-08-06 22:03:53 +02:00
|
|
|
make clean
|
2010-08-20 21:33:59 +02:00
|
|
|
fi
|
2010-08-06 22:03:53 +02:00
|
|
|
make || (echo "Compilation failed" ; exit 1)
|
2012-06-14 20:27:58 +02:00
|
|
|
cp -r kc ressources AUTHORS COPYING README* www install.sh "$DIR"
|
2012-06-07 19:52:51 +02:00
|
|
|
rm -rf "$DIR"/ressources/po/*
|
2012-06-07 19:48:52 +02:00
|
|
|
cp -r ressources/po/*.qm "$DIR/ressources/po/" # Copy only QM files
|
2011-04-24 12:39:40 +02:00
|
|
|
find "$DIR" -type f -executable -exec ${HOST}strip \{\} \;
|
2011-01-06 18:33:26 +01:00
|
|
|
tar -jcf "$FILE" "$DIR"
|
|
|
|
rm -rf "$DIR"
|
2011-03-05 12:26:35 +01:00
|
|
|
|
|
|
|
# Debian packaging
|
2011-03-07 09:06:37 +01:00
|
|
|
if [ -d "debian" ] ; then
|
|
|
|
DEB_FILE="kisscount_${VERSION}-1_${ARCH}.deb"
|
2011-03-05 12:26:35 +01:00
|
|
|
rm -rf "$DEB_DIR" "$DEB_FILE"
|
2012-02-28 09:34:33 +01:00
|
|
|
mkdir "$DEB_DIR"
|
2012-06-14 20:27:58 +02:00
|
|
|
cp -r kc.1 kc debian README* ChangeLog AUTHORS COPYING ressources "$DEB_DIR"
|
2012-06-07 19:48:52 +02:00
|
|
|
rm -rf "$DEB_DIR/ressources/po/*"
|
2012-06-07 19:52:51 +02:00
|
|
|
cp -r ressources/po/*.qm "$DEB_DIR"/ressources/po/ # Copy only QM files
|
2011-03-05 12:26:35 +01:00
|
|
|
cd "$DEB_DIR"
|
2012-02-28 09:34:33 +01:00
|
|
|
${HOST}strip kc
|
2011-03-05 12:26:35 +01:00
|
|
|
mv debian/Makefile .
|
2012-02-28 09:34:33 +01:00
|
|
|
[ ! -d src ] && ln -s ../src
|
|
|
|
[ ! -d lib ] && ln -s ../lib
|
2011-03-05 12:26:35 +01:00
|
|
|
#sed -i s/i686/$ARCH/g debian/control
|
|
|
|
#dh_make -f "../$DEB_FILE" --copyright gpl3 --email $DEBEMAIL -s
|
|
|
|
[ "${ARCH}" == "x86_64" ] && ARCH="amd64"
|
2011-03-07 09:06:37 +01:00
|
|
|
[ "${ARCH}" == "i686" ] && ARCH="i386"
|
2012-02-28 09:34:33 +01:00
|
|
|
debuild -us -uc -b -i -a${ARCH} || (cd - ; exit 1)
|
2011-03-05 12:26:35 +01:00
|
|
|
cd -
|
2012-02-28 09:40:42 +01:00
|
|
|
rm -rf "$DEB_DIR" "$DEB_FILE".changes "$DEB_FILE".build
|
2011-03-07 09:06:37 +01:00
|
|
|
fi
|
2011-03-05 12:26:35 +01:00
|
|
|
|
2011-03-07 09:06:37 +01:00
|
|
|
if [ -z "$DEB_FILE" ] ; then
|
|
|
|
echo "Packaged into $FILE !"
|
|
|
|
else
|
|
|
|
echo "Packaged into $FILE and $DEB_FILE !"
|
|
|
|
fi
|