summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-03-19 22:53:55 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2022-03-27 19:39:01 +0900
commit03f809b8fae5b5fc3a2acc6cc278dc72aff75e2d (patch)
tree770e4e10e572e448f3a82ce5a38a126c0476bd38 /ext
parentc69ddddf0cbdcd72b1f1b1fbfed79686a0ae1dff (diff)
downloadpsych-03f809b8fae5b5fc3a2acc6cc278dc72aff75e2d.tar.gz
Download libyaml source
Diffstat (limited to 'ext')
-rw-r--r--ext/psych/extconf.rb8
-rw-r--r--ext/psych/extlibs7
2 files changed, 15 insertions, 0 deletions
diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb
index 05e3f4a..02e0b7a 100644
--- a/ext/psych/extconf.rb
+++ b/ext/psych/extconf.rb
@@ -9,6 +9,14 @@ end
yaml_source = with_config("libyaml-source-dir") || enable_config("bundled-libyaml", false)
if yaml_source == true
yaml_source = Dir.glob("#{$srcdir}/yaml{,-*}/").max_by {|n| File.basename(n).scan(/\d+/).map(&:to_i)}
+ unless yaml_source
+ require_relative '../../tool/extlibs.rb'
+ extlibs = ExtLibs.new(cache_dir: File.expand_path("../../tmp/download_cache", $srcdir))
+ unless extlibs.process_under($srcdir)
+ raise "failed to download libyaml source"
+ end
+ yaml_source, = Dir.glob("#{$srcdir}/yaml-*/")
+ end
elsif yaml_source
yaml_source = yaml_source.gsub(/\$\((\w+)\)|\$\{(\w+)\}/) {ENV[$1||$2]}
end
diff --git a/ext/psych/extlibs b/ext/psych/extlibs
new file mode 100644
index 0000000..b4ac02e
--- /dev/null
+++ b/ext/psych/extlibs
@@ -0,0 +1,7 @@
+ver = 0.2.5
+
+https://github.com/yaml/libyaml/releases/download/$(ver)/yaml-$(ver).tar.gz \
+ rmd160:cc175ed640046722fb7790de828002633407b6b9 \
+ sha256:c642ae9b75fee120b2d96c712538bd2cf283228d2337df2cf2988e3c02678ef4 \
+ sha512:dadd7d8e0d88b5ebab005e5d521d56d541580198aa497370966b98c904586e642a1cd4f3881094eb57624f218d50db77417bbfd0ffdce50340f011e35e8c4c02 \
+ #