Blame autobuild/build.sh

c0f946
#!/usr/bin/env bash
8cebc4
#
8cebc4
# SynfigStudio build script
8cebc4
# Copyright (c) 2008-2018 Konstantin Dmitriev
8cebc4
#
8cebc4
# This package is free software; you can redistribute it and/or
8cebc4
# modify it under the terms of the GNU General Public License as
8cebc4
# published by the Free Software Foundation; either version 2 of
8cebc4
# the License, or (at your option) any later version.
8cebc4
#
8cebc4
# This package is distributed in the hope that it will be useful,
8cebc4
# but WITHOUT ANY WARRANTY; without even the implied warranty of
8cebc4
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
8cebc4
# General Public License for more details.
8cebc4
8cebc4
# = Usage: =
8cebc4
#    ./build.sh [package] [mode]
8cebc4
#
8cebc4
# where:
8cebc4
#   - [package] is all|etl|core|studio
8cebc4
#   - [mode] is full|clean|configure|make
8cebc4
#   
8cebc4
#
8cebc4
# = Examples: =
8cebc4
#
8cebc4
# == Standart mode ==
8cebc4
# Configure and (re)build:
8cebc4
#    ./build.sh
8cebc4
# Configure and make clean build:
8cebc4
#    ./build.sh all full
8cebc4
# Quick rebuild (without configure):
8cebc4
#    ./build.sh all make
8cebc4
# Quick rebuild od synfig-core (without configure):
8cebc4
#    ./build.sh core make
8cebc4
8cebc4
set -e
8cebc4
8cebc4
REPO_DIR=`dirname "$0"`
8cebc4
pushd ${REPO_DIR}/.. > /dev/null
8cebc4
REPO_DIR=`pwd`
8cebc4
popd > /dev/null
8cebc4
8cebc4
RELEASE=8
8cebc4
if [ -z "$PREFIX" ]; then
8cebc4
#PREFIX=$HOME/synfig
8cebc4
PREFIX=`pwd`/build
8cebc4
fi
8cebc4
8cebc4
MAKE_THREADS=2					#count of threads for make
8cebc4
8cebc4
# Allow overriding PREFIX and other settings
8cebc4
if [ -f "./build.conf" ] ; then
8cebc4
	. "./build.conf"
8cebc4
fi
8cebc4
8cebc4
if [ -z $DEBUG ]; then
8cebc4
	export DEBUG=0
8cebc4
fi
8cebc4
8cebc4
if [[ $DEBUG == 1 ]]; then
8cebc4
	DEBUG='--enable-debug --enable-optimization=0'
8cebc4
else
8cebc4
	DEBUG=''
8cebc4
fi
8cebc4
8cebc4
[ -d ETL ] || mkdir ETL
8cebc4
[ -d synfig-core ] || mkdir synfig-core
8cebc4
[ -d synfig-studio ] || mkdir synfig-studio
8cebc4
[ -d "${PREFIX}" ] || mkdir "${PREFIX}"
8cebc4
8cebc4
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig:${PREFIX}/lib64/pkgconfig:/usr/local/lib/pkgconfig:/usr/lib/`uname -i`-linux-gnu/pkgconfig/:$PKG_CONFIG_PATH
8cebc4
export PATH=${PREFIX}/bin:$PATH
8cebc4
export LD_LIBRARY_PATH=${PREFIX}/lib:${PREFIX}/lib64:/usr/local/lib:$LD_LIBRARY_PATH
8cebc4
export LDFLAGS="-Wl,-rpath -Wl,\\\$\$ORIGIN/lib"
8cebc4
8cebc4
#============================== ETL ====================================
8cebc4
8cebc4
etl_clean() {
8cebc4
cd ETL
8cebc4
echo "Cleaning source tree..."
8cebc4
make clean || true
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
etl_configure()
8cebc4
{
8cebc4
cd ETL
8cebc4
echo "Going to configure..."
8cebc4
pushd ${REPO_DIR}/ETL/ >/dev/null
8cebc4
/bin/bash ${REPO_DIR}/ETL/bootstrap.sh
8cebc4
popd
8cebc4
/bin/bash ${REPO_DIR}/ETL/configure --prefix=${PREFIX} --includedir=${PREFIX}/include $DEBUG
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
etl_make()
8cebc4
{
8cebc4
cd ETL
8cebc4
make -j$MAKE_THREADS
8cebc4
sed -i "s|^Cflags: -I\\\${includedir}|Cflags: -I$REPO_DIR\/ETL -I\\\${includedir}|" ETL.pc
8cebc4
make install
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
etl_build()
8cebc4
{
8cebc4
etl_configure
8cebc4
etl_make
8cebc4
}
8cebc4
8cebc4
etl_full()
8cebc4
{
8cebc4
etl_clean
8cebc4
etl_configure
8cebc4
etl_make
8cebc4
}
8cebc4
8cebc4
#======================== Synfig-Core ==================================
8cebc4
8cebc4
core_clean()
8cebc4
{
8cebc4
cd synfig-core
8cebc4
echo "Cleaning source tree..."
8cebc4
make clean || true
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
core_configure()
8cebc4
{
8cebc4
cd synfig-core
8cebc4
pushd ${REPO_DIR}/synfig-core/ >/dev/null
8cebc4
/bin/bash ${REPO_DIR}/synfig-core/bootstrap.sh
8cebc4
popd >/dev/null
8cebc4
if [ -e /etc/debian_version ] && [ -z "$BOOST_CONFIGURE_OPTIONS" ]; then
8cebc4
	# Debian/Ubuntu multiarch
8cebc4
	MULTIARCH_LIBDIR="/usr/lib/`uname -m`-linux-gnu/"
8cebc4
	if [ -e "${MULTIARCH_LIBDIR}/libboost_program_options.so" ]; then
8cebc4
		export BOOST_CONFIGURE_OPTIONS="--with-boost-libdir=$MULTIARCH_LIBDIR"
8cebc4
	fi
8cebc4
fi
8cebc4
/bin/bash ${REPO_DIR}/synfig-core/configure --prefix=${PREFIX} \
8cebc4
	--includedir=${PREFIX}/include \
8cebc4
	--disable-static --enable-shared \
8cebc4
	--with-magickpp \
f9f5a8
	--with-libavcodec \
8cebc4
	--without-included-ltdl \
8cebc4
	$BOOST_CONFIGURE_OPTIONS \
8cebc4
	$DEBUG
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
core_make()
8cebc4
{
8cebc4
cd synfig-core
8cebc4
make -j$MAKE_THREADS
8cebc4
sed -i "s|^includedir=.*$|includedir=$REPO_DIR\/synfig-core\/src|" synfig.pc
8cebc4
make install
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
core_build()
8cebc4
{
8cebc4
core_configure
8cebc4
core_make
8cebc4
}
8cebc4
8cebc4
core_full()
8cebc4
{
8cebc4
core_clean
8cebc4
core_configure
8cebc4
core_make
8cebc4
}
8cebc4
8cebc4
#======================== Synfig-Studio ==================================
8cebc4
8cebc4
studio_clean()
8cebc4
{
8cebc4
cd synfig-studio
8cebc4
echo "Cleaning source tree..."
8cebc4
make clean || true
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
studio_configure()
8cebc4
{
8cebc4
cd synfig-studio
8cebc4
pushd ${REPO_DIR}/synfig-studio/ >/dev/null
8cebc4
/bin/bash ${REPO_DIR}/synfig-studio/bootstrap.sh
8cebc4
popd >/dev/null
8cebc4
/bin/bash ${REPO_DIR}/synfig-studio/configure --prefix=${PREFIX} \
8cebc4
	--includedir=${PREFIX}/include \
8cebc4
	--disable-static \
8cebc4
	--enable-shared \
8cebc4
	--enable-jack \
8cebc4
	--enable-warnings=max $DEBUG
8cebc4
cd ..
8cebc4
}
8cebc4
8cebc4
studio_make()
8cebc4
{
8cebc4
cd synfig-studio
8cebc4
make -j$MAKE_THREADS
8cebc4
make install
8cebc4
for n in AUTHORS COPYING NEWS README
8cebc4
do
8cebc4
  	cp -f ${REPO_DIR}/synfig-studio/$n ${PREFIX}
8cebc4
done
917586
917586
if [ ! -z "$NIX_BUILD_CORES" ]; then
604ba3
	source "`head -n 1 ${MAKE_WRAPPER_PATH}/nix-support/propagated-build-inputs | sed -e 's/[[:space:]]*$//'`/nix-support/setup-hook"
604ba3
	source "${MAKE_WRAPPER_PATH}/nix-support/setup-hook"
5e783e
	wrapProgram "${PREFIX}/bin/synfigstudio" \
917586
		  --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH" \
917586
		  --prefix XCURSOR_PATH : "$ADWAITA_PATH/share/icons" \
917586
		  --set XCURSOR_THEME "Adwaita"
917586
fi
917586
8cebc4
cd ..
34ed8c
msg_done
8cebc4
}
8cebc4
8cebc4
studio_build()
8cebc4
{
8cebc4
studio_configure
8cebc4
studio_make
8cebc4
}
8cebc4
8cebc4
studio_full()
8cebc4
{
8cebc4
studio_clean
8cebc4
studio_configure
8cebc4
studio_make
8cebc4
}
8cebc4
8cebc4
#=============================== ALL ===================================
8cebc4
8cebc4
all_clean()
8cebc4
{
8cebc4
etl_clean
8cebc4
core_clean
8cebc4
studio_clean
8cebc4
}
8cebc4
8cebc4
all_configure()
8cebc4
{
8cebc4
etl_configure
8cebc4
core_configure
8cebc4
studio_configure
8cebc4
}
8cebc4
8cebc4
all_make()
8cebc4
{
8cebc4
etl_make
8cebc4
core_make
8cebc4
studio_make
8cebc4
}
8cebc4
8cebc4
all_build()
8cebc4
{
8cebc4
etl_build
8cebc4
core_build
8cebc4
studio_build
8cebc4
}
8cebc4
8cebc4
all_full()
8cebc4
{
8cebc4
etl_full
8cebc4
core_full
8cebc4
studio_full
8cebc4
}
8cebc4
8cebc4
msg_done()
8cebc4
{
8cebc4
echo
8cebc4
echo
8cebc4
echo "Done. Please check your Synfig installation in"
8cebc4
echo " ${PREFIX}"
8cebc4
echo
8cebc4
echo "You can start Synfig by executing"
8cebc4
echo " ${PREFIX}/bin/synfigstudio"
8cebc4
echo
8cebc4
}
8cebc4
8cebc4
#============================== MAIN ===================================
8cebc4
8cebc4
if [ -z $1 ]; then
8cebc4
	ARG1='all'
8cebc4
else
8cebc4
	ARG1=$1
8cebc4
fi
8cebc4
8cebc4
if [ -z $2 ]; then
8cebc4
	ARG2='build'
8cebc4
else
8cebc4
	ARG2=$2
8cebc4
fi
8cebc4
8cebc4
# executing command
8cebc4
${ARG1}_${ARG2}