mkmf-lite 0.3.2 → 0.5.1
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES.rdoc → CHANGES.md} +28 -11
- data/Gemfile +7 -0
- data/{MANIFEST.rdoc → MANIFEST.md} +3 -2
- data/{README.rdoc → README.md} +23 -21
- data/Rakefile +4 -6
- data/lib/mkmf/lite.rb +20 -6
- data/lib/mkmf/templates/check_valueof.erb +8 -0
- data/mkmf-lite.gemspec +4 -6
- data/spec/mkmf_lite_spec.rb +137 -0
- metadata +23 -24
- metadata.gz.sig +0 -0
- data/test/test_mkmf_lite.rb +0 -119
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bb580c0250d33fdbd926c5f85c792e13015866a0c4d18e67aa4acf6b16491f9
|
4
|
+
data.tar.gz: 23d85c79fcb12a6030b812653e78fce81ed7d33fcfe1a4ef4d2200b919e26bfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73afcb819c629c2d88eb46aa52bdaab5dd43ebdd148259f3b72291490c0ddf311af9525d1dfabeb5d530e23576bb2161074964275689fe6f77193b706a863dd5
|
7
|
+
data.tar.gz: fa5c1b19b4697cb5481fcac641ae4ae86eb0b3a3b19f623f8336b251f6dd3962f78d96582952f687c1af4522dad0c59824c2adf1aea966da86d94969dc467ffe
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{CHANGES.rdoc → CHANGES.md}
RENAMED
@@ -1,29 +1,46 @@
|
|
1
|
-
|
1
|
+
## 0.5.1 - 18-Dec-2020
|
2
|
+
* Switch docs to markdown format because github isn't rendering rdoc properly.
|
3
|
+
|
4
|
+
## 0.5.0 - 6-Dec-2020
|
5
|
+
* Added the check_valueof method.
|
6
|
+
|
7
|
+
## 0.4.2 - 31-Aug-2020
|
8
|
+
* Did I say I didn't need ptools? Well I was wrong. It's back.
|
9
|
+
|
10
|
+
## 0.4.1 - 31-Aug-2020
|
11
|
+
* Removed the ptools dependency, just use IO::NULL.
|
12
|
+
|
13
|
+
## 0.4.0 - 4-Jul-2020
|
14
|
+
* Replaced test-unit with rspec, rewrote the tests, and made relevant
|
15
|
+
changes to the gemspec, etc.
|
16
|
+
* Pinned the ptools version to 1.3.x.
|
17
|
+
|
18
|
+
## 0.3.2 - 19-Mar-2020
|
2
19
|
* Properly include a LICENSE file as per the Apache-2.0 license.
|
3
20
|
|
4
|
-
|
21
|
+
## 0.3.1 - 11-Dec-2019
|
5
22
|
* Added .rdoc extension to various text files so that they render more nicely
|
6
23
|
on github.
|
7
24
|
|
8
|
-
|
25
|
+
## 0.3.0 - 6-Jan-2019
|
9
26
|
* Changed license to Apache-2.0.
|
10
27
|
* Replaced class variables with methods.
|
11
28
|
* Updated cert.
|
12
29
|
|
13
|
-
|
30
|
+
## 0.2.6 - 6-Sep-2015
|
14
31
|
* Added an mkmf-lite.rb file for convenience.
|
15
32
|
* Assume Rubygems 2.x.
|
16
33
|
* This gem is now signed.
|
17
34
|
|
18
|
-
|
35
|
+
## 0.2.5 - 2-Oct-2014
|
19
36
|
* The CC command for mingw now defaults to searching your path rather than
|
20
37
|
relying on an environment variable because it wasn't trustworthy.
|
21
38
|
* Updated the gem:install task for Rubygems 2.x.
|
22
39
|
|
23
|
-
|
40
|
+
## 0.2.4 - 7-Mar-2013
|
24
41
|
* The have_header method now accepts an optional list of directories to search.
|
25
42
|
|
26
|
-
|
43
|
+
## 0.2.3 - 25-Apr-2012
|
27
44
|
* No longer assumes mingw/gcc on Windows. Now passes all tests with a
|
28
45
|
version of Ruby compiled with MSVC++.
|
29
46
|
* Eliminate Config vs RbConfig warnings in 1.9.3.
|
@@ -31,17 +48,17 @@
|
|
31
48
|
result in unwanted output.
|
32
49
|
* Upgraded test-unit prerequisite to 2.4.0 or later.
|
33
50
|
|
34
|
-
|
51
|
+
## 0.2.2 - 6-Dec-2011
|
35
52
|
* Added the check_sizeof method.
|
36
53
|
* If CONFIG['COMMON_HEADERS'] is blank then stdio.h and stdlib.h are
|
37
54
|
used instead. On MS Windows the windows.h header is also used.
|
38
55
|
|
39
|
-
|
56
|
+
## 0.2.1 - 21-Jan-2011
|
40
57
|
* Minor platform detection adjustments for MS Windows.
|
41
58
|
|
42
|
-
|
59
|
+
## 0.2.0 - 8-Jun-2010
|
43
60
|
* Now works properly with JRuby (though it still requires a compiler
|
44
61
|
somewhere on your system).
|
45
62
|
|
46
|
-
|
63
|
+
## 0.1.0 - 24-May-2010
|
47
64
|
* Initial release.
|
data/Gemfile
ADDED
@@ -1,13 +1,14 @@
|
|
1
1
|
* CHANGES.rdoc
|
2
2
|
* LICENSE
|
3
3
|
* MANIFEST.rdoc
|
4
|
-
* README.rdoc
|
5
4
|
* Rakefile
|
6
5
|
* mkmf-lite.gemspec
|
7
6
|
* certs/djberg96_pub.pem
|
8
7
|
* lib/mkmf/lite.rb
|
8
|
+
* lib/mkmf/templates/check_sizeof.erb
|
9
|
+
* lib/mkmf/templates/check_valueof.erb
|
9
10
|
* lib/mkmf/templates/have_func.erb
|
10
11
|
* lib/mkmf/templates/have_func_pointer.erb
|
11
12
|
* lib/mkmf/templates/have_header.erb
|
12
13
|
* lib/mkmf/templates/have_struct_member.erb
|
13
|
-
*
|
14
|
+
* spec/mkmf_lite_spec.rb
|
data/{README.rdoc → README.md}
RENAMED
@@ -1,28 +1,30 @@
|
|
1
|
-
|
1
|
+
## Summary
|
2
2
|
A light version of mkmf designed for use within programs.
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
## Installation
|
5
|
+
`gem install mkmf-lite`
|
6
6
|
|
7
|
-
|
7
|
+
## Prerequisites
|
8
8
|
A C compiler somewhere on your system.
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
## Synopsis
|
11
|
+
```
|
12
|
+
require 'mkmf/lite'
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
class System
|
15
|
+
extend Mkmf::Lite
|
15
16
|
|
16
|
-
|
17
|
+
HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
19
|
+
def some_method
|
20
|
+
if HAVE_PW_NAME
|
21
|
+
# Do something
|
22
22
|
end
|
23
23
|
end
|
24
|
+
end
|
25
|
+
```
|
24
26
|
|
25
|
-
|
27
|
+
## Description
|
26
28
|
The mkmf library that ships as part of the Ruby standard library is not
|
27
29
|
meant for use as an internal library. It's strictly designed for building
|
28
30
|
C extensions. It's huge, its methods sit in a global namespace, it contains
|
@@ -36,24 +38,24 @@ used in conjunction with FFI. Also, the source code is quite readable.
|
|
36
38
|
It does not package C extensions, nor generate a log file or a Makefile. It
|
37
39
|
does, however, require that you have a C compiler somewhere on your system.
|
38
40
|
|
39
|
-
|
41
|
+
## Known Issues
|
40
42
|
You may see this warning from JRuby 1.4.x and earlier:
|
41
43
|
|
42
44
|
warning: Useless use of a variable in void context.
|
43
45
|
|
44
46
|
You can ignore these (or, upgrade your Jruby).
|
45
47
|
|
46
|
-
|
48
|
+
## License
|
47
49
|
Apache-2.0
|
48
50
|
|
49
|
-
|
50
|
-
(C) 2010-
|
51
|
+
## Copyright
|
52
|
+
(C) 2010-2020 Daniel J. Berger
|
51
53
|
All Rights Reserved
|
52
54
|
|
53
|
-
|
55
|
+
## Warranty
|
54
56
|
This library is provided "as is" and without any express or
|
55
57
|
implied warranties, including, without limitation, the implied
|
56
58
|
warranties of merchantability and fitness for a particular purpose.
|
57
59
|
|
58
|
-
|
59
|
-
Daniel Berger
|
60
|
+
## Author
|
61
|
+
Daniel J. Berger
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/clean'
|
3
|
-
require '
|
3
|
+
require 'rspec/core/rake_task'
|
4
4
|
|
5
5
|
CLEAN.include("**/*.gem", "**/*.rbc")
|
6
6
|
|
@@ -20,9 +20,7 @@ namespace 'gem' do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
t.warning = true
|
26
|
-
end
|
23
|
+
desc "Run the test suite"
|
24
|
+
RSpec::Core::RakeTask.new(:spec)
|
27
25
|
|
28
|
-
task :default => :
|
26
|
+
task :default => :spec
|
data/lib/mkmf/lite.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'rbconfig'
|
3
3
|
require 'tmpdir'
|
4
|
-
require 'ptools'
|
5
4
|
require 'open3'
|
5
|
+
require 'ptools'
|
6
6
|
|
7
7
|
module Mkmf
|
8
8
|
module Lite
|
9
9
|
# The version of the mkmf-lite library
|
10
|
-
MKMF_LITE_VERSION = '0.
|
10
|
+
MKMF_LITE_VERSION = '0.5.1'.freeze
|
11
11
|
|
12
12
|
private
|
13
13
|
|
@@ -95,6 +95,20 @@ module Mkmf
|
|
95
95
|
try_to_compile(code)
|
96
96
|
end
|
97
97
|
|
98
|
+
# Returns the value of the given +constant+ (which could also be a macro)
|
99
|
+
# using +headers+, or common headers if no headers are specified.
|
100
|
+
#
|
101
|
+
# If this method fails an error is raised. This could happen if the constant
|
102
|
+
# can't be found and/or the header files do not include the indicated constant.
|
103
|
+
#
|
104
|
+
def check_valueof(constant, headers = [])
|
105
|
+
headers = get_header_string(headers)
|
106
|
+
erb = ERB.new(read_template('check_valueof.erb'))
|
107
|
+
code = erb.result(binding)
|
108
|
+
|
109
|
+
try_to_execute(code)
|
110
|
+
end
|
111
|
+
|
98
112
|
# Returns the sizeof +type+ using +headers+, or common headers if no
|
99
113
|
# headers are specified.
|
100
114
|
#
|
@@ -171,8 +185,8 @@ module Mkmf
|
|
171
185
|
command += cpp_source_file
|
172
186
|
|
173
187
|
# Temporarily close these
|
174
|
-
$stderr.reopen(
|
175
|
-
$stdout.reopen(
|
188
|
+
$stderr.reopen(IO::NULL)
|
189
|
+
$stdout.reopen(IO::NULL)
|
176
190
|
|
177
191
|
if system(command)
|
178
192
|
$stdout.reopen(stdout_orig) # We need this back for open3 to work.
|
@@ -223,8 +237,8 @@ module Mkmf
|
|
223
237
|
command += cpp_out_file + ' '
|
224
238
|
command += cpp_source_file
|
225
239
|
|
226
|
-
$stderr.reopen(
|
227
|
-
$stdout.reopen(
|
240
|
+
$stderr.reopen(IO::NULL)
|
241
|
+
$stdout.reopen(IO::NULL)
|
228
242
|
boolean = system(command)
|
229
243
|
}
|
230
244
|
ensure
|
data/mkmf-lite.gemspec
CHANGED
@@ -3,19 +3,17 @@ 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.
|
6
|
+
spec.version = '0.5.1'
|
7
7
|
spec.author = 'Daniel J. Berger'
|
8
8
|
spec.license = 'Apache-2.0'
|
9
9
|
spec.email = 'djberg96@gmail.com'
|
10
10
|
spec.homepage = 'http://github.com/djberg96/mkmf-lite'
|
11
|
-
spec.test_file = '
|
11
|
+
spec.test_file = 'spec/mkmf_lite_spec.rb'
|
12
12
|
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
13
13
|
spec.cert_chain = ['certs/djberg96_pub.pem']
|
14
14
|
|
15
|
-
spec.
|
16
|
-
|
17
|
-
spec.add_dependency('ptools')
|
18
|
-
spec.add_development_dependency('test-unit', '>= 2.4.0')
|
15
|
+
spec.add_dependency('ptools', '~> 1.4')
|
16
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
19
17
|
|
20
18
|
spec.metadata = {
|
21
19
|
'homepage_uri' => 'https://github.com/djberg96/mkmf-lite',
|
@@ -0,0 +1,137 @@
|
|
1
|
+
########################################################################
|
2
|
+
# mkmf_lite_spec.rb
|
3
|
+
#
|
4
|
+
# Tests for the mkmf-lite library.
|
5
|
+
########################################################################
|
6
|
+
require 'rubygems'
|
7
|
+
require 'rspec'
|
8
|
+
require 'mkmf/lite'
|
9
|
+
|
10
|
+
describe Mkmf::Lite do
|
11
|
+
subject { Class.new{ |obj| obj.extend Mkmf::Lite } }
|
12
|
+
|
13
|
+
let(:st_type) { 'struct stat' }
|
14
|
+
let(:st_member) { 'st_uid' }
|
15
|
+
let(:st_header) { 'sys/stat.h' }
|
16
|
+
let(:constant) { 'EOF' }
|
17
|
+
|
18
|
+
describe "constants" do
|
19
|
+
example "version information" do
|
20
|
+
expect(described_class::MKMF_LITE_VERSION).to eq('0.5.1')
|
21
|
+
expect(described_class::MKMF_LITE_VERSION).to be_frozen
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "have_header" do
|
26
|
+
example "have_header basic functionality" do
|
27
|
+
expect(subject).to respond_to(:have_header)
|
28
|
+
end
|
29
|
+
|
30
|
+
example "have_header returns expected boolean value" do
|
31
|
+
expect(subject.have_header('stdio.h')).to eq(true)
|
32
|
+
expect(subject.have_header('foobar.h')).to eq(false)
|
33
|
+
end
|
34
|
+
|
35
|
+
example "have_header accepts an array of directories as a second argument" do
|
36
|
+
expect{ subject.have_header('stdio.h', '/usr/local/include') }.not_to raise_error
|
37
|
+
expect{ subject.have_header('stdio.h', '/usr/local/include', '/usr/include') }.not_to raise_error
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "have_func" do
|
42
|
+
example "have_func basic functionality" do
|
43
|
+
expect(subject).to respond_to(:have_func)
|
44
|
+
end
|
45
|
+
|
46
|
+
example "have_func with no arguments returns expected boolean value" do
|
47
|
+
expect(subject.have_func('abort')).to eq(true)
|
48
|
+
expect(subject.have_func('abortxyz')).to eq(false)
|
49
|
+
end
|
50
|
+
|
51
|
+
example "have_func with arguments returns expected boolean value" do
|
52
|
+
expect(subject.have_func('printf', 'stdio.h')).to eq(true)
|
53
|
+
expect(subject.have_func('printfx', 'stdio.h')).to eq(false)
|
54
|
+
end
|
55
|
+
|
56
|
+
example "have_func requires at least one argument" do
|
57
|
+
expect{ subject.have_func }.to raise_error(ArgumentError)
|
58
|
+
end
|
59
|
+
|
60
|
+
example "have_func accepts a maximum of two arguments" do
|
61
|
+
expect{ subject.have_func('printf', 'stdio.h', 'bogus') }.to raise_error(ArgumentError)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context "have_struct_member" do
|
66
|
+
example "have_struct_member basic functionality" do
|
67
|
+
expect(subject).to respond_to(:have_struct_member)
|
68
|
+
end
|
69
|
+
|
70
|
+
example "have_struct_member returns expected boolean value" do
|
71
|
+
expect(subject.have_struct_member(st_type, st_member, st_header)).to eq(true)
|
72
|
+
expect(subject.have_struct_member(st_type, 'pw_bogus', st_header)).to eq(false)
|
73
|
+
expect(subject.have_struct_member(st_type, st_member)).to eq(false)
|
74
|
+
end
|
75
|
+
|
76
|
+
example "have_struct_member requires at least two arguments" do
|
77
|
+
expect{ subject.have_struct_member() }.to raise_error(ArgumentError)
|
78
|
+
expect{ subject.have_struct_member('struct passwd') }.to raise_error(ArgumentError)
|
79
|
+
end
|
80
|
+
|
81
|
+
example "have_struct_member accepts a maximum of three arguments" do
|
82
|
+
expect{ subject.have_struct_member('struct passwd', 'pw_name', 'pwd.h', true) }.to raise_error(ArgumentError)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context "check_valueof" do
|
87
|
+
example "check_valueof basic functionality" do
|
88
|
+
expect(subject).to respond_to(:check_valueof)
|
89
|
+
expect{ subject.check_sizeof(constant) }.not_to raise_error
|
90
|
+
end
|
91
|
+
|
92
|
+
example "check_valueof requires at least one argument" do
|
93
|
+
expect{ subject.check_valueof }.to raise_error(ArgumentError)
|
94
|
+
end
|
95
|
+
|
96
|
+
example "check_valueof accepts a maximum of two arguments" do
|
97
|
+
expect{ subject.check_valueof(constant, 'stdio.h', 1) }.to raise_error(ArgumentError)
|
98
|
+
end
|
99
|
+
|
100
|
+
example "check_valueof works with one or two arguments" do
|
101
|
+
expect{ subject.check_valueof(constant) }.not_to raise_error
|
102
|
+
expect{ subject.check_valueof(constant, 'stdio.h') }.not_to raise_error
|
103
|
+
end
|
104
|
+
|
105
|
+
example "check_valueof returns an integer value" do
|
106
|
+
value = subject.check_valueof(constant)
|
107
|
+
expect(value).to be_kind_of(Integer)
|
108
|
+
expect(value).to eq(-1)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
context "check_sizeof" do
|
113
|
+
example "check_sizeof basic functionality" do
|
114
|
+
expect(subject).to respond_to(:check_sizeof)
|
115
|
+
expect{ subject.check_sizeof(st_type, st_header) }.not_to raise_error
|
116
|
+
end
|
117
|
+
|
118
|
+
example "check_sizeof requires at least one argument" do
|
119
|
+
expect{ subject.check_sizeof }.to raise_error(ArgumentError)
|
120
|
+
end
|
121
|
+
|
122
|
+
example "check_sizeof accepts a maximum of two arguments" do
|
123
|
+
expect{ subject.check_sizeof('div_t', 'stdlib.h', 1) }.to raise_error(ArgumentError)
|
124
|
+
end
|
125
|
+
|
126
|
+
example "check_sizeof works with one or two arguments" do
|
127
|
+
expect{ subject.check_sizeof('div_t') }.not_to raise_error
|
128
|
+
expect{ subject.check_sizeof('div_t', 'stdlib.h') }.not_to raise_error
|
129
|
+
end
|
130
|
+
|
131
|
+
example "check_sizeof returns an integer value" do
|
132
|
+
size = subject.check_sizeof(st_type, st_header)
|
133
|
+
expect(size).to be_kind_of(Integer)
|
134
|
+
expect(size).to be > 0
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkmf-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
@@ -35,36 +35,36 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2020-
|
38
|
+
date: 2020-12-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: ptools
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '1.4'
|
47
47
|
type: :runtime
|
48
48
|
prerelease: false
|
49
49
|
version_requirements: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
|
-
- - "
|
51
|
+
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '1.4'
|
54
54
|
- !ruby/object:Gem::Dependency
|
55
|
-
name:
|
55
|
+
name: rspec
|
56
56
|
requirement: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
|
-
- - "
|
58
|
+
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: '3.9'
|
61
61
|
type: :development
|
62
62
|
prerelease: false
|
63
63
|
version_requirements: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
|
-
- - "
|
65
|
+
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version:
|
67
|
+
version: '3.9'
|
68
68
|
description: |2
|
69
69
|
The mkmf-lite library is a light version of the the mkmf library
|
70
70
|
designed for use as a library. It does not create packages, builds,
|
@@ -74,26 +74,25 @@ description: |2
|
|
74
74
|
email: djberg96@gmail.com
|
75
75
|
executables: []
|
76
76
|
extensions: []
|
77
|
-
extra_rdoc_files:
|
78
|
-
- CHANGES.rdoc
|
79
|
-
- MANIFEST.rdoc
|
80
|
-
- README.rdoc
|
77
|
+
extra_rdoc_files: []
|
81
78
|
files:
|
82
|
-
- CHANGES.
|
79
|
+
- CHANGES.md
|
80
|
+
- Gemfile
|
83
81
|
- LICENSE
|
84
|
-
- MANIFEST.
|
85
|
-
- README.
|
82
|
+
- MANIFEST.md
|
83
|
+
- README.md
|
86
84
|
- Rakefile
|
87
85
|
- certs/djberg96_pub.pem
|
88
86
|
- lib/mkmf-lite.rb
|
89
87
|
- lib/mkmf/lite.rb
|
90
88
|
- lib/mkmf/templates/check_sizeof.erb
|
89
|
+
- lib/mkmf/templates/check_valueof.erb
|
91
90
|
- lib/mkmf/templates/have_func.erb
|
92
91
|
- lib/mkmf/templates/have_func_pointer.erb
|
93
92
|
- lib/mkmf/templates/have_header.erb
|
94
93
|
- lib/mkmf/templates/have_struct_member.erb
|
95
94
|
- mkmf-lite.gemspec
|
96
|
-
-
|
95
|
+
- spec/mkmf_lite_spec.rb
|
97
96
|
homepage: http://github.com/djberg96/mkmf-lite
|
98
97
|
licenses:
|
99
98
|
- Apache-2.0
|
@@ -104,7 +103,7 @@ metadata:
|
|
104
103
|
documentation_uri: https://github.com/djberg96/mkmf-lite/wiki
|
105
104
|
source_code_uri: https://github.com/djberg96/mkmf-lite
|
106
105
|
wiki_uri: https://github.com/djberg96/mkmf-lite/wiki
|
107
|
-
post_install_message:
|
106
|
+
post_install_message:
|
108
107
|
rdoc_options: []
|
109
108
|
require_paths:
|
110
109
|
- lib
|
@@ -119,9 +118,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
118
|
- !ruby/object:Gem::Version
|
120
119
|
version: '0'
|
121
120
|
requirements: []
|
122
|
-
rubygems_version: 3.0.
|
123
|
-
signing_key:
|
121
|
+
rubygems_version: 3.0.3
|
122
|
+
signing_key:
|
124
123
|
specification_version: 4
|
125
124
|
summary: A lighter version of mkmf designed for use as a library
|
126
125
|
test_files:
|
127
|
-
-
|
126
|
+
- spec/mkmf_lite_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/test/test_mkmf_lite.rb
DELETED
@@ -1,119 +0,0 @@
|
|
1
|
-
########################################################################
|
2
|
-
# test_mkmf_lite.rb
|
3
|
-
#
|
4
|
-
# Tests for the mkmf-lite library.
|
5
|
-
########################################################################
|
6
|
-
require 'rubygems'
|
7
|
-
require 'test-unit'
|
8
|
-
require 'mkmf/lite'
|
9
|
-
|
10
|
-
class TC_Mkmf_Lite < Test::Unit::TestCase
|
11
|
-
include Mkmf::Lite
|
12
|
-
|
13
|
-
def self.startup
|
14
|
-
@@windows = File::ALT_SEPARATOR
|
15
|
-
end
|
16
|
-
|
17
|
-
def setup
|
18
|
-
@st_type = 'struct stat'
|
19
|
-
@st_member = 'st_uid'
|
20
|
-
@st_header = 'sys/stat.h'
|
21
|
-
end
|
22
|
-
|
23
|
-
test "version information" do
|
24
|
-
assert_equal('0.3.2', MKMF_LITE_VERSION)
|
25
|
-
assert_true(MKMF_LITE_VERSION.frozen?)
|
26
|
-
end
|
27
|
-
|
28
|
-
test "have_header basic functionality" do
|
29
|
-
assert_respond_to(self, :have_header)
|
30
|
-
end
|
31
|
-
|
32
|
-
test "have_header returns expected boolean value" do
|
33
|
-
assert_true(have_header('stdio.h'))
|
34
|
-
assert_false(have_header('foobar.h'))
|
35
|
-
end
|
36
|
-
|
37
|
-
test "have_header accepts an array of directories as a second argument" do
|
38
|
-
assert_nothing_raised{ have_header('stdio.h', '/usr/local/include') }
|
39
|
-
assert_nothing_raised{ have_header('stdio.h', '/usr/local/include', '/usr/include') }
|
40
|
-
end
|
41
|
-
|
42
|
-
test "have_func basic functionality" do
|
43
|
-
assert_respond_to(self, :have_func)
|
44
|
-
end
|
45
|
-
|
46
|
-
test "have_func with no arguments returns expected boolean value" do
|
47
|
-
assert_true(have_func('abort'))
|
48
|
-
assert_false(have_func('abortxyz'))
|
49
|
-
end
|
50
|
-
|
51
|
-
test "have_func with arguments returns expected boolean value" do
|
52
|
-
assert_true(have_func('printf', 'stdio.h'))
|
53
|
-
assert_false(have_func('printfx', 'stdio.h'))
|
54
|
-
end
|
55
|
-
|
56
|
-
test "have_func requires at least one argument" do
|
57
|
-
assert_raise(ArgumentError){ have_func }
|
58
|
-
end
|
59
|
-
|
60
|
-
test "have_func accepts a maximum of two arguments" do
|
61
|
-
assert_raise(ArgumentError){ have_func('printf', 'stdio.h', 'bogus') }
|
62
|
-
end
|
63
|
-
|
64
|
-
test "have_struct_member basic functionality" do
|
65
|
-
assert_respond_to(self, :have_struct_member)
|
66
|
-
end
|
67
|
-
|
68
|
-
test "have_struct_member returns expected boolean value" do
|
69
|
-
assert_true(have_struct_member(@st_type, @st_member, @st_header))
|
70
|
-
assert_false(have_struct_member(@st_type, 'pw_bogus', @st_header))
|
71
|
-
assert_false(have_struct_member(@st_type, @st_member))
|
72
|
-
end
|
73
|
-
|
74
|
-
test "have_struct_member requires at least two arguments" do
|
75
|
-
assert_raise(ArgumentError){ have_struct_member() }
|
76
|
-
assert_raise(ArgumentError){ have_struct_member('struct passwd') }
|
77
|
-
end
|
78
|
-
|
79
|
-
test "have_struct_member accepts a maximum of three arguments" do
|
80
|
-
assert_raise(ArgumentError){
|
81
|
-
have_struct_member('struct passwd', 'pw_name', 'pwd.h', true)
|
82
|
-
}
|
83
|
-
end
|
84
|
-
|
85
|
-
test "check_sizeof basic functionality" do
|
86
|
-
assert_respond_to(self, :check_sizeof)
|
87
|
-
assert_nothing_raised{ check_sizeof(@st_type, @st_header) }
|
88
|
-
end
|
89
|
-
|
90
|
-
test "check_sizeof requires at least one argument" do
|
91
|
-
assert_raise(ArgumentError){ check_sizeof }
|
92
|
-
assert_raise(ArgumentError){ check_sizeof('struct passwd', 'pw_name', 1) }
|
93
|
-
end
|
94
|
-
|
95
|
-
test "check_sizeof accepts a maximum of two arguments" do
|
96
|
-
assert_raise(ArgumentError){ check_sizeof('div_t', 'stdlib.h', 1) }
|
97
|
-
end
|
98
|
-
|
99
|
-
test "check_sizeof works with one or two arguments" do
|
100
|
-
assert_nothing_raised{ check_sizeof('div_t') }
|
101
|
-
assert_nothing_raised{ check_sizeof('div_t', 'stdlib.h') }
|
102
|
-
end
|
103
|
-
|
104
|
-
test "check_sizeof returns an integer value" do
|
105
|
-
size = check_sizeof(@st_type, @st_header)
|
106
|
-
assert_kind_of(Integer, size)
|
107
|
-
assert_true(size > 0)
|
108
|
-
end
|
109
|
-
|
110
|
-
def teardown
|
111
|
-
@st_type = nil
|
112
|
-
@st_member = nil
|
113
|
-
@st_header = nil
|
114
|
-
end
|
115
|
-
|
116
|
-
def self.shutdown
|
117
|
-
@@windows = nil
|
118
|
-
end
|
119
|
-
end
|