summaryrefslogtreecommitdiff
path: root/test/windows/odb/mingw/build
blob: 28e896415a064cef9a126518ff36ed9b8be88dcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#! /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
}

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"

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 libodb-boost
  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 libodb-boost
#
cd libodb-boost

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-libodb-boost=../libodb-boost \
--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-libodb-boost=../libodb-boost \
--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 ..