Top Level Namespace
Defined Under Namespace
Modules: GSL, Jac, OOL
Classes: Array, Range
Instance Method Summary
collapse
Instance Method Details
#create_conf_h(file) ⇒ Object
Function derived from NArray’s extconf.rb.
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
|
# File 'ext/gsl_native/extconf.rb', line 13
def create_conf_h(file) print "creating #{file}\n"
File.open(file, 'w') do |hfile|
= file.upcase.sub(/\s|\./, '_')
hfile.puts "#ifndef #{}"
hfile.puts "#define #{}"
hfile.puts
hfile.puts "#define RUBY_2 1" if RUBY_VERSION >= '2.0'
for line in $defs
line =~ /^-D(.*)/
match_data = $1.dup
if match_data.match(/GSL_VERSION*/)
hfile.printf "#define #{match_data.to_s.split('=').join(' ')}\n"
else
hfile.printf "#define %s 1\n", match_data
end
end
hfile.puts
hfile.puts "#endif"
end
end
|
#gsl_config_arg(arg) ⇒ Object
3
4
5
6
7
8
9
10
|
# File 'ext/gsl_native/extconf.rb', line 3
def gsl_config_arg(arg)
yield arg_config("--with-gsl-#{arg}") {
sh = 'sh ' if RUBY_PLATFORM =~ /mingw/
IO.popen("#{sh}gsl-config --#{arg}") { |f| f.gets.chomp }
}, lambda { |val| puts "checking gsl #{arg}... #{val}"; val }
rescue => err
abort "*** ERROR: missing required library to compile this module: #{err}"
end
|
#gsl_def(const, value = nil) ⇒ Object
41
42
43
44
|
# File 'ext/gsl_native/extconf.rb', line 41
def gsl_def(const, value = nil)
value = "=#{value}" if value
$defs << "-D#{const}#{value}"
end
|
#gsl_dir_config(target, idir = nil, ldir = idir) ⇒ Object
54
55
56
|
# File 'ext/gsl_native/extconf.rb', line 54
def gsl_dir_config(target, idir = nil, ldir = idir)
dir_config(target, idir || $sitearchdir, ldir || $sitearchdir)
end
|
#gsl_gem_config(target, dir = 'ext') ⇒ Object
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'ext/gsl_native/extconf.rb', line 58
def gsl_gem_config(target, dir = 'ext')
path = begin
require 'rubygems'
if target == 'narray'
gem 'narray'
spec = Gem::Specification.find_by_path("#{target}")
File.join(spec.full_gem_path, dir) if spec
else
gem 'nmatrix'
spec = Gem::Specification.find_all_by_name("#{target}").compact
File.join(spec[0].require_path)
end
rescue LoadError
end
gsl_dir_config(target, path)
$LOCAL_LIBS += " -l:#{target}.so" if arg_config("--force-link-#{target}") ||
$CFLAGS.include?('-Wl,--no-undefined') ||
$LDFLAGS.include?('-Wl,--no-undefined')
end
|
46
47
48
|
# File 'ext/gsl_native/extconf.rb', line 46
def (library, )
have_library(library) if ()
end
|
#gsl_have_library(func) ⇒ Object
50
51
52
|
# File 'ext/gsl_native/extconf.rb', line 50
def gsl_have_library(func)
have_func(func) if have_library('gsl', func)
end
|