Fixed the build script for MySQL so it uses MySQL_Config instead of guessing based on what my configuration was.

This commit is contained in:
GRMrGecko 2012-02-12 21:21:27 -06:00
parent 391ec344a0
commit b0ed19fe38

View File

@ -1,7 +1,8 @@
#!/bin/bash #!/bin/bash
INSTALLNAMETOOL=`which install_name_tool` # Fixes Mac OS X issue with linking. INSTALLNAMETOOL=`which install_name_tool 2>> /dev/null` # Fixes Mac OS X issue with linking.
ZNCBUILD=`which znc-buildmod` ZNCBUILD=`which znc-buildmod 2>> /dev/null`
MYSQLCONFIG=`which mysql_config 2>> /dev/null`
if [ -f logMySQL.buildconfig ]; then if [ -f logMySQL.buildconfig ]; then
. ./logMySQL.buildconfig . ./logMySQL.buildconfig
@ -15,11 +16,11 @@ if [ "$ZNCBUILD" = "" ]; then
fi fi
fi fi
if [ "$MYSQL" = "" ]; then if [ "$MYSQLCONFIG" = "" ]; then
echo "Where is MySQL path [/usr/local/mysql]:" echo "Where is MySQL_Config path [/usr/local/mysql/bin/mysql_config]:"
read MYSQL read MYSQLCONFIG
if [ "$MYSQL" = "" ]; then if [ "$MYSQLCONFIG" = "" ]; then
MYSQL="/usr/local/mysql" MYSQLCONFIG="/usr/local/mysql/bin/mysql_config"
fi fi
fi fi
@ -34,13 +35,17 @@ fi
if [ ! -f logMySQL.buildconfig ]; then if [ ! -f logMySQL.buildconfig ]; then
echo "#!/bin/bash" > logMySQL.buildconfig echo "#!/bin/bash" > logMySQL.buildconfig
echo "ZNCBUILD=\"$ZNCBUILD\"" >> logMySQL.buildconfig echo "ZNCBUILD=\"$ZNCBUILD\"" >> logMySQL.buildconfig
echo "MYSQL=\"$MYSQL\"" >> logMySQL.buildconfig echo "MYSQLCONFIG=\"$MYSQLCONFIG\"" >> logMySQL.buildconfig
echo "ZNCCONFIG=\"$ZNCCONFIG\"" >> logMySQL.buildconfig echo "ZNCCONFIG=\"$ZNCCONFIG\"" >> logMySQL.buildconfig
chmod 755 logMySQL.buildconfig chmod 755 logMySQL.buildconfig
fi fi
LDFLAGS="-L $MYSQL/lib -lmysqlclient -I $MYSQL/include" "$ZNCBUILD" logmysql.cpp MYSQLINCLUDE=`$MYSQLCONFIG --include`
MYSQLLIBS=`$MYSQLCONFIG --libs`
LDFLAGS="$MYSQLLIBS $MYSQLINCLUDE" "$ZNCBUILD" logmysql.cpp
if [ "$INSTALLNAMETOOL" != "" ]; then if [ "$INSTALLNAMETOOL" != "" ]; then
MYSQL=`$MYSQLCONFIG --libs | sed -e "s/.*-L//;s/ .*//"`
"$INSTALLNAMETOOL" -change libmysqlclient.18.dylib "$MYSQL/libmysqlclient.dylib" logmysql.so "$INSTALLNAMETOOL" -change libmysqlclient.18.dylib "$MYSQL/libmysqlclient.dylib" logmysql.so
fi fi
cp logmysql.so "$ZNCCONFIG/modules/logmysql.so" cp logmysql.so "$ZNCCONFIG/modules/logmysql.so"