diff --git a/.cross_rubies b/.cross_rubies index dbb64a4806..77a5115c31 100644 --- a/.cross_rubies +++ b/.cross_rubies @@ -1,21 +1,28 @@ -3.0.0:i686-w64-mingw32 -3.0.0:x86_64-w64-mingw32 -3.0.0:i686-linux-gnu -3.0.0:x86_64-linux-gnu +3.1.0:x86_64-linux +3.1.0:x86_64-darwin +3.1.0:x86-mingw32 +3.1.0:x86-linux +3.1.0:x64-mingw-ucrt +3.1.0:arm64-darwin +3.1.0:aarch64-linux +3.0.0:x86_64-linux 3.0.0:x86_64-darwin +3.0.0:x86-mingw32 +3.0.0:x86-linux +3.0.0:x64-mingw32 3.0.0:arm64-darwin 3.0.0:aarch64-linux -2.7.0:i686-w64-mingw32 -2.7.0:x86_64-w64-mingw32 -2.7.0:i686-linux-gnu -2.7.0:x86_64-linux-gnu +2.7.0:x86_64-linux 2.7.0:x86_64-darwin +2.7.0:x86-mingw32 +2.7.0:x86-linux +2.7.0:x64-mingw32 2.7.0:arm64-darwin 2.7.0:aarch64-linux -2.6.0:i686-w64-mingw32 -2.6.0:x86_64-w64-mingw32 -2.6.0:i686-linux-gnu -2.6.0:x86_64-linux-gnu +2.6.0:x86_64-linux 2.6.0:x86_64-darwin +2.6.0:x86-mingw32 +2.6.0:x86-linux +2.6.0:x64-mingw32 2.6.0:arm64-darwin 2.6.0:aarch64-linux diff --git a/ext/nokogiri/extconf.rb b/ext/nokogiri/extconf.rb index 3f536cdb63..60bb8b08b9 100644 --- a/ext/nokogiri/extconf.rb +++ b/ext/nokogiri/extconf.rb @@ -176,7 +176,7 @@ def config_system_libraries? end def windows? - RbConfig::CONFIG["target_os"].match?(/mingw32|mswin/) + RbConfig::CONFIG["target_os"].match?(/mingw|mswin/) end def solaris? @@ -413,10 +413,12 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p = true) end MiniPortile.new(name, version).tap do |recipe| + def recipe.port_path + "#{@target}/#{RUBY_PLATFORM}/#{@name}/#{@version}" + end + recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p - # Prefer host_alias over host in order to use i586-mingw32msvc as - # correct compiler prefix for cross build, but use host if not set. - recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"] + recipe.host = RbConfig::CONFIG["host"] recipe.configure_options << "--libdir=#{File.join(recipe.path, "lib")}" yield recipe @@ -473,7 +475,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p = true) "#{key}=#{value.strip}" end - checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{recipe.host}.installed" + checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{RUBY_PLATFORM}.installed" if File.exist?(checkpoint) && !recipe.source_directory message("Building Nokogiri with a packaged version of #{name}-#{version}.\n") else diff --git a/rakelib/extensions.rake b/rakelib/extensions.rake index 8a8a69857f..b782921a98 100644 --- a/rakelib/extensions.rake +++ b/rakelib/extensions.rake @@ -3,8 +3,9 @@ require "rbconfig" require "shellwords" -CrossRuby = Struct.new(:version, :host) do +CrossRuby = Struct.new(:version, :platform) do WINDOWS_PLATFORM_REGEX = /mingw|mswin/ + MINGWUCRT_PLATFORM_REGEX = /mingw-ucrt/ MINGW32_PLATFORM_REGEX = /mingw32/ LINUX_PLATFORM_REGEX = /linux/ X86_LINUX_PLATFORM_REGEX = /x86.*linux/ @@ -40,30 +41,32 @@ CrossRuby = Struct.new(:version, :host) do end end - def platform - @platform ||= case host - when /\Ax86_64.*mingw32/ - "x64-mingw32" - when /\Ai[3-6]86.*mingw32/ - "x86-mingw32" - when /\Ax86_64.*linux/ - "x86_64-linux" - when /\Ai[3-6]86.*linux/ - "x86-linux" - when /\Aaarch64-linux/ + def host + @host ||= case platform + when "x64-mingw-ucrt" + "x86_64-w64-mingw32" + when "x64-mingw32" + "x86_64-w64-mingw32" + when "x86-mingw32" + "i686-w64-mingw32" + when "x86_64-linux" + "x86_64-linux-gnu" + when "x86-linux" + "i686-linux-gnu" + when "aarch64-linux" "aarch64-linux" - when /\Ax86_64-darwin/ + when "x86_64-darwin" "x86_64-darwin" - when /\Aarm64-darwin/ + when "arm64-darwin" "arm64-darwin" else - raise "CrossRuby.platform: unsupported host: #{host}" + raise "CrossRuby.platform: unsupported platform: #{platform}" end end def tool(name) (@binutils_prefix ||= case platform - when "x64-mingw32" + when "x64-mingw-ucrt", "x64-mingw32" "x86_64-w64-mingw32-" when "x86-mingw32" "i686-w64-mingw32-" @@ -71,11 +74,11 @@ CrossRuby = Struct.new(:version, :host) do "x86_64-redhat-linux-" when "x86-linux" "i686-redhat-linux-" - when /a.*64.*linux/ + when "aarch64-linux" "aarch64-linux-gnu-" - when /x86_64.*darwin/ + when "x86_64-darwin" "x86_64-apple-darwin-" - when /a.*64.*darwin/ + when "arm64-darwin" "aarch64-apple-darwin-" else raise "CrossRuby.tool: unmatched platform: #{platform}" @@ -84,7 +87,7 @@ CrossRuby = Struct.new(:version, :host) do def target_file_format case platform - when "x64-mingw32" + when "x64-mingw-ucrt", "x64-mingw32" "pei-x86-64" when "x86-mingw32" "pei-i386" @@ -113,6 +116,8 @@ CrossRuby = Struct.new(:version, :host) do def libruby_dll case platform + when "x64-mingw-ucrt" + "x64-ucrt-ruby#{api_ver_suffix}.dll" when "x64-mingw32" "x64-msvcrt-ruby#{api_ver_suffix}.dll" when "x86-mingw32" @@ -133,6 +138,25 @@ CrossRuby = Struct.new(:version, :host) do "advapi32.dll", libruby_dll, ] + when MINGWUCRT_PLATFORM_REGEX + [ + "kernel32.dll", + "ws2_32.dll", + "advapi32.dll", + "api-ms-win-crt-convert-l1-1-0.dll", + "api-ms-win-crt-environment-l1-1-0.dll", + "api-ms-win-crt-filesystem-l1-1-0.dll", + "api-ms-win-crt-heap-l1-1-0.dll", + "api-ms-win-crt-locale-l1-1-0.dll", + "api-ms-win-crt-math-l1-1-0.dll", + "api-ms-win-crt-private-l1-1-0.dll", + "api-ms-win-crt-runtime-l1-1-0.dll", + "api-ms-win-crt-stdio-l1-1-0.dll", + "api-ms-win-crt-string-l1-1-0.dll", + "api-ms-win-crt-time-l1-1-0.dll", + "api-ms-win-crt-utility-l1-1-0.dll", + libruby_dll, + ] when X86_LINUX_PLATFORM_REGEX [ "libm.so.6", @@ -282,7 +306,7 @@ namespace "gem" do desc "build native gem for #{plat} platform" task plat do RakeCompilerDock.sh(<<~EOT, platform: plat) - rvm use 3.0 && + rvm use 3.1.0 && gem install bundler --no-document && bundle && bundle exec rake gem:#{plat}:builder MAKE='nice make -j`nproc`'