rake-compiler 1.1.3 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a440a2d8c83bb1c19ded360f560ed350a7872385ac1ecb3c00eed20243824a37
4
- data.tar.gz: fb1a76fa0de52441b3307fb6a228b363581b1a10f1ead12340be380c88a21030
3
+ metadata.gz: 02cad822f10b4321127ce0c91ecb9ce1b7465897be75cb63864598f67a0862f9
4
+ data.tar.gz: e892ced800adc8b779b7a248f726590d2a9967c6efb95817778af4b51f650d4a
5
5
  SHA512:
6
- metadata.gz: 3af072dc0c061056c366876d13a57fbaa9d219cf80b20733c6aecabd23cfeb99d174a8028fb06db0fb7190c51e7beb37c4731227553293b720ed0c2524856ce3
7
- data.tar.gz: 827b37a381927c52dbf53e132aef924801339c6b441283f09a5708d0d80e234073cb7c0dc1957239ab65fc4ab59bafdccb95f7b3d08a212056f3cd2e19baea40
6
+ metadata.gz: b773ca5038495c9301561f7f093dd292a90c8987d71964234359e742e159e3dcceba66762a12c161a79b60c0d8eb55b2fc1d65dfb186a64b8905ea75148090f5
7
+ data.tar.gz: 281a93c3f8e00a01ede2150bff92f8898406fef693192d1a83710eb7e40c07e53229f91aeee8c661489a4901e81c702e8d55f667858f59ddeb47f8f93da75ab3
data/History.md CHANGED
@@ -1,7 +1,30 @@
1
- ### 1.1.3/ 2021-12-08
1
+ ### 1.1.7 / 2022-01-04
2
2
 
3
3
  * Fixes:
4
- * Fix a bug that wrong install location is used.
4
+ * Fix binary paths for staging and clobber.
5
+ [#197](https://github.com/rake-compiler/rake-compiler/issues/197) [Patch by konsolebox]
6
+
7
+ ### 1.1.6 / 2021-12-12
8
+
9
+ * Fixes:
10
+ * Fix a regression bug that `Symbol` can't be used for `name` of `Rake::ExtensionTask.new`.
11
+
12
+ ### 1.1.5 / 2021-12-12
13
+
14
+ * Fixes:
15
+ * Fix a regression bug that wrong install location is used when name that includes `/` is specified to `Rake::ExtensionTask.new`.
16
+ [#196](https://github.com/rake-compiler/rake-compiler/issues/196) [Reported by konsolebox]
17
+
18
+ ### 1.1.4 / 2021-12-11
19
+
20
+ * Fixes:
21
+ * Fix a regression bug that installed gem can't be found on cross compile.
22
+ [#195](https://github.com/rake-compiler/rake-compiler/issues/195) [Reported by Mike Dalessio]
23
+
24
+ ### 1.1.3 / 2021-12-08
25
+
26
+ * Fixes:
27
+ * Fix a regression bug that wrong install location is used.
5
28
  [#194](https://github.com/rake-compiler/rake-compiler/issues/194) [Reported by Andrew Kane]
6
29
 
7
30
  ### 1.1.2 / 2021-12-07
@@ -40,6 +40,9 @@ module Rake
40
40
  @tmp_dir = 'tmp'
41
41
  @ext_dir = "ext/#{@name}"
42
42
  @lib_dir = 'lib'
43
+ if @name and File.dirname(@name.to_s) != "."
44
+ @lib_dir += "/#{File.dirname(@name.to_s)}"
45
+ end
43
46
  @config_options = []
44
47
  @extra_options = ARGV.select { |i| i =~ /\A--?/ }
45
48
  end
@@ -82,9 +82,12 @@ module Rake
82
82
  private
83
83
  # copy other gem files to staging directory
84
84
  def define_staging_file_tasks(files, lib_path, stage_path, platf, ruby_ver)
85
+ # lib_binary_path
86
+ lib_binary_path = "#{lib_path}/#{File.basename(binary(platf))}"
87
+
85
88
  files.each do |gem_file|
86
89
  # ignore directories and the binary extension
87
- next if File.directory?(gem_file) || gem_file == "#{lib_path}/#{binary(platf)}"
90
+ next if File.directory?(gem_file) || gem_file == lib_binary_path
88
91
  stage_file = "#{stage_path}/#{gem_file}"
89
92
 
90
93
  # copy each file from base to stage directory
@@ -105,12 +108,13 @@ module Rake
105
108
  platf = for_platform || platform
106
109
 
107
110
  binary_path = binary(platf)
111
+ binary_base_name = File.basename(binary_path)
108
112
 
109
113
  # lib_path
110
114
  lib_path = lib_dir
111
115
 
112
- lib_binary_path = "#{lib_path}/#{binary_path}"
113
- lib_binary_dir_path = File.dirname(lib_binary_path)
116
+ # lib_binary_path
117
+ lib_binary_path = "#{lib_path}/#{binary_base_name}"
114
118
 
115
119
  # tmp_path
116
120
  tmp_path = "#{@tmp_dir}/#{platf}/#{@name}/#{ruby_ver}"
@@ -119,19 +123,19 @@ module Rake
119
123
  siteconf_path = "#{tmp_path}/.rake-compiler-siteconf.rb"
120
124
  tmp_binary_path = "#{tmp_path}/#{binary_path}"
121
125
  tmp_binary_dir_path = File.dirname(tmp_binary_path)
122
- stage_binary_path = "#{stage_path}/#{lib_path}/#{binary_path}"
126
+ stage_binary_path = "#{stage_path}/#{lib_binary_path}"
123
127
  stage_binary_dir_path = File.dirname(stage_binary_path)
124
128
 
125
129
  # cleanup and clobbering
126
130
  CLEAN.include(tmp_path)
127
131
  CLEAN.include(stage_path)
128
- CLOBBER.include("#{lib_path}/#{binary(platf)}")
132
+ CLOBBER.include(lib_binary_path)
129
133
  CLOBBER.include("#{@tmp_dir}")
130
134
 
131
135
  # directories we need
132
136
  directory tmp_path
133
137
  directory tmp_binary_dir_path
134
- directory lib_binary_dir_path
138
+ directory lib_path
135
139
  directory stage_binary_dir_path
136
140
 
137
141
  directory File.dirname(siteconf_path)
@@ -150,7 +154,7 @@ module Rake
150
154
 
151
155
  # copy binary from temporary location to final lib
152
156
  # tmp/extension_name/extension_name.{so,bundle} => lib/
153
- task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_binary_dir_path, tmp_binary_path, "#{tmp_path}/Makefile"] do
157
+ task "copy:#{@name}:#{platf}:#{ruby_ver}" => [lib_path, tmp_binary_path, "#{tmp_path}/Makefile"] do
154
158
  # install in lib for native platform only
155
159
  unless for_platform
156
160
  sh "#{make} install target_prefix=", chdir: tmp_path
@@ -175,8 +179,8 @@ Java extension should be preferred.
175
179
 
176
180
  chdir tmp_path do
177
181
  sh make
178
- if binary_path != File.basename(binary_path)
179
- cp File.basename(binary_path), binary_path
182
+ if binary_path != binary_base_name
183
+ cp binary_base_name, binary_path
180
184
  end
181
185
  end
182
186
  end
@@ -237,7 +241,7 @@ Java extension should be preferred.
237
241
  # platform matches the indicated one.
238
242
  if platf == RUBY_PLATFORM then
239
243
  # ensure file is always copied
240
- file "#{lib_path}/#{binary_path}" => ["copy:#{name}:#{platf}:#{ruby_ver}"]
244
+ file lib_binary_path => ["copy:#{name}:#{platf}:#{ruby_ver}"]
241
245
 
242
246
  task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
243
247
  task "compile" => ["compile:#{platf}"]
@@ -253,6 +257,9 @@ Java extension should be preferred.
253
257
  # lib_path
254
258
  lib_path = lib_dir
255
259
 
260
+ # lib_binary_path
261
+ lib_binary_path = "#{lib_path}/#{File.basename(binary(platf))}"
262
+
256
263
  # Update compiled platform/version combinations
257
264
  @ruby_versions_per_platform[platf] << ruby_ver
258
265
 
@@ -332,13 +339,13 @@ Java extension should be preferred.
332
339
  end
333
340
 
334
341
  # add binaries to the dependency chain
335
- task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{lib_path}/#{binary(platf)}"]
342
+ task "native:#{@gem_spec.name}:#{platf}" => ["#{stage_path}/#{lib_binary_path}"]
336
343
 
337
344
  # ensure the extension get copied
338
- unless Rake::Task.task_defined?("#{lib_path}/#{binary(platf)}") then
339
- file "#{lib_path}/#{binary(platf)}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
345
+ unless Rake::Task.task_defined?(lib_binary_path) then
346
+ file lib_binary_path => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
340
347
  end
341
- file "#{stage_path}/#{lib_dir}/#{binary(platf)}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
348
+ file "#{stage_path}/#{lib_binary_path}" => ["copy:#{@name}:#{platf}:#{ruby_ver}"]
342
349
 
343
350
  # Allow segmented packaging by platform (open door for 'cross compile')
344
351
  task "native:#{platf}" => ["native:#{@gem_spec.name}:#{platf}"]
@@ -397,6 +404,9 @@ Java extension should be preferred.
397
404
  # lib_path
398
405
  lib_path = lib_dir
399
406
 
407
+ # lib_binary_path
408
+ lib_binary_path = "#{lib_path}/#{File.basename(binary(for_platform))}"
409
+
400
410
  unless rbconfig_file = config_file["rbconfig-#{for_platform}-#{ruby_ver}"] then
401
411
  warn "no configuration section for specified version of Ruby (rbconfig-#{for_platform}-#{ruby_ver})"
402
412
  return
@@ -416,8 +426,21 @@ Java extension should be preferred.
416
426
  # genearte fake.rb for different ruby versions
417
427
  file "#{tmp_path}/fake.rb" => [rbconfig_file] do |t|
418
428
  File.open(t.name, 'w') do |f|
419
- f.write fake_rb(for_platform, ruby_ver)
420
- f.write File.read(t.prerequisites.first)
429
+ # Keep the original RbConfig::CONFIG["ENABLE_SHARED"] to use
430
+ # the same RubyGems extension directory. See also
431
+ # Gem::BasicSpecificaion#extenions_dir and
432
+ # Gem.extension_api_version.
433
+ #
434
+ # if RbConfig::CONFIG["ENABLE_SHARED"] == "no"
435
+ # "extensions/x86_64-linux/2.5.0-static"
436
+ # else
437
+ # "extensions/x86_64-linux/2.5.0"
438
+ # end
439
+ f.puts("require 'rbconfig'")
440
+ f.puts("original_enable_shared = RbConfig::CONFIG['ENABLE_SHARED']")
441
+ f.puts(fake_rb(for_platform, ruby_ver))
442
+ f.puts(File.read(t.prerequisites.first))
443
+ f.puts("RbConfig::CONFIG['ENABLE_SHARED'] = original_enable_shared")
421
444
  end
422
445
  end
423
446
 
@@ -450,12 +473,12 @@ Java extension should be preferred.
450
473
 
451
474
  # clear lib/binary dependencies and trigger cross platform ones
452
475
  # check if lib/binary is defined (damn bundle versus so versus dll)
453
- if Rake::Task.task_defined?("#{lib_path}/#{binary(for_platform)}") then
454
- Rake::Task["#{lib_path}/#{binary(for_platform)}"].prerequisites.clear
476
+ if Rake::Task.task_defined?(lib_binary_path) then
477
+ Rake::Task[lib_binary_path].prerequisites.clear
455
478
  end
456
479
 
457
480
  # FIXME: targeting multiple platforms copies the file twice
458
- file "#{lib_path}/#{binary(for_platform)}" => ["copy:#{@name}:#{for_platform}:#{ruby_ver}"]
481
+ file lib_binary_path => ["copy:#{@name}:#{for_platform}:#{ruby_ver}"]
459
482
 
460
483
  # if everything for native task is in place
461
484
  if @gem_spec && @gem_spec.platform == 'ruby' then
@@ -53,15 +53,20 @@ module Rake
53
53
  # platform usage
54
54
  platf = for_platform || platform
55
55
 
56
+ binary_path = binary(platf)
57
+
56
58
  # lib_path
57
59
  lib_path = lib_dir
58
60
 
61
+ # lib_binary_path
62
+ lib_binary_path = "#{lib_path}/#{File.basename(binary_path)}"
63
+
59
64
  # tmp_path
60
65
  tmp_path = "#{@tmp_dir}/#{platf}/#{@name}"
61
66
 
62
67
  # cleanup and clobbering
63
68
  CLEAN.include(tmp_path)
64
- CLOBBER.include("#{lib_path}/#{binary(platf)}")
69
+ CLOBBER.include(lib_binary_path)
65
70
  CLOBBER.include("#{@tmp_dir}")
66
71
 
67
72
  # directories we need
@@ -70,11 +75,11 @@ module Rake
70
75
 
71
76
  # copy binary from temporary location to final lib
72
77
  # tmp/extension_name/extension_name.{so,bundle} => lib/
73
- task "copy:#{@name}:#{platf}" => [lib_path, "#{tmp_path}/#{binary(platf)}"] do
74
- install "#{tmp_path}/#{binary(platf)}", "#{lib_path}/#{binary(platf)}"
78
+ task "copy:#{@name}:#{platf}" => [lib_path, "#{tmp_path}/#{binary_path}"] do
79
+ install "#{tmp_path}/#{binary_path}", lib_binary_path
75
80
  end
76
81
 
77
- file "#{tmp_path}/#{binary(platf)}" => "#{tmp_path}/.build" do
82
+ file "#{tmp_path}/#{binary_path}" => "#{tmp_path}/.build" do
78
83
 
79
84
  class_files = FileList["#{tmp_path}/**/*.class"].
80
85
  gsub("#{tmp_path}/", '')
@@ -86,7 +91,7 @@ module Rake
86
91
  ["-C #{tmp_path}", path]
87
92
  }.flatten
88
93
 
89
- sh "jar cf #{tmp_path}/#{binary(platf)} #{args.join(' ')}"
94
+ sh "jar cf #{tmp_path}/#{binary_path} #{args.join(' ')}"
90
95
  end
91
96
 
92
97
  file "#{tmp_path}/.build" => [tmp_path] + source_files do
@@ -137,7 +142,7 @@ execute the Rake compilation task using the JRuby interpreter.
137
142
  # platform matches the indicated one.
138
143
  if platf == RUBY_PLATFORM then
139
144
  # ensure file is always copied
140
- file "#{lib_path}/#{binary(platf)}" => ["copy:#{name}:#{platf}"]
145
+ file lib_binary_path => ["copy:#{name}:#{platf}"]
141
146
 
142
147
  task "compile:#{@name}" => ["compile:#{@name}:#{platf}"]
143
148
  task "compile" => ["compile:#{platf}"]
@@ -184,12 +189,15 @@ execute the Rake compilation task using the JRuby interpreter.
184
189
  end
185
190
  end
186
191
 
192
+ # lib_binary_path
193
+ lib_binary_path = "#{lib_path}/#{File.basename(binary(platform))}"
194
+
187
195
  # add binaries to the dependency chain
188
- task "java:#{@gem_spec.name}" => ["#{lib_path}/#{binary(platform)}"]
196
+ task "java:#{@gem_spec.name}" => [lib_binary_path]
189
197
 
190
198
  # ensure the extension get copied
191
- unless Rake::Task.task_defined?("#{lib_path}/#{binary(platform)}") then
192
- file "#{lib_path}/#{binary(platform)}" => ["copy:#{name}:#{platform}"]
199
+ unless Rake::Task.task_defined?(lib_binary_path) then
200
+ file lib_binary_path => ["copy:#{name}:#{platform}"]
193
201
  end
194
202
 
195
203
  task 'java' => ["java:#{@gem_spec.name}"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-compiler
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kouhei Sutou
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-12-07 00:00:00.000000000 Z
12
+ date: 2022-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: 1.8.23
147
147
  requirements: []
148
- rubygems_version: 3.3.0.dev
148
+ rubygems_version: 3.4.0.dev
149
149
  signing_key:
150
150
  specification_version: 4
151
151
  summary: Rake-based Ruby Extension (C, Java) task generator.