davidrichards-gsl 1.11.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/extconf.rb +272 -0
- metadata +66 -0
data/ext/extconf.rb
ADDED
@@ -0,0 +1,272 @@
|
|
1
|
+
require 'mkmf'
|
2
|
+
|
3
|
+
|
4
|
+
module GSL
|
5
|
+
class Version
|
6
|
+
def initialize(str)
|
7
|
+
@str = str
|
8
|
+
@ary = str.split(".").collect { |elm| elm.to_i }
|
9
|
+
end
|
10
|
+
def to_s; @str; end
|
11
|
+
def inspect; @str; end
|
12
|
+
def >=(ver)
|
13
|
+
ary2 = ver.split(".").collect { |elm| elm.to_i }
|
14
|
+
if @ary[0] > ary2[0]; return true; end
|
15
|
+
if @ary[0] < ary2[0]; return false; end
|
16
|
+
if @ary[1] > ary2[1]; return true; end
|
17
|
+
if @ary[1] < ary2[1]; return false; end
|
18
|
+
if @ary.size < ary2.size; return false; end
|
19
|
+
if @ary.size == 3 and ary2.size == 3
|
20
|
+
if @ary[2] < ary2[2]; return false; end
|
21
|
+
end
|
22
|
+
return true
|
23
|
+
end
|
24
|
+
def <(ver)
|
25
|
+
ary2 = ver.split(".").collect { |elm| elm.to_i }
|
26
|
+
if @ary[0] >= ary2[0]; return false; end
|
27
|
+
if @ary[0] >= ary2[0]; return false; end
|
28
|
+
return true
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if /mingw/ =~ RUBY_PLATFORM
|
34
|
+
GSL_CONFIG = "sh gsl-config"
|
35
|
+
else
|
36
|
+
GSL_CONFIG = "gsl-config"
|
37
|
+
end
|
38
|
+
|
39
|
+
def gsl_config()
|
40
|
+
print("checking gsl cflags... ")
|
41
|
+
IO.popen("#{GSL_CONFIG} --cflags") do |f|
|
42
|
+
cflags = f.gets.chomp
|
43
|
+
puts(cflags)
|
44
|
+
$CFLAGS += " " + cflags
|
45
|
+
end
|
46
|
+
|
47
|
+
IO.popen("#{GSL_CONFIG} --libs") do |f|
|
48
|
+
libs = f.gets.chomp
|
49
|
+
dir_config("cblas")
|
50
|
+
dir_config("atlas")
|
51
|
+
if have_library("cblas") and have_library("atlas")
|
52
|
+
libs.gsub!("-lgslcblas", "-lcblas -latlas")
|
53
|
+
$LOCAL_LIBS += " " + libs.gsub(" -lgslcblas", "")
|
54
|
+
print("checking gsl libs... ")
|
55
|
+
puts(libs)
|
56
|
+
else
|
57
|
+
print("checking gsl libs... ")
|
58
|
+
puts(libs)
|
59
|
+
$LOCAL_LIBS += " " + libs
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
def check_version(configfile)
|
66
|
+
|
67
|
+
print("checking gsl version... ")
|
68
|
+
IO.popen("#{GSL_CONFIG} --version") do |f|
|
69
|
+
ver = GSL::Version.new(f.gets.chomp)
|
70
|
+
puts(ver)
|
71
|
+
configfile.printf("#ifndef GSL_VERSION\n#define GSL_VERSION \"#{ver}\"\n#endif\n")
|
72
|
+
|
73
|
+
if ver >= "0.9.4"
|
74
|
+
configfile.printf("#ifndef GSL_0_9_4_LATER\n#define GSL_0_9_4_LATER\n#endif\n")
|
75
|
+
else
|
76
|
+
configfile.close
|
77
|
+
raise("Ruby/GSL requires gsl-0.9.4 or later.")
|
78
|
+
end
|
79
|
+
if ver >= "1.0"
|
80
|
+
configfile.printf("#ifndef GSL_1_0_LATER\n#define GSL_1_0_LATER\n#endif\n")
|
81
|
+
end
|
82
|
+
if ver >= "1.1"
|
83
|
+
configfile.printf("#ifndef GSL_1_1_LATER\n#define GSL_1_1_LATER\n#endif\n")
|
84
|
+
end
|
85
|
+
if ver >= "1.1.1"
|
86
|
+
configfile.printf("#ifndef GSL_1_1_1_LATER\n#define GSL_1_1_1_LATER\n#endif\n")
|
87
|
+
end
|
88
|
+
if ver >= "1.2"
|
89
|
+
configfile.printf("#ifndef GSL_1_2_LATER\n#define GSL_1_2_LATER\n#endif\n")
|
90
|
+
end
|
91
|
+
if ver >= "1.3"
|
92
|
+
configfile.printf("#ifndef GSL_1_3_LATER\n#define GSL_1_3_LATER\n#endif\n")
|
93
|
+
end
|
94
|
+
if ver >= "1.4"
|
95
|
+
configfile.printf("#ifndef GSL_1_4_LATER\n#define GSL_1_4_LATER\n#endif\n")
|
96
|
+
end
|
97
|
+
if ver >= "1.4.90"
|
98
|
+
configfile.printf("#ifndef GSL_1_4_9_LATER\n#define GSL_1_4_9_LATER\n#endif\n")
|
99
|
+
end
|
100
|
+
|
101
|
+
if ver >= "1.5.90"
|
102
|
+
configfile.printf("#ifndef GSL_1_6_LATER\n#define GSL_1_6_LATER\n#endif\n")
|
103
|
+
end
|
104
|
+
|
105
|
+
if ver >= "1.7.90"
|
106
|
+
configfile.printf("#ifndef GSL_1_8_LATER\n#define GSL_1_8_LATER\n#endif\n")
|
107
|
+
end
|
108
|
+
if ver >= "1.8.90"
|
109
|
+
configfile.printf("#ifndef GSL_1_9_LATER\n#define GSL_1_9_LATER\n#endif\n")
|
110
|
+
end
|
111
|
+
|
112
|
+
if ver >= "1.9.90"
|
113
|
+
configfile.printf("#ifndef GSL_1_10_LATER\n#define GSL_1_10_LATER\n#endif\n")
|
114
|
+
end
|
115
|
+
if ver < "1.4"
|
116
|
+
configfile.printf("#ifndef GSL_CONST_OLD\n#define GSL_CONST_OLD\n#endif\n")
|
117
|
+
end
|
118
|
+
|
119
|
+
if ver >= "1.11"
|
120
|
+
configfile.printf("#ifndef GSL_1_11_LATER\n#define GSL_1_11_LATER\n#endif\n")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
#####
|
126
|
+
|
127
|
+
$CFLAGS = " -Wall -I../include "
|
128
|
+
|
129
|
+
begin
|
130
|
+
RB_GSL_CONFIG = File.open("../include/rb_gsl_config.h", "w")
|
131
|
+
RB_GSL_CONFIG.printf("#ifndef ___RB_GSL_CONFIG_H___\n")
|
132
|
+
RB_GSL_CONFIG.printf("#define ___RB_GSL_CONFIG_H___\n\n")
|
133
|
+
|
134
|
+
check_version(RB_GSL_CONFIG)
|
135
|
+
|
136
|
+
gsl_config()
|
137
|
+
|
138
|
+
have_func("round")
|
139
|
+
|
140
|
+
# Check GSL extensions
|
141
|
+
|
142
|
+
if have_header("rngextra/rngextra.h")
|
143
|
+
have_library("rngextra")
|
144
|
+
end
|
145
|
+
|
146
|
+
if have_header("qrngextra/qrngextra.h")
|
147
|
+
have_library("qrngextra")
|
148
|
+
end
|
149
|
+
|
150
|
+
if have_header("ool/ool_version.h")
|
151
|
+
have_library("ool")
|
152
|
+
end
|
153
|
+
|
154
|
+
if have_header("tensor/tensor.h")
|
155
|
+
have_library("tensor")
|
156
|
+
end
|
157
|
+
|
158
|
+
if have_header("jacobi.h")
|
159
|
+
have_library("jacobi")
|
160
|
+
end
|
161
|
+
if have_header("gsl/gsl_cqp.h")
|
162
|
+
have_library("cqp")
|
163
|
+
end
|
164
|
+
if have_header("gsl/gsl_multimin_fsdf.h")
|
165
|
+
have_library("bundle_method")
|
166
|
+
end
|
167
|
+
|
168
|
+
if have_library("gsl", "gsl_poly_solve_quartic")
|
169
|
+
RB_GSL_CONFIG.printf("#ifndef HAVE_POLY_SOLVE_QUARTIC\n#define HAVE_POLY_SOLVE_QUARTIC\n#endif\n")
|
170
|
+
end
|
171
|
+
if have_library("gsl", "gsl_eigen_francis")
|
172
|
+
RB_GSL_CONFIG.printf("#ifndef HAVE_EIGEN_FRANCIS\n#define HAVE_EIGEN_FRANCIS\n#endif\n")
|
173
|
+
end
|
174
|
+
|
175
|
+
if have_header("ndlinear/gsl_multifit_ndlinear.h")
|
176
|
+
have_library("ndlinear")
|
177
|
+
end
|
178
|
+
|
179
|
+
begin
|
180
|
+
print("checking rb-gsl version...")
|
181
|
+
IO.popen("cat ../VERSION") do |f|
|
182
|
+
ver = GSL::Version.new(f.gets.chomp)
|
183
|
+
puts(ver)
|
184
|
+
RB_GSL_CONFIG.printf("#ifndef RUBY_GSL_VERSION\n#define RUBY_GSL_VERSION \"#{ver}\"\n#endif\n")
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
RUBY_VERSION2 = GSL::Version.new(RUBY_VERSION)
|
189
|
+
|
190
|
+
puts("checking ruby version... #{RUBY_VERSION2}")
|
191
|
+
if RUBY_VERSION2 >= "1.8"
|
192
|
+
RB_GSL_CONFIG.printf("#ifndef RUBY_1_8_LATER\n#define RUBY_1_8_LATER\n#endif\n")
|
193
|
+
|
194
|
+
if find_executable("graph")
|
195
|
+
RB_GSL_CONFIG.printf("#ifndef HAVE_GNU_GRAPH\n#define HAVE_GNU_GRAPH\n#endif\n")
|
196
|
+
end
|
197
|
+
else
|
198
|
+
path = (path || ENV['PATH']).split(File::PATH_SEPARATOR)
|
199
|
+
flag = 0
|
200
|
+
print("checking for GNU graph... ")
|
201
|
+
path.each do |dir|
|
202
|
+
if File.executable?(file = File.join(dir, "graph"))
|
203
|
+
puts("yes")
|
204
|
+
RB_GSL_CONFIG.printf("#ifndef HAVE_GNU_GRAPH\n#define HAVE_GNU_GRAPH\n#endif\n")
|
205
|
+
flag = 1
|
206
|
+
break
|
207
|
+
end
|
208
|
+
end
|
209
|
+
puts("no") if flag == 0
|
210
|
+
end
|
211
|
+
if RUBY_VERSION2 >= "1.9"
|
212
|
+
RB_GSL_CONFIG.printf("#ifndef RUBY_1_9_LATER\n#define RUBY_1_9_LATER\n#endif\n")
|
213
|
+
end
|
214
|
+
|
215
|
+
RB_GSL_CONFIG.printf("\n#endif\n")
|
216
|
+
RB_GSL_CONFIG.close
|
217
|
+
|
218
|
+
rescue
|
219
|
+
raise("Check GSL>=0.9.4 is installed, and the command \"gsl-config\" is in search path.")
|
220
|
+
end
|
221
|
+
|
222
|
+
#narray_config = dir_config("narray")
|
223
|
+
narray_config = dir_config('narray',$sitearchdir,$sitearchdir)
|
224
|
+
# Try to find narray with RubyGems
|
225
|
+
begin
|
226
|
+
require 'rubygems'
|
227
|
+
na_gemspec=Gem.searcher.find('narray.h')
|
228
|
+
if na_gemspec
|
229
|
+
narray_config = File.join(na_gemspec.full_gem_path, na_gemspec.require_path)
|
230
|
+
$CPPFLAGS = " -I#{narray_config} "+$CPPFLAGS
|
231
|
+
end
|
232
|
+
rescue LoadError
|
233
|
+
end
|
234
|
+
have_narray_h = have_header("narray.h")
|
235
|
+
if narray_config
|
236
|
+
if RUBY_PLATFORM =~ /cygwin|mingw/
|
237
|
+
# have_library("narray") || raise("ERROR: narray import library is not found")
|
238
|
+
have_library("narray")
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
tamu_anova_config = dir_config('tamu_anova',$sitearchdir,$sitearchdir)
|
243
|
+
have_tamu_anova_h = have_header("tamu_anova/tamu_anova.h")
|
244
|
+
if tamu_anova_config
|
245
|
+
have_library("tamuanova")
|
246
|
+
# if RUBY_PLATFORM =~ /cygwin|mingw/
|
247
|
+
# have_library("tamuanova") || raise("ERROR: tamu_anova import library is not found")
|
248
|
+
# end
|
249
|
+
end
|
250
|
+
|
251
|
+
File.open("../lib/gsl.rb", "w") do |file|
|
252
|
+
if have_narray_h
|
253
|
+
file.print("require('narray')\n")
|
254
|
+
end
|
255
|
+
# file.print("require('rb_gsl')\ninclude GSL\n")
|
256
|
+
file.print("require('rb_gsl')\n")
|
257
|
+
file.print("require('gsl/oper.rb')\n")
|
258
|
+
end
|
259
|
+
|
260
|
+
File.open("../lib/rbgsl.rb", "w") do |file|
|
261
|
+
if have_narray_h
|
262
|
+
file.print("require('narray')\n")
|
263
|
+
end
|
264
|
+
file.print("require('rb_gsl')\n")
|
265
|
+
file.print("require('gsl/oper.rb')\n")
|
266
|
+
end
|
267
|
+
|
268
|
+
srcs = Dir.glob("*.c") - ["vector_source.c", "matrix_source.c", "tensor_source.c", "poly_source.c", "block_source.c"]
|
269
|
+
|
270
|
+
$objs = srcs.collect { |f| f.sub(".c", ".o") }
|
271
|
+
|
272
|
+
create_makefile("rb_gsl")
|
metadata
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: davidrichards-gsl
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.11.2.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yoshiki Tsunesada
|
8
|
+
- David MacMahon
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-05-16 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: narray
|
18
|
+
type: :runtime
|
19
|
+
version_requirement:
|
20
|
+
version_requirements: !ruby/object:Gem::Requirement
|
21
|
+
requirements:
|
22
|
+
- - ">="
|
23
|
+
- !ruby/object:Gem::Version
|
24
|
+
version: 0.5.9
|
25
|
+
version:
|
26
|
+
description: RubyGSL is a Ruby interface to the GNU Scientific Library, for numerical computing with Ruby
|
27
|
+
email: y-tsunesada@mm.em-net.ne.jp
|
28
|
+
executables: []
|
29
|
+
|
30
|
+
extensions:
|
31
|
+
- ext/extconf.rb
|
32
|
+
extra_rdoc_files: []
|
33
|
+
|
34
|
+
files: []
|
35
|
+
|
36
|
+
has_rdoc: false
|
37
|
+
homepage: http://rb-gsl.rubyforge.org/
|
38
|
+
post_install_message:
|
39
|
+
rdoc_options: []
|
40
|
+
|
41
|
+
require_paths:
|
42
|
+
- lib
|
43
|
+
- lib/gsl
|
44
|
+
- lib/ool
|
45
|
+
- ext
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - ">="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 1.8.1
|
51
|
+
version:
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
version:
|
58
|
+
requirements:
|
59
|
+
- GSL (http://www.gnu.org/software/gsl/)
|
60
|
+
rubyforge_project: rb-gsl
|
61
|
+
rubygems_version: 1.2.0
|
62
|
+
signing_key:
|
63
|
+
specification_version: 2
|
64
|
+
summary: Ruby interface to GSL
|
65
|
+
test_files: []
|
66
|
+
|