#! /usr/bin/env bash # Build ODB for mingw # # -rebuild # -test # trap 'exit 1' ERR function error () { echo "$*" 1>&2 } function clean () { if [ -f $1/Makefile ]; then make -C $1 distclean fi } MYSQL=/c/projects/mysql-mingw32/bin/mysql.exe CPPFLAGS=-I/c/projects/mysql-mingw32/include LDFLAGS="-L/c/projects/mysql-mingw32/lib -Wl,--enable-auto-import" test=n rebuild=n while [ $# -gt 0 ]; do case $1 in -rebuild) rebuild=y shift ;; -test) test=y shift ;; *) error "unknown option: $1" exit 1 ;; esac done # Clean everything up if we are rebuilding. # if [ $rebuild = y ]; then clean libodb clean libodb-mysql clean libodb-tracer clean odb-tests clean odb-examples fi # Build libodb # cd libodb if [ $rebuild = y ]; then ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi make cd .. # Build libodb-mysql # cd libodb-mysql if [ $rebuild = y ]; then ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi make cd .. # Build libodb-tracer # cd libodb-tracer if [ $rebuild = y ]; then ./configure --with-libodb=../libodb CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi make cd .. # Build odb-tests # cd odb-tests if [ $rebuild = y ]; then ./configure \ --with-database=mysql \ --with-libodb=../libodb \ --with-libodb-mysql=../libodb-mysql \ --with-libodb-tracer=../libodb-tracer \ --with-mysql-host=192.168.0.5 \ --with-mysql-client=$MYSQL \ CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" DIFFFLAGS=-ubB fi make if [ $test = y ]; then make check fi cd .. # Build odb-examples # cd odb-examples if [ $rebuild = y ]; then ./configure \ --with-database=mysql \ --with-libodb=../libodb \ --with-libodb-mysql=../libodb-mysql \ --with-mysql-host=192.168.0.5 \ --with-mysql-client=$MYSQL \ CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" fi make if [ $test = y ]; then make check fi cd ..