Blame publish.sh

57263e
#!/bin/bash
57263e
94a33e
# you may set env var EXAMPLESROOT (helianthus-examples repo)
94a33e
57263e
set -e
57263e
57263e
ROOT="$(cd `dirname "$0"`; pwd)"
57263e
cd "$ROOT"
57263e
94a33e
if [ -z "$EXAMPLESROOT" ]; then
94a33e
	EXAMPLESROOT="$ROOT/../helianthus-examples"
94a33e
fi
94a33e
57263e
VER="$(git describe --tags)"
57263e
PUBDIR="$ROOT/build-publish"
57263e
mkdir -p "$PUBDIR"
57263e
57263e
57263e
# build win
57263e
if [ "$1" != "fast" ]; then
57263e
	echo " -- build win -- "
57263e
	cd "$ROOT/win"
57263e
	./rebuild-heli-win.sh
57263e
	cd "$ROOT"
57263e
fi
57263e
57263e
57263e
# prepare sources
57263e
echo " -- prepare sources -- "
57263e
SRCNAME="helianthus-src-$VER"
57263e
SRCDIR="$PUBDIR/$SRCNAME"
57263e
rm -rf "$SRCDIR"
57263e
mkdir -p "$SRCDIR"
57263e
cd "$SRCDIR"
57263e
git --work-tree=. checkout .
57263e
cd "$ROOT"
57263e
57263e
57263e
# prepare binaries
57263e
echo " -- prepare binaries -- "
57263e
BINNAME="helianthus-bin-$VER"
57263e
BINDIR="$PUBDIR/$BINNAME"
57263e
rm -rf "$BINDIR"
57263e
cp -r "$ROOT/win/release" "$BINDIR"
57263e
cp -r "$ROOT/win/unpack" "$BINDIR/src"
57263e
rm -f "$BINDIR/src/"*.done
57263e
cp -r "$SRCDIR" "$BINDIR/src/"
57263e
echo "Binary files licensed under GPL. Look license notes in src directory and subdirectories" >> "$BINDIR/readme"
57263e
57263e
94a33e
# prepare examples
94a33e
echo " -- prepare examples -- "
94a33e
HELIROOT="$ROOT" "$EXAMPLESROOT/publish.sh"
94a33e
cp -r "$EXAMPLESROOT/build-publish/"* "$BINDIR/"
94a33e
cp -r "$EXAMPLESROOT/build-publish/"* "$SRCDIR/"
94a33e
rm -rf "$SRCDIR/examples"*/bin
94a33e
94a33e
57263e
# prepare archives
57263e
cd "$PUBDIR"
57263e
echo " -- prepare archives -- "
57263e
rm -f "$BINNAME.tar.gz"
57263e
rm -f "$SRCNAME.tar.gz"
57263e
rm -f "$BINNAME.zip"
57263e
rm -f "$SRCNAME.zip"
57263e
echo     "$BINNAME.tar.gz"
57263e
tar -czf "$BINNAME.tar.gz" "$BINNAME"
57263e
echo     "$SRCNAME.tar.gz"
57263e
tar -czf "$SRCNAME.tar.gz" "$SRCNAME"
57263e
echo     "$BINNAME.zip"
57263e
zip -rq  "$BINNAME.zip" "$BINNAME"
57263e
echo     "$SRCNAME.zip"
57263e
zip -rq  "$SRCNAME.zip" "$SRCNAME"
57263e
cd "$ROOT"
57263e
57263e
echo " -- done -- "