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. Tests the master branch by default."
17 echo " ./buildtest.sh [commit] [/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..."
96 if [ -z "$COMMIT" ] ; then
103 # Do we have a ~/.barrytest2 config?
105 if [ -f ~
/.barrytest2
] ; then
111 # First, build opensync in a local directory
114 if [ -n "$OSYNCROOTDIR" ] ; then
115 echo "Using opensync rootdir: $OSYNCROOTDIR"
116 elif [ -z "$OSYNCROOTDIR" -a -n "$OSYNCSOURCE" ] ; then
117 echo "Extracting opensync sources and building..."
118 (cd build
&& tar xjf
"$OSYNCSOURCE" && \
119 cd libopensync-0.22
&& \
120 .
/configure
-prefix="$BASEPATH/build/osyncrootdir" && \
121 make $MAKEOPTS install)
122 OSYNCROOTDIR
="$BASEPATH/build/osyncrootdir"
128 if [ -n "$OSYNCROOTDIR_0_40" ] ; then
129 echo "Using opensync-0.4x rootdir: $OSYNCROOTDIR_0_40"
135 # Move .. barry into its own buildable directory
137 echo "Moving barry [$COMMIT] into it's own directory..."
140 (cd "./$(git rev-parse --show-cdup)" && git archive
--prefix="" "$COMMIT") | \
141 tar -C build
/barry
-xf -
142 cp -a build
/barry build
/barry-orig
147 # Prepare for Barry building
150 export PKG_CONFIG_PATH
="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR/lib/pkgconfig:$OSYNCROOTDIR_0_40/lib/pkgconfig"
154 # Create configure script
160 # Build and test as individual packages
162 echo "Individual package build test..."
164 rm -rf "$BASEPATH/build/rootdir"
166 export CXXFLAGS
="-Wall -Werror -O0 -g"
167 .
/configure
--prefix="$BASEPATH/build/rootdir" --disable-boost
170 .
/configure
--prefix="$BASEPATH/build/rootdir" --disable-sync
173 .
/configure
--prefix="$BASEPATH/build/rootdir" --enable-boost --with-zlib
179 export CXXFLAGS
="-Wall -Werror -ansi -pedantic -O0 -g"
180 .
/configure
--prefix="$BASEPATH/build/rootdir"
187 export CXXFLAGS
="-Wall -Werror -O0 -g"
188 .
/configure
--prefix="$BASEPATH/build/rootdir"
194 cd opensync-plugin-0.4x
195 export CXXFLAGS
="-Wall -Werror -O0 -g"
196 .
/configure
--prefix="$BASEPATH/build/rootdir"
203 export CXXFLAGS
="-Wall -Werror -O0 -g"
204 .
/configure
--prefix="$BASEPATH/build/rootdir"
210 if [ "$DESKTOP_OPTIONAL_BUILD_TEST" = "1" ] ; then
211 BACKUP_PKG_CONFIG_PATH
="$PKG_CONFIG_PATH"
213 echo "\aTesting optional desktop builds in 10 seconds..."
219 export PKG_CONFIG_PATH
="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR/lib/pkgconfig"
221 export CXXFLAGS
="-Wall -Werror -O0 -g"
222 .
/configure
--prefix="$BASEPATH/build/rootdir"
228 export PKG_CONFIG_PATH
="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR_0_40/lib/pkgconfig"
230 export CXXFLAGS
="-Wall -Werror -O0 -g"
231 .
/configure
--prefix="$BASEPATH/build/rootdir"
237 export PKG_CONFIG_PATH
="$BACKUP_PKG_CONFIG_PATH"
239 # Test without evolution (EvoSources.cc dummy code)
240 export CXXFLAGS
="-Wall -Werror -O0 -g"
241 .
/configure
--prefix="$BASEPATH/build/rootdir" --without-evolution
251 # Build and test as one package
254 echo "Single build test..."
256 rm -rf "$BASEPATH/build/rootdir"
258 export CXXFLAGS
="-Wall -Werror -O0 -g"
259 .
/configure
--prefix="$BASEPATH/build/rootdir" \
262 --enable-opensync-plugin \
263 --enable-opensync-plugin-4x \
265 make $MAKEOPTS install
267 .
/configure
--prefix="$BASEPATH/build/rootdir" \
269 --enable-opensync-plugin \
270 --enable-opensync-plugin-4x \
276 # Test libusb selection from configure
277 # using with and without selection
279 if [ "$LIBUSB_0_1_OPTIONAL_BUILD_TEST" = "1" -a "$LIBUSB_1_0_OPTIONAL_BUILD_TEST" = "1" ] ; then
280 echo "Testing choosing libusb options..."
281 # Test that libusb 1.0 is chosen by default
282 .
/configure
--prefix="$BASEPATH/build/rootdir"
283 make $MAKEOPTS install
284 ldd
$BASEPATH/build
/rootdir
/lib
/libbarry.so |
grep libusb-1.0.so
285 rm -rf "$BASEPATH/build/rootdir"
288 # Test that libusb 0.1 is chosen if not libusb 1.0
289 .
/configure
--prefix="$BASEPATH/build/rootdir" \
291 make $MAKEOPTS install
292 ldd
$BASEPATH/build
/rootdir
/lib
/libbarry.so |
grep libusb-0.1.so
293 rm -rf "$BASEPATH/build/rootdir"
296 # Test that libusb 0.1 is chosen if explicitly asked for
297 .
/configure
--prefix="$BASEPATH/build/rootdir" \
299 make $MAKEOPTS install
300 ldd
$BASEPATH/build
/rootdir
/lib
/libbarry.so |
grep libusb-0.1.so
301 rm -rf "$BASEPATH/build/rootdir"
307 # Test that cleanall cleans up all traces
309 echo "Testing buildgen cleanall..."
310 .
/buildgen.sh cleanall
312 diff -ruN build
/barry-orig build
/barry
318 # Test 'make dist' (the dist family of targets leaves build evidence
319 # behind, so do this after the cleanall check)
321 echo "Testing 'make dist'..."
323 rm -rf "$BASEPATH/build/rootdir"
328 --enable-opensync-plugin \
329 --enable-opensync-plugin-4x \
333 tar -C ..
/disttree
-xjf barry-
*.
*.
*.
tar.bz2
336 # remove the dist tarballs
337 rm -f barry-
*.
*.
*.
tar.
{bz2
,gz
}
338 # compare our tree with the disttree
341 # autom4te.cache - autogenerated stuff we don't care about
342 # debian - dist tarball shouldn't have to care about that
343 # m4/ - more autogenerated stuff we dont' care about
347 --exclude=autom4te.cache \
351 --exclude=po-osyncwrap \
352 barry disttree
/barry-
*.
*.
*
358 rm -rf "$BASEPATH/build"
359 echo "All tests passed."