on xenial help sign in
Improve build scripts error reporting and interactivity.
09ab175Michał Sawicz
build+10−9
@@ -37,12 +37,13 @@ BUILD_TYPE="debug"
37[ $# -eq 1 ] && BUILD_TYPE="$1"
37[ $# -eq 1 ] && BUILD_TYPE="$1"
38
38
39install_dependencies() {
39install_dependencies() {
40+ . /etc/lsb-release
40− sudo add-apt-repository -y ppa:phablet-team/desktop-deps || exit 1
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
41− sudo add-apt-repository -y ppa:canonical-qt5-edgers/qt5-proper || exit 2;
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;
42− sudo add-apt-repository -y ppa:ubuntu-sdk-team/ppa || exit 3
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
43 sudo apt-get update || exit 4
44 sudo apt-get update || exit 4
44− echo "Installing dependencies.."
45+ echo "Installing Unity 8 dependencies.."
45− sudo apt-get install -y 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 6
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
46}
47}
47
48
48if [ -f "/usr/bin/ninja" ] ; then
49if [ -f "/usr/bin/ninja" ] ; then
@@ -55,13 +56,13 @@ fi
55
56
56if $SETUP; then
57if $SETUP; then
57 install_dependencies
58 install_dependencies
58− ./build_unity --setup || exit 6
59+ ./build_unity --setup || exit 1$?
59− ./build_unity
60+ ./build_unity || exit 1$?
60else
61else
61 if $CLEAN; then rm -rf builddir; fi
62 if $CLEAN; then rm -rf builddir; fi
62 mkdir -p builddir
63 mkdir -p builddir
63 cd builddir
64 cd builddir
64− PKG_CONFIG_PATH=$UNITY_BUILD_DIR/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. ${GENERATOR}
65+ PKG_CONFIG_PATH=$UNITY_BUILD_DIR/lib/pkgconfig/:$PKG_CONFIG_PATH cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE .. ${GENERATOR} || exit 6
65− ${BUILD_COMMAND}
66+ ${BUILD_COMMAND} || exit 7
66fi
67fi
67
68
build_unity+34−27
@@ -39,52 +39,58 @@ do
39 shift
39 shift
40done
40done
41
41
42−install_dependencies() {
42+install_utils() {
43+ echo "Installing build utilities.."
44+ sudo apt-get install devscripts equivs || exit 4
45+}
46+
47+mk_build_deps() {
43 echo "Installing build dependencies.."
48 echo "Installing build dependencies.."
44− sudo apt-get build-dep -y libunity unity || exit 4
49+ cd $TARGET_DIR
45− sudo apt-get install -y libgtest-dev gnome-common libfolks-dev libtelepathy-glib-dev || exit 5
50+ sudo mk-build-deps -B -i $TARGET_DIR/libunity/debian/control || exit 5
46− # HUD dependencies
51+ sudo mk-build-deps -B -i $TARGET_DIR/unity/debian/control || exit 6
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
52+ sudo mk-build-deps -B -i $TARGET_DIR/people_lens/debian/control || exit 7
53+ sudo mk-build-deps -B -i $TARGET_DIR/hud/debian/control || exit 8
48}
54}
49
55
50branch_libunity() {
56branch_libunity() {
51 echo "Branching libunity.."
57 echo "Branching libunity.."
52− bzr branch lp:libunity/phablet $TARGET_DIR/libunity
58+ bzr branch lp:libunity/phablet $TARGET_DIR/libunity || exit 9
53}
59}
54
60
55branch_unity() {
61branch_unity() {
56 echo "Branching Unity.."
62 echo "Branching Unity.."
57− bzr branch lp:unity/phablet-mods $TARGET_DIR/unity
63+ bzr branch lp:unity/phablet-mods $TARGET_DIR/unity || exit 10
58}
64}
59
65
60branch_people_lens() {
66branch_people_lens() {
61 echo "Branching people lens.."
67 echo "Branching people lens.."
62− bzr branch lp:unity-lens-people $TARGET_DIR/people_lens
68+ bzr branch lp:unity-lens-people $TARGET_DIR/people_lens || exit 11
63}
69}
64
70
65branch_hud() {
71branch_hud() {
66 echo "Branching hud.."
72 echo "Branching hud.."
67− bzr branch lp:hud $TARGET_DIR/hud
73+ bzr branch lp:hud $TARGET_DIR/hud || exit 12
68}
74}
69
75
70update_unity() {
76update_unity() {
71 echo "Updating Unity.."
77 echo "Updating Unity.."
72− bzr pull -d $TARGET_DIR/unity
78+ bzr pull -d $TARGET_DIR/unity || exit 13
73}
79}
74
80
75update_libunity() {
81update_libunity() {
76 echo "Updating libunity.."
82 echo "Updating libunity.."
77− bzr pull -d $TARGET_DIR/libunity
83+ bzr pull -d $TARGET_DIR/libunity || exit 14
78}
84}
79
85
80update_people_lens() {
86update_people_lens() {
81 echo "Updating people lens.."
87 echo "Updating people lens.."
82− bzr pull -d $TARGET_DIR/people_lens
88+ bzr pull -d $TARGET_DIR/people_lens || exit 15
83}
89}
84
90
85update_hud() {
91update_hud() {
86 echo "Updating hud"
92 echo "Updating hud"
87− bzr pull -d $TARGET_DIR/hud
93+ bzr pull -d $TARGET_DIR/hud || exit 16
88}
94}
89
95
90compile_libunity() {
96compile_libunity() {
@@ -93,12 +99,12 @@ compile_libunity() {
93 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/libunity --quiet --unknown --ignored --force; fi
99 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/libunity --quiet --unknown --ignored --force; fi
94
100
95 cd $TARGET_DIR/libunity
101 cd $TARGET_DIR/libunity
96− bzr revert --quiet -r $LIBUNITY_REV || exit 8
102+ bzr revert --quiet -r $LIBUNITY_REV || exit 17
97
103
98− ./autogen.sh --prefix $BUILD_DIR --disable-debug
104+ ./autogen.sh --prefix $BUILD_DIR --disable-debug || exit 18
99
105
100 echo "Building libunity and installing in " $BUILD_DIR
106 echo "Building libunity and installing in " $BUILD_DIR
101− make -j$NUM_JOBS install
107+ make -j$NUM_JOBS install || exit 19
102
108
103}
109}
104
110
@@ -108,17 +114,16 @@ compile_unity_core() {
108 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/unity --quiet --unknown --ignored --force; fi
114 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/unity --quiet --unknown --ignored --force; fi
109
115
110 cd $TARGET_DIR/unity
116 cd $TARGET_DIR/unity
111− bzr revert --quiet -r $UNITY_REV || exit 9
117+ bzr revert --quiet -r $UNITY_REV || exit 20
112
118
113 mkdir $TARGET_DIR/unity/build
119 mkdir $TARGET_DIR/unity/build
114 cd $TARGET_DIR/unity/build
120 cd $TARGET_DIR/unity/build
115
121
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
122+ 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 || exit 21
117
123
118 echo "Building UnityCore and installing in " $BUILD_DIR
124 echo "Building UnityCore and installing in " $BUILD_DIR
119 cd UnityCore
125 cd UnityCore
120− make -j$NUM_JOBS
126+ make -j$NUM_JOBS install || exit 21
121− make install
122
127
123}
128}
124
129
@@ -128,12 +133,12 @@ compile_people_lens() {
128 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/people_lens --quiet --unknown --ignored --force; fi
133 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/people_lens --quiet --unknown --ignored --force; fi
129
134
130 cd $TARGET_DIR/people_lens
135 cd $TARGET_DIR/people_lens
131− bzr revert --quiet -r $PEOPLE_LENS_REV || exit 10
136+ bzr revert --quiet -r $PEOPLE_LENS_REV || exit 22
132
137
133− PKG_CONFIG_PATH=$BUILD_DIR/lib/pkgconfig:$PKG_CONFIG_PATH ./autogen.sh --prefix $BUILD_DIR --enable-localinstall
138+ PKG_CONFIG_PATH=$BUILD_DIR/lib/pkgconfig:$PKG_CONFIG_PATH ./autogen.sh --prefix $BUILD_DIR --enable-localinstall || exit 23
134
139
135 echo "Building people lens and installing in " $BUILD_DIR
140 echo "Building people lens and installing in " $BUILD_DIR
136− MAINTAINER_VALAFLAGS="--vapidir=${BUILD_DIR}/share/vala/vapi" make -j$NUM_JOBS install
141+ MAINTAINER_VALAFLAGS="--vapidir=${BUILD_DIR}/share/vala/vapi" make -j$NUM_JOBS install || exit 24
137
142
138}
143}
139
144
@@ -143,15 +148,15 @@ compile_hud() {
143 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/hud --quiet --unknown --ignored --force; fi
148 if $CLEAN; then bzr clean-tree -d $TARGET_DIR/hud --quiet --unknown --ignored --force; fi
144
149
145 cd $TARGET_DIR/hud
150 cd $TARGET_DIR/hud
146− bzr revert -r $HUD_REV || exit 11
151+ bzr revert -r $HUD_REV || exit 25
147
152
148 mkdir $TARGET_DIR/hud/build
153 mkdir $TARGET_DIR/hud/build
149 cd $TARGET_DIR/hud/build
154 cd $TARGET_DIR/hud/build
150
155
151− cmake $TARGET_DIR/hud/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$BUILD_DIR -DCMAKE_INSTALL_LIBDIR=lib -DLOCAL_INSTALL=ON -DENABLE_TESTS=OFF
156+ cmake $TARGET_DIR/hud/ -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$BUILD_DIR -DCMAKE_INSTALL_LIBDIR=lib -DLOCAL_INSTALL=ON -DENABLE_TESTS=OFF || exit 26
152
157
153 echo "Building hud and installing in " $BUILD_DIR
158 echo "Building hud and installing in " $BUILD_DIR
154− make install
159+ make install || exit 27
155
160
156}
161}
157
162
@@ -165,17 +170,19 @@ link_lenses() {
165
170
166if $SETUP; then
171if $SETUP; then
167 echo "Setting up environment for building Unity.."
172 echo "Setting up environment for building Unity.."
168− install_dependencies
173+ install_utils
169 mkdir -p $TARGET_DIR
174 mkdir -p $TARGET_DIR
170 branch_libunity
175 branch_libunity
171 branch_unity
176 branch_unity
172 branch_people_lens
177 branch_people_lens
173 branch_hud
178 branch_hud
179+ mk_build_deps
174elif $UPDATE; then
180elif $UPDATE; then
175 update_libunity
181 update_libunity
176 update_unity
182 update_unity
177 update_people_lens
183 update_people_lens
178 update_hud
184 update_hud
185+ mk_build_deps
179else
186else
180 if $CLEAN; then rm -Rf $BUILD_DIR; fi
187 if $CLEAN; then rm -Rf $BUILD_DIR; fi
181 mkdir -p $BUILD_DIR
188 mkdir -p $BUILD_DIR