Add BlackBerry.alx parser support
[barry.git] / test / buildtest.sh
bloba26d2407e7fea650f5f39adc0eb3faf3e47a694d
1 #!/bin/sh
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 # Jump to directory that script is located, if necessary
40 if [ "$(dirname $0)" != "." ] ; then
41 cd "$(pwd)/$(dirname $0)"
42 echo "You ran the script outside the directory it is in."
43 echo "Changing directory to: $(pwd)"
44 echo "If this is not desired, abort now..."
45 sleep 1s
48 if [ -d "build" ] ; then
49 echo "'build' directory already exists, exiting..."
50 exit 1
53 BASEPATH=$(pwd)
54 OSYNCSOURCE="$1"
56 mkdir -p build
59 # Do we have a ~/.barrytest2 config?
61 if [ -f ~/.barrytest2 ] ; then
62 . ~/.barrytest2
67 # First, build opensync in a local directory
70 if [ -n "$OSYNCROOTDIR" ] ; then
71 echo "Using opensync rootdir: $OSYNCROOTDIR"
72 elif [ -z "$OSYNCROOTDIR" -a -n "$OSYNCSOURCE" ] ; then
73 echo "Extracting opensync sources and building..."
74 (cd build && tar xjf "$OSYNCSOURCE" && \
75 cd libopensync-0.22 && \
76 ./configure -prefix="$BASEPATH/build/osyncrootdir" && \
77 make $MAKEOPTS install)
78 OSYNCROOTDIR="$BASEPATH/build/osyncrootdir"
79 else
80 Usage
81 exit 1
84 if [ -n "$OSYNCROOTDIR_0_40" ] ; then
85 echo "Using opensync-0.4x rootdir: $OSYNCROOTDIR_0_40"
91 # Move .. barry into its own buildable directory
94 mkdir -p build/barry
95 (tar -C .. --exclude=CVS --exclude=.git --exclude=test/build -cf - . | \
96 tar -C build/barry -xf -)
97 diff -ruN --exclude=CVS --exclude=.git --exclude=test --exclude=build .. build/barry
102 # Prepare for Barry building
104 cd build/barry
105 export PKG_CONFIG_PATH="$BASEPATH/build/rootdir/lib/pkgconfig:$OSYNCROOTDIR/lib/pkgconfig:$OSYNCROOTDIR_0_40/lib/pkgconfig"
109 # Create configure script
111 ./buildgen.sh
115 # Build and test as individual packages
117 echo "Individual package build test..."
119 rm -rf "$BASEPATH/build/rootdir"
121 export CXXFLAGS="-Wall -Werror -O0 -g"
122 ./configure --prefix="$BASEPATH/build/rootdir" --disable-boost
123 make $MAKEOPTS
124 make distclean
125 ./configure --prefix="$BASEPATH/build/rootdir" --enable-boost --with-zlib
126 make $MAKEOPTS
127 make install
128 make distclean
130 cd gui
131 export CXXFLAGS="-Wall -Werror -ansi -pedantic -O0 -g"
132 ./configure --prefix="$BASEPATH/build/rootdir"
133 make $MAKEOPTS
134 make install
135 make distclean
136 cd ..
138 cd opensync-plugin
139 export CXXFLAGS="-Wall -Werror -O0 -g"
140 ./configure --prefix="$BASEPATH/build/rootdir"
141 make $MAKEOPTS
142 make install
143 make distclean
144 cd ..
146 cd opensync-plugin-0.4x
147 export CXXFLAGS="-Wall -Werror -O0 -g"
148 ./configure --prefix="$BASEPATH/build/rootdir"
149 make $MAKEOPTS
150 make install
151 make distclean
152 cd ..
157 # Build and test as one package
160 echo "Single build test..."
162 rm -rf "$BASEPATH/build/rootdir"
164 export CXXFLAGS="-Wall -Werror -O0 -g"
165 ./configure --prefix="$BASEPATH/build/rootdir" --enable-boost \
166 --enable-gui --enable-opensync-plugin --enable-opensync-plugin-4x
167 make $MAKEOPTS install
168 make distclean
169 ./configure --prefix="$BASEPATH/build/rootdir" \
170 --enable-gui --enable-opensync-plugin --enable-opensync-plugin-4x
171 make $MAKEOPTS
172 make distclean
176 # Test that cleanall cleans up all traces
178 ./buildgen.sh cleanall
179 cd "$BASEPATH"
180 diff -ruN --exclude=CVS --exclude=.git --exclude=test --exclude=build .. build/barry
181 cd build/barry
186 # Test 'make dist' (the dist family of targets leaves build evidence
187 # behind, so do this after the cleanall check)
189 echo "Testing 'make dist'..."
191 rm -rf "$BASEPATH/build/rootdir"
193 ./buildgen.sh
194 ./configure --enable-gui --enable-opensync-plugin --enable-opensync-plugin-4x
195 make dist
196 make distcheck
197 make distclean
202 # Success
204 cd "$BASEPATH"
205 rm -rf "$BASEPATH/build"
206 echo "All tests passed."