~unity-team/+junk/dashboard-playground

« back to all changes in this revision

Viewing changes to build_unity

  • Committer: Michał Sawicz
  • Date: 2013-06-05 22:03:08 UTC
  • Revision ID: michal.sawicz@canonical.com-20130605220308-yny8fv3futtr04fg
Inital unity8 commit.

Previous history can be found at https://code.launchpad.net/~unity-team/unity/phablet

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
TARGET_DIR=$PWD/../unity_build
 
4
BUILD_DIR=$TARGET_DIR/build
 
5
SETUP=false
 
6
UPDATE=false
 
7
CLEAN=false
 
8
NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
 
9
LENSES="applications mockmusic mockvideos"
 
10
 
 
11
# verified working revisions
 
12
LIBUNITY_REV=215
 
13
UNITY_REV=3260
 
14
PEOPLE_LENS_REV=74
 
15
HUD_REV=252
 
16
 
 
17
usage() {
 
18
    echo "usage: build_unity [OPTIONS]\n"
 
19
    echo "Script to build Unity on Ubuntu 12.10.\n"
 
20
    echo "OPTIONS:"
 
21
    echo "  -s, --setup   Setup the build environment and branch Unity"
 
22
    echo "  -u, --update  Update Unity's source code"
 
23
    echo "  -c, --clean   Clean build trees before building"
 
24
    exit 1
 
25
}
 
26
 
 
27
set -- `getopt -n$0 -u -a --longoptions="setup,update,clean,help" "such" "$@"`
 
28
 
 
29
# FIXME: giving incorrect arguments does not call usage and exit
 
30
while [ $# -gt 0 ]
 
31
do
 
32
    case "$1" in
 
33
       -s|--setup)   SETUP=true;;
 
34
       -u|--update)  UPDATE=true;;
 
35
       -c|--clean)   CLEAN=true;;
 
36
       -h|--help)    usage;;
 
37
       --)           shift;break;;
 
38
    esac
 
39
    shift
 
40
done
 
41
 
 
42
install_dependencies() {
 
43
    echo "Installing build dependencies.."
 
44
    sudo apt-get build-dep -y libunity unity || exit 4
 
45
    sudo apt-get install -y libgtest-dev gnome-common libfolks-dev libtelepathy-glib-dev || exit 5
 
46
    # HUD dependencies
 
47
    sudo apt-get install -y bamfdaemon debhelper dh-autoreconf gir1.2-dee-1.0 gnome-common gnome-doc-utils gobject-introspection gtk-doc-tools indicator-application indicator-appmenu indicator-appmenu-tools intltool libappindicator3-dev libbamf3-dev libdbusmenu-glib-dev libdbusmenu-gtk3-dev libdbusmenu-jsonloader-dev libdbustest1-dev libdee-dev libgirepository1.0-dev libgtk-3-dev libncurses5-dev libreadline-dev libsqlite3-dev metacity sqlite3 valac-0.18 libpocketsphinx-dev libsphinxbase-dev  || exit 6
 
48
}
 
49
 
 
50
branch_libunity() {
 
51
    echo "Branching libunity.."
 
52
    bzr branch lp:libunity/phablet $TARGET_DIR/libunity
 
53
}
 
54
 
 
55
branch_unity() {
 
56
    echo "Branching Unity.."
 
57
    bzr branch lp:unity/phablet-mods $TARGET_DIR/unity
 
58
}
 
59
 
 
60
branch_people_lens() {
 
61
    echo "Branching people lens.."
 
62
    bzr branch lp:unity-lens-people $TARGET_DIR/people_lens
 
63
}
 
64
 
 
65
branch_hud() {
 
66
    echo "Branching hud.."
 
67
    bzr branch lp:hud $TARGET_DIR/hud
 
68
}
 
69
 
 
70
update_unity() {
 
71
    echo "Updating Unity.."
 
72
    bzr pull -d $TARGET_DIR/unity
 
73
}
 
74
 
 
75
update_libunity() {
 
76
    echo "Updating libunity.."
 
77
    bzr pull -d $TARGET_DIR/libunity
 
78
}
 
79
 
 
80
update_people_lens() {
 
81
    echo "Updating people lens.."
 
82
    bzr pull -d $TARGET_DIR/people_lens
 
83
}
 
84
 
 
85
update_hud() {
 
86
    echo "Updating hud"
 
87
    bzr pull -d $TARGET_DIR/hud
 
88
}
 
89
 
 
90
compile_libunity() {
 
91
    echo "Configuring libunity.."
 
92
 
 
93
    if $CLEAN; then bzr clean-tree -d $TARGET_DIR/libunity --quiet --unknown --ignored --force; fi
 
94
 
 
95
    cd $TARGET_DIR/libunity
 
96
    bzr revert --quiet -r $LIBUNITY_REV || exit 8
 
97
 
 
98
    ./autogen.sh --prefix $BUILD_DIR --disable-debug
 
99
 
 
100
    echo "Building libunity and installing in " $BUILD_DIR
 
101
    make -j$NUM_JOBS install
 
102
 
 
103
}
 
104
 
 
105
compile_unity_core() {
 
106
    echo "Configuring Unity.."
 
107
 
 
108
    if $CLEAN; then bzr clean-tree -d $TARGET_DIR/unity --quiet --unknown --ignored --force; fi
 
109
 
 
110
    cd $TARGET_DIR/unity
 
111
    bzr revert --quiet -r $UNITY_REV || exit 9
 
112
 
 
113
    mkdir $TARGET_DIR/unity/build
 
114
    cd $TARGET_DIR/unity/build
 
115
 
 
116
    PKG_CONFIG_PATH=$BUILD_DIR/lib/pkgconfig:$PKG_CONFIG_PATH cmake $TARGET_DIR/unity -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$BUILD_DIR -DCOMPIZ_PLUGIN_INSTALL_TYPE=local -DGSETTINGS_LOCALINSTALL=ON
 
117
 
 
118
    echo "Building UnityCore and installing in " $BUILD_DIR
 
119
    cd UnityCore
 
120
    make -j$NUM_JOBS
 
121
    make install
 
122
 
 
123
}
 
124
 
 
125
compile_people_lens() {
 
126
    echo "Configuring people lens.."
 
127
 
 
128
    if $CLEAN; then bzr clean-tree -d $TARGET_DIR/people_lens --quiet --unknown --ignored --force; fi
 
129
 
 
130
    cd $TARGET_DIR/people_lens
 
131
    bzr revert --quiet -r $PEOPLE_LENS_REV || exit 10
 
132
 
 
133
    PKG_CONFIG_PATH=$BUILD_DIR/lib/pkgconfig:$PKG_CONFIG_PATH ./autogen.sh --prefix $BUILD_DIR --enable-localinstall
 
134
 
 
135
    echo "Building people lens and installing in " $BUILD_DIR
 
136
    MAINTAINER_VALAFLAGS="--vapidir=${BUILD_DIR}/share/vala/vapi" make -j$NUM_JOBS install
 
137
 
 
138
}
 
139
 
 
140
compile_hud() {
 
141
    echo "Configuring hud.."
 
142
 
 
143
    if $CLEAN; then bzr clean-tree -d $TARGET_DIR/hud --quiet --unknown --ignored --force; fi
 
144
 
 
145
    cd $TARGET_DIR/hud
 
146
    bzr revert -r $HUD_REV || exit 11
 
147
 
 
148
    mkdir $TARGET_DIR/hud/build
 
149
    cd $TARGET_DIR/hud/build
 
150
 
 
151
    cmake $TARGET_DIR/hud/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$BUILD_DIR -DCMAKE_INSTALL_LIBDIR=lib -DLOCAL_INSTALL=ON -DENABLE_TESTS=OFF
 
152
 
 
153
    echo "Building hud and installing in " $BUILD_DIR
 
154
    make install
 
155
 
 
156
}
 
157
 
 
158
link_lenses() {
 
159
    echo "Linking system lenses.."
 
160
    mkdir -p $BUILD_DIR/share/unity/lenses/
 
161
    for LENS in $LENSES; do
 
162
        [ -e $BUILD_DIR/share/unity/lenses/$LENS ] || ln -ivs /usr/share/unity/lenses/$LENS $BUILD_DIR/share/unity/lenses/$LENS
 
163
    done
 
164
}
 
165
 
 
166
if $SETUP; then
 
167
    echo "Setting up environment for building Unity.."
 
168
    install_dependencies
 
169
    mkdir -p $TARGET_DIR
 
170
    branch_libunity
 
171
    branch_unity
 
172
    branch_people_lens
 
173
    branch_hud
 
174
elif $UPDATE; then
 
175
    update_libunity
 
176
    update_unity
 
177
    update_people_lens
 
178
    update_hud
 
179
else
 
180
    if $CLEAN; then rm -Rf $BUILD_DIR; fi
 
181
    mkdir -p $BUILD_DIR
 
182
    compile_libunity
 
183
    compile_unity_core
 
184
    compile_people_lens
 
185
    compile_hud
 
186
    link_lenses
 
187
fi
 
188