#!/usr/bin/env bash # create the Makefile from the Makefile.tokutek template and some # command line parameters shopt -s compat31 tokudb=/usr/local/tokudb tokudb_version=`basename $tokudb` mysql=/usr/local/mysql libdir=/usr/local/mysql/lib function usage() { echo "configure.tokutek" echo "--with-tokudb=$tokudb" echo "--tokudb_version=$tokudb_version" echo "--with-mysql=$mysql" echo "--libdir=$libdir" } while [ $# -gt 0 ] ; do arg=$1; shift if [[ $arg =~ "--with-tokudb=(.*)" ]] ; then tokudb=${BASH_REMATCH[1]} tokudb_version=`basename $tokudb` elif [[ $arg =~ "--with-mysql=(.*)" ]] ; then mysql=${BASH_REMATCH[1]} elif [[ $arg =~ "--libdir=(.*)" ]] ; then libdir=${BASH_REMATCH[1]} elif [[ $arg =~ "--tokudb_version=(.*)" ]] ; then tokudb_version=${BASH_REMATCH[1]} else usage; exit 1 fi done error=0 if [ ! -d $tokudb ] ; then echo $tokudb missing # error=1 fi if [ ! -d $mysql ] ; then echo $mysql missing error=1 fi if [ ! -d $libdir ] ; then echo $libdir missing error=1 fi if [ $error -ne 0 ] ; then exit 1 ; fi # escape the path names so that the sed works # note: i was not smart enough to get this right without a sequence of experiments tokudb=`echo $tokudb | sed -e s/\\\//\\\\\\\\\\\//g` # echo $tokudb mysql=`echo $mysql | sed -e s/\\\//\\\\\\\\\\\//g` # echo $mysql libdir=`echo $libdir | sed -e s/\\\//\\\\\\\\\\\//g` # echo $libdir sed -e "s/^TOKUDB =\(.*\)$/TOKUDB = $tokudb/" \ -e "s/^MYSQL_SRC = \(.*\)/MYSQL_SRC = $mysql/" \ -e "s/^MYSQL_LIBDIR = \(.*\)/MYSQL_LIBDIR = $libdir/" \ -e "s/^TOKUDB_VERSION =\(.*\)/TOKUDB_VERSION = \"$tokudb_version\"/" Makefile