#!/bin/sh PACKAGE=unity8 UNITY_BUILD_DIR=$PWD/../unity_build/build SETUP=false CLEAN=false NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 )) usage() { echo "usage: build [OPTIONS] [BUILD_TYPE]\n" >&2 echo "Script to build the shell. If BUILD_TYPE is not specified, it defaults to \"debug\".\n" >&2 echo "OPTIONS:" >&2 echo " -s, --setup Setup the build environment and branch Unity" >&2 echo " -c, --clean Clean the build tree before building" >&2 echo >&2 exit 1 } ARGS=`getopt -n$0 -u -a --longoptions="setup,clean,help" -o "sch" -- "$@"` [ $? -ne 0 ] && usage eval set -- "$ARGS" while [ $# -gt 0 ] do case "$1" in -s|--setup) SETUP=true;; -c|--clean) CLEAN=true;; -h|--help) usage;; --) shift;break;; esac shift done [ $# -gt 1 ] && usage BUILD_TYPE="debug" [ $# -eq 1 ] && BUILD_TYPE="$1" install_dependencies() { . /etc/lsb-release [ -f /etc/apt/sources.list.d/phablet-team-desktop-deps-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:phablet-team/desktop-deps || exit 1 [ -f /etc/apt/sources.list.d/canonical-qt5-edgers-qt5-proper-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:canonical-qt5-edgers/qt5-proper || exit 2; [ -f /etc/apt/sources.list.d/ubuntu-sdk-team-ppa-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:ubuntu-sdk-team/ppa || exit 3 sudo apt-get update || exit 4 echo "Installing Unity 8 dependencies.." sudo apt-get install qtdeclarative5-ubuntu-ui-toolkit-plugin qtdeclarative5-dee-plugin indicators-client indicators-client-plugin-* qtbase5-dev qtbase5-private-dev qtdeclarative5-dev qtdeclarative5-dev-tools qtdeclarative5-test-plugin libdee-qt5-dev libpulse-dev qtdeclarative5-xmllistmodel-plugin unity-lens-mock demo-assets ubuntu-mobile-icons libusermetricsoutput1-dev || exit 5 } if [ -f "/usr/bin/ninja" ] ; then GENERATOR="-G Ninja" BUILD_COMMAND="ninja -j$NUM_JOBS" else GENERATOR= BUILD_COMMAND="make -j$NUM_JOBS" fi if $SETUP; then install_dependencies ./build_unity --setup || exit 1$? ./build_unity || exit 1$? else if $CLEAN; then rm -rf builddir; fi mkdir -p builddir cd builddir PKG_CONFIG_PATH=$UNITY_BUILD_DIR/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. ${GENERATOR} || exit 6 ${BUILD_COMMAND} || exit 7 fi