LogSQL/buildLogMySQL

51 lines
1.4 KiB
Plaintext
Raw Normal View History

2012-02-11 13:35:43 -06:00
#!/bin/bash
INSTALLNAMETOOL=`which install_name_tool 2>> /dev/null` # Fixes Mac OS X issue with linking.
ZNCBUILD=`which znc-buildmod 2>> /dev/null`
MYSQLCONFIG=`which mysql_config 2>> /dev/null`
if [ -f logMySQL.buildconfig ]; then
. ./logMySQL.buildconfig
fi
2012-02-11 13:35:43 -06:00
if [ "$ZNCBUILD" = "" ]; then
echo "Where is znc-buildmod:"
read ZNCBUILD
if [ "$ZNCBUILD" = "" ]; then
exit
fi
fi
if [ "$MYSQLCONFIG" = "" ]; then
echo "Where is MySQL_Config path [/usr/local/mysql/bin/mysql_config]:"
read MYSQLCONFIG
if [ "$MYSQLCONFIG" = "" ]; then
MYSQLCONFIG="/usr/local/mysql/bin/mysql_config"
fi
2012-02-11 13:35:43 -06:00
fi
if [ "$ZNCCONFIG" = "" ]; then
echo "Where is ZNC configuration path [$HOME/.znc]:"
read ZNCCONFIG
if [ "$ZNCCONFIG" = "" ]; then
ZNCCONFIG="$HOME/.znc"
fi
fi
if [ ! -f logMySQL.buildconfig ]; then
echo "#!/bin/bash" > logMySQL.buildconfig
echo "ZNCBUILD=\"$ZNCBUILD\"" >> logMySQL.buildconfig
echo "MYSQLCONFIG=\"$MYSQLCONFIG\"" >> logMySQL.buildconfig
echo "ZNCCONFIG=\"$ZNCCONFIG\"" >> logMySQL.buildconfig
chmod 755 logMySQL.buildconfig
2012-02-11 13:35:43 -06:00
fi
MYSQLINCLUDE=`$MYSQLCONFIG --include`
MYSQLLIBS=`$MYSQLCONFIG --libs`
LDFLAGS="$MYSQLLIBS $MYSQLINCLUDE" "$ZNCBUILD" logmysql.cpp
if [ "$INSTALLNAMETOOL" != "" ]; then
MYSQL=`$MYSQLCONFIG --libs | sed -e "s/.*-L//;s/ .*//"`
"$INSTALLNAMETOOL" -change libmysqlclient.18.dylib "$MYSQL/libmysqlclient.dylib" logmysql.so
fi
2012-02-11 13:35:43 -06:00
cp logmysql.so "$ZNCCONFIG/modules/logmysql.so"