Blob Blame Raw
#!/bin/bash

# you may set env var HELIROOT (helianthus repo)
# or HELIBUILDER (path to build-program-win.sh script from Helianthus)

set -e

ROOT="$(cd `dirname "$0"`; pwd)"
cd "$ROOT"

if [ -z "$HELIROOT" ]; then
	HELIROOT="$ROOT/../helianthus"
fi

if [ -z "$HELIBUILDER" ]; then
	HELIBUILDER="$HELIROOT/win/build-program-win.sh"
fi


VER="$(git describe --tags)"
rm -rf build-publish
PUBDIR="$ROOT/build-publish/examples-$VER"
mkdir -p "$PUBDIR"
cd "$PUBDIR"


echo "-- prepare sources --"
mkdir -p src
cd src
git --work-tree=. checkout .
cd ..


echo "-- prepare binaries --"
mkdir bin
cd src
for file in *.c; do
	echo "-- -- $file"
	TARGETPATH="$PUBDIR/bin" "$HELIBUILDER" ${file::-2} ${file}
done
cp -r data ../bin/
cd ..


cd ..
echo "-- done --"