diff --git a/src/scripts/make-deb.sh b/src/scripts/make-deb.sh new file mode 100755 index 0000000..8050313 --- /dev/null +++ b/src/scripts/make-deb.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# Copyright (c) 2019-2020 The Hush developers +# Released under the GPLv3 + +DEBLOG=deb.log.$$ + +if [ -z $QT_STATIC ]; then + echo "QT_STATIC is not set. Please set it to the base directory of a statically compiled Qt"; + exit 1; +fi + +APP_VERSION=$(cat src/version.h | cut -d\" -f2) +if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi +#if [ -z $PREV_VERSION ]; then echo "PREV_VERSION is not set"; exit 1; fi + +if [ -z $HUSH_DIR ]; then + echo "HUSH_DIR is not set. Please set it to the base directory of hush3.git" + exit 1; +fi + +if [ ! -f $HUSH_DIR/artifacts/komodod ]; then + echo "Couldn't find komodod in $HUSH_DIR/artifacts/. Please build komodod." + exit 1; +fi + +if [ ! -f $HUSH_DIR/artifacts/komodo-cli ]; then + echo "Couldn't find komodo-cli in $HUSH_DIR/artifacts/. Please build komodod." + exit 1; +fi + +echo -n "Cleaning..............." +rm -rf bin/* +rm -rf artifacts/* +make distclean >/dev/null 2>&1 +echo "[OK]" + +echo "" +echo "[Building $APP_VERSION on" `lsb_release -r`" logging to $DEBLOG ]" + +echo -n "Translations............" +QT_STATIC=$QT_STATIC bash src/scripts/dotranslations.sh >/dev/null +echo -n "Configuring............" +$QT_STATIC/bin/qmake silentdragon.pro -spec linux-clang CONFIG+=release > /dev/null +echo "[OK]" + + +echo -n "Building..............." +rm -rf bin/silentdragon* > /dev/null +make clean > /dev/null +./build.sh release > /dev/null +echo "[OK]" + + +# Test for Qt +echo -n "Static link............" +if [[ $(ldd silentdragon | grep -i "Qt") ]]; then + echo "FOUND QT; ABORT"; + exit 1 +fi +echo "[OK]" + + +echo -n "Packaging.............." +APP=SilentDragon-v$APP_VERSION +DIR=bin/$APP +mkdir $DIR > /dev/null +strip silentdragon + +cp silentdragon $DIR > /dev/null +cp $HUSH_DIR/artifacts/komodod $DIR > /dev/null +cp $HUSH_DIR/artifacts/komodo-cli $DIR > /dev/null +cp $HUSH_DIR/artifacts/komodo-tx $DIR > /dev/null +cp $HUSH_DIR/artifacts/hushd $DIR > /dev/null +cp $HUSH_DIR/artifacts/hush-cli $DIR > /dev/null +cp $HUSH_DIR/artifacts/hush-tx $DIR > /dev/null +cp README.md $DIR > /dev/null +cp LICENSE $DIR > /dev/null + +cd bin && tar czf $APP.tar.gz $DIR/ > /dev/null +cd .. + +mkdir artifacts >/dev/null 2>&1 +cp $DIR.tar.gz ./artifacts/$APP-linux.tar.gz +echo "[OK]" + + +if [ -f artifacts/$APP-linux.tar.gz ] ; then + echo -n "Package contents......." + # Test if the package is built OK + if tar tf "artifacts/$APP-linux.tar.gz" | wc -l | grep -q "9"; then + echo "[OK]" + else + echo "[ERROR] Wrong number of files does not match 9" + exit 1 + fi +else + echo "[ERROR]" + exit 1 +fi + +echo -n "Building deb..........." +debdir=bin/deb/silentdragon-v$APP_VERSION +mkdir -p $debdir > /dev/null +mkdir $debdir/DEBIAN +mkdir -p $debdir/usr/local/bin + +cat src/scripts/control | sed "s/RELEASE_VERSION/$APP_VERSION/g" > $debdir/DEBIAN/control + +cp silentdragon $debdir/usr/local/bin/ +# TODO: how does this interact with hushd deb ? +cp $HUSH_DIR/artifacts/komodod $debdir/usr/local/bin/hush-komodod + +mkdir -p $debdir/usr/share/pixmaps/ +cp res/silentdragon.xpm $debdir/usr/share/pixmaps/ + +mkdir -p $debdir/usr/share/applications +cp src/scripts/desktopentry $debdir/usr/share/applications/silentdragon.desktop + +dpkg-deb --build $debdir >/dev/null +cp $debdir.deb artifacts/$DIR.deb +echo "[OK]" + +exit 0 diff --git a/src/scripts/make-linux-bin.sh b/src/scripts/make-linux-bin.sh new file mode 100644 index 0000000..c948250 --- /dev/null +++ b/src/scripts/make-linux-bin.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright (c) 2020 The Hush developers +# Released under the GPLv3 + +DEBLOG=deb.log.$$ +APP_VERSION=$(cat src/version.h | cut -d\" -f2) +if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi + +# This assumes we already have a staticly compiled SD + +echo -n "Packaging.............." +APP=SilentDragon-v$APP_VERSION-linux +DIR=$APP +mkdir $DIR +strip silentdragon + +cp silentdragon $DIR +cp komodod $DIR +cp komodo-cli $DIR +cp komodo-tx $DIR +cp hushd $DIR +cp hush-cli $DIR +cp hush-tx $DIR +cp README.md $DIR +cp LICENSE $DIR +#TODO: and param files? + +tar czf $APP.tar.gz $DIR/ diff --git a/src/scripts/make-only-deb.sh b/src/scripts/make-only-deb.sh new file mode 100755 index 0000000..5cbdab0 --- /dev/null +++ b/src/scripts/make-only-deb.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# Copyright (c) 2020 The Hush developers +# Released under the GPLv3 + +DEBLOG=deb.log.$$ +APP_VERSION=$(cat src/version.h | cut -d\" -f2) +if [ -z $APP_VERSION ]; then echo "APP_VERSION is not set"; exit 1; fi + +# This assumes we already have a staticly compiled SD + +echo -n "Packaging.............." +APP=SilentDragon-v$APP_VERSION +DIR=$APP +mkdir $DIR +strip silentdragon + +cp silentdragon $DIR +cp komodod $DIR +cp komodo-cli $DIR +cp komodo-tx $DIR +cp hushd $DIR +cp hush-cli $DIR +cp hush-tx $DIR +cp README.md $DIR +cp LICENSE $DIR +#TODO: and param files + +tar czf $APP.tar.gz $DIR/ +cd .. + +echo -n "Building deb..........." +debdir=bin/deb/silentdragon-v$APP_VERSION +mkdir -p $debdir > /dev/null +mkdir $debdir/DEBIAN +mkdir -p $debdir/usr/local/bin + +cat src/scripts/control | sed "s/RELEASE_VERSION/$APP_VERSION/g" > $debdir/DEBIAN/control + +cp silentdragon $debdir/usr/local/bin/ +# TODO: how does this interact with hushd deb ? +cp $HUSH_DIR/artifacts/komodod $debdir/usr/local/bin/hush-komodod + +mkdir -p $debdir/usr/share/pixmaps/ +cp res/silentdragon.xpm $debdir/usr/share/pixmaps/ + +mkdir -p $debdir/usr/share/applications +cp src/scripts/desktopentry $debdir/usr/share/applications/silentdragon.desktop + +dpkg-deb --build $debdir >/dev/null +cp $debdir.deb artifacts/$DIR.deb +echo "[OK]" + +exit 0