-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
387 additions
and
168 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
CACHE_VER: 18 | ||
CACHE_VER: 19 | ||
TZ: "Etc/UTC" | ||
VERBOSE: no | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
CACHE_VER: 18 | ||
CACHE_VER: 19 | ||
VERBOSE: no | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,7 +60,7 @@ concurrency: | |
cancel-in-progress: true | ||
|
||
env: | ||
CACHE_VER: 18 | ||
CACHE_VER: 19 | ||
VERBOSE: no | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
# frozen_string_literal: true | ||
|
||
# Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com). | ||
# All rights reserved. | ||
# This file is a part of tebako | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
# modification, are permitted provided that the following conditions | ||
# are met: | ||
# 1. Redistributions of source code must retain the above copyright | ||
# notice, this list of conditions and the following disclaimer. | ||
# 2. Redistributions in binary form must reproduce the above copyright | ||
# notice, this list of conditions and the following disclaimer in the | ||
# documentation and/or other materials provided with the distribution. | ||
# | ||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | ||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS | ||
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
# POSSIBILITY OF SUCH DAMAGE. | ||
|
||
require_relative "patch_literals" | ||
require_relative "patch_main" | ||
require_relative "patch_libraries" | ||
require_relative "patch_helpers" | ||
require_relative "patch_buildsystem" | ||
|
||
# Tebako - an executable packager | ||
module Tebako | ||
module Packager | ||
# Ruby patching definitions (pass2) | ||
class Pass2Patch < Patch | ||
def initialize(ostype, deps_lib_dir, ruby_ver) | ||
super() | ||
@ostype = ostype | ||
@scmb = ScenarioManagerBase.new(@ostype) | ||
@deps_lib_dir = deps_lib_dir | ||
@ruby_ver = ruby_ver | ||
end | ||
|
||
def patch_map | ||
patch_map = patch_map_base | ||
patch_map.store("thread_pthread.c", LINUX_MUSL_THREAD_PTHREAD_PATCH) if @scmb.musl? | ||
if @scmb.msys? | ||
patch_map.merge!(msys_patches) | ||
elsif @ruby_ver.ruby3x? | ||
patch_map.store("common.mk", COMMON_MK_PATCH) | ||
end | ||
extend_patch_map_r33(patch_map) | ||
patch_map.store("prism_compile.c", PRISM_PATCHES) if @ruby_ver.ruby34? | ||
patch_map | ||
end | ||
|
||
private | ||
|
||
include Tebako::Packager::PatchBuildsystem | ||
include Tebako::Packager::PatchLiterals | ||
def extend_patch_map_r33(patch_map) | ||
if @ruby_ver.ruby33? || @scmb.msys? | ||
patch_map.store("config.status", | ||
get_config_status_patch(@ostype, @deps_lib_dir, @ruby_ver)) | ||
end | ||
patch_map | ||
end | ||
|
||
def dir_c_patch | ||
pattern = ScenarioManagerBase.new.msys? ? "/* define system APIs */" : "#ifdef HAVE_GETATTRLIST" | ||
patch = PatchHelpers.patch_c_file_pre(pattern) | ||
patch.merge!(DIR_C_BASE_PATCH) | ||
patch | ||
end | ||
|
||
def dln_c_patch | ||
pattern = "#ifndef dln_loaderror" | ||
# Not using substitutions of dlxxx functions on Windows | ||
patch = { | ||
pattern => "#{@scmb.msys? ? C_FILE_SUBST_LESS : C_FILE_SUBST}\n#{pattern}\n" | ||
} | ||
|
||
if @scmb.msys? | ||
patch.merge!(@ruby_ver.ruby32? ? DLN_C_MSYS_PATCH : DLN_C_MSYS_PATCH_PRE32) | ||
end | ||
|
||
patch | ||
end | ||
|
||
def io_c_msys_patch | ||
patch = @ruby_ver.ruby32? ? IO_C_MSYS_PATCH : IO_C_MSYS_PATCH_PRE_32 | ||
patch.merge(IO_C_MSYS_BASE_PATCH) | ||
end | ||
|
||
def io_c_patch | ||
patch = PatchHelpers.patch_c_file_pre("/* define system APIs */") | ||
patch.merge!(io_c_msys_patch) if @scmb.msys? | ||
patch | ||
end | ||
|
||
def util_c_patch | ||
if @ruby_ver.ruby31? | ||
PatchHelpers.patch_c_file_post("#endif /* !HAVE_GNU_QSORT_R */") | ||
else | ||
PatchHelpers.patch_c_file_pre("#ifndef S_ISDIR") | ||
end | ||
end | ||
|
||
def tool_mkconfig_rb_patch | ||
subst = @scmb.msys? ? TOOL_MKCONFIG_RB_SUBST_MSYS : TOOL_MKCONFIG_RB_SUBST | ||
{ | ||
" if fast[name]" => subst | ||
} | ||
end | ||
|
||
def msys_patches | ||
{ | ||
"cygwin/GNUmakefile.in" => get_gnumakefile_in_patch_p2(@ruby_ver), | ||
"ruby.c" => RUBY_C_MSYS_PATCHES, | ||
"win32/file.c" => WIN32_FILE_C_MSYS_PATCHES, | ||
"win32/win32.c" => WIN32_WIN32_C_MSYS_PATCHES | ||
} | ||
end | ||
|
||
def patch_map_base | ||
{ | ||
"template/Makefile.in" => template_makefile_in_patch, | ||
"tool/mkconfig.rb" => tool_mkconfig_rb_patch, | ||
"dir.c" => dir_c_patch, "dln.c" => dln_c_patch, | ||
"io.c" => io_c_patch, "main.c" => PatchMain.get_main_c_patch(@ruby_ver), | ||
"file.c" => PatchHelpers.patch_c_file_pre("/* define system APIs */"), | ||
"util.c" => util_c_patch | ||
} | ||
end | ||
|
||
def mlibs_subst | ||
yjit_libs = @ruby_ver.ruby32only? ? "$(YJIT_LIBS) " : "" | ||
{ | ||
"MAINLIBS = #{yjit_libs}@MAINLIBS@" => | ||
"# -- Start of tebako patch -- \n" \ | ||
"MAINLIBS = #{yjit_libs}#{PatchLibraries.mlibs(@ostype, @deps_lib_dir, @ruby_ver, true)}\n" \ | ||
"# -- End of tebako patch -- \n" | ||
} | ||
end | ||
|
||
def template_makefile_in_patch | ||
template_makefile_in_patch_two(@ruby_ver).merge(mlibs_subst) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.