mkmf-lite 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +8 -0
- data/lib/mkmf/lite.rb +25 -9
- data/mkmf-lite.gemspec +2 -2
- data/test/test_mkmf_lite.rb +4 -5
- metadata +16 -16
data/CHANGES
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
= 0.2.3 - 25-Apr-2012
|
2
|
+
* No longer assumes mingw/gcc on Windows. Now passes all tests with a
|
3
|
+
version of Ruby compiled with MSVC++.
|
4
|
+
* Eliminate Config vs RbConfig warnings in 1.9.3.
|
5
|
+
* The stdout stream is now temporarily closed in places where it could
|
6
|
+
result in unwanted output.
|
7
|
+
* Upgraded test-unit prerequisite to 2.4.0 or later.
|
8
|
+
|
1
9
|
= 0.2.2 - 6-Dec-2011
|
2
10
|
* Added the check_sizeof method.
|
3
11
|
* If CONFIG['COMMON_HEADERS'] is blank then stdio.h and stdlib.h are
|
data/lib/mkmf/lite.rb
CHANGED
@@ -12,14 +12,19 @@ end
|
|
12
12
|
module Mkmf
|
13
13
|
module Lite
|
14
14
|
# The version of the mkmf-lite library
|
15
|
-
MKMF_LITE_VERSION = '0.2.
|
15
|
+
MKMF_LITE_VERSION = '0.2.3'
|
16
16
|
|
17
|
-
@@cpp_command =
|
18
|
-
@@cpp_outfile = Config::CONFIG['CPPOUTFILE'] || "-o conftest.i"
|
17
|
+
@@cpp_command = RbConfig::CONFIG['CC'] || RbConfig::CONFIG['CPP']
|
19
18
|
@@cpp_srcfile = 'conftest.c'
|
20
19
|
|
21
|
-
if
|
22
|
-
@@
|
20
|
+
if File::ALT_SEPARATOR && RbConfig::CONFIG['CPP'] =~ /^cl/
|
21
|
+
@@cpp_outfile = '/Feconftest.exe'
|
22
|
+
else
|
23
|
+
@@cpp_outfile = '-o conftest.exe'
|
24
|
+
end
|
25
|
+
|
26
|
+
if RbConfig::CONFIG['LIBS']
|
27
|
+
@@cpp_libraries = RbConfig::CONFIG['LIBS'] + RbConfig::CONFIG['LIBRUBYARG']
|
23
28
|
else
|
24
29
|
# TODO: We should adjust this based on OS. For now we're using
|
25
30
|
# arguments I think you'll typically see set on Linux and BSD.
|
@@ -28,7 +33,7 @@ module Mkmf
|
|
28
33
|
|
29
34
|
# JRuby, and possibly others
|
30
35
|
unless @@cpp_command
|
31
|
-
case
|
36
|
+
case RbConfig::CONFIG['host_os']
|
32
37
|
when /msdos|mswin|win32|windows|mingw|cygwin/i
|
33
38
|
@@cpp_command = File.which('cl') || File.which('gcc')
|
34
39
|
when /sunos|solaris|hpux/i
|
@@ -117,7 +122,7 @@ module Mkmf
|
|
117
122
|
def get_header_string(headers)
|
118
123
|
headers = [headers] unless headers.is_a?(Array)
|
119
124
|
|
120
|
-
common_headers =
|
125
|
+
common_headers = RbConfig::CONFIG['COMMON_HEADERS']
|
121
126
|
|
122
127
|
if common_headers.nil? || common_headers.empty?
|
123
128
|
if headers.empty?
|
@@ -148,6 +153,7 @@ module Mkmf
|
|
148
153
|
result = 0
|
149
154
|
|
150
155
|
stderr_orig = $stderr.dup
|
156
|
+
stdout_orig = $stdout.dup
|
151
157
|
|
152
158
|
Dir.chdir(Dir.tmpdir){
|
153
159
|
File.open(@@cpp_srcfile, 'w'){ |fh| fh.write(code) }
|
@@ -156,22 +162,29 @@ module Mkmf
|
|
156
162
|
command += @@cpp_outfile + ' '
|
157
163
|
command += @@cpp_srcfile
|
158
164
|
|
165
|
+
# Temporarily close these
|
159
166
|
$stderr.reopen(File.null)
|
167
|
+
$stdout.reopen(File.null)
|
160
168
|
|
161
169
|
if system(command)
|
162
|
-
|
170
|
+
$stdout.reopen(stdout_orig) # We need this back for open3 to work.
|
171
|
+
|
172
|
+
conftest = File::ALT_SEPARATOR ? "conftest.exe" : "./conftest.exe"
|
173
|
+
|
174
|
+
Open3.popen3(conftest) do |stdin, stdout, stderr|
|
163
175
|
stdin.close
|
164
176
|
stderr.close
|
165
177
|
result = stdout.gets.chomp.to_i
|
166
178
|
end
|
167
179
|
else
|
168
|
-
raise "Failed to compile source code:\n===\n" + code + "==="
|
180
|
+
raise "Failed to compile source code with command '#{command}':\n===\n" + code + "==="
|
169
181
|
end
|
170
182
|
}
|
171
183
|
ensure
|
172
184
|
File.delete(@@cpp_srcfile) if File.exists?(@@cpp_srcfile)
|
173
185
|
File.delete(@@cpp_outfile) if File.exists?(@@cpp_outfile)
|
174
186
|
$stderr.reopen(stderr_orig)
|
187
|
+
$stdout.reopen(stdout_orig)
|
175
188
|
end
|
176
189
|
|
177
190
|
result
|
@@ -188,6 +201,7 @@ module Mkmf
|
|
188
201
|
begin
|
189
202
|
boolean = false
|
190
203
|
stderr_orig = $stderr.dup
|
204
|
+
stdout_orig = $stdout.dup
|
191
205
|
|
192
206
|
Dir.chdir(Dir.tmpdir){
|
193
207
|
File.open(@@cpp_srcfile, 'w'){ |fh| fh.write(code) }
|
@@ -197,11 +211,13 @@ module Mkmf
|
|
197
211
|
command += @@cpp_srcfile
|
198
212
|
|
199
213
|
$stderr.reopen(File.null)
|
214
|
+
$stdout.reopen(File.null)
|
200
215
|
boolean = system(command)
|
201
216
|
}
|
202
217
|
ensure
|
203
218
|
File.delete(@@cpp_srcfile) if File.exists?(@@cpp_srcfile)
|
204
219
|
File.delete(@@cpp_outfile) if File.exists?(@@cpp_outfile)
|
220
|
+
$stdout.reopen(stdout_orig)
|
205
221
|
$stderr.reopen(stderr_orig)
|
206
222
|
end
|
207
223
|
|
data/mkmf-lite.gemspec
CHANGED
@@ -3,7 +3,7 @@ require 'rubygems'
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'mkmf-lite'
|
5
5
|
spec.summary = 'A lighter version of mkmf designed for use as a library'
|
6
|
-
spec.version = '0.2.
|
6
|
+
spec.version = '0.2.3'
|
7
7
|
spec.author = 'Daniel J. Berger'
|
8
8
|
spec.license = 'Artistic 2.0'
|
9
9
|
spec.email = 'djberg96@gmail.com'
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.rubyforge_project = 'shards'
|
16
16
|
|
17
17
|
spec.add_dependency('ptools')
|
18
|
-
spec.add_development_dependency('test-unit', '>= 2.
|
18
|
+
spec.add_development_dependency('test-unit', '>= 2.4.0')
|
19
19
|
|
20
20
|
spec.description = <<-EOF
|
21
21
|
The mkmf-lite library is a light version of the the mkmf library
|
data/test/test_mkmf_lite.rb
CHANGED
@@ -4,8 +4,7 @@
|
|
4
4
|
# Tests for the mkmf-lite library.
|
5
5
|
########################################################################
|
6
6
|
require 'rubygems'
|
7
|
-
|
8
|
-
require 'test/unit'
|
7
|
+
require 'test-unit'
|
9
8
|
require 'mkmf/lite'
|
10
9
|
|
11
10
|
class TC_Mkmf_Lite < Test::Unit::TestCase
|
@@ -22,7 +21,7 @@ class TC_Mkmf_Lite < Test::Unit::TestCase
|
|
22
21
|
end
|
23
22
|
|
24
23
|
test "version information" do
|
25
|
-
assert_equal('0.2.
|
24
|
+
assert_equal('0.2.3', MKMF_LITE_VERSION)
|
26
25
|
end
|
27
26
|
|
28
27
|
test "have_header basic functionality" do
|
@@ -84,7 +83,7 @@ class TC_Mkmf_Lite < Test::Unit::TestCase
|
|
84
83
|
|
85
84
|
test "check_sizeof basic functionality" do
|
86
85
|
assert_respond_to(self, :check_sizeof)
|
87
|
-
assert_nothing_raised{ check_sizeof(
|
86
|
+
assert_nothing_raised{ check_sizeof(@st_type, @st_header) }
|
88
87
|
end
|
89
88
|
|
90
89
|
test "check_sizeof requires at least one argument" do
|
@@ -102,7 +101,7 @@ class TC_Mkmf_Lite < Test::Unit::TestCase
|
|
102
101
|
end
|
103
102
|
|
104
103
|
test "check_sizeof returns an integer value" do
|
105
|
-
size = check_sizeof(
|
104
|
+
size = check_sizeof(@st_type, @st_header)
|
106
105
|
assert_kind_of(Integer, size)
|
107
106
|
assert_true(size > 0)
|
108
107
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkmf-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel J. Berger
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2012-04-25 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: ptools
|
@@ -39,12 +39,12 @@ dependencies:
|
|
39
39
|
requirements:
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
hash:
|
42
|
+
hash: 31
|
43
43
|
segments:
|
44
44
|
- 2
|
45
|
-
-
|
46
|
-
-
|
47
|
-
version: 2.
|
45
|
+
- 4
|
46
|
+
- 0
|
47
|
+
version: 2.4.0
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
50
|
description: " The mkmf-lite library is a light version of the the mkmf library\n designed for use as a library. It does not create packages, builds,\n or log files of any kind. Instead, it provides mixin methods that you\n can use in FFI or tests to check for the presence of header files,\n constants, and so on.\n"
|
@@ -58,18 +58,18 @@ extra_rdoc_files:
|
|
58
58
|
- README
|
59
59
|
- MANIFEST
|
60
60
|
files:
|
61
|
+
- test/test_mkmf_lite.rb
|
62
|
+
- Rakefile
|
63
|
+
- MANIFEST
|
61
64
|
- CHANGES
|
62
|
-
- lib/mkmf/lite.rb
|
63
|
-
- lib/mkmf/templates/check_sizeof.erb
|
64
65
|
- lib/mkmf/templates/have_func.erb
|
65
|
-
- lib/mkmf/templates/
|
66
|
+
- lib/mkmf/templates/check_sizeof.erb
|
66
67
|
- lib/mkmf/templates/have_header.erb
|
68
|
+
- lib/mkmf/templates/have_func_pointer.erb
|
67
69
|
- lib/mkmf/templates/have_struct_member.erb
|
68
|
-
-
|
69
|
-
- mkmf-lite.gemspec
|
70
|
-
- Rakefile
|
70
|
+
- lib/mkmf/lite.rb
|
71
71
|
- README
|
72
|
-
-
|
72
|
+
- mkmf-lite.gemspec
|
73
73
|
homepage: http://www.rubyforge.org/projects/shards
|
74
74
|
licenses:
|
75
75
|
- Artistic 2.0
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements: []
|
100
100
|
|
101
101
|
rubyforge_project: shards
|
102
|
-
rubygems_version: 1.8.
|
102
|
+
rubygems_version: 1.8.17
|
103
103
|
signing_key:
|
104
104
|
specification_version: 3
|
105
105
|
summary: A lighter version of mkmf designed for use as a library
|