From 2cea0dc10d7becabf707f7b6da4c65144397257b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Jun 2010 16:51:32 +0200 Subject: Build system setup --- build/mysql/configure | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++ build/mysql/mysql | 56 +++++++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100755 build/mysql/configure create mode 100755 build/mysql/mysql (limited to 'build/mysql') diff --git a/build/mysql/configure b/build/mysql/configure new file mode 100755 index 0000000..e4bae87 --- /dev/null +++ b/build/mysql/configure @@ -0,0 +1,77 @@ +#! /usr/bin/env bash + +# file : build/mysql/configure +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# +# dcf_root - dynamic configuration root +# + +$echo +$echo "Please enter the MySQL client program path." +$echo + +driver=`read_path --command mysql` + +$echo +$echo "Please enter the MySQL database user." +$echo + +user=`read_value "odb_test"` + +$echo +$echo "Please enter the MySQL database password. Enter NULL for" +$echo "unspecified password as opposed to the empty password." +$echo + +passwd=`read_value "NULL"` + +$echo +$echo "Please enter the MySQL database name. Note that it WILL BE" +$echo "MODIFIED by the tests." +$echo + +db=`read_value "odb_test"` + +$echo +$echo "Please enter the MySQL database host." +$echo + +host=`read_value "localhost"` + +$echo +$echo "Please enter the MySQL database port." +$echo + +port=`read_value "0"` + +$echo +$echo "Please enter the MySQL database socket name. Enter NULL for" +$echo "unspecified name as opposed to the empty name." +$echo + +socket=`read_value "NULL"` + +opt=$dcf_root/db.options +drv=$dcf_root/db-driver + +echo "--user '$user'" >$opt + +if [ "$passwd" != "NULL" ]; then +echo "--passwd '$passwd'" >>$opt +fi + +echo "--db-name '$db'" >>$opt +echo "--host '$host'" >>$opt +echo "--port $port" >>$opt + +if [ "$socket" != "NULL" ]; then +echo "--socket '$socket'" >>$opt +fi + +echo "#!/bin/sh" >$drv +echo "opt=\`cat $opt\`" >>$drv +echo "eval $scf_root/mysql/mysql --driver $driver \$opt \$*" >>$drv +chmod 755 $drv diff --git a/build/mysql/mysql b/build/mysql/mysql new file mode 100755 index 0000000..766e580 --- /dev/null +++ b/build/mysql/mysql @@ -0,0 +1,56 @@ +#! /usr/bin/env bash + +# file : build/mysql/mysql +# author : Boris Kolpackov +# copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC +# license : GNU GPL v2; see accompanying LICENSE file + +# +# MySQL driver wrapper. +# + +while [ $# -gt 0 ]; do + case $1 in + --driver) + driver=$2 + shift 2 + ;; + --user) + opt="$opt --user=$2" + shift 2 + ;; + --passwd) + opt="$opt --password=$2" + shift 2 + ;; + --db-name) + opt="$opt --database=$2" + shift 2 + ;; + --host) + opt="$opt --host=$2" + shift 2 + ;; + --port) + opt="$opt --port=$2" + shift 2 + ;; + --socket) + opt="$opt --socket=$2" + shift 2 + ;; + *) + break + ;; + esac +done + +if [ -z "$driver" ]; then + driver=mysql +fi + +if [ -n "$1" ]; then + exec $driver $opt <$1 +else + exec $driver $opt +fi -- cgit v1.1