mkmf-lite 0.2.6 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/{CHANGES → CHANGES.rdoc} +28 -8
- data/LICENSE +177 -0
- data/{MANIFEST → MANIFEST.rdoc} +4 -3
- data/README.rdoc +59 -0
- data/Rakefile +4 -6
- data/certs/djberg96_pub.pem +22 -17
- data/lib/mkmf/lite.rb +40 -43
- data/mkmf-lite.gemspec +14 -6
- data/spec/mkmf_lite_spec.rb +111 -0
- metadata +50 -53
- metadata.gz.sig +0 -0
- data/README +0 -59
- data/test/test_mkmf_lite.rb +0 -118
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e5fbebe26461faed92ccf6a8d53559fa6ded609ea0b86a6aa2ac568ae686379a
|
4
|
+
data.tar.gz: 354bc9ea211b75135c36561959f79c3d49a87adbda94d278afbbefed487ae2eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65a70af388b94df60553fde2f2a0e2e9e8506e519a45292e4a001bbb7582248218eb53743510c3a27ea6bb066d7e64052b8995348a4fab39c5cdd561d1642f55
|
7
|
+
data.tar.gz: c391ed16452f6a9dace0b27c6c792cd4ea41882a1657595aba5367130e50802f67c27de650578d6a7ce3f63f35b70e122ee94a2eccc249f8d88475ad283d53fa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/{CHANGES → CHANGES.rdoc}
RENAMED
@@ -1,17 +1,37 @@
|
|
1
|
-
|
1
|
+
== 0.4.1 - 31-Aug-2020
|
2
|
+
* Removed the ptools dependency, just use IO::NULL.
|
3
|
+
|
4
|
+
== 0.4.0 - 4-Jul-2020
|
5
|
+
* Replaced test-unit with rspec, rewrote the tests, and made relevant
|
6
|
+
changes to the gemspec, etc.
|
7
|
+
* Pinned the ptools version to 1.3.x.
|
8
|
+
|
9
|
+
== 0.3.2 - 19-Mar-2020
|
10
|
+
* Properly include a LICENSE file as per the Apache-2.0 license.
|
11
|
+
|
12
|
+
== 0.3.1 - 11-Dec-2019
|
13
|
+
* Added .rdoc extension to various text files so that they render more nicely
|
14
|
+
on github.
|
15
|
+
|
16
|
+
== 0.3.0 - 6-Jan-2019
|
17
|
+
* Changed license to Apache-2.0.
|
18
|
+
* Replaced class variables with methods.
|
19
|
+
* Updated cert.
|
20
|
+
|
21
|
+
== 0.2.6 - 6-Sep-2015
|
2
22
|
* Added an mkmf-lite.rb file for convenience.
|
3
23
|
* Assume Rubygems 2.x.
|
4
24
|
* This gem is now signed.
|
5
25
|
|
6
|
-
|
26
|
+
== 0.2.5 - 2-Oct-2014
|
7
27
|
* The CC command for mingw now defaults to searching your path rather than
|
8
28
|
relying on an environment variable because it wasn't trustworthy.
|
9
29
|
* Updated the gem:install task for Rubygems 2.x.
|
10
30
|
|
11
|
-
|
31
|
+
== 0.2.4 - 7-Mar-2013
|
12
32
|
* The have_header method now accepts an optional list of directories to search.
|
13
33
|
|
14
|
-
|
34
|
+
== 0.2.3 - 25-Apr-2012
|
15
35
|
* No longer assumes mingw/gcc on Windows. Now passes all tests with a
|
16
36
|
version of Ruby compiled with MSVC++.
|
17
37
|
* Eliminate Config vs RbConfig warnings in 1.9.3.
|
@@ -19,17 +39,17 @@
|
|
19
39
|
result in unwanted output.
|
20
40
|
* Upgraded test-unit prerequisite to 2.4.0 or later.
|
21
41
|
|
22
|
-
|
42
|
+
== 0.2.2 - 6-Dec-2011
|
23
43
|
* Added the check_sizeof method.
|
24
44
|
* If CONFIG['COMMON_HEADERS'] is blank then stdio.h and stdlib.h are
|
25
45
|
used instead. On MS Windows the windows.h header is also used.
|
26
46
|
|
27
|
-
|
47
|
+
== 0.2.1 - 21-Jan-2011
|
28
48
|
* Minor platform detection adjustments for MS Windows.
|
29
49
|
|
30
|
-
|
50
|
+
== 0.2.0 - 8-Jun-2010
|
31
51
|
* Now works properly with JRuby (though it still requires a compiler
|
32
52
|
somewhere on your system).
|
33
53
|
|
34
|
-
|
54
|
+
== 0.1.0 - 24-May-2010
|
35
55
|
* Initial release.
|
data/LICENSE
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
|
2
|
+
Apache License
|
3
|
+
Version 2.0, January 2004
|
4
|
+
http://www.apache.org/licenses/
|
5
|
+
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7
|
+
|
8
|
+
1. Definitions.
|
9
|
+
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
12
|
+
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
14
|
+
the copyright owner that is granting the License.
|
15
|
+
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
17
|
+
other entities that control, are controlled by, or are under common
|
18
|
+
control with that entity. For the purposes of this definition,
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
20
|
+
direction or management of such entity, whether by contract or
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
23
|
+
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
25
|
+
exercising permissions granted by this License.
|
26
|
+
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
28
|
+
including but not limited to software source code, documentation
|
29
|
+
source, and configuration files.
|
30
|
+
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
32
|
+
transformation or translation of a Source form, including but
|
33
|
+
not limited to compiled object code, generated documentation,
|
34
|
+
and conversions to other media types.
|
35
|
+
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
37
|
+
Object form, made available under the License, as indicated by a
|
38
|
+
copyright notice that is included in or attached to the work
|
39
|
+
(an example is provided in the Appendix below).
|
40
|
+
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
47
|
+
the Work and Derivative Works thereof.
|
48
|
+
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
50
|
+
the original version of the Work and any modifications or additions
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
62
|
+
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
65
|
+
subsequently incorporated within the Work.
|
66
|
+
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
73
|
+
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
79
|
+
where such license applies only to those patent claims licensable
|
80
|
+
by such Contributor that are necessarily infringed by their
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
83
|
+
institute patent litigation against any entity (including a
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
86
|
+
or contributory patent infringement, then any patent licenses
|
87
|
+
granted to You under this License for that Work shall terminate
|
88
|
+
as of the date such litigation is filed.
|
89
|
+
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
92
|
+
modifications, and in Source or Object form, provided that You
|
93
|
+
meet the following conditions:
|
94
|
+
|
95
|
+
(a) You must give any other recipients of the Work or
|
96
|
+
Derivative Works a copy of this License; and
|
97
|
+
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
99
|
+
stating that You changed the files; and
|
100
|
+
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
103
|
+
attribution notices from the Source form of the Work,
|
104
|
+
excluding those notices that do not pertain to any part of
|
105
|
+
the Derivative Works; and
|
106
|
+
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
109
|
+
include a readable copy of the attribution notices contained
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
112
|
+
of the following places: within a NOTICE text file distributed
|
113
|
+
as part of the Derivative Works; within the Source form or
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
115
|
+
within a display generated by the Derivative Works, if and
|
116
|
+
wherever such third-party notices normally appear. The contents
|
117
|
+
of the NOTICE file are for informational purposes only and
|
118
|
+
do not modify the License. You may add Your own attribution
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
121
|
+
that such additional attribution notices cannot be construed
|
122
|
+
as modifying the License.
|
123
|
+
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
125
|
+
may provide additional or different license terms and conditions
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
129
|
+
the conditions stated in this License.
|
130
|
+
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
134
|
+
this License, without any additional terms or conditions.
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
136
|
+
the terms of any separate license agreement you may have executed
|
137
|
+
with Licensor regarding such Contributions.
|
138
|
+
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
141
|
+
except as required for reasonable and customary use in describing the
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
143
|
+
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
153
|
+
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
159
|
+
incidental, or consequential damages of any character arising as a
|
160
|
+
result of this License or out of the use or inability to use the
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
163
|
+
other commercial damages or losses), even if such Contributor
|
164
|
+
has been advised of the possibility of such damages.
|
165
|
+
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
169
|
+
or other liability obligations and/or rights consistent with this
|
170
|
+
License. However, in accepting such obligations, You may act only
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
175
|
+
of your accepting any such warranty or additional liability.
|
176
|
+
|
177
|
+
END OF TERMS AND CONDITIONS
|
data/{MANIFEST → MANIFEST.rdoc}
RENAMED
@@ -1,5 +1,6 @@
|
|
1
|
-
* CHANGES
|
2
|
-
*
|
1
|
+
* CHANGES.rdoc
|
2
|
+
* LICENSE
|
3
|
+
* MANIFEST.rdoc
|
3
4
|
* Rakefile
|
4
5
|
* mkmf-lite.gemspec
|
5
6
|
* certs/djberg96_pub.pem
|
@@ -8,4 +9,4 @@
|
|
8
9
|
* lib/mkmf/templates/have_func_pointer.erb
|
9
10
|
* lib/mkmf/templates/have_header.erb
|
10
11
|
* lib/mkmf/templates/have_struct_member.erb
|
11
|
-
*
|
12
|
+
* spec/mkmf_lite_spec.rb
|
data/README.rdoc
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
== Summary
|
2
|
+
A light version of mkmf designed for use within programs.
|
3
|
+
|
4
|
+
== Installation
|
5
|
+
gem install mkmf-lite
|
6
|
+
|
7
|
+
== Prerequisites
|
8
|
+
A C compiler somewhere on your system.
|
9
|
+
|
10
|
+
== Synopsis
|
11
|
+
require 'mkmf/lite'
|
12
|
+
|
13
|
+
class System
|
14
|
+
extend Mkmf::Lite
|
15
|
+
|
16
|
+
HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
|
17
|
+
|
18
|
+
def some_method
|
19
|
+
if HAVE_PW_NAME
|
20
|
+
# Do something
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
== Description
|
26
|
+
The mkmf library that ships as part of the Ruby standard library is not
|
27
|
+
meant for use as an internal library. It's strictly designed for building
|
28
|
+
C extensions. It's huge, its methods sit in a global namespace, it contains
|
29
|
+
many methods you don't care about, and it emits stuff to $stdout that cannot
|
30
|
+
easily be disabled. Also, the source code is monstrous.
|
31
|
+
|
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.
|
43
|
+
|
44
|
+
You can ignore these (or, upgrade your Jruby).
|
45
|
+
|
46
|
+
== License
|
47
|
+
Apache-2.0
|
48
|
+
|
49
|
+
== Copyright
|
50
|
+
(C) 2010-2020 Daniel J. Berger
|
51
|
+
All Rights Reserved
|
52
|
+
|
53
|
+
== Warranty
|
54
|
+
This library is provided "as is" and without any express or
|
55
|
+
implied warranties, including, without limitation, the implied
|
56
|
+
warranties of merchantability and fitness for a particular purpose.
|
57
|
+
|
58
|
+
== Author
|
59
|
+
Daniel 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/certs/djberg96_pub.pem
CHANGED
@@ -1,21 +1,26 @@
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
2
|
-
|
2
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
3
3
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
4
|
-
|
4
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
5
5
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
6
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
7
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
8
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
9
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
10
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
11
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
|
12
|
+
ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
|
13
|
+
74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
|
14
|
+
058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
|
15
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
16
|
+
AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
|
17
|
+
YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
18
|
+
/3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
|
19
|
+
h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
|
20
|
+
6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
|
21
|
+
ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
22
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
23
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
24
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
25
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
21
26
|
-----END CERTIFICATE-----
|
data/lib/mkmf/lite.rb
CHANGED
@@ -1,48 +1,45 @@
|
|
1
1
|
require 'erb'
|
2
2
|
require 'rbconfig'
|
3
3
|
require 'tmpdir'
|
4
|
-
require 'ptools'
|
5
4
|
require 'open3'
|
6
5
|
|
7
6
|
module Mkmf
|
8
7
|
module Lite
|
9
8
|
# The version of the mkmf-lite library
|
10
|
-
MKMF_LITE_VERSION = '0.
|
9
|
+
MKMF_LITE_VERSION = '0.4.1'.freeze
|
11
10
|
|
12
|
-
|
13
|
-
@@cpp_srcfile = 'conftest.c'
|
11
|
+
private
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
def cpp_command
|
14
|
+
command = RbConfig::CONFIG['CC'] || RbConfig::CONFIG['CPP'] || File.which('cc') || File.which('gcc') || File.which('cl')
|
15
|
+
raise "Compiler not found" unless command
|
16
|
+
command
|
19
17
|
end
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
else
|
24
|
-
# TODO: We should adjust this based on OS. For now we're using
|
25
|
-
# arguments I think you'll typically see set on Linux and BSD.
|
26
|
-
@@cpp_libraries = "-lrt -ldl -lcrypt -lm"
|
19
|
+
def cpp_source_file
|
20
|
+
'conftest.c'
|
27
21
|
end
|
28
22
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
when /sunos|solaris|hpux/i
|
35
|
-
@@cpp_command = File.which('cc') || File.which('gcc')
|
36
|
-
else
|
37
|
-
@@cpp_command = 'gcc'
|
23
|
+
def cpp_out_file
|
24
|
+
if File::ALT_SEPARATOR && RbConfig::CONFIG['CPP'] =~ /^cl/
|
25
|
+
'/Feconftest.exe'
|
26
|
+
else
|
27
|
+
'-o conftest.exe'
|
38
28
|
end
|
39
29
|
end
|
40
30
|
|
41
|
-
#
|
42
|
-
|
43
|
-
|
31
|
+
# TODO: We should adjust this based on OS. For now we're using
|
32
|
+
# arguments I think you'll typically see set on Linux and BSD.
|
33
|
+
def cpp_libraries
|
34
|
+
if RbConfig::CONFIG['LIBS']
|
35
|
+
RbConfig::CONFIG['LIBS'] + RbConfig::CONFIG['LIBRUBYARG']
|
36
|
+
else
|
37
|
+
'-lrt -ldl -lcrypt -lm'
|
38
|
+
end
|
44
39
|
end
|
45
40
|
|
41
|
+
public
|
42
|
+
|
46
43
|
# Check for the presence of the given +header+ file. You may optionally
|
47
44
|
# provide a list of directories to search.
|
48
45
|
#
|
@@ -166,15 +163,15 @@ module Mkmf
|
|
166
163
|
stdout_orig = $stdout.dup
|
167
164
|
|
168
165
|
Dir.chdir(Dir.tmpdir){
|
169
|
-
File.open(
|
166
|
+
File.open(cpp_source_file, 'w'){ |fh| fh.write(code) }
|
170
167
|
|
171
|
-
command =
|
172
|
-
command +=
|
173
|
-
command +=
|
168
|
+
command = cpp_command + ' '
|
169
|
+
command += cpp_out_file + ' '
|
170
|
+
command += cpp_source_file
|
174
171
|
|
175
172
|
# Temporarily close these
|
176
|
-
$stderr.reopen(
|
177
|
-
$stdout.reopen(
|
173
|
+
$stderr.reopen(IO::NULL)
|
174
|
+
$stdout.reopen(IO::NULL)
|
178
175
|
|
179
176
|
if system(command)
|
180
177
|
$stdout.reopen(stdout_orig) # We need this back for open3 to work.
|
@@ -191,8 +188,8 @@ module Mkmf
|
|
191
188
|
end
|
192
189
|
}
|
193
190
|
ensure
|
194
|
-
File.delete(
|
195
|
-
File.delete(
|
191
|
+
File.delete(cpp_source_file) if File.exists?(cpp_source_file)
|
192
|
+
File.delete(cpp_out_file) if File.exists?(cpp_out_file)
|
196
193
|
$stderr.reopen(stderr_orig)
|
197
194
|
$stdout.reopen(stdout_orig)
|
198
195
|
end
|
@@ -214,24 +211,24 @@ module Mkmf
|
|
214
211
|
stdout_orig = $stdout.dup
|
215
212
|
|
216
213
|
Dir.chdir(Dir.tmpdir){
|
217
|
-
File.open(
|
214
|
+
File.open(cpp_source_file, 'w'){ |fh| fh.write(code) }
|
218
215
|
|
219
216
|
if command_options
|
220
|
-
command =
|
217
|
+
command = cpp_command + ' ' + command_options + ' '
|
221
218
|
else
|
222
|
-
command =
|
219
|
+
command = cpp_command + ' '
|
223
220
|
end
|
224
221
|
|
225
|
-
command +=
|
226
|
-
command +=
|
222
|
+
command += cpp_out_file + ' '
|
223
|
+
command += cpp_source_file
|
227
224
|
|
228
|
-
$stderr.reopen(
|
229
|
-
$stdout.reopen(
|
225
|
+
$stderr.reopen(IO::NULL)
|
226
|
+
$stdout.reopen(IO::NULL)
|
230
227
|
boolean = system(command)
|
231
228
|
}
|
232
229
|
ensure
|
233
|
-
File.delete(
|
234
|
-
File.delete(
|
230
|
+
File.delete(cpp_source_file) if File.exists?(cpp_source_file)
|
231
|
+
File.delete(cpp_out_file) if File.exists?(cpp_out_file)
|
235
232
|
$stdout.reopen(stdout_orig)
|
236
233
|
$stderr.reopen(stderr_orig)
|
237
234
|
end
|
data/mkmf-lite.gemspec
CHANGED
@@ -3,19 +3,27 @@ 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.4.1'
|
7
7
|
spec.author = 'Daniel J. Berger'
|
8
|
-
spec.license = '
|
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.extra_rdoc_files
|
15
|
+
spec.extra_rdoc_files = Dir['*.rdoc']
|
16
16
|
|
17
|
-
spec.
|
18
|
-
|
17
|
+
spec.add_development_dependency('rspec', '~> 3.9')
|
18
|
+
|
19
|
+
spec.metadata = {
|
20
|
+
'homepage_uri' => 'https://github.com/djberg96/mkmf-lite',
|
21
|
+
'bug_tracker_uri' => 'https://github.com/djberg96/mkmf-lite/issues',
|
22
|
+
'changelog_uri' => 'https://github.com/djberg96/mkmf-lite/blob/master/CHANGES.rdoc',
|
23
|
+
'documentation_uri' => 'https://github.com/djberg96/mkmf-lite/wiki',
|
24
|
+
'source_code_uri' => 'https://github.com/djberg96/mkmf-lite',
|
25
|
+
'wiki_uri' => 'https://github.com/djberg96/mkmf-lite/wiki'
|
26
|
+
}
|
19
27
|
|
20
28
|
spec.description = <<-EOF
|
21
29
|
The mkmf-lite library is a light version of the the mkmf library
|
@@ -0,0 +1,111 @@
|
|
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
|
+
|
17
|
+
describe "constants" do
|
18
|
+
example "version information" do
|
19
|
+
expect(described_class::MKMF_LITE_VERSION).to eq('0.4.1')
|
20
|
+
expect(described_class::MKMF_LITE_VERSION).to be_frozen
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "have_header" do
|
25
|
+
example "have_header basic functionality" do
|
26
|
+
expect(subject).to respond_to(:have_header)
|
27
|
+
end
|
28
|
+
|
29
|
+
example "have_header returns expected boolean value" do
|
30
|
+
expect(subject.have_header('stdio.h')).to eq(true)
|
31
|
+
expect(subject.have_header('foobar.h')).to eq(false)
|
32
|
+
end
|
33
|
+
|
34
|
+
example "have_header accepts an array of directories as a second argument" do
|
35
|
+
expect{ subject.have_header('stdio.h', '/usr/local/include') }.not_to raise_error
|
36
|
+
expect{ subject.have_header('stdio.h', '/usr/local/include', '/usr/include') }.not_to raise_error
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "have_func" do
|
41
|
+
example "have_func basic functionality" do
|
42
|
+
expect(subject).to respond_to(:have_func)
|
43
|
+
end
|
44
|
+
|
45
|
+
example "have_func with no arguments returns expected boolean value" do
|
46
|
+
expect(subject.have_func('abort')).to eq(true)
|
47
|
+
expect(subject.have_func('abortxyz')).to eq(false)
|
48
|
+
end
|
49
|
+
|
50
|
+
example "have_func with arguments returns expected boolean value" do
|
51
|
+
expect(subject.have_func('printf', 'stdio.h')).to eq(true)
|
52
|
+
expect(subject.have_func('printfx', 'stdio.h')).to eq(false)
|
53
|
+
end
|
54
|
+
|
55
|
+
example "have_func requires at least one argument" do
|
56
|
+
expect{ subject.have_func }.to raise_error(ArgumentError)
|
57
|
+
end
|
58
|
+
|
59
|
+
example "have_func accepts a maximum of two arguments" do
|
60
|
+
expect{ subject.have_func('printf', 'stdio.h', 'bogus') }.to raise_error(ArgumentError)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
context "have_struct_member" do
|
65
|
+
example "have_struct_member basic functionality" do
|
66
|
+
expect(subject).to respond_to(:have_struct_member)
|
67
|
+
end
|
68
|
+
|
69
|
+
example "have_struct_member returns expected boolean value" do
|
70
|
+
expect(subject.have_struct_member(st_type, st_member, st_header)).to eq(true)
|
71
|
+
expect(subject.have_struct_member(st_type, 'pw_bogus', st_header)).to eq(false)
|
72
|
+
expect(subject.have_struct_member(st_type, st_member)).to eq(false)
|
73
|
+
end
|
74
|
+
|
75
|
+
example "have_struct_member requires at least two arguments" do
|
76
|
+
expect{ subject.have_struct_member() }.to raise_error(ArgumentError)
|
77
|
+
expect{ subject.have_struct_member('struct passwd') }.to raise_error(ArgumentError)
|
78
|
+
end
|
79
|
+
|
80
|
+
example "have_struct_member accepts a maximum of three arguments" do
|
81
|
+
expect{ subject.have_struct_member('struct passwd', 'pw_name', 'pwd.h', true) }.to raise_error(ArgumentError)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
context "check_sizeof" do
|
86
|
+
example "check_sizeof basic functionality" do
|
87
|
+
expect(subject).to respond_to(:check_sizeof)
|
88
|
+
expect{ subject.check_sizeof(st_type, st_header) }.not_to raise_error
|
89
|
+
end
|
90
|
+
|
91
|
+
example "check_sizeof requires at least one argument" do
|
92
|
+
expect{ subject.check_sizeof }.to raise_error(ArgumentError)
|
93
|
+
expect{ subject.check_sizeof('struct passwd', 'pw_name', 1) }.to raise_error(ArgumentError)
|
94
|
+
end
|
95
|
+
|
96
|
+
example "check_sizeof accepts a maximum of two arguments" do
|
97
|
+
expect{ subject.check_sizeof('div_t', 'stdlib.h', 1) }.to raise_error(ArgumentError)
|
98
|
+
end
|
99
|
+
|
100
|
+
example "check_sizeof works with one or two arguments" do
|
101
|
+
expect{ subject.check_sizeof('div_t') }.not_to raise_error
|
102
|
+
expect{ subject.check_sizeof('div_t', 'stdlib.h') }.not_to raise_error
|
103
|
+
end
|
104
|
+
|
105
|
+
example "check_sizeof returns an integer value" do
|
106
|
+
size = subject.check_sizeof(st_type, st_header)
|
107
|
+
expect(size).to be_kind_of(Integer)
|
108
|
+
expect(size).to be > 0
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
metadata
CHANGED
@@ -1,65 +1,56 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mkmf-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.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
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
|
14
14
|
cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
15
|
-
|
15
|
+
MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
|
16
16
|
ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
17
|
+
bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
|
18
|
+
A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
|
19
|
+
u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
|
20
|
+
75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
|
21
|
+
6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
|
22
|
+
iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
|
23
|
+
ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
|
24
|
+
74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
|
25
|
+
058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
|
26
|
+
HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
|
27
|
+
AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
|
28
|
+
YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
|
29
|
+
/3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
|
30
|
+
h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
|
31
|
+
6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
|
32
|
+
ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
|
33
|
+
1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
|
34
|
+
DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
|
35
|
+
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
|
+
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2020-08-31 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
41
|
+
name: rspec
|
37
42
|
requirement: !ruby/object:Gem::Requirement
|
38
43
|
requirements:
|
39
|
-
- - "
|
44
|
+
- - "~>"
|
40
45
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
42
|
-
type: :runtime
|
43
|
-
prerelease: false
|
44
|
-
version_requirements: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: test-unit
|
51
|
-
requirement: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: 2.4.0
|
46
|
+
version: '3.9'
|
56
47
|
type: :development
|
57
48
|
prerelease: false
|
58
49
|
version_requirements: !ruby/object:Gem::Requirement
|
59
50
|
requirements:
|
60
|
-
- - "
|
51
|
+
- - "~>"
|
61
52
|
- !ruby/object:Gem::Version
|
62
|
-
version:
|
53
|
+
version: '3.9'
|
63
54
|
description: |2
|
64
55
|
The mkmf-lite library is a light version of the the mkmf library
|
65
56
|
designed for use as a library. It does not create packages, builds,
|
@@ -70,13 +61,14 @@ email: djberg96@gmail.com
|
|
70
61
|
executables: []
|
71
62
|
extensions: []
|
72
63
|
extra_rdoc_files:
|
73
|
-
- CHANGES
|
74
|
-
-
|
75
|
-
-
|
64
|
+
- CHANGES.rdoc
|
65
|
+
- MANIFEST.rdoc
|
66
|
+
- README.rdoc
|
76
67
|
files:
|
77
|
-
- CHANGES
|
78
|
-
-
|
79
|
-
-
|
68
|
+
- CHANGES.rdoc
|
69
|
+
- LICENSE
|
70
|
+
- MANIFEST.rdoc
|
71
|
+
- README.rdoc
|
80
72
|
- Rakefile
|
81
73
|
- certs/djberg96_pub.pem
|
82
74
|
- lib/mkmf-lite.rb
|
@@ -87,12 +79,18 @@ files:
|
|
87
79
|
- lib/mkmf/templates/have_header.erb
|
88
80
|
- lib/mkmf/templates/have_struct_member.erb
|
89
81
|
- mkmf-lite.gemspec
|
90
|
-
-
|
82
|
+
- spec/mkmf_lite_spec.rb
|
91
83
|
homepage: http://github.com/djberg96/mkmf-lite
|
92
84
|
licenses:
|
93
|
-
-
|
94
|
-
metadata:
|
95
|
-
|
85
|
+
- Apache-2.0
|
86
|
+
metadata:
|
87
|
+
homepage_uri: https://github.com/djberg96/mkmf-lite
|
88
|
+
bug_tracker_uri: https://github.com/djberg96/mkmf-lite/issues
|
89
|
+
changelog_uri: https://github.com/djberg96/mkmf-lite/blob/master/CHANGES.rdoc
|
90
|
+
documentation_uri: https://github.com/djberg96/mkmf-lite/wiki
|
91
|
+
source_code_uri: https://github.com/djberg96/mkmf-lite
|
92
|
+
wiki_uri: https://github.com/djberg96/mkmf-lite/wiki
|
93
|
+
post_install_message:
|
96
94
|
rdoc_options: []
|
97
95
|
require_paths:
|
98
96
|
- lib
|
@@ -107,10 +105,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
105
|
- !ruby/object:Gem::Version
|
108
106
|
version: '0'
|
109
107
|
requirements: []
|
110
|
-
|
111
|
-
|
112
|
-
signing_key:
|
108
|
+
rubygems_version: 3.1.4
|
109
|
+
signing_key:
|
113
110
|
specification_version: 4
|
114
111
|
summary: A lighter version of mkmf designed for use as a library
|
115
112
|
test_files:
|
116
|
-
-
|
113
|
+
- spec/mkmf_lite_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|
data/README
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
== Summary
|
2
|
-
A light version of mkmf designed for use within programs.
|
3
|
-
|
4
|
-
== Installation
|
5
|
-
gem install mkmf-lite
|
6
|
-
|
7
|
-
== Prerequisites
|
8
|
-
A C compiler somewhere on your system.
|
9
|
-
|
10
|
-
== Synopsis
|
11
|
-
require 'mkmf/lite'
|
12
|
-
|
13
|
-
class System
|
14
|
-
extend Mkmf::Lite
|
15
|
-
|
16
|
-
HAVE_PW_NAME = have_struct_member('struct passwd', 'pw_name', 'pwd.h')
|
17
|
-
|
18
|
-
def some_method
|
19
|
-
if HAVE_PW_NAME
|
20
|
-
# Do something
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
== Description
|
26
|
-
The mkmf library that ships as part of the Ruby standard library is not
|
27
|
-
meant for use as an internal library. It's strictly designed for building
|
28
|
-
C extensions. It's huge, its methods sit in a global namespace, it contains
|
29
|
-
many methods you don't care about, and it emits stuff to $stdout that cannot
|
30
|
-
easily be disabled. Also, the source code is monstrous.
|
31
|
-
|
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.
|
43
|
-
|
44
|
-
You can ignore these (or, upgrade your Jruby).
|
45
|
-
|
46
|
-
== License
|
47
|
-
Artistic 2.0
|
48
|
-
|
49
|
-
== Copyright
|
50
|
-
(C) 2010-2015 Daniel J. Berger
|
51
|
-
All Rights Reserved
|
52
|
-
|
53
|
-
== Warranty
|
54
|
-
This library is provided "as is" and without any express or
|
55
|
-
implied warranties, including, without limitation, the implied
|
56
|
-
warranties of merchantability and fitness for a particular purpose.
|
57
|
-
|
58
|
-
== Author
|
59
|
-
Daniel Berger
|
data/test/test_mkmf_lite.rb
DELETED
@@ -1,118 +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.2.6', MKMF_LITE_VERSION)
|
25
|
-
end
|
26
|
-
|
27
|
-
test "have_header basic functionality" do
|
28
|
-
assert_respond_to(self, :have_header)
|
29
|
-
end
|
30
|
-
|
31
|
-
test "have_header returns expected boolean value" do
|
32
|
-
assert_true(have_header('stdio.h'))
|
33
|
-
assert_false(have_header('foobar.h'))
|
34
|
-
end
|
35
|
-
|
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
|
-
end
|
40
|
-
|
41
|
-
test "have_func basic functionality" do
|
42
|
-
assert_respond_to(self, :have_func)
|
43
|
-
end
|
44
|
-
|
45
|
-
test "have_func with no arguments returns expected boolean value" do
|
46
|
-
assert_true(have_func('abort'))
|
47
|
-
assert_false(have_func('abortxyz'))
|
48
|
-
end
|
49
|
-
|
50
|
-
test "have_func with arguments returns expected boolean value" do
|
51
|
-
assert_true(have_func('printf', 'stdio.h'))
|
52
|
-
assert_false(have_func('printfx', 'stdio.h'))
|
53
|
-
end
|
54
|
-
|
55
|
-
test "have_func requires at least one argument" do
|
56
|
-
assert_raise(ArgumentError){ have_func }
|
57
|
-
end
|
58
|
-
|
59
|
-
test "have_func accepts a maximum of two arguments" do
|
60
|
-
assert_raise(ArgumentError){ have_func('printf', 'stdio.h', 'bogus') }
|
61
|
-
end
|
62
|
-
|
63
|
-
test "have_struct_member basic functionality" do
|
64
|
-
assert_respond_to(self, :have_struct_member)
|
65
|
-
end
|
66
|
-
|
67
|
-
test "have_struct_member returns expected boolean value" do
|
68
|
-
assert_true(have_struct_member(@st_type, @st_member, @st_header))
|
69
|
-
assert_false(have_struct_member(@st_type, 'pw_bogus', @st_header))
|
70
|
-
assert_false(have_struct_member(@st_type, @st_member))
|
71
|
-
end
|
72
|
-
|
73
|
-
test "have_struct_member requires at least two arguments" do
|
74
|
-
assert_raise(ArgumentError){ have_struct_member() }
|
75
|
-
assert_raise(ArgumentError){ have_struct_member('struct passwd') }
|
76
|
-
end
|
77
|
-
|
78
|
-
test "have_struct_member accepts a maximum of three arguments" do
|
79
|
-
assert_raise(ArgumentError){
|
80
|
-
have_struct_member('struct passwd', 'pw_name', 'pwd.h', true)
|
81
|
-
}
|
82
|
-
end
|
83
|
-
|
84
|
-
test "check_sizeof basic functionality" do
|
85
|
-
assert_respond_to(self, :check_sizeof)
|
86
|
-
assert_nothing_raised{ check_sizeof(@st_type, @st_header) }
|
87
|
-
end
|
88
|
-
|
89
|
-
test "check_sizeof requires at least one argument" do
|
90
|
-
assert_raise(ArgumentError){ check_sizeof }
|
91
|
-
assert_raise(ArgumentError){ check_sizeof('struct passwd', 'pw_name', 1) }
|
92
|
-
end
|
93
|
-
|
94
|
-
test "check_sizeof accepts a maximum of two arguments" do
|
95
|
-
assert_raise(ArgumentError){ check_sizeof('div_t', 'stdlib.h', 1) }
|
96
|
-
end
|
97
|
-
|
98
|
-
test "check_sizeof works with one or two arguments" do
|
99
|
-
assert_nothing_raised{ check_sizeof('div_t') }
|
100
|
-
assert_nothing_raised{ check_sizeof('div_t', 'stdlib.h') }
|
101
|
-
end
|
102
|
-
|
103
|
-
test "check_sizeof returns an integer value" do
|
104
|
-
size = check_sizeof(@st_type, @st_header)
|
105
|
-
assert_kind_of(Integer, size)
|
106
|
-
assert_true(size > 0)
|
107
|
-
end
|
108
|
-
|
109
|
-
def teardown
|
110
|
-
@st_type = nil
|
111
|
-
@st_member = nil
|
112
|
-
@st_header = nil
|
113
|
-
end
|
114
|
-
|
115
|
-
def self.shutdown
|
116
|
-
@@windows = nil
|
117
|
-
end
|
118
|
-
end
|