mirror of
https://github.com/ruby/ruby.git
synced 2026-01-27 04:24:23 +00:00
[ruby/nkf] Add JRuby extension to the gem
This pulls in the nkf extension implementation from JRuby. The build and load logic has been updated along the same lines as ruby/digest and the gem appears to build correctly for the -java platform. Fixes https://github.com/ruby/nkf/pull/13 https://github.com/ruby/nkf/commit/18f57f36ed
This commit is contained in:
parent
e2e15ddd67
commit
c6b548accb
@ -11,8 +11,8 @@ end
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "nkf"
|
||||
spec.version = source_version
|
||||
spec.authors = ["NARUSE Yui"]
|
||||
spec.email = ["naruse@airemix.jp"]
|
||||
spec.authors = ["NARUSE Yui", "Charles Oliver Nutter"]
|
||||
spec.email = ["naruse@airemix.jp", "headius@headius.com"]
|
||||
|
||||
spec.summary = %q{Ruby extension for Network Kanji Filter}
|
||||
spec.description = %q{Ruby extension for Network Kanji Filter}
|
||||
@ -28,8 +28,16 @@ Gem::Specification.new do |spec|
|
||||
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
||||
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
||||
end
|
||||
|
||||
if Gem::Platform === spec.platform and spec.platform =~ 'java' or RUBY_ENGINE == 'jruby'
|
||||
spec.platform = 'java'
|
||||
|
||||
spec.files += Dir["lib/nkf.jar"]
|
||||
else
|
||||
spec.extensions = ["ext/nkf/extconf.rb"]
|
||||
end
|
||||
|
||||
spec.bindir = "exe"
|
||||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
||||
spec.require_paths = ["lib"]
|
||||
spec.extensions = ["ext/nkf/extconf.rb"]
|
||||
end
|
||||
|
||||
6
lib/nkf.rb
Normal file
6
lib/nkf.rb
Normal file
@ -0,0 +1,6 @@
|
||||
if RUBY_ENGINE == "jruby"
|
||||
require 'nkf.jar'
|
||||
JRuby::Util.load_ext('org.jruby.ext.nkf.NKFLibrary')
|
||||
else
|
||||
require 'nkf.so'
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user