rake-compiler 0.9.1 → 0.9.2
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.
- data/History.txt +6 -0
- data/README.rdoc +15 -6
- data/lib/rake/extensiontask.rb +16 -0
- data/tasks/gem.rake +1 -1
- metadata +4 -4
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -225,7 +225,16 @@ How can this be you say? Simple, rake-compiler's cross compilation features
|
|
225
225
|
take advantage of GCC's host/target capabilities to build 'target' binaries on
|
226
226
|
different 'host' OS's.
|
227
227
|
|
228
|
-
=== How I do this from Linux or OSX?
|
228
|
+
=== How do I do this from Linux or OSX?
|
229
|
+
|
230
|
+
==== The Easy Way
|
231
|
+
|
232
|
+
Use rake-compiler-dev-box, a virtual machine provisioned with all the necessary
|
233
|
+
build tools. With one command, you can cross-compile and package your gem into
|
234
|
+
native, Java, and Windows fat binaries (with 1.8, 1.9, and 2.0 support). See
|
235
|
+
https://github.com/tjschuck/rake-compiler-dev-box for more information.
|
236
|
+
|
237
|
+
==== The Manual Way
|
229
238
|
|
230
239
|
In addition to having the development tool chain installed (GCC), you also need to
|
231
240
|
install your platform's <tt>mingw32</tt> cross compilation package.
|
@@ -256,7 +265,7 @@ Download and extract. After that, make sure the bin directory is added to the PA
|
|
256
265
|
|
257
266
|
You can add this to your <tt>.profile</tt> to avoid the repitition.
|
258
267
|
|
259
|
-
|
268
|
+
==== I've got my tool-chain installed, now what?
|
260
269
|
|
261
270
|
First, you need to build Ruby for Windows on your Linux or OSX system.
|
262
271
|
|
@@ -292,7 +301,7 @@ The host will vary depending on provider (mingw32 versus mingw-w64 projects).
|
|
292
301
|
Please consult the documentation and website of the MinGW package provider before
|
293
302
|
reporting any issues.
|
294
303
|
|
295
|
-
|
304
|
+
==== OK, let's cross compile some gems!
|
296
305
|
|
297
306
|
Now, you only need specify a few additional options in your extension definition:
|
298
307
|
|
@@ -314,7 +323,7 @@ platform for Ruby.
|
|
314
323
|
To target gems for MRI Ruby's current official distribution, please force the
|
315
324
|
platform to the one (i386-mswin32-60) previously shown.
|
316
325
|
|
317
|
-
|
326
|
+
==== Warning, magician about to do some tricks, don't blink!
|
318
327
|
|
319
328
|
Cross compiling is still very simple:
|
320
329
|
|
@@ -326,7 +335,7 @@ And now, building gems for your Windows users is just 5 more letters:
|
|
326
335
|
|
327
336
|
And you're done, yeah.
|
328
337
|
|
329
|
-
|
338
|
+
==== But wait, there's more
|
330
339
|
|
331
340
|
You can specify which version of Ruby to build the extension against:
|
332
341
|
|
@@ -372,7 +381,7 @@ This approach catch the cases of provided fat binaries or gems compiled by the
|
|
372
381
|
end user installing the gem. It has also been implemented successfully in
|
373
382
|
several projects.
|
374
383
|
|
375
|
-
|
384
|
+
== What are you talking about? (Give me examples)
|
376
385
|
|
377
386
|
I know all the above sounds like a complete foreign language (it does even for me!).
|
378
387
|
So, what if I show you some examples?
|
data/lib/rake/extensiontask.rb
CHANGED
@@ -380,6 +380,17 @@ Java extension should be preferred.
|
|
380
380
|
# copy mkmf from cross-ruby location
|
381
381
|
file "#{tmp_path}/mkmf.rb" => [mkmf_file] do |t|
|
382
382
|
cp t.prerequisites.first, t.name
|
383
|
+
if ruby_ver < "1.9" && "1.9" <= RUBY_VERSION
|
384
|
+
File.open(t.name, 'r+t') do |f|
|
385
|
+
content = f.read
|
386
|
+
content.sub!(/^( break )\*(defaults)$/, '\\1\\2.first')
|
387
|
+
content.sub!(/^( return )\*(defaults)$/, '\\1\\2.first')
|
388
|
+
content.sub!(/^( mfile\.)print( configuration\(srcprefix\))$/, '\\1puts\\2')
|
389
|
+
f.rewind
|
390
|
+
f.write content
|
391
|
+
f.truncate(f.tell)
|
392
|
+
end
|
393
|
+
end
|
383
394
|
end
|
384
395
|
|
385
396
|
# genearte fake.rb for different ruby versions
|
@@ -471,6 +482,11 @@ Java extension should be preferred.
|
|
471
482
|
|
472
483
|
def fake_rb(platform, version)
|
473
484
|
<<-FAKE_RB
|
485
|
+
# Pre-load resolver library before faking, in order to avoid error
|
486
|
+
# "cannot load such file -- win32/resolv" when it is required later on.
|
487
|
+
# See also: https://github.com/tjschuck/rake-compiler-dev-box/issues/5
|
488
|
+
require 'resolv'
|
489
|
+
|
474
490
|
class Object
|
475
491
|
remove_const :RUBY_PLATFORM
|
476
492
|
remove_const :RUBY_VERSION
|
data/tasks/gem.rake
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 63
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 2
|
10
|
+
version: 0.9.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Luis Lavena
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2013-
|
18
|
+
date: 2013-11-14 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
version_requirements: &id001 !ruby/object:Gem::Requirement
|