aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mysql-connector-odbc.rb
diff options
context:
space:
mode:
authorRyan McCuaig2012-05-24 10:43:25 -0700
committerAdam Vandenberg2012-06-24 11:32:10 -0700
commite441edc78d7e05726e60a769a89da2978c0e4b60 (patch)
tree866287e99a15429715d818672fc0a9a0383e6097 /Library/Formula/mysql-connector-odbc.rb
parent51d8dcda5482a1335be58a49f29088c73c5041a1 (diff)
downloadhomebrew-e441edc78d7e05726e60a769a89da2978c0e4b60.tar.bz2
mysql-connector-odbc 5.1.11
Closes #12414. Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Formula/mysql-connector-odbc.rb')
-rw-r--r--Library/Formula/mysql-connector-odbc.rb63
1 files changed, 63 insertions, 0 deletions
diff --git a/Library/Formula/mysql-connector-odbc.rb b/Library/Formula/mysql-connector-odbc.rb
new file mode 100644
index 000000000..68a33e152
--- /dev/null
+++ b/Library/Formula/mysql-connector-odbc.rb
@@ -0,0 +1,63 @@
+require 'formula'
+
+class MySqlInstalled < Requirement
+ def message; <<-EOS.undent
+ MySQL is required to install.
+
+ You can install this with Homebrew using:
+ brew install mysql
+
+ If you plan to install mysql-odbc-connector as universal (32- and 64-bit),
+ install MySQL using:
+ brew install mysql --universal
+
+ Or, you can use an official installer from:
+ http://dev.mysql.com/downloads/mysql/
+ EOS
+ end
+ def satisfied?
+ which 'mysql_config'
+ end
+ def fatal?
+ true
+ end
+end
+
+class MysqlConnectorOdbc < Formula
+ homepage 'http://dev.mysql.com/doc/refman/5.1/en/connector-odbc.html'
+ url 'http://mysql.mirror.iweb.ca/Downloads/Connector-ODBC/5.1/mysql-connector-odbc-5.1.11-src.tar.gz'
+ sha1 '46aeaf721eddedaed239c4a688faee1990dcec62'
+
+ # Won't compile against mysql-connector-c, as the C connector exports an API version
+ # that causes issues with how "my_free" is declared
+ depends_on MySqlInstalled.new
+ depends_on 'cmake' => :build
+
+ def options
+ [['--universal', "Make mysql-connector-odbc a universal binary"]]
+ end
+
+ def install
+ args = ["-DCMAKE_INSTALL_PREFIX=#{prefix}"]
+ args << "-DCMAKE_OSX_ARCHITECTURES='i386;x86_64'" if ARGV.build_universal?
+ 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