4 # Edit these settings to reflect your system
8 export CXX
="ccache g++"
10 # Make sure any errors stop the test
14 echo "Main Barry build test script."
17 echo " ./buildtest.sh /path/to/libopensync-0.22.tar.bz2"
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."
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"
27 echo "You can also set OSYNCROOTDIR_0_40 to the 0.4x opensync directory."
31 if [ "$1" = "-h" ] ; then
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
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."
48 echo "Press enter to continue..."
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
56 echo "No libusb 0.1 library found in pkgconfig, will"
57 echo "not perform libusb 0.1 based tests."
59 echo "Press enter to continue..."
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
67 echo "No libusb 1.0 library found in pkgconfig, will"
68 echo "not perform libusb 1.0 based tests."
70 echo "Press enter to continue..."
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..."
87 if [ -d "build" ] ; then
88 echo "'build' directory already exists, exiting..."
98 # Do we have a ~/.barrytest2 config?
100 if [ -f ~
/.barrytest2
] ; then
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"
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..."
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
144 export PKG_CONFIG_PATH
="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR/lib/pkgconfig:$OSYNCROOTDIR_0_40/lib/pkgconfig"
148 # Create configure script
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
164 .
/configure
--prefix="$BASEPATH/build/rootdir" --disable-sync
167 .
/configure
--prefix="$BASEPATH/build/rootdir" --enable-boost --with-zlib
173 export CXXFLAGS
="-Wall -Werror -ansi -pedantic -O0 -g"
174 .
/configure
--prefix="$BASEPATH/build/rootdir"
181 export CXXFLAGS
="-Wall -Werror -O0 -g"
182 .
/configure
--prefix="$BASEPATH/build/rootdir"
188 cd opensync-plugin-0.4x
189 export CXXFLAGS
="-Wall -Werror -O0 -g"
190 .
/configure
--prefix="$BASEPATH/build/rootdir"
197 export CXXFLAGS
="-Wall -Werror -O0 -g"
198 .
/configure
--prefix="$BASEPATH/build/rootdir"
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..."
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"
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"
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
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" \
256 --enable-opensync-plugin \
257 --enable-opensync-plugin-4x \
259 make $MAKEOPTS install
261 .
/configure
--prefix="$BASEPATH/build/rootdir" \
263 --enable-opensync-plugin \
264 --enable-opensync-plugin-4x \
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"
282 # Test that libusb 0.1 is chosen if not libusb 1.0
283 .
/configure
--prefix="$BASEPATH/build/rootdir" \
285 make $MAKEOPTS install
286 ldd
$BASEPATH/build
/rootdir
/lib
/libbarry.so |
grep libusb-0.1.so
287 rm -rf "$BASEPATH/build/rootdir"
290 # Test that libusb 0.1 is chosen if explicitly asked for
291 .
/configure
--prefix="$BASEPATH/build/rootdir" \
293 make $MAKEOPTS install
294 ldd
$BASEPATH/build
/rootdir
/lib
/libbarry.so |
grep libusb-0.1.so
295 rm -rf "$BASEPATH/build/rootdir"
301 # Test that cleanall cleans up all traces
303 echo "Testing buildgen cleanall..."
304 .
/buildgen.sh cleanall
306 diff -ruN --exclude=CVS
--exclude=.git
--exclude=test --exclude=build .. 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"
322 --enable-opensync-plugin \
323 --enable-opensync-plugin-4x \
327 tar -C ..
/disttree
-xjf barry-
*.
*.
*.
tar.bz2
330 # remove the dist tarballs
331 rm -f barry-
*.
*.
*.
tar.
{bz2
,gz
}
332 # compare our tree with the disttree
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
341 --exclude=autom4te.cache \
345 barry disttree
/barry-
*.
*.
*
351 rm -rf "$BASEPATH/build"
352 echo "All tests passed."