desktop: CalEditDlg: fixed dialog title bar
[barry.git] / test / buildtest.sh
blobc90e257a2a261cbc7f69cdbb417ababcde1cdebf
1 #!/bin/bash
4 # Edit these settings to reflect your system
6 MAKEOPTS=-j2
7 export CC="ccache gcc"
8 export CXX="ccache g++"
10 # Make sure any errors stop the test
11 set -e
13 Usage() {
14 echo "Main Barry build test script."
15 echo
16 echo "Usage:"
17 echo " ./buildtest.sh /path/to/libopensync-0.22.tar.bz2"
18 echo
19 echo "Or, write a ~/.barrytest2 file that contains shell commands"
20 echo "setting OSYNCROOTDIR to the directory you used as a --prefix"
21 echo "when building your own libopensync."
22 echo
23 echo "Note that this directory must be writable by the user that"
24 echo "runs the test, as the plugin will be installed during the"
25 echo "build test."
26 echo
27 echo "You can also set OSYNCROOTDIR_0_40 to the 0.4x opensync directory."
28 echo
31 if [ "$1" = "-h" ] ; then
32 Usage
33 exit 1
37 # Check whether the desktop 0.22/0.4x optional build tests can be done
39 DESKTOP_OPTIONAL_BUILD_TEST=1
40 if pkg-config --list-all |grep opensync ; then
41 DESKTOP_OPTIONAL_BUILD_TEST=0
42 echo
43 echo "A version of opensync is already installed on your"
44 echo "system in default directories. Therefore the"
45 echo "tests of the optional desktop builds cannot be done,"
46 echo "and will therefore be skipped."
47 echo
48 echo "Press enter to continue..."
49 read
52 LIBUSB_0_1_OPTIONAL_BUILD_TEST=1
53 if ! pkg-config --list-all | grep "libusb " ; then
54 LIBUSB_0_1_OPTIONAL_BUILD_TEST=0
55 echo
56 echo "No libusb 0.1 library found in pkgconfig, will"
57 echo "not perform libusb 0.1 based tests."
58 echo
59 echo "Press enter to continue..."
60 read
63 LIBUSB_1_0_OPTIONAL_BUILD_TEST=1
64 if ! pkg-config --list-all | grep "libusb-1.0 " ; then
65 LIBUSB_1_0_OPTIONAL_BUILD_TEST=0
66 echo
67 echo "No libusb 1.0 library found in pkgconfig, will"
68 echo "not perform libusb 1.0 based tests."
69 echo
70 echo "Press enter to continue..."
71 read
76 # Jump to directory that script is located, if necessary
79 if [ "$(dirname $0)" != "." ] ; then
80 cd "$(pwd)/$(dirname $0)"
81 echo "You ran the script outside the directory it is in."
82 echo "Changing directory to: $(pwd)"
83 echo "If this is not desired, abort now..."
84 sleep 1s
87 if [ -d "build" ] ; then
88 echo "'build' directory already exists, exiting..."
89 exit 1
92 BASEPATH=$(pwd)
93 OSYNCSOURCE="$1"
95 mkdir -p build
98 # Do we have a ~/.barrytest2 config?
100 if [ -f ~/.barrytest2 ] ; then
101 . ~/.barrytest2
106 # First, build opensync in a local directory
109 if [ -n "$OSYNCROOTDIR" ] ; then
110 echo "Using opensync rootdir: $OSYNCROOTDIR"
111 elif [ -z "$OSYNCROOTDIR" -a -n "$OSYNCSOURCE" ] ; then
112 echo "Extracting opensync sources and building..."
113 (cd build && tar xjf "$OSYNCSOURCE" && \
114 cd libopensync-0.22 && \
115 ./configure -prefix="$BASEPATH/build/osyncrootdir" && \
116 make $MAKEOPTS install)
117 OSYNCROOTDIR="$BASEPATH/build/osyncrootdir"
118 else
119 Usage
120 exit 1
123 if [ -n "$OSYNCROOTDIR_0_40" ] ; then
124 echo "Using opensync-0.4x rootdir: $OSYNCROOTDIR_0_40"
130 # Move .. barry into its own buildable directory
132 echo "Moving barry into it's own directory..."
133 mkdir -p build/barry
134 (tar -C .. --exclude=CVS --exclude=.git --exclude=test/build -cf - . | \
135 tar -C build/barry -xf -)
136 diff -ruN --exclude=CVS --exclude=.git --exclude=test --exclude=build .. build/barry
141 # Prepare for Barry building
143 cd build/barry
144 export PKG_CONFIG_PATH="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR/lib/pkgconfig:$OSYNCROOTDIR_0_40/lib/pkgconfig"
148 # Create configure script
150 ./buildgen.sh
154 # Build and test as individual packages
156 echo "Individual package build test..."
158 rm -rf "$BASEPATH/build/rootdir"
160 export CXXFLAGS="-Wall -Werror -O0 -g"
161 ./configure --prefix="$BASEPATH/build/rootdir" --disable-boost
162 make $MAKEOPTS
163 make distclean
164 ./configure --prefix="$BASEPATH/build/rootdir" --disable-sync
165 make $MAKEOPTS
166 make distclean
167 ./configure --prefix="$BASEPATH/build/rootdir" --enable-boost --with-zlib
168 make $MAKEOPTS
169 make install
170 make distclean
172 cd gui
173 export CXXFLAGS="-Wall -Werror -ansi -pedantic -O0 -g"
174 ./configure --prefix="$BASEPATH/build/rootdir"
175 make $MAKEOPTS
176 make install
177 make distclean
178 cd ..
180 cd opensync-plugin
181 export CXXFLAGS="-Wall -Werror -O0 -g"
182 ./configure --prefix="$BASEPATH/build/rootdir"
183 make $MAKEOPTS
184 make install
185 make distclean
186 cd ..
188 cd opensync-plugin-0.4x
189 export CXXFLAGS="-Wall -Werror -O0 -g"
190 ./configure --prefix="$BASEPATH/build/rootdir"
191 make $MAKEOPTS
192 make install
193 make distclean
194 cd ..
196 cd desktop
197 export CXXFLAGS="-Wall -Werror -O0 -g"
198 ./configure --prefix="$BASEPATH/build/rootdir"
199 make $MAKEOPTS
200 make install
201 make distclean
202 cd ..
204 if [ "$DESKTOP_OPTIONAL_BUILD_TEST" = "1" ] ; then
205 BACKUP_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
207 echo "\aTesting optional desktop builds in 10 seconds..."
208 sleep 10s
210 cd desktop
212 # Test only 0.22
213 export PKG_CONFIG_PATH="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR/lib/pkgconfig"
215 export CXXFLAGS="-Wall -Werror -O0 -g"
216 ./configure --prefix="$BASEPATH/build/rootdir"
217 make $MAKEOPTS
218 make install
219 make distclean
221 # Test only 0.4x
222 export PKG_CONFIG_PATH="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR_0_40/lib/pkgconfig"
224 export CXXFLAGS="-Wall -Werror -O0 -g"
225 ./configure --prefix="$BASEPATH/build/rootdir"
226 make $MAKEOPTS
227 make install
228 make distclean
230 # Restore path
231 export PKG_CONFIG_PATH="$BACKUP_PKG_CONFIG_PATH"
233 # Test without evolution (EvoSources.cc dummy code)
234 export CXXFLAGS="-Wall -Werror -O0 -g"
235 ./configure --prefix="$BASEPATH/build/rootdir" --without-evolution
236 make $MAKEOPTS
237 make install
238 make distclean
240 cd ..
245 # Build and test as one package
248 echo "Single build test..."
250 rm -rf "$BASEPATH/build/rootdir"
252 export CXXFLAGS="-Wall -Werror -O0 -g"
253 ./configure --prefix="$BASEPATH/build/rootdir" \
254 --enable-boost \
255 --enable-gui \
256 --enable-opensync-plugin \
257 --enable-opensync-plugin-4x \
258 --enable-desktop
259 make $MAKEOPTS install
260 make distclean
261 ./configure --prefix="$BASEPATH/build/rootdir" \
262 --enable-gui \
263 --enable-opensync-plugin \
264 --enable-opensync-plugin-4x \
265 --enable-desktop
266 make $MAKEOPTS
267 make distclean
270 # Test libusb selection from configure
271 # using with and without selection
273 if [ "$LIBUSB_0_1_OPTIONAL_BUILD_TEST" = "1" -a "$LIBUSB_1_0_OPTIONAL_BUILD_TEST" = "1" ] ; then
274 echo "Testing choosing libusb options..."
275 # Test that libusb 1.0 is chosen by default
276 ./configure --prefix="$BASEPATH/build/rootdir"
277 make $MAKEOPTS install
278 ldd $BASEPATH/build/rootdir/lib/libbarry.so | grep libusb-1.0.so
279 rm -rf "$BASEPATH/build/rootdir"
280 make distclean
282 # Test that libusb 0.1 is chosen if not libusb 1.0
283 ./configure --prefix="$BASEPATH/build/rootdir" \
284 --without-libusb1_0
285 make $MAKEOPTS install
286 ldd $BASEPATH/build/rootdir/lib/libbarry.so | grep libusb-0.1.so
287 rm -rf "$BASEPATH/build/rootdir"
288 make distclean
290 # Test that libusb 0.1 is chosen if explicitly asked for
291 ./configure --prefix="$BASEPATH/build/rootdir" \
292 --with-libusb
293 make $MAKEOPTS install
294 ldd $BASEPATH/build/rootdir/lib/libbarry.so | grep libusb-0.1.so
295 rm -rf "$BASEPATH/build/rootdir"
296 make distclean
301 # Test that cleanall cleans up all traces
303 echo "Testing buildgen cleanall..."
304 ./buildgen.sh cleanall
305 cd "$BASEPATH"
306 diff -ruN --exclude=CVS --exclude=.git --exclude=test --exclude=build .. build/barry
307 cd build/barry
312 # Test 'make dist' (the dist family of targets leaves build evidence
313 # behind, so do this after the cleanall check)
315 echo "Testing 'make dist'..."
317 rm -rf "$BASEPATH/build/rootdir"
319 ./buildgen.sh
320 ./configure \
321 --enable-gui \
322 --enable-opensync-plugin \
323 --enable-opensync-plugin-4x \
324 --enable-desktop
325 make dist
326 mkdir ../disttree
327 tar -C ../disttree -xjf barry-*.*.*.tar.bz2
328 make distcheck
329 make distclean
330 # remove the dist tarballs
331 rm -f barry-*.*.*.tar.{bz2,gz}
332 # compare our tree with the disttree
333 cd ..
334 # skip:
335 # autom4te.cache - autogenerated stuff we don't care about
336 # debian - dist tarball shouldn't have to care about that
337 # m4/ - more autogenerated stuff we dont' care about
338 # po/ - unsure
340 diff -ruN \
341 --exclude=autom4te.cache \
342 --exclude=debian \
343 --exclude='*.m4' \
344 --exclude=po \
345 barry disttree/barry-*.*.*
348 # Success
350 cd "$BASEPATH"
351 rm -rf "$BASEPATH/build"
352 echo "All tests passed."