on 8.02+15.04.20150318-0ubuntu1 help sign in
unity8/build.sh
97 lines 2.8 kB history raw
1#!/bin/sh
3SETUP=false
4CLEAN=false
5NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
6CODE_DIR=$( dirname `readlink -f $0` )
8usage() {
9 echo "usage: build [OPTIONS] [BUILD_TYPE]\n" >&2
10 echo "Script to build the shell. If BUILD_TYPE is not specified, it defaults to \"debug\".\n" >&2
11 echo "OPTIONS:" >&2
12 echo " -s, --setup Setup the build environment and branch Unity" >&2
13 echo " -c, --clean Clean the build tree before building" >&2
14 echo >&2
15 exit 1
18ARGS=`getopt -n$0 -u -a --longoptions="setup,clean,help" -o "sch" -- "$@"`
19[ $? -ne 0 ] && usage
20eval set -- "$ARGS"
22while [ $# -gt 0 ]
23do
24 case "$1" in
25 -s|--setup) SETUP=true;;
26 -c|--clean) CLEAN=true;;
27 -h|--help) usage;;
28 --) shift;break;;
29 esac
30 shift
31done
33[ $# -gt 1 ] && usage
35BUILD_TYPE="debug"
36[ $# -eq 1 ] && BUILD_TYPE="$1"
38install_dependencies() {
39 sudo apt-get update || exit 4
40 echo "Installing Unity 8 dependencies.."
41 sudo apt-get install devscripts \
42 equivs \
43 gsettings-desktop-schemas \
44 gsettings-ubuntu-schemas \
45 pay-service \
46 qmenumodel-qml \
47 qml-module-qtquick-layouts \
48 qml-module-qtquick-xmllistmodel \
49 qtdeclarative5-gsettings1.0 \
50 qtdeclarative5-ubuntu-ui-toolkit-plugin \
51 qtdeclarative5-ubuntu-settings-components \
52 qtdeclarative5-ubuntu-telephony0.1 \
53 qtdeclarative5-ubuntu-thumbnailer0.1 \
54 qtdeclarative5-unity-notifications-plugin \
55 qml-module-ubuntu-connectivity \
56 ubuntu-mobile-icons \
57 ubuntu-system-settings \
58 unity-plugin-scopes \
59 xvfb \
60 || exit 5
63mk_build_deps() {
64 if [ ! -f control -o $CODE_DIR/debian/control -nt control ]; then
65 sed 's/\:native//g' $CODE_DIR/debian/control > control
66 mk-build-deps --install --root-cmd sudo control
67 fi
70if [ -f "/usr/bin/ccache" ] ; then
71 if [ "x$CC" = "x" ]; then
72 export CC='ccache gcc'
73 fi
74 if [ "x$CXX" = "x" ] ; then
75 export CXX='ccache g++'
76 fi
77fi
79if [ -f "/usr/bin/ninja" ] ; then
80 GENERATOR="-G Ninja"
81 # Ninja does not need -j, it parallelizes automatically.
82 BUILD_COMMAND="ninja"
83else
84 GENERATOR=
85 BUILD_COMMAND="make -j$NUM_JOBS"
86fi
88if $SETUP; then
89 install_dependencies
90else
91 if $CLEAN; then rm -rf builddir; fi
92 mkdir -p builddir
93 cd builddir
94 mk_build_deps
95 cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CODE_DIR ${GENERATOR} || exit 6
96 ${BUILD_COMMAND} || exit 7
97fi