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 +++++++++++++++++++++++++++--------------- test/windows/odb/mingw/unpack | 33 +----------- test/windows/odb/unpack | 76 ++++++++++++++++++-------- 3 files changed, 136 insertions(+), 95 deletions(-) (limited to 'test') 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 diff --git a/test/windows/odb/mingw/unpack b/test/windows/odb/mingw/unpack index c7164a0..ff24c84 100755 --- a/test/windows/odb/mingw/unpack +++ b/test/windows/odb/mingw/unpack @@ -1,34 +1,3 @@ #! /usr/bin/env bash -trap 'exit 1' ERR - -function error () -{ - echo "$*" 1>&2 -} - -base=/t/pack - -rm -rf libodb libodb-mysql libodb-tracer libodb-boost odb-tests odb-examples - -v=`echo $base/libodb-?.*.zip | sed -e "s%$base/libodb-\(.*\).zip%\1%"` - -echo unpacking $v from $base - -unzip -q $base/libodb-$v.zip -mv libodb-$v libodb - -unzip -q $base/libodb-tracer-$v.zip -mv libodb-tracer-$v libodb-tracer - -unzip -q $base/libodb-mysql-$v.zip -mv libodb-mysql-$v libodb-mysql - -unzip -q $base/libodb-boost-$v.zip -mv libodb-boost-$v libodb-boost - -unzip -q $base/odb-tests-$v.zip -mv odb-tests-$v odb-tests - -unzip -q $base/odb-examples-$v.zip -mv odb-examples-$v odb-examples +../unpack -mingw diff --git a/test/windows/odb/unpack b/test/windows/odb/unpack index 8e1c180..6570816 100755 --- a/test/windows/odb/unpack +++ b/test/windows/odb/unpack @@ -1,5 +1,10 @@ #! /usr/bin/env bash +# Unpack ODB distribution for Windows. +# +# -mingw unpack for MinGW +# + trap 'exit 1' ERR function error () @@ -7,8 +12,27 @@ function error () echo "$*" 1>&2 } -base=/cygdrive/t/pack databases="sqlite mysql" +mingw=n + +while [ $# -gt 0 ]; do + case $1 in + -mingw) + mingw=y + shift + ;; + *) + error "unknown option: $1" + exit 1 + ;; + esac +done + +if [ $mingw = y ]; then + base=/t/pack +else + base=/cygdrive/t/pack +fi rm -rf libodb libodb-sqlite libodb-mysql libodb-tracer libodb-boost \ odb odb-tests-* odb-examples-* @@ -33,25 +57,35 @@ unzip -q $base/libodb-boost-$v.zip mv libodb-boost-$v libodb-boost unzip -q $base/odb-tests-$v.zip -for d in $databases; do - cp -r odb-tests-$v odb-tests-$d -done -rm -r odb-tests-$v +if [ $mingw = n ]; then + for d in $databases; do + cp -r odb-tests-$v odb-tests-$d + done + rm -r odb-tests-$v +else + mv odb-tests-$v odb-tests +fi unzip -q $base/odb-examples-$v.zip -for d in $databases; do - cp -r odb-examples-$v odb-examples-$d -done -rm -r odb-examples-$v - -unzip -q $base/odb-$v-i686-windows.zip -mv odb-$v-i686-windows odb - -cp default.options odb/etc/odb/ - -for d in $databases; do - cp $d.options odb-tests-$d/ - cp $d-driver.bat odb-tests-$d/ - cp $d.options odb-examples-$d/ - cp $d-driver.bat odb-examples-$d/ -done +if [ $mingw = n ]; then + for d in $databases; do + cp -r odb-examples-$v odb-examples-$d + done + rm -r odb-examples-$v +else + mv odb-examples-$v odb-examples +fi + +if [ $mingw = n ]; then + unzip -q $base/odb-$v-i686-windows.zip + mv odb-$v-i686-windows odb + + cp default.options odb/etc/odb/ + + for d in $databases; do + cp $d.options odb-tests-$d/ + cp $d-driver.bat odb-tests-$d/ + cp $d.options odb-examples-$d/ + cp $d-driver.bat odb-examples-$d/ + done +fi -- cgit v1.1