Top Level Namespace

Defined Under Namespace

Modules: EventMachine, JavaFields Classes: BufferedTokenizer, IO, StringIO, TestConnection

Constant Summary collapse

EM =

Alias for EventMachine

EventMachine
SSL_HEADS =
%w(openssl/ssl.h openssl/err.h)
SSL_LIBS =
%w(crypto ssl)
SSL_LIBS_WIN =

OpenSSL 0.9.8 and 1.0.x for Windows use the *eay32 library names

RUBY_PLATFORM =~ /mswin|mingw|bccwin/ ? %w(ssleay32 libeay32) : []
GNU_CHAIN =
true
OS_WIN32 =
true
OS_UNIX =
true

Instance Method Summary collapse

Instance Method Details

#add_define(name) ⇒ Object



15
16
17
# File 'ext/extconf.rb', line 15

def add_define(name)
  $defs.push("-D#{name}")
end

#append_library(libs, lib) ⇒ Object

override append_library, so it actually appends (instead of prepending) this fixes issues with linking ssl, since libcrypto depends on symbols in libssl



24
25
26
# File 'ext/extconf.rb', line 24

def append_library(libs, lib)
  libs + " " + format(LIBARG, lib)
end

#check_heads(heads = [], fatal = false) ⇒ Object



11
12
13
# File 'ext/extconf.rb', line 11

def check_heads heads = [], fatal = false
  heads.all? { |head| have_header(head) || (abort("could not find header: #{head}") if fatal)}
end

#check_libs(libs = [], fatal = false) ⇒ Object



7
8
9
# File 'ext/extconf.rb', line 7

def check_libs libs = [], fatal = false
  libs.all? { |lib| have_library(lib) || (abort("could not find library: #{lib}") if fatal) }
end

#dir_config_search(pretty_name, name, paths, &b) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'ext/extconf.rb', line 54

def dir_config_search(pretty_name, name, paths, &b)
  paths.each do |p|
    if dir_config_wrapper('OpenSSL', 'ssl', p + '/include', p + '/lib') && yield
      warn "-----\nFound #{pretty_name} in path #{p}\n-----"
      return true
    end
  end
  false
end

#dir_config_wrapper(pretty_name, name, idefault = nil, ldefault = nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'ext/extconf.rb', line 34

def dir_config_wrapper(pretty_name, name, idefault=nil, ldefault=nil)
  inc, lib = dir_config(name, idefault, ldefault)
  if inc && lib
    # TODO: Remove when 2.0.0 is the minimum supported version
    # Ruby versions not incorporating the mkmf fix at
    # https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/39717
    # do not properly search for lib directories, and must be corrected
    unless lib && lib[-3, 3] == 'lib'
      @libdir_basename = 'lib'
      inc, lib = dir_config(name, idefault, ldefault)
    end
    unless idefault && ldefault
      abort "-----\nCannot find #{pretty_name} include path #{inc}\n-----" unless inc && inc.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
      abort "-----\nCannot find #{pretty_name} library path #{lib}\n-----" unless lib && lib.split(File::PATH_SEPARATOR).any? { |dir| File.directory?(dir) }
      warn "-----\nUsing #{pretty_name} in path #{File.dirname inc}\n-----"
    end
    true
  end
end

#pkg_config_wrapper(pretty_name, name) ⇒ Object



64
65
66
67
68
69
70
# File 'ext/extconf.rb', line 64

def pkg_config_wrapper(pretty_name, name)
  cflags, ldflags, libs = pkg_config(name)
  unless [cflags, ldflags, libs].any?(&:nil?) || [cflags, ldflags, libs].any?(&:empty?)
    warn "-----\nUsing #{pretty_name} from pkg-config #{cflags} && #{ldflags} && #{libs}\n-----"
    true
  end
end