on d7014ef help sign in
unity8/build
68 lines 2.4 kB history raw
1#!/bin/sh
3PACKAGE=unity8
4UNITY_BUILD_DIR=$PWD/../unity_build/build
5SETUP=false
6CLEAN=false
7NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
9usage() {
10 echo "usage: build [OPTIONS] [BUILD_TYPE]\n" >&2
11 echo "Script to build the shell. If BUILD_TYPE is not specified, it defaults to \"debug\".\n" >&2
12 echo "OPTIONS:" >&2
13 echo " -s, --setup Setup the build environment and branch Unity" >&2
14 echo " -c, --clean Clean the build tree before building" >&2
15 echo >&2
16 exit 1
19ARGS=`getopt -n$0 -u -a --longoptions="setup,clean,help" -o "sch" -- "$@"`
20[ $? -ne 0 ] && usage
21eval set -- "$ARGS"
23while [ $# -gt 0 ]
24do
25 case "$1" in
26 -s|--setup) SETUP=true;;
27 -c|--clean) CLEAN=true;;
28 -h|--help) usage;;
29 --) shift;break;;
30 esac
31 shift
32done
34[ $# -gt 1 ] && usage
36BUILD_TYPE="debug"
37[ $# -eq 1 ] && BUILD_TYPE="$1"
39install_dependencies() {
40 . /etc/lsb-release
41 [ -f /etc/apt/sources.list.d/phablet-team-desktop-deps-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:phablet-team/desktop-deps || exit 1
42 [ -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;
43 [ -f /etc/apt/sources.list.d/ubuntu-sdk-team-ppa-${DISTRIB_CODENAME}.list ] || sudo add-apt-repository ppa:ubuntu-sdk-team/ppa || exit 3
44 sudo apt-get update || exit 4
45 echo "Installing Unity 8 dependencies.."
46 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 || exit 5
49if [ -f "/usr/bin/ninja" ] ; then
50 GENERATOR="-G Ninja"
51 BUILD_COMMAND="ninja -j$NUM_JOBS"
52else
53 GENERATOR=
54 BUILD_COMMAND="make -j$NUM_JOBS"
55fi
57if $SETUP; then
58 install_dependencies
59 ./build_unity --setup || exit 1$?
60 ./build_unity || exit 1$?
61else
62 if $CLEAN; then rm -rf builddir; fi
63 mkdir -p builddir
64 cd builddir
65 PKG_CONFIG_PATH=$UNITY_BUILD_DIR/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. ${GENERATOR} || exit 6
66 ${BUILD_COMMAND} || exit 7
67fi