mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/zlib] Search zlib.c as a gem
https://github.com/ruby/zlib/commit/8f43b264cd
This commit is contained in:
parent
ce477089f6
commit
f10c9cb1f2
1 changed files with 11 additions and 4 deletions
|
@ -1,9 +1,16 @@
|
|||
# coding: utf-8
|
||||
# frozen_string_literal: true
|
||||
source_version = File.open(File.join(__dir__, "zlib.c")) {|f|
|
||||
f.gets("\n#define RUBY_ZLIB_VERSION ")
|
||||
f.gets[/\s*(".+")/, 1].undump
|
||||
}
|
||||
|
||||
source_version = ["", "ext/zlib/"].find do |dir|
|
||||
begin
|
||||
break File.open(File.join(__dir__, "#{dir}zlib.c")) {|f|
|
||||
f.gets("\n#define RUBY_ZLIB_VERSION ")
|
||||
f.gets[/\s*"(.+)"/, 1]
|
||||
}
|
||||
rescue Errno::ENOENT
|
||||
end
|
||||
end
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "zlib"
|
||||
spec.version = source_version
|
||||
|
|
Loading…
Reference in a new issue