2012-05-24 17:43:25 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class MysqlConnectorOdbc < Formula
|
|
|
|
homepage 'http://dev.mysql.com/doc/refman/5.1/en/connector-odbc.html'
|
2014-02-16 23:12:22 +00:00
|
|
|
url 'http://mysql.mirror.iweb.ca/Connector-ODBC/5.1/mysql-connector-odbc-5.1.12-src.tar.gz'
|
2013-06-09 09:33:45 +00:00
|
|
|
sha1 '6ee162de8a277cdb017c5c8eee6284601837e7da'
|
2012-05-24 17:43:25 +00:00
|
|
|
|
|
|
|
# Won't compile against mysql-connector-c, as the C connector exports an API version
|
|
|
|
# that causes issues with how "my_free" is declared
|
2013-07-01 22:15:44 +00:00
|
|
|
depends_on MysqlDependency
|
2012-05-24 17:43:25 +00:00
|
|
|
depends_on 'cmake' => :build
|
|
|
|
|
2012-08-12 17:57:31 +00:00
|
|
|
option :universal
|
2012-05-24 17:43:25 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
args = ["-DCMAKE_INSTALL_PREFIX=#{prefix}"]
|
2013-08-02 03:51:36 +00:00
|
|
|
args << "-DCMAKE_OSX_ARCHITECTURES='#{Hardware::CPU.universal_archs.as_cmake_arch_flags}'" if build.universal?
|
2013-06-09 09:33:45 +00:00
|
|
|
args << "-DMYSQL_LIB:FILEPATH=#{HOMEBREW_PREFIX}/lib/libmysqlclient_r.a"
|
2012-05-24 17:43:25 +00:00
|
|
|
ENV['MYSQL_DIR'] = HOMEBREW_PREFIX
|
|
|
|
system 'cmake', ".", *args
|
|
|
|
fix_goofy_link_file_error
|
|
|
|
system 'make install'
|
|
|
|
end
|
|
|
|
|
|
|
|
def fix_goofy_link_file_error
|
|
|
|
# fixes linker error on linking up libmyodbc5.so on lion
|
|
|
|
# I have no idea why the -L/usr/local/lib -lmysqlclient_r doesn't do the
|
|
|
|
# trick. Can't use homebrew's patch system since it applies before link.txt
|
|
|
|
# exists; it gets generated by cmake.
|
|
|
|
#
|
|
|
|
# see http://bugs.mysql.com/bug.php?id=63302
|
|
|
|
#
|
|
|
|
link_file_name = "driver/CMakeFiles/myodbc5.dir/link.txt"
|
|
|
|
old_link = File.read link_file_name
|
|
|
|
File.open link_file_name, 'w' do |f|
|
|
|
|
f.puts "#{old_link.strip} #{HOMEBREW_PREFIX}/lib/libmysqlclient_r.a"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|