mkmf-lite 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ = 0.2.4 - 7-Mar-2013
2
+ * The have_header method now accepts an optional list of directories to search.
3
+
1
4
  = 0.2.3 - 25-Apr-2012
2
5
  * No longer assumes mingw/gcc on Windows. Now passes all tests with a
3
6
  version of Ruby compiled with MSVC++.
data/README CHANGED
@@ -11,7 +11,7 @@
11
11
  require 'mkmf/lite'
12
12
 
13
13
  class System
14
- include Mkmf::Lite
14
+ extend Mkmf::Lite
15
15
 
16
16
  HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
17
17
 
@@ -12,7 +12,7 @@ end
12
12
  module Mkmf
13
13
  module Lite
14
14
  # The version of the mkmf-lite library
15
- MKMF_LITE_VERSION = '0.2.3'
15
+ MKMF_LITE_VERSION = '0.2.4'
16
16
 
17
17
  @@cpp_command = RbConfig::CONFIG['CC'] || RbConfig::CONFIG['CPP']
18
18
  @@cpp_srcfile = 'conftest.c'
@@ -43,14 +43,24 @@ module Mkmf
43
43
  end
44
44
  end
45
45
 
46
- # Check for the presence of the given +header+ file.
46
+ # Check for the presence of the given +header+ file. You may optionally
47
+ # provide a list of directories to search.
47
48
  #
48
49
  # Returns true if found, or false if not found.
49
50
  #
50
- def have_header(header)
51
+ def have_header(header, *directories)
51
52
  erb = ERB.new(read_template('have_header.erb'))
52
53
  code = erb.result(binding)
53
- try_to_compile(code)
54
+
55
+ if directories.empty?
56
+ options = nil
57
+ else
58
+ options = ""
59
+ directories.each{ |dir| options += "-I#{dir} " }
60
+ options.rstrip!
61
+ end
62
+
63
+ try_to_compile(code, options)
54
64
  end
55
65
 
56
66
  # Check for the presence of the given +function+ in the common header
@@ -197,7 +207,7 @@ module Mkmf
197
207
  # Note that $stderr is temporarily redirected to the null device because
198
208
  # we don't actually care about the reason for failure.
199
209
  #
200
- def try_to_compile(code)
210
+ def try_to_compile(code, command_options=nil)
201
211
  begin
202
212
  boolean = false
203
213
  stderr_orig = $stderr.dup
@@ -206,7 +216,12 @@ module Mkmf
206
216
  Dir.chdir(Dir.tmpdir){
207
217
  File.open(@@cpp_srcfile, 'w'){ |fh| fh.write(code) }
208
218
 
209
- command = @@cpp_command + ' '
219
+ if command_options
220
+ command = @@cpp_command + ' ' + command_options + ' '
221
+ else
222
+ command = @@cpp_command + ' '
223
+ end
224
+
210
225
  command += @@cpp_outfile + ' '
211
226
  command += @@cpp_srcfile
212
227
 
@@ -3,11 +3,11 @@ 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.3'
6
+ spec.version = '0.2.4'
7
7
  spec.author = 'Daniel J. Berger'
8
8
  spec.license = 'Artistic 2.0'
9
9
  spec.email = 'djberg96@gmail.com'
10
- spec.homepage = 'http://www.rubyforge.org/projects/shards'
10
+ spec.homepage = 'http://github.com/djberg96/mkmf-lite'
11
11
  spec.test_file = 'test/test_mkmf_lite.rb'
12
12
  spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
13
13
 
@@ -21,7 +21,7 @@ class TC_Mkmf_Lite < Test::Unit::TestCase
21
21
  end
22
22
 
23
23
  test "version information" do
24
- assert_equal('0.2.3', MKMF_LITE_VERSION)
24
+ assert_equal('0.2.4', MKMF_LITE_VERSION)
25
25
  end
26
26
 
27
27
  test "have_header basic functionality" do
@@ -33,9 +33,9 @@ class TC_Mkmf_Lite < Test::Unit::TestCase
33
33
  assert_false(have_header('foobar.h'))
34
34
  end
35
35
 
36
- test "have_header requires one argument only" do
37
- assert_raise(ArgumentError){ have_header }
38
- assert_raise(ArgumentError){ have_header('stdio.h', 'stdlib.h') }
36
+ test "have_header accepts an array of directories as a second argument" do
37
+ assert_nothing_raised{ have_header('stdio.h', '/usr/local/include') }
38
+ assert_nothing_raised{ have_header('stdio.h', '/usr/local/include', '/usr/include') }
39
39
  end
40
40
 
41
41
  test "have_func basic functionality" do
metadata CHANGED
@@ -1,107 +1,97 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: mkmf-lite
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.4
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 3
10
- version: 0.2.3
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Daniel J. Berger
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-25 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-03-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: ptools
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
32
22
  type: :runtime
33
- version_requirements: *id001
34
- - !ruby/object:Gem::Dependency
35
- name: test-unit
36
23
  prerelease: false
37
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: test-unit
32
+ requirement: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- hash: 31
43
- segments:
44
- - 2
45
- - 4
46
- - 0
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
47
37
  version: 2.4.0
48
38
  type: :development
49
- version_requirements: *id002
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"
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 2.4.0
46
+ description: ! " The mkmf-lite library is a light version of the the mkmf library\n
47
+ \ designed for use as a library. It does not create packages, builds,\n or
48
+ log files of any kind. Instead, it provides mixin methods that you\n can use
49
+ in FFI or tests to check for the presence of header files,\n constants, and so
50
+ on.\n"
51
51
  email: djberg96@gmail.com
52
52
  executables: []
53
-
54
53
  extensions: []
55
-
56
- extra_rdoc_files:
54
+ extra_rdoc_files:
57
55
  - CHANGES
58
56
  - README
59
57
  - MANIFEST
60
- files:
61
- - test/test_mkmf_lite.rb
62
- - Rakefile
63
- - MANIFEST
58
+ files:
64
59
  - CHANGES
65
- - lib/mkmf/templates/have_func.erb
60
+ - lib/mkmf/lite.rb
66
61
  - lib/mkmf/templates/check_sizeof.erb
67
- - lib/mkmf/templates/have_header.erb
62
+ - lib/mkmf/templates/have_func.erb
68
63
  - lib/mkmf/templates/have_func_pointer.erb
64
+ - lib/mkmf/templates/have_header.erb
69
65
  - lib/mkmf/templates/have_struct_member.erb
70
- - lib/mkmf/lite.rb
71
- - README
66
+ - MANIFEST
72
67
  - mkmf-lite.gemspec
73
- homepage: http://www.rubyforge.org/projects/shards
74
- licenses:
68
+ - Rakefile
69
+ - README
70
+ - test/test_mkmf_lite.rb
71
+ homepage: http://github.com/djberg96/mkmf-lite
72
+ licenses:
75
73
  - Artistic 2.0
76
74
  post_install_message:
77
75
  rdoc_options: []
78
-
79
- require_paths:
76
+ require_paths:
80
77
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
78
+ required_ruby_version: !ruby/object:Gem::Requirement
82
79
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- hash: 3
87
- segments:
88
- - 0
89
- version: "0"
90
- required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ! '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
85
  none: false
92
- requirements:
93
- - - ">="
94
- - !ruby/object:Gem::Version
95
- hash: 3
96
- segments:
97
- - 0
98
- version: "0"
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
99
90
  requirements: []
100
-
101
91
  rubyforge_project: shards
102
- rubygems_version: 1.8.17
92
+ rubygems_version: 1.8.23
103
93
  signing_key:
104
94
  specification_version: 3
105
95
  summary: A lighter version of mkmf designed for use as a library
106
- test_files:
96
+ test_files:
107
97
  - test/test_mkmf_lite.rb