Skip to content

Commit

Permalink
Upgrade brew formula
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jul 28, 2015
1 parent 95ef7fa commit 4399e5d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 16 deletions.
10 changes: 5 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ if [ $(echo "$OSTYPE" | grep "darwin") ]; then

# Use system 'brew' if available
if [ $(command -v brew) ]; then
MYSQLBREWDIR="$(brew --prefix)/Cellar/mysql-connector-c/6.1.3";
MYSQLBREWDIR="$(brew --prefix)/Cellar/mysql-connector-c/6.1.6";
if [ ! -r "$MYSQLBREWDIR/include/mysql.h" ]; then
echo "Brewing libmysql...";
brew install ./tools/mysql-connector-c.rb;
Expand All @@ -94,13 +94,13 @@ if [ $(echo "$OSTYPE" | grep "darwin") ]; then
if [ ! -r "$LOCALBREW/bin/brew" ]; then
mkdir -p $LOCALBREW && curl -fsSL https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C $LOCALBREW
fi
if [ ! -r "$LOCALBREW/Cellar/mysql-connector-c/6.1.3/include/mysql.h" ]; then
if [ ! -r "$LOCALBREW/Cellar/mysql-connector-c/6.1.6/include/mysql.h" ]; then
HOMEBREW_CACHE="/tmp" $LOCALBREW/bin/brew install ./tools/mysql-connector-c.rb;
fi
if [ -r "$LOCALBREW/Cellar/mysql-connector-c/6.1.3/include/mysql.h" ]; then
if [ -r "$LOCALBREW/Cellar/mysql-connector-c/6.1.6/include/mysql.h" ]; then
echo "Using local brew from $LOCALBREW."
echo "PKG_CPPFLAGS= -I../$LOCALBREW/Cellar/mysql-connector-c/6.1.3/include/" > src/Makevars
cp -f $LOCALBREW/Cellar/mysql-connector-c/6.1.3/lib/libmysqlclient.a ./src/libmysqlstatic.a
echo "PKG_CPPFLAGS= -I../$LOCALBREW/Cellar/mysql-connector-c/6.1.6/include/" > src/Makevars
cp -f $LOCALBREW/Cellar/mysql-connector-c/6.1.6/lib/libmysqlclient.a ./src/libmysqlstatic.a
echo "PKG_LIBS= -L. -lz -lmysqlstatic" >> src/Makevars
exit 0;
fi
Expand Down
31 changes: 20 additions & 11 deletions tools/mysql-connector-c.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
require 'formula'

class MysqlConnectorC < Formula
homepage 'http://dev.mysql.com/downloads/connector/c/'
url 'http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.1.3-src.tar.gz'
sha1 'd70392aafb9ddeddd797c8131898e8727f904898'
desc "MySQL database connector for C applications"
homepage "https://dev.mysql.com/downloads/connector/c/"
url "https://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.1.6-src.tar.gz"
sha256 "2222433012c415871958b61bc4f3683e1ebe77e3389f698b267058c12533ea78"

bottle do
sha256 "b7cc223beca61228800d26878f7882b23afeb3a8a4297c1b2b84a9faa604a7e4" => :yosemite
sha256 "c9a3c310c3eb3f9a0284b6b337bc531e0bb1e5351134fa7d8b26d331aaaebd7b" => :mavericks
sha256 "5928f92ae51c122d69863ecfdda5f055bc0f6e8aea02c8ae484f3148747f5984" => :mountain_lion
end

depends_on 'cmake' => :build
depends_on "cmake" => :build

conflicts_with 'mysql', 'mariadb', 'percona-server',
:because => 'both install MySQL client libraries'
conflicts_with "mysql", "mariadb", "percona-server",
:because => "both install MySQL client libraries"

fails_with :llvm do
build 2334
Expand All @@ -17,8 +22,12 @@ class MysqlConnectorC < Formula

def install
system "cmake", ".", *std_cmake_args
system 'make'
ENV.j1
system 'make install'
system "make", "install"
end

test do
system "#{bin}/mysql_config", "--cflags"
system "#{bin}/mysql_config", "--include"
system "#{bin}/mysql_config", "--libs"
end
end

0 comments on commit 4399e5d

Please sign in to comment.