on 7.85+14.04.20140415.2-0ubuntu1 help sign in
unity8/build
92 lines 2.6 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 qmenumodel-qml \
46 qtdeclarative5-dee-plugin \
47 qtdeclarative5-gsettings1.0 \
48 qtdeclarative5-ubuntu-ui-toolkit-plugin \
49 qtdeclarative5-ubuntu-settings-components \
50 qtdeclarative5-ubuntu-thumbnailer0.1 \
51 unity-notifications-impl \
52 qtdeclarative5-xmllistmodel-plugin \
53 ubuntu-mobile-icons \
54 unity-scope-home \
55 unity-lens-applications \
56 unity-plugin-scopes \
57 xvfb \
58 || exit 5
61mk_build_deps() {
62 [ ! -f unity8-build-deps*deb -o $CODE_DIR/debian/control -nt unity8-build-deps*deb ] && mk-build-deps --install --root-cmd sudo $CODE_DIR/debian/control
65if [ -f "/usr/bin/ccache" ] ; then
66 if [ "x$CC" = "x" ]; then
67 export CC='ccache gcc'
68 fi
69 if [ "x$CXX" = "x" ] ; then
70 export CXX='ccache g++'
71 fi
72fi
74if [ -f "/usr/bin/ninja" ] ; then
75 GENERATOR="-G Ninja"
76 # Ninja does not need -j, it parallelizes automatically.
77 BUILD_COMMAND="ninja"
78else
79 GENERATOR=
80 BUILD_COMMAND="make -j$NUM_JOBS"
81fi
83if $SETUP; then
84 install_dependencies
85else
86 if $CLEAN; then rm -rf builddir; fi
87 mkdir -p builddir
88 cd builddir
89 mk_build_deps
90 cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CODE_DIR ${GENERATOR} || exit 6
91 ${BUILD_COMMAND} || exit 7
92fi