# sets up build environemnt to match CI situation

function test_targets(){
	. ../deploy/targets.sh
	. ./context/version.sh
	echo LP_VERSION=${LP_VERSION}
	echo DEBIAN_VERSION_BASE=${DEBIAN_VERSION_BASE}
	echo SERIES=${SERIES}
	echo SUFFIX=${SUFFIX}
	echo SF_DIR=${SF_DIR}
	echo LP_SERIES=${LP_SERIES}
	echo ZI_SERIES=${ZI_SERIES}
	echo STEAM_BRANCH=${STEAM_BRANCH}
	echo ITCH_CHANNEL=${ITCH_CHANNEL}
	echo UBUNTU_PPA=${UBUNTU_PPA}
	echo UPLOAD_SCP=${UPLOAD_SCP}
	echo DOWNLOAD_URI_BASE=${DOWNLOAD_URI_BASE}
}

git_repo=@top_srcdir@
export git_repo
if @top_srcdir@/docker/scripts/setup_ci_variables_test.sh $*; then
	. @top_srcdir@/docker/scripts/setup_ci_variables_test.sh $*
	. @top_srcdir@/docker/scripts/brand.sh @top_srcdir@
	pushd @top_builddir@
	make distclean
	@abs_top_srcdir@/configure --disable-glout progname=${PROGRAM_NAME} progtitle="${PROGRAM_TITLE}"
	popd
	rm -f CI_INFO
	make CI_INFO
	echo ""
	echo ""
	echo '****** CI_INFO ********'
	cat CI_INFO
	OLD_STAGING=${STAGING}
	echo ""
	echo '****** STAGING=true ********'
	STAGING=true
	test_targets
	echo ""
	echo '****** STAGING=false ********'
	STAGING=false
	test_targets

	echo ""
	STAGING=${OLD_STAGING}
fi

