ruby-changes:71538
From: Nobuyoshi <ko1@a...>
Date: Tue, 29 Mar 2022 20:58:12 +0900 (JST)
Subject: [ruby-changes:71538] c67088dbae (master): [ruby/psych] Try bundled libyaml source if pre-installed is unavailable
https://git.ruby-lang.org/ruby.git/commit/?id=c67088dbae From c67088dbae9e61a4c07742ceee7fb46597589d95 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Tue, 29 Mar 2022 18:42:00 +0900 Subject: [ruby/psych] Try bundled libyaml source if pre-installed is unavailable https://github.com/ruby/psych/commit/f78e1dba89 --- ext/psych/extconf.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ext/psych/extconf.rb b/ext/psych/extconf.rb index 17c0deee96..78456b5687 100644 --- a/ext/psych/extconf.rb +++ b/ext/psych/extconf.rb @@ -7,7 +7,16 @@ if $mswin or $mingw or $cygwin https://github.com/ruby/ruby/blob/trunk/ext/psych/extconf.rb#L7 end yaml_source = with_config("libyaml-source-dir") || enable_config("bundled-libyaml", false) +unless yaml_source # default to pre-installed libyaml + pkg_config('yaml-0.1') + dir_config('libyaml') + unless find_header('yaml.h') && find_library('yaml', 'yaml_get_version') + yaml_source = true # fallback to the bundled source if exists + end +end + if yaml_source == true + # search the latest libyaml source under $srcdir 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' @@ -16,6 +25,7 @@ if yaml_source == true https://github.com/ruby/ruby/blob/trunk/ext/psych/extconf.rb#L25 raise "failed to download libyaml source" end yaml_source, = Dir.glob("#{$srcdir}/yaml-*/") + raise "libyaml not found" unless yaml_source end elsif yaml_source yaml_source = yaml_source.gsub(/\$\((\w+)\)|\$\{(\w+)\}/) {ENV[$1||$2]} @@ -41,12 +51,6 @@ if yaml_source https://github.com/ruby/ruby/blob/trunk/ext/psych/extconf.rb#L51 Logging.message("INCLFAG=#$INCLFAG\n") libyaml = "#{yaml}/src/.libs/libyaml.#$LIBEXT" $LOCAL_LIBS.prepend("$(LIBYAML) ") -else - pkg_config('yaml-0.1') - dir_config('libyaml') - unless find_header('yaml.h') && find_library('yaml', 'yaml_get_version') - raise "libyaml not found" - end end create_makefile 'psych' do |mk| -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/