aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/mysql.rb
blob: 76fd2a7c424f029be6294ca23595efae710b4a42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'brewkit'

class Mysql <Formula
  @url='http://mysql.llarian.net/Downloads/MySQL-5.1/mysql-5.1.37.zip'
  @homepage='http://dev.mysql.com/doc/refman/5.1/en/'
  @md5='7564d7759a8077b3a0e6190955422287'

  depends_on 'readline'

  def options
    [
      ['--with-tests', "Keep tests when installing."],
      ['--with-bench', "Keep benchmark app when installing."],
      ['--client-only', "Only install client tools, not the server."],
    ]
  end

  def install
    ENV['CXXFLAGS'] = ENV['CXXFLAGS'].gsub "-fomit-frame-pointer", ""
    ENV['CXXFLAGS'] += " -fno-omit-frame-pointer -felide-constructors"

    configure_args = [
      "--without-bench",
      "--without-docs",
      "--without-debug",
      "--disable-dependency-tracking",
      "--prefix=#{prefix}",
      "--with-plugins=innobase,myisam",
      "--with-extra-charsets=complex",
      "--with-plugins=innobase,myisam",
      "--with-ssl",
      "--enable-assembler",
      "--enable-thread-safe-client",
      "--enable-local-infile",
      "--enable-shared"]

    if ARGV.include? '--client-only'
      configure_args.push("--without-server")
    end

    system "./configure", *configure_args
    system "make install"

    # Why does sql-bench still get built w/ above options?
    (prefix+'sql-bench').rmtree unless ARGV.include? '--with-bench'

    # save 66MB!
    (prefix+'mysql-test').rmtree unless ARGV.include? '--with-tests'
  end
end