From 0b49bfc996c2fca0f3fb7e1b043976df93ed28f8 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 1 Apr 2011 11:08:37 +0200 Subject: SQLite support in MinGW build scripts --- test/windows/odb/mingw/build | 122 ++++++++++++++++++++++++++++--------------- 1 file changed, 80 insertions(+), 42 deletions(-) (limited to 'test/windows/odb/mingw/build') diff --git a/test/windows/odb/mingw/build b/test/windows/odb/mingw/build index 28e8964..31c1dc6 100755 --- a/test/windows/odb/mingw/build +++ b/test/windows/odb/mingw/build @@ -1,9 +1,10 @@ #! /usr/bin/env bash -# Build ODB for mingw +# Build ODB for MinGW # # -rebuild # -test +# -db # trap 'exit 1' ERR @@ -20,12 +21,19 @@ function clean () } ROOT=/c/projects -MYSQL=$ROOT/mysql-mingw32/bin/mysql.exe -CPPFLAGS="-I$ROOT/boost-mingw32 -I$ROOT/mysql-mingw32/include" -LDFLAGS="-L$ROOT/boost-mingw32/stage/lib -L$ROOT/mysql-mingw32/lib -Wl,--enable-auto-import" +MYSQL=$ROOT/mysql-mingw32 +SQLITE=$ROOT/sqlite-mingw32 +BOOST=$ROOT/boost-mingw32 + +CPPFLAGS="-I$BOOST -I$SQLITE -I$MYSQL/include" +LDFLAGS="-L$BOOST/stage/lib -L$SQLITE -L$MYSQL/lib -Wl,--enable-auto-import" + +mysql_options="--with-mysql-host=192.168.0.5 --with-mysql-client=$MYSQL/bin/mysql.exe" +sqlite_options="--with-sqlite-db=c:\\projects\\odb\\odb_test.db" test=n rebuild=n +db= while [ $# -gt 0 ]; do case $1 in @@ -37,6 +45,11 @@ while [ $# -gt 0 ]; do test=y shift ;; + -db) + shift + db="$db $1" + shift + ;; *) error "unknown option: $1" exit 1 @@ -44,33 +57,52 @@ while [ $# -gt 0 ]; do esac done +if [ "$db" = "" ]; then + db="sqlite mysql" +fi + # Clean everything up if we are rebuilding. # if [ $rebuild = y ]; then clean libodb + clean libodb-sqlite clean libodb-mysql clean libodb-tracer clean libodb-boost - clean odb-tests - clean odb-examples + + for d in $db; do + rm -rf odb-tests-$d + rm -rf odb-examples-$d + done fi # Build libodb # cd libodb -if [ $rebuild = y ]; then +if [ $rebuild = y -o ! -f Makefile ]; then ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi make cd .. +# Build libodb-sqlite +# +cd libodb-sqlite + +if [ $rebuild = y -o ! -f Makefile ]; then + ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" +fi + +make +cd .. + # Build libodb-mysql # cd libodb-mysql -if [ $rebuild = y ]; then +if [ $rebuild = y -o ! -f Makefile ]; then ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi @@ -81,7 +113,7 @@ cd .. # cd libodb-tracer -if [ $rebuild = y ]; then +if [ $rebuild = y -o ! -f Makefile ]; then ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi @@ -92,7 +124,7 @@ cd .. # cd libodb-boost -if [ $rebuild = y ]; then +if [ $rebuild = y -o ! -f Makefile ]; then ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi @@ -101,47 +133,53 @@ cd .. # Build odb-tests # -cd odb-tests +for d in $db; do + mkdir -p odb-tests-$d + cd odb-tests-$d -if [ $rebuild = y ]; then - ./configure \ ---with-database=mysql \ + optvar=${d}_options + +# @@ --with-libodb-boost=../libodb-boost \ + + if [ $rebuild = y -o ! -f Makefile ]; then + ../odb-tests/configure \ +--with-database=$d \ --with-libodb=../libodb \ ---with-libodb-mysql=../libodb-mysql \ +--with-libodb-$d=../libodb-$d \ --with-libodb-tracer=../libodb-tracer \ ---with-libodb-boost=../libodb-boost \ ---with-mysql-host=192.168.0.5 \ ---with-mysql-client=$MYSQL \ +${!optvar} \ CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" DIFFFLAGS=-ubB -fi - -make - -if [ $test = y ]; then - make check -fi + fi -cd .. + make + if [ $test = y ]; then + make check + fi + cd .. +done # Build odb-examples # -cd odb-examples +for d in $db; do + mkdir -p odb-examples-$d + cd odb-examples-$d -if [ $rebuild = y ]; then - ./configure \ ---with-database=mysql \ ---with-libodb=../libodb \ ---with-libodb-mysql=../libodb-mysql \ ---with-libodb-boost=../libodb-boost \ ---with-mysql-host=192.168.0.5 \ ---with-mysql-client=$MYSQL \ -CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" -fi + optvar=${d}_options -make +# @@ --with-libodb-boost=../libodb-boost \ -if [ $test = y ]; then - make check -fi + if [ $rebuild = y -o ! -f Makefile ]; then + ../odb-examples/configure \ +--with-database=$d \ +--with-libodb=../libodb \ +--with-libodb-$d=../libodb-$d \ +${!optvar} \ +CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" DIFFFLAGS=-ubB + fi -cd .. + make + if [ $test = y ]; then + make check + fi + cd .. +done -- cgit v1.1