mkmf-lite 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,2 +1,6 @@
1
+ = 0.2.0 - 8-Jun-2010
2
+ * Now works properly with JRuby (though it still requires a compiler
3
+ somewhere on your system).
4
+
1
5
  = 0.1.0 - 24-May-2010
2
6
  * Initial release.
data/README CHANGED
@@ -1,7 +1,13 @@
1
- = Summary
1
+ == Summary
2
2
  A light version of mkmf designed for use within programs.
3
3
 
4
- = Synopsis
4
+ == Installation
5
+ gem install mkmf-lite
6
+
7
+ == Prerequisites
8
+ A C compiler somewhere on your system.
9
+
10
+ == Synopsis
5
11
  require 'mkmf/lite'
6
12
 
7
13
  class System
@@ -16,18 +22,26 @@
16
22
  end
17
23
  end
18
24
 
19
- = Description
25
+ == Description
20
26
  The mkmf library that ships as part of the Ruby standard library is not
21
27
  meant for use as an internal library. It's strictly designed for building
22
28
  C extensions. It's huge, its methods sit in a global namespace, it contains
23
- many methods you don't care about, and emits output to $stdout that cannot
29
+ many methods you don't care about, and it emits stuff to $stdout that cannot
24
30
  easily be disabled. Also, the source code is monstrous.
25
31
 
26
- The mkmf-lite is a module, it's small, and it's designed to be mixed into
27
- classes. It contains a handful of methods that, most likely, will be used
28
- in conjunction with FFI. Also, the source code is quite readable.
32
+ The mkmf-lite library is a module, it's small, and it's designed to be mixed
33
+ into classes. It contains a handful of methods that, most likely, will be
34
+ used in conjunction with FFI. Also, the source code is quite readable.
35
+
36
+ It does not package C extensions, nor generate a log file or a Makefile. It
37
+ does, however, require that you have a C compiler somewhere on your system.
38
+
39
+ == Known Issues
40
+ You may see this warning from JRuby 1.4.x and earlier:
41
+
42
+ warning: Useless use of a variable in void context.
29
43
 
30
- It does not package C extensions, nor generate a log file or a Makefile.
44
+ You can ignore these (or, upgrade your Jruby).
31
45
 
32
46
  == License
33
47
  Artistic 2.0
@@ -41,5 +55,5 @@
41
55
  implied warranties, including, without limitation, the implied
42
56
  warranties of merchantability and fitness for a particular purpose.
43
57
 
44
- = Author
58
+ == Author
45
59
  Daniel Berger
data/lib/mkmf/lite.rb CHANGED
@@ -6,13 +6,32 @@ require 'ptools'
6
6
  module Mkmf
7
7
  module Lite
8
8
  # The version of the mkmf-lite library
9
- MKMF_LITE_VERSION = '0.1.0'
9
+ MKMF_LITE_VERSION = '0.2.0'
10
10
 
11
11
  @@cpp_command = Config::CONFIG['CC'] || Config::CONFIG['CPP']
12
- @@cpp_outfile = Config::CONFIG['CPPOUTFILE'] # -o conftest.i
13
- @@cpp_libraries = Config::CONFIG['LIBS'] + Config::CONFIG['LIBRUBYARG']
12
+ @@cpp_outfile = Config::CONFIG['CPPOUTFILE'] || "-o conftest.i"
14
13
  @@cpp_srcfile = 'conftest.c'
15
14
 
15
+ if Config::CONFIG['LIBS']
16
+ @@cpp_libraries = Config::CONFIG['LIBS'] + Config::CONFIG['LIBRUBYARG']
17
+ else
18
+ # TODO: We should adjust this based on OS. For now we're using
19
+ # arguments I think you'll typically see set on Linux and BSD.
20
+ @@cpp_libraries = "-lrt -ldl -lcrypt -lm"
21
+ end
22
+
23
+ # JRuby, and possibly others
24
+ unless @@cpp_command
25
+ case Config::CONFIG['host_os']
26
+ when /msdos|mswin|win32|mingw|cygwin/i
27
+ @@cpp_command = File.which('cl') || File.which('gcc')
28
+ when /sunos|solaris|hpux/i
29
+ @@cpp_command = File.which('cc') || File.which('gcc')
30
+ else
31
+ @@cpp_command = 'gcc'
32
+ end
33
+ end
34
+
16
35
  # Check for the presence of the given +header+ file.
17
36
  #
18
37
  # Returns true if found, or false if not found.
@@ -71,7 +90,9 @@ module Mkmf
71
90
  def get_header_string(headers)
72
91
  headers = [headers] unless headers.is_a?(Array)
73
92
 
74
- unless Config::CONFIG['COMMON_HEADERS'].empty?
93
+ common_headers = Config::CONFIG['COMMON_HEADERS']
94
+
95
+ unless common_headers.nil? || common_headers.empty?
75
96
  headers += Config::CONFIG['COMMON_HEADERS'].split
76
97
  end
77
98
 
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.1.0'
6
+ spec.version = '0.2.0'
7
7
  spec.author = 'Daniel J. Berger'
8
8
  spec.license = 'Artistic 2.0'
9
9
  spec.email = 'djberg96@gmail.com'
@@ -22,7 +22,7 @@ class TC_Mkmf_Lite < Test::Unit::TestCase
22
22
  end
23
23
 
24
24
  test "version information" do
25
- assert_equal('0.1.0', MKMF_LITE_VERSION)
25
+ assert_equal('0.2.0', MKMF_LITE_VERSION)
26
26
  end
27
27
 
28
28
  test "have_header basic functionality" do
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mkmf-lite
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 23
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 1
8
+ - 2
8
9
  - 0
9
- version: 0.1.0
10
+ version: 0.2.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Daniel J. Berger
@@ -14,16 +15,18 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-05-24 00:00:00 -06:00
18
+ date: 2010-06-08 00:00:00 -06:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: ptools
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ">="
26
28
  - !ruby/object:Gem::Version
29
+ hash: 3
27
30
  segments:
28
31
  - 0
29
32
  version: "0"
@@ -33,9 +36,11 @@ dependencies:
33
36
  name: test-unit
34
37
  prerelease: false
35
38
  requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
36
40
  requirements:
37
41
  - - ">="
38
42
  - !ruby/object:Gem::Version
43
+ hash: 1
39
44
  segments:
40
45
  - 2
41
46
  - 0
@@ -54,17 +59,17 @@ extra_rdoc_files:
54
59
  - README
55
60
  - MANIFEST
56
61
  files:
62
+ - MANIFEST
57
63
  - CHANGES
64
+ - README
65
+ - mkmf-lite.gemspec
66
+ - test/test_mkmf_lite.rb
67
+ - Rakefile
58
68
  - lib/mkmf/lite.rb
59
- - lib/mkmf/templates/have_func.erb
60
69
  - lib/mkmf/templates/have_func_pointer.erb
61
70
  - lib/mkmf/templates/have_header.erb
71
+ - lib/mkmf/templates/have_func.erb
62
72
  - lib/mkmf/templates/have_struct_member.erb
63
- - MANIFEST
64
- - mkmf-lite.gemspec
65
- - Rakefile
66
- - README
67
- - test/test_mkmf_lite.rb
68
73
  has_rdoc: true
69
74
  homepage: http://www.rubyforge.org/projects/shards
70
75
  licenses:
@@ -75,23 +80,27 @@ rdoc_options: []
75
80
  require_paths:
76
81
  - lib
77
82
  required_ruby_version: !ruby/object:Gem::Requirement
83
+ none: false
78
84
  requirements:
79
85
  - - ">="
80
86
  - !ruby/object:Gem::Version
87
+ hash: 3
81
88
  segments:
82
89
  - 0
83
90
  version: "0"
84
91
  required_rubygems_version: !ruby/object:Gem::Requirement
92
+ none: false
85
93
  requirements:
86
94
  - - ">="
87
95
  - !ruby/object:Gem::Version
96
+ hash: 3
88
97
  segments:
89
98
  - 0
90
99
  version: "0"
91
100
  requirements: []
92
101
 
93
102
  rubyforge_project: shards
94
- rubygems_version: 1.3.6
103
+ rubygems_version: 1.3.7
95
104
  signing_key:
96
105
  specification_version: 3
97
106
  summary: A lighter version of mkmf designed for use as a library