From d13d659731a7a81bfda053caeb1a593fe2d92aba Mon Sep 17 00:00:00 2001 From: Yuta Saito Date: Mon, 29 Jan 2024 11:04:03 +0000 Subject: [PATCH] Apply patches per source version There is no reason to limit patch application to "head" only. --- lib/ruby_wasm/packager.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/ruby_wasm/packager.rb b/lib/ruby_wasm/packager.rb index fe364a0fd8..eef6fe4fb8 100644 --- a/lib/ruby_wasm/packager.rb +++ b/lib/ruby_wasm/packager.rb @@ -62,7 +62,7 @@ def support_dynamic_linking? # Retrieves the root directory of the Ruby project. # The root directory contains the following stuff: - # * patches/*.patch + # * patches/{source}/*.patch # * build_manifest.json # * rubies # * build @@ -84,13 +84,11 @@ def root # Retrieves the alias definitions for the Ruby sources. def self.build_source_aliases(root) - patches = Dir[File.join(root, "patches", "*.patch")] sources = { "head" => { type: "github", repo: "ruby/ruby", - rev: "master", - patches: patches.map { |p| File.expand_path(p) } + rev: "master" }, "3.3" => { type: "tarball", @@ -101,7 +99,12 @@ def self.build_source_aliases(root) url: "https://cache.ruby-lang.org/pub/ruby/3.2/ruby-3.2.3.tar.gz" } } - sources.each { |name, source| source[:name] = name } + sources.each do |name, source| + source[:name] = name + patches = Dir[File.join(root, "patches", name, "*.patch")] + .map { |p| File.expand_path(p) } + source[:patches] = patches + end build_manifest = File.join(root, "build_manifest.json") if File.exist?(build_manifest)