Top Level Namespace

Defined Under Namespace

Modules: Mysql2

Constant Summary collapse

GLOB =
"{#{dirs.join(',')}}/{mysql_config,mysql_config5,mariadb_config}".freeze

Instance Method Summary collapse

Instance Method Details

#add_ssl_defines(header) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'ext/mysql2/extconf.rb', line 16

def add_ssl_defines(header)
  all_modes_found = %w[SSL_MODE_DISABLED SSL_MODE_PREFERRED SSL_MODE_REQUIRED SSL_MODE_VERIFY_CA SSL_MODE_VERIFY_IDENTITY].inject(true) do |m, ssl_mode|
    m && have_const(ssl_mode, header)
  end
  if all_modes_found
    $CFLAGS << ' -DFULL_SSL_MODE_SUPPORT'
  else
    # if we only have ssl toggle (--ssl,--disable-ssl) from 5.7.3 to 5.7.10
    # and the verify server cert option. This is also the case for MariaDB.
    has_verify_support  = have_const('MYSQL_OPT_SSL_VERIFY_SERVER_CERT', header)
    has_enforce_support = have_const('MYSQL_OPT_SSL_ENFORCE', header)
    $CFLAGS << ' -DNO_SSL_MODE_SUPPORT' if !has_verify_support && !has_enforce_support
  end
end

#asplode(lib) ⇒ Object

Some helper functions



6
7
8
9
10
11
12
13
14
# File 'ext/mysql2/extconf.rb', line 6

def asplode(lib)
  if RUBY_PLATFORM =~ /mingw|mswin/
    abort "-----\n#{lib} is missing. Check your installation of MySQL or Connector/C, and try again.\n-----"
  elsif RUBY_PLATFORM =~ /darwin/
    abort "-----\n#{lib} is missing. You may need to 'brew install mysql' or 'port install mysql', and try again.\n-----"
  else
    abort "-----\n#{lib} is missing. You may need to 'sudo apt-get install libmariadb-dev', 'sudo apt-get install libmysqlclient-dev' or 'sudo yum install mysql-devel', and try again.\n-----"
  end
end