#!/bin/bash
set -eux

tmpdir=./tmp

# NOTE: $1 will be set with fdroid builds only.

echo '### prepare source'

(cd .. && make rules && make all_games_html && make mo)

mkdir -p ${tmpdir}
rm -rf ${tmpdir}/*

cp -a ../data ${tmpdir}
cp -a ../docs ${tmpdir}
cp -a ../html-src ${tmpdir}
cp -a ../locale ${tmpdir}
cp -a ../po ${tmpdir}
cp -a ../pysollib ${tmpdir}
cp -a ../scripts ${tmpdir}
cp -a ../pysol.py ${tmpdir}

cp -a main.py ${tmpdir}
mkdir -p ${tmpdir}/data/images/cards/bottoms/trumps-only
echo "" > ${tmpdir}/data/images/cards/bottoms/trumps-only/.keep

echo '### prepare cardsets'

./mkcards
./resize4k ${tmpdir}/data/tiles

cp -a cardsets/* ${tmpdir}/data

echo '### eval version'

./aversion ${tmpdir} > ${tmpdir}/version.txt

echo '### end init'
