Blame autobuild/synfigstudio-release.sh

e96980
#!/bin/bash
e96980
e96980
# Usage notes
e96980
#
e96980
# Running this script will creates release tarballs for all synfig 
e96980
# modules and testing them by installing into ~/local-synfig/.
e96980
#
e96980
# It is also possible to run procedure for each module separately by 
e96980
# passing specific arguments to the script:
e96980
# * Run procedures for ETL:
e96980
#    synfigstudio-release.sh etl
e96980
# * Run procedures for synfig-core:
e96980
#    synfigstudio-release.sh core
e96980
# * Run procedures for synfig-studio:
e96980
#    synfigstudio-release.sh studio
5367b2
# * Run check for localization files:
5367b2
#    synfigstudio-release.sh l10n
e96980
#
e96980
e96980
set -e
e96980
e96980
export SCRIPTPATH=$(cd `dirname "$0"`; pwd)
e96980
export SRCPREFIX=`dirname "$SCRIPTPATH"`
e96980
e96980
e96980
export PREFIX="$HOME/local-synfig"
e96980
export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$PREFIX/lib/pkgconfig"
e96980
export PATH="$PREFIX/bin:$PATH"
e96980
export ETL_VERSION=`cat $SRCPREFIX/ETL/configure.ac |egrep "AC_INIT\(\[Extended Template Library\],"| sed "s|.*Library\],\[||" | sed "s|\],\[.*||"`
e96980
echo "ETL_VERSION=$ETL_VERSION"
e96980
export CORE_VERSION=`cat $SRCPREFIX/synfig-core/configure.ac |egrep "AC_INIT\(\[Synfig Core\],"| sed "s|.*Core\],\[||" | sed "s|\],\[.*||"`
e96980
echo "CORE_VERSION=$CORE_VERSION"
e96980
export STUDIO_VERSION=`cat $SRCPREFIX/synfig-studio/configure.ac |egrep "AC_INIT\(\[Synfig Studio\],"| sed "s|.*Studio\],\[||" | sed "s|\],\[.*||"`
e96980
echo "STUDIO_VERSION=$STUDIO_VERSION"
e96980
9993d9
# Colored output
9993d9
RED='\033[0;31m'
9993d9
YLW='\033[1;33m'
9993d9
GRN='\033[0;32m'
9993d9
NC='\033[0m' # No Color
9993d9
7eb210
if [ -e /etc/debian_version ] && [ -z $with_boost_libdir ]; then
7eb210
	# Debian/Ubuntu multiarch
7eb210
	MULTIARCH_LIBDIR="/usr/lib/`uname -m`-linux-gnu/"
7eb210
	if [ -e "${MULTIARCH_LIBDIR}/libboost_program_options.so" ]; then
7eb210
		export with_boost_libdir=$MULTIARCH_LIBDIR
7eb210
	fi
7eb210
fi
7eb210
7eb210
e96980
if [ -z $THREADS ]; then
e96980
	export THREADS=4
e96980
fi
e96980
9993d9
start_stage() 
5367b2
{
9993d9
	echo -e "Starting ${YLW}$1${NC} stage"
9993d9
}
9993d9
9993d9
end_stage() {
9993d9
	echo "$1 complete."
9993d9
}
9993d9
9993d9
l10n_check()
9993d9
{
9993d9
	cd $2
5367b2
	OUTPUT=`intltool-update -m 2>&1`
5367b2
	
5367b2
	if [ ! -z "${OUTPUT}" ]; then
9993d9
		echo -e "Checking $1 translations... ${RED}Error${NC}"
9993d9
		echo "${OUTPUT}"
9993d9
		exit 1
9993d9
	fi
9993d9
	echo -e "Checking $1 translations... ${GRN}Done${NC}"
9993d9
}
9993d9
9993d9
l10n()
9993d9
{
9993d9
	start_stage "l10n"
9993d9
	l10n_check "Synfig Core" "$SRCPREFIX/synfig-core/po"
9993d9
	l10n_check "Synfig Studio" "$SRCPREFIX/synfig-studio/po"
9993d9
	end_stage "l10n"
5367b2
}
5367b2
e96980
pack-etl()
e96980
{
9993d9
	start_stage "Pack ETL"
e96980
	cd $SRCPREFIX/ETL
e96980
	autoreconf -if
e96980
	./configure --prefix="$PREFIX"
e96980
	make distcheck -j${THREADS}
e96980
	mv ETL-${ETL_VERSION}.tar.gz ../../
9993d9
	end_stage "Pack ETL"
e96980
}
e96980
e96980
test-etl()
e96980
{
9993d9
	start_stage "Test ETL"
e96980
	cd $SRCPREFIX/../
e96980
	tar xf ETL-${ETL_VERSION}.tar.gz
e96980
	cd ETL-${ETL_VERSION}
e96980
	./configure --prefix="$PREFIX"
e96980
	make install -j${THREADS}
e96980
	cd ..
e96980
	rm -rf $SRCPREFIX/../ETL-${ETL_VERSION}
9993d9
	end_stage "Test ETL"
e96980
}
e96980
e96980
etl()
e96980
{
9993d9
	start_stage "ETL"
e96980
	pack-etl
e96980
	test-etl
9993d9
	end_stage "ETL"
e96980
}
e96980
e96980
pack-core()
e96980
{
9993d9
	start_stage "Pack Synfig Core"
e96980
	cd $SRCPREFIX/synfig-core
c70f84
    ./bootstrap.sh
e96980
	./configure --prefix="$PREFIX"
9993d9
	echo "------------------------------------- pack-core make"
e96980
	make distcheck -j${THREADS}
e96980
	mv synfig-${CORE_VERSION}.tar.gz ../../
9993d9
	end_stage "Pack Synfig Core"
e96980
}
e96980
e96980
test-core()
e96980
{
9993d9
	start_stage "Test Synfig Core"
e96980
	cd $SRCPREFIX/../
e96980
	tar xf synfig-${CORE_VERSION}.tar.gz
e96980
	cd synfig-${CORE_VERSION}
e96980
	./configure --prefix="$PREFIX"
e96980
	make install -j${THREADS}
e96980
	cd ..
e96980
	rm -rf $SRCPREFIX/../synfig-${CORE_VERSION}
9993d9
	end_stage "Test Synfig Core"
e96980
}
e96980
e96980
core()
e96980
{
9993d9
	start_stage "Synfig Core"
e96980
	pack-core
e96980
	test-core
9993d9
	end_stage "Synfig Core"
e96980
}
e96980
e96980
pack-studio()
e96980
{
9993d9
	start_stage "Pack Synfig Studio"
e96980
	cd $SRCPREFIX/synfig-studio
e96980
	./bootstrap.sh
e96980
	./configure --prefix="$PREFIX"
e96980
	make distcheck -j${THREADS}
e96980
	mv synfigstudio-${STUDIO_VERSION}.tar.gz ../..
9993d9
	end_stage "Pack Synfig Studio"
e96980
}
e96980
e96980
test-studio()
e96980
{
9993d9
	start_stage "Test Synfig Studio"
e96980
	cd $SRCPREFIX/../
e96980
	tar xf synfigstudio-${STUDIO_VERSION}.tar.gz
e96980
	cd synfigstudio-${STUDIO_VERSION}
e96980
	./configure --prefix="$PREFIX"
e96980
	make install -j${THREADS}
e96980
	cd ..
e96980
	rm -rf $SRCPREFIX/../synfigstudio-${STUDIO_VERSION}
9993d9
	end_stage "Test Synfig Studio"
e96980
}
e96980
e96980
studio()
e96980
{
9993d9
	start_stage "Synfig Studio"
e96980
	pack-studio
e96980
	test-studio
9993d9
	end_stage "Synfig Studio"
e96980
}
e96980
e96980
mkall()
e96980
{
5367b2
	l10n
e96980
	etl
e96980
	core
e96980
	studio
e96980
}
e96980
e96980
do_cleanup()
e96980
{
9993d9
	start_stage "Clean up"
9993d9
	#echo "Cleaning up..."
9993d9
	if [ "${PREFIX}" != "${DEPSPREFIX}" ]; then
e96980
		[ ! -e ${DEPSPREFIX} ] || mv ${DEPSPREFIX} ${DEPSPREFIX}.off
e96980
	fi
e96980
	[ ! -e ${SYSPREFIX} ] || mv ${SYSPREFIX} ${SYSPREFIX}.off
e96980
	exit
e96980
}
e96980
e96980
#trap do_cleanup INT SIGINT SIGTERM EXIT
e96980
e96980
if [ -z $1 ]; then
e96980
	rm -rf "$PREFIX" || true
e96980
	mkall
e96980
else
e96980
	echo "Executing custom user command..."
e96980
e96980
	$@
e96980
fi
e96980
e96980
#do_cleanup