tebako 0.12.9 → 0.12.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CMakeLists.txt +3 -3
- data/README.adoc +26 -12
- data/exe/tebako-packager +10 -11
- data/lib/tebako/build_helpers.rb +1 -14
- data/lib/tebako/cli.rb +28 -7
- data/lib/tebako/cli_helpers.rb +2 -2
- data/lib/tebako/codegen.rb +21 -20
- data/lib/tebako/deploy_helper.rb +18 -30
- data/lib/tebako/error.rb +3 -0
- data/lib/tebako/options_manager.rb +5 -27
- data/lib/tebako/packager/pass1_patch.rb +11 -60
- data/lib/tebako/packager/pass2_patch.rb +154 -0
- data/lib/tebako/packager/patch_buildsystem.rb +10 -6
- data/lib/tebako/packager/patch_helpers.rb +0 -12
- data/lib/tebako/packager/rubygems_patch.rb +83 -0
- data/lib/tebako/packager.rb +20 -18
- data/lib/tebako/ruby_builder.rb +1 -1
- data/lib/tebako/ruby_version.rb +6 -6
- data/lib/tebako/scenario_manager.rb +159 -40
- data/lib/tebako/version.rb +1 -1
- data/tebako.gemspec +2 -0
- metadata +32 -3
- data/lib/tebako/packager/pass2.rb +0 -149
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '009ef5486538fdd768a0b44c2833236a1f4f5a86ec9a00d89608d4eb601a06d1'
|
4
|
+
data.tar.gz: 3e2fde5102b5dfc56d9ea8cb9ab133133634e5e586de593f2183ba67c2504eb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ffba2ca2bdd4724bdce1cf7179383028dbeea2e38d3c1ae070f25809eabfcb7bd16a1ed4550895259423d42ae8b190db2438f135cda439b28af9c2004192999
|
7
|
+
data.tar.gz: 49c62bfdbe3312f7582cc67b9b9766ec1fe38aee715a7888a8de61764b338b2fb21dc35cf2b91f1f96948b9baf5ab9d3ad5758737e91728420f754736ecebc7c
|
data/CMakeLists.txt
CHANGED
@@ -364,7 +364,7 @@ ExternalProject_Add(${RUBY_PRJ}
|
|
364
364
|
CONFIGURE_COMMAND ""
|
365
365
|
BUILD_COMMAND ruby ${EXE}/tebako-packager pass1 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${FS_MOUNT_POINT} ${DATA_SRC_DIR} ${RUBY_VER}
|
366
366
|
# Make it for MacOS otherwise LDFLAGS are invalid
|
367
|
-
COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_LIB_DIR}
|
367
|
+
# COMMAND ${CMAKE_COMMAND} -E make_directory ${DEPS_LIB_DIR}
|
368
368
|
COMMAND ${GNU_BASH} -c "${RUBY_SOURCE_DIR}/configure ${OPENSSL_RUBY_OPTION} ${LIBYAML_RUBY_OPTION} \
|
369
369
|
--without-gmp \
|
370
370
|
--disable-dtrace \
|
@@ -410,7 +410,7 @@ if (${SETUP_MODE})
|
|
410
410
|
# Packaged filesystem
|
411
411
|
|
412
412
|
add_custom_target(packaged_filesystem
|
413
|
-
COMMAND ruby ${DEPS_BIN_DIR}/deploy.rb
|
413
|
+
COMMAND ruby ${DEPS_BIN_DIR}/deploy.rb ${RUBY_VER}
|
414
414
|
DEPENDS setup
|
415
415
|
BYPRODUCTS ${DATA_BIN_FILE}
|
416
416
|
)
|
@@ -431,7 +431,7 @@ if (${SETUP_MODE})
|
|
431
431
|
|
432
432
|
add_dependencies(tebako-fs packaged_filesystem)
|
433
433
|
|
434
|
-
add_custom_target(tebako COMMAND ruby ${EXE}/tebako-packager finalize ${
|
434
|
+
add_custom_target(tebako COMMAND ruby ${EXE}/tebako-packager finalize ${RUBY_SOURCE_DIR} ${APP_NAME} ${RUBY_VER} ${DEPS_BIN_DIR}/patchelf ${WITH_PATCHELF})
|
435
435
|
add_dependencies(tebako setup tebako-fs)
|
436
436
|
|
437
437
|
endif(${SETUP_MODE})
|
data/README.adoc
CHANGED
@@ -1075,33 +1075,47 @@ operation. The following table lists the possible exit codes and their meanings.
|
|
1075
1075
|
| 116 | Ruby version does not satify Gemfile requirements
|
1076
1076
|
|===
|
1077
1077
|
|
1078
|
-
==
|
1078
|
+
== Ruby and bundler versions selection
|
1079
1079
|
|
1080
1080
|
During packaging tebako creates its own Ruby execution environment that is independent from the host Ruby environment.
|
1081
1081
|
The version of Ruby that is used in the package is defined by the combination of the `--Ruby` option and ruby requirement
|
1082
1082
|
specified in Gemfile.
|
1083
1083
|
|
1084
|
-
.Package Ruby version selection
|
1084
|
+
.Package Ruby version selection rules
|
1085
1085
|
[cols="3", options="header"]
|
1086
1086
|
|===
|
1087
|
-
| Gemfile requirement
|
1087
|
+
| Gemfile requirement
|
1088
|
+
| `--Ruby` option given
|
1089
|
+
| `--Ruby` option absent
|
1088
1090
|
|
1089
|
-
| Specified
|
1090
|
-
|
|
1091
|
+
| *Specified*
|
1092
|
+
| The version specified by `--Ruby` option if it is supported and satisfies Gemfile requirement; error otherwise
|
1093
|
+
| The minimal supported Ruby version that satisfies Gemfile requirement; error otherwise
|
1094
|
+
| *Not specified*
|
1095
|
+
| The version specified by `--Ruby` option if it is supported; error otherwise | Default Tebako Ruby version (3.2.6).
|
1091
1096
|
|
1092
1097
|
|===
|
1093
1098
|
|
1099
|
+
When bundler is used to package the application, the version of bundler that is used is determined by the Ruby version
|
1100
|
+
and the bundler version requirements specified in the Gemfile.
|
1094
1101
|
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1102
|
+
.Package bundler version selection rules
|
1103
|
+
[cols="3", options="header"]
|
1104
|
+
|===
|
1105
|
+
| Gemfile requirement
|
1106
|
+
| Ruby version 2.7.8, 3.0.7
|
1107
|
+
| Ruby version 3.1.x or above
|
1098
1108
|
|
1099
|
-
|
1109
|
+
| *Specified*
|
1110
|
+
| The maximum version that meets Gemfile requirement if it is >= 2.4.22 ; error otherwise
|
1111
|
+
| The maximum version that meets Gemfile requirement if it is >= 2.4.22 ; error otherwise
|
1112
|
+
| *Not specified*
|
1113
|
+
| 2.4.22
|
1114
|
+
| Default bundler version for this version of Ruby.
|
1100
1115
|
|
1101
|
-
|
1116
|
+
|===
|
1102
1117
|
|
1103
|
-
|
1104
|
-
was copied from `ruby-packer`.
|
1118
|
+
== Packaging scenarios
|
1105
1119
|
|
1106
1120
|
Depending on the configuration files that are present in the root project folder, the Tebako Ruby packager supports different packaging scenarios.
|
1107
1121
|
|
data/exe/tebako-packager
CHANGED
@@ -70,19 +70,18 @@ begin
|
|
70
70
|
|
71
71
|
when "finalize"
|
72
72
|
# ARGV[0] -- command
|
73
|
-
# ARGV[1] --
|
74
|
-
# ARGV[2] --
|
75
|
-
# ARGV[3] --
|
76
|
-
# ARGV[4] --
|
77
|
-
# ARGV[5] --
|
78
|
-
|
79
|
-
unless ARGV.length == 7
|
73
|
+
# ARGV[1] -- RUBY_SOURCE_DIR
|
74
|
+
# ARGV[2] -- APP_NAME
|
75
|
+
# ARGV[3] -- RUBY_VER
|
76
|
+
# ARGV[4] -- patchelf executable
|
77
|
+
# ARGV[5] -- WITH_PATHELF
|
78
|
+
unless ARGV.length == 6
|
80
79
|
raise Tebako::Error,
|
81
|
-
"tebako-packager finalize command expects
|
80
|
+
"tebako-packager finalize command expects 6 arguments, #{ARGV.length} has been provided."
|
82
81
|
end
|
83
|
-
ruby_ver = Tebako::RubyVersion.new(ARGV[
|
84
|
-
with_patchelf = ARGV[
|
85
|
-
Tebako::Packager.finalize(ARGV[1], ARGV[2],
|
82
|
+
ruby_ver = Tebako::RubyVersion.new(ARGV[3])
|
83
|
+
with_patchelf = ARGV[5].casecmp("ON").zero? || ARGV[5].casecmp("YES").zero?
|
84
|
+
Tebako::Packager.finalize(ARGV[1], ARGV[2], ruby_ver, with_patchelf ? ARGV[4] : nil)
|
86
85
|
else
|
87
86
|
raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
|
88
87
|
end
|
data/lib/tebako/build_helpers.rb
CHANGED
@@ -32,21 +32,8 @@ module Tebako
|
|
32
32
|
# Ruby build helpers
|
33
33
|
module BuildHelpers
|
34
34
|
class << self
|
35
|
-
def ncores
|
36
|
-
if RUBY_PLATFORM.include?("darwin")
|
37
|
-
out, st = Open3.capture2e("sysctl", "-n", "hw.ncpu")
|
38
|
-
else
|
39
|
-
out, st = Open3.capture2e("nproc", "--all")
|
40
|
-
end
|
41
|
-
|
42
|
-
if !st.signaled? && st.exitstatus.zero?
|
43
|
-
out.strip.to_i
|
44
|
-
else
|
45
|
-
4
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
35
|
def run_with_capture(args)
|
36
|
+
args = args.compact
|
50
37
|
puts " ... @ #{args.join(" ")}"
|
51
38
|
out, st = Open3.capture2e(*args)
|
52
39
|
raise Tebako::Error, "Failed to run #{args.join(" ")} (#{st}):\n #{out}" if st.signaled? || !st.exitstatus.zero?
|
data/lib/tebako/cli.rb
CHANGED
@@ -28,6 +28,8 @@
|
|
28
28
|
|
29
29
|
require "digest"
|
30
30
|
require "fileutils"
|
31
|
+
require "find"
|
32
|
+
require "pathname"
|
31
33
|
require "open3"
|
32
34
|
require "thor"
|
33
35
|
require "yaml"
|
@@ -36,6 +38,7 @@ require_relative "cache_manager"
|
|
36
38
|
require_relative "cli_helpers"
|
37
39
|
require_relative "error"
|
38
40
|
require_relative "ruby_version"
|
41
|
+
require_relative "scenario_manager"
|
39
42
|
require_relative "version"
|
40
43
|
|
41
44
|
# Tebako - an executable packager
|
@@ -66,10 +69,11 @@ module Tebako
|
|
66
69
|
(om,) = bootstrap(clean: true)
|
67
70
|
|
68
71
|
suffix = options["Ruby"].nil? ? "" : "_#{options["Ruby"]}"
|
69
|
-
nmr = "src
|
70
|
-
nms = "stash#{suffix}*"
|
71
|
-
|
72
|
-
FileUtils.rm_rf(
|
72
|
+
nmr = Dir.glob(File.join(om.deps, "src", "_ruby#{suffix}*"))
|
73
|
+
nms = Dir.glob(File.join(om.deps, "stash#{suffix}*"))
|
74
|
+
|
75
|
+
FileUtils.rm_rf(nmr + nms, secure: true)
|
76
|
+
extra_win_clean(nmr)
|
73
77
|
end
|
74
78
|
|
75
79
|
desc "hash", "Print build script hash (ci cache key)"
|
@@ -147,13 +151,29 @@ module Tebako
|
|
147
151
|
[options_manager, cache_manager]
|
148
152
|
end
|
149
153
|
|
154
|
+
# Ruby extension maker sometimes creates files with 'NUL' name on Windows
|
155
|
+
# This method removes such files
|
156
|
+
def extra_win_clean(nmr)
|
157
|
+
return unless nmr.any? && ScenarioManagerBase.new.msys?
|
158
|
+
|
159
|
+
nmr.each do |path|
|
160
|
+
if File.basename(path) == "NUL"
|
161
|
+
full_path = "//?/#{path}"
|
162
|
+
FileUtils.rm_f(full_path)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
FileUtils.rm_rf(nmr, secure: true)
|
166
|
+
end
|
167
|
+
|
150
168
|
def initialize(*args)
|
151
169
|
super
|
152
170
|
return if args[2][:current_command].name.include?("hash")
|
153
171
|
|
154
172
|
puts "Tebako executable packager version #{Tebako::VERSION}"
|
155
173
|
end
|
174
|
+
end
|
156
175
|
|
176
|
+
no_commands do
|
157
177
|
def options
|
158
178
|
original_options = super
|
159
179
|
tebafile = original_options["tebafile"].nil? ? DEFAULT_TEBAFILE : original_options["tebafile"]
|
@@ -164,9 +184,7 @@ module Tebako
|
|
164
184
|
original_options
|
165
185
|
end
|
166
186
|
end
|
167
|
-
end
|
168
187
|
|
169
|
-
no_commands do
|
170
188
|
def source
|
171
189
|
c_path = Pathname.new(__FILE__).realpath
|
172
190
|
@source ||= File.expand_path("../../..", c_path)
|
@@ -177,7 +195,10 @@ module Tebako
|
|
177
195
|
|
178
196
|
opts = ""
|
179
197
|
opts += " '--root'" if options["root"].nil?
|
180
|
-
|
198
|
+
if options["entry-point"].nil?
|
199
|
+
opts += ", " unless opts.empty?
|
200
|
+
opts += " '--entry-point'"
|
201
|
+
end
|
181
202
|
raise Thor::Error, "No value provided for required options #{opts}" unless opts.empty?
|
182
203
|
end
|
183
204
|
end
|
data/lib/tebako/cli_helpers.rb
CHANGED
@@ -82,7 +82,7 @@ module Tebako
|
|
82
82
|
return unless %w[both runtime bundle].include?(options_manager.mode)
|
83
83
|
|
84
84
|
generate_files(options_manager, scenario_manager)
|
85
|
-
merged_env = ENV.to_h.merge(
|
85
|
+
merged_env = ENV.to_h.merge(scenario_manager.b_env)
|
86
86
|
Tebako.packaging_error(103) unless system(merged_env, press_cfg_cmd(options_manager))
|
87
87
|
Tebako.packaging_error(104) unless system(merged_env, press_build_cmd(options_manager))
|
88
88
|
end
|
@@ -90,7 +90,7 @@ module Tebako
|
|
90
90
|
def do_setup(options_manager)
|
91
91
|
puts "Setting up tebako packaging environment"
|
92
92
|
|
93
|
-
merged_env = ENV.to_h.merge(
|
93
|
+
merged_env = ENV.to_h.merge(Tebako::ScenarioManagerBase.new.b_env)
|
94
94
|
Tebako.packaging_error(101) unless system(merged_env, setup_cfg_cmd(options_manager))
|
95
95
|
Tebako.packaging_error(102) unless system(merged_env, setup_build_cmd(options_manager))
|
96
96
|
end
|
data/lib/tebako/codegen.rb
CHANGED
@@ -62,14 +62,12 @@ module Tebako
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def deploy_mk(opt, scm)
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
72
|
-
SUBST
|
65
|
+
case opt.mode
|
66
|
+
when "bundle"
|
67
|
+
deploy_mk_bundle(opt, scm)
|
68
|
+
when /runtime|both/
|
69
|
+
deploy_mk_stub(opt)
|
70
|
+
end
|
73
71
|
end
|
74
72
|
|
75
73
|
def deploy_mk_bundle(opt, scm)
|
@@ -81,15 +79,6 @@ module Tebako
|
|
81
79
|
SUBST
|
82
80
|
end
|
83
81
|
|
84
|
-
def deploy_mk_inner(opt, scm)
|
85
|
-
case opt.mode
|
86
|
-
when "bundle"
|
87
|
-
deploy_mk_bundle(opt, scm)
|
88
|
-
when /runtime|both/
|
89
|
-
deploy_mk_stub(opt)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
82
|
def deploy_mk_stub(opt)
|
94
83
|
<<~SUBST
|
95
84
|
Tebako::Packager.deploy("#{opt.data_src_dir}", "#{opt.data_pre_dir}",
|
@@ -102,8 +91,20 @@ module Tebako
|
|
102
91
|
<<~SUBST
|
103
92
|
#{deploy_rq}
|
104
93
|
|
105
|
-
|
106
|
-
|
94
|
+
begin
|
95
|
+
#{deploy_rb_inner(opt, scm)}
|
96
|
+
rescue Tebako::Error => e
|
97
|
+
puts "deploy script failed: \#{e.message} [\#{e.error_code}]"
|
98
|
+
exit(e.error_code)
|
99
|
+
end
|
100
|
+
SUBST
|
101
|
+
end
|
102
|
+
|
103
|
+
def deploy_rb_inner(opt, scm)
|
104
|
+
<<~SUBST
|
105
|
+
rv = Tebako::RubyVersion.new(ARGV[0])
|
106
|
+
stash = File.join("#{opt.deps}", "stash_\#{ARGV[0]}")
|
107
|
+
Tebako::Packager::init(stash.to_s, "#{opt.data_src_dir}",
|
107
108
|
"#{opt.data_pre_dir}", "#{opt.data_bin_dir}")
|
108
109
|
#{deploy_crt_implib(opt, scm)}
|
109
110
|
#{deploy_mk(opt, scm)}
|
@@ -121,7 +122,7 @@ module Tebako
|
|
121
122
|
|
122
123
|
def stub_rb(opt)
|
123
124
|
<<~SUBST
|
124
|
-
puts "Copyright (c) 2024 Ribose Inc (https://www.ribose.com)"
|
125
|
+
puts "Copyright (c) 2024-2025 Ribose Inc (https://www.ribose.com)"
|
125
126
|
puts "Tebako runtime stub v#{Tebako::VERSION}"
|
126
127
|
puts "To run your application please call #{File.basename(opt.package)} --tebako-run <your tebako package>"
|
127
128
|
SUBST
|
data/lib/tebako/deploy_helper.rb
CHANGED
@@ -34,16 +34,13 @@ require_relative "build_helpers"
|
|
34
34
|
require_relative "packager/patch_helpers"
|
35
35
|
require_relative "scenario_manager"
|
36
36
|
|
37
|
+
require_relative "packager/patch"
|
38
|
+
require_relative "packager/rubygems_patch"
|
39
|
+
|
37
40
|
# Tebako - an executable packager
|
38
41
|
module Tebako
|
39
|
-
# Magic version numbers used to ensure compatibility for Ruby 2.7.x, 3.0.x
|
40
|
-
# These are the minimal versions required to provide linux-gnu / linux-musl differentiation by bundler
|
41
|
-
# Ruby 3.1+ default rubygems versions work correctly out of the box
|
42
|
-
BUNDLER_VERSION = "2.4.22"
|
43
|
-
RUBYGEMS_VERSION = "3.4.22"
|
44
|
-
|
45
42
|
# Tebako packaging support (deployer)
|
46
|
-
class DeployHelper <
|
43
|
+
class DeployHelper < ScenarioManagerWithBundler # rubocop:disable Metrics/ClassLength
|
47
44
|
def initialize(fs_root, fs_entrance, target_dir, pre_dir)
|
48
45
|
super(fs_root, fs_entrance)
|
49
46
|
@fs_root = fs_root
|
@@ -51,13 +48,13 @@ module Tebako
|
|
51
48
|
@target_dir = target_dir
|
52
49
|
@pre_dir = pre_dir
|
53
50
|
@verbose = %w[yes true].include?(ENV.fetch("VERBOSE", nil))
|
54
|
-
@ncores = BuildHelpers.ncores
|
55
51
|
end
|
56
52
|
|
57
|
-
attr_reader :
|
53
|
+
attr_reader :gem_home
|
58
54
|
|
59
55
|
def configure(ruby_ver, cwd)
|
60
56
|
@ruby_ver = ruby_ver
|
57
|
+
@needs_bundler = true unless @ruby_ver.ruby31?
|
61
58
|
@cwd = cwd
|
62
59
|
|
63
60
|
@tbd = File.join(@target_dir, "bin")
|
@@ -73,7 +70,7 @@ module Tebako
|
|
73
70
|
update_rubygems
|
74
71
|
system("#{gem_command} env") if @verbose
|
75
72
|
install_gem("tebako-runtime")
|
76
|
-
install_gem("bundler",
|
73
|
+
install_gem("bundler", @bundler_version) if @needs_bundler
|
77
74
|
deploy_solution
|
78
75
|
check_cwd
|
79
76
|
end
|
@@ -99,28 +96,26 @@ module Tebako
|
|
99
96
|
BuildHelpers.run_with_capture_v(params)
|
100
97
|
end
|
101
98
|
|
102
|
-
def needs_bundler?
|
103
|
-
@with_gemfile && !@ruby_ver.ruby31?
|
104
|
-
end
|
105
|
-
|
106
99
|
def update_rubygems
|
107
100
|
return if @ruby_ver.ruby31?
|
108
101
|
|
109
102
|
puts " ... updating rubygems to #{Tebako::RUBYGEMS_VERSION}"
|
110
103
|
BuildHelpers.run_with_capture_v([@gem_command, "update", "--no-doc", "--system",
|
111
104
|
Tebako::RUBYGEMS_VERSION])
|
112
|
-
|
105
|
+
|
106
|
+
patch = Packager::RubygemsUpdatePatch.new(@fs_mount_point).patch_map
|
107
|
+
Packager.do_patch(patch, "#{@target_dir}/lib/ruby/site_ruby/#{@ruby_ver.api_version}")
|
113
108
|
end
|
114
109
|
|
115
110
|
private
|
116
111
|
|
117
112
|
def bundle_config
|
118
|
-
BuildHelpers.run_with_capture_v([@bundler_command, "config", "set", "--local", "build.ffi",
|
113
|
+
BuildHelpers.run_with_capture_v([@bundler_command, bundler_reference, "config", "set", "--local", "build.ffi",
|
119
114
|
"--disable-system-libffi"])
|
120
|
-
BuildHelpers.run_with_capture_v([@bundler_command,
|
121
|
-
@nokogiri_option])
|
122
|
-
BuildHelpers.run_with_capture_v([@bundler_command,
|
123
|
-
@force_ruby_platform])
|
115
|
+
BuildHelpers.run_with_capture_v([@bundler_command, bundler_reference, "config",
|
116
|
+
"set", "--local", "build.nokogiri", @nokogiri_option])
|
117
|
+
BuildHelpers.run_with_capture_v([@bundler_command, bundler_reference, "config",
|
118
|
+
"set", "--local", "force_ruby_platform", @force_ruby_platform])
|
124
119
|
end
|
125
120
|
|
126
121
|
def check_entry_point(entry_point_root)
|
@@ -166,8 +161,8 @@ module Tebako
|
|
166
161
|
Dir.chdir(@pre_dir) do
|
167
162
|
bundle_config
|
168
163
|
puts " *** It may take a long time for a big project. It takes REALLY long time on Windows ***"
|
169
|
-
BuildHelpers.run_with_capture_v([@bundler_command, "install", "--jobs=#{
|
170
|
-
BuildHelpers.run_with_capture_v([@bundler_command, "exec", @gem_command, "build", gemspec])
|
164
|
+
BuildHelpers.run_with_capture_v([@bundler_command, bundler_reference, "install", "--jobs=#{ncores}"])
|
165
|
+
BuildHelpers.run_with_capture_v([@bundler_command, bundler_reference, "exec", @gem_command, "build", gemspec])
|
171
166
|
install_all_gems_or_fail
|
172
167
|
end
|
173
168
|
|
@@ -226,7 +221,7 @@ module Tebako
|
|
226
221
|
Dir.chdir(@tld) do
|
227
222
|
bundle_config
|
228
223
|
puts " *** It may take a long time for a big project. It takes REALLY long time on Windows ***"
|
229
|
-
BuildHelpers.run_with_capture_v([@bundler_command, "install", "--jobs=#{
|
224
|
+
BuildHelpers.run_with_capture_v([@bundler_command, bundler_reference, "install", "--jobs=#{ncores}"])
|
230
225
|
end
|
231
226
|
|
232
227
|
check_entry_point("local")
|
@@ -259,12 +254,5 @@ module Tebako
|
|
259
254
|
|
260
255
|
gem_files.each { |gem_file| install_gem(gem_file) }
|
261
256
|
end
|
262
|
-
|
263
|
-
def patch_after_rubygems_update(target_dir, ruby_api_ver)
|
264
|
-
# Autoload cannot handle statically linked openssl extension
|
265
|
-
# Changing it to require seems to be the simplest solution
|
266
|
-
Packager::PatchHelpers.patch_file("#{target_dir}/lib/ruby/site_ruby/#{ruby_api_ver}/rubygems/openssl.rb",
|
267
|
-
{ "autoload :OpenSSL, \"openssl\"" => "require \"openssl\"" })
|
268
|
-
end
|
269
257
|
end
|
270
258
|
end
|
data/lib/tebako/error.rb
CHANGED
@@ -44,6 +44,9 @@ module Tebako
|
|
44
44
|
114 => "Entry point is not within the project root",
|
45
45
|
115 => "Failed to load Gemfile",
|
46
46
|
116 => "Ruby version does not satify Gemfile requirements",
|
47
|
+
117 => "Failed to load Gemfile.lock",
|
48
|
+
118 => "Bundler version in Gemfile.lock does satisfy minimal Tebako version requirememnts",
|
49
|
+
119 => "Failed to find compatible bundler version",
|
47
50
|
201 => "Warning. Could not create cache version file"
|
48
51
|
}.freeze
|
49
52
|
|
@@ -44,19 +44,11 @@ module Tebako
|
|
44
44
|
@options = options
|
45
45
|
@rv = Tebako::RubyVersion.new(@options["Ruby"])
|
46
46
|
@ruby_ver, @ruby_hash = @rv.extend_ruby_version
|
47
|
+
@scmb = ScenarioManagerBase.new
|
47
48
|
end
|
48
49
|
|
49
50
|
attr_reader :ruby_ver, :rv
|
50
51
|
|
51
|
-
def b_env
|
52
|
-
u_flags = if RbConfig::CONFIG["host_os"] =~ /darwin/
|
53
|
-
"-DTARGET_OS_SIMULATOR=0 -DTARGET_OS_IPHONE=0 #{ENV.fetch("CXXFLAGS", nil)}"
|
54
|
-
else
|
55
|
-
ENV.fetch("CXXFLAGS", nil)
|
56
|
-
end
|
57
|
-
@b_env ||= { "CXXFLAGS" => u_flags }
|
58
|
-
end
|
59
|
-
|
60
52
|
def cfg_options
|
61
53
|
## {v_parts[3]} may be something like rc1 that won't work with CMake
|
62
54
|
v_parts = Tebako::VERSION.split(".")
|
@@ -64,7 +56,7 @@ module Tebako
|
|
64
56
|
# So we have to use \"xxx\"
|
65
57
|
@cfg_options ||=
|
66
58
|
"-DCMAKE_BUILD_TYPE=Release -DRUBY_VER:STRING=\"#{@ruby_ver}\" -DRUBY_HASH:STRING=\"#{@ruby_hash}\" " \
|
67
|
-
"-DDEPS:STRING=\"#{deps}\" -G \"#{m_files}\" -B \"#{output_folder}\" -S \"#{source}\" " \
|
59
|
+
"-DDEPS:STRING=\"#{deps}\" -G \"#{@scmb.m_files}\" -B \"#{output_folder}\" -S \"#{source}\" " \
|
68
60
|
"#{remove_glibc_private} -DTEBAKO_VERSION:STRING=\"#{v_parts[0]}.#{v_parts[1]}.#{v_parts[2]}\""
|
69
61
|
end
|
70
62
|
|
@@ -127,7 +119,7 @@ module Tebako
|
|
127
119
|
|
128
120
|
def fs_current
|
129
121
|
fs_current = Dir.pwd
|
130
|
-
if
|
122
|
+
if @scmb.msys?
|
131
123
|
fs_current, cygpath_res = Open3.capture2e("cygpath", "-w", fs_current)
|
132
124
|
Tebako.packaging_error(101) unless cygpath_res.success?
|
133
125
|
fs_current.strip!
|
@@ -158,20 +150,6 @@ module Tebako
|
|
158
150
|
@mode ||= @options["mode"].nil? ? "bundle" : @options["mode"]
|
159
151
|
end
|
160
152
|
|
161
|
-
def m_files
|
162
|
-
# [TODO]
|
163
|
-
# Ninja generates incorrect script for tebako press target -- gets lost in a chain custom targets
|
164
|
-
# Using makefiles has negative performance impact so it needs to be fixed
|
165
|
-
@m_files ||= case RUBY_PLATFORM
|
166
|
-
when /linux/, /darwin/
|
167
|
-
"Unix Makefiles"
|
168
|
-
when /msys|mingw|cygwin/
|
169
|
-
"MinGW Makefiles"
|
170
|
-
else
|
171
|
-
raise Tebako::Error.new("#{RUBY_PLATFORM} is not supported.", 112)
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
153
|
def output_folder
|
176
154
|
@output_folder ||= File.join(prefix, "o")
|
177
155
|
end
|
@@ -329,8 +307,8 @@ module Tebako
|
|
329
307
|
@source ||= File.expand_path("../../..", c_path)
|
330
308
|
end
|
331
309
|
|
332
|
-
def stash_dir
|
333
|
-
@stash_dir ||= "#{stash_dir_all}_#{@ruby_ver}"
|
310
|
+
def stash_dir(rver = nil)
|
311
|
+
@stash_dir ||= "#{stash_dir_all}_#{rver || @ruby_ver}"
|
334
312
|
end
|
335
313
|
|
336
314
|
def stash_dir_all
|
@@ -29,6 +29,7 @@ require_relative "patch_helpers"
|
|
29
29
|
require_relative "patch_buildsystem"
|
30
30
|
|
31
31
|
require_relative "patch"
|
32
|
+
require_relative "rubygems_patch"
|
32
33
|
# Tebako - an executable packager
|
33
34
|
module Tebako
|
34
35
|
# Packager module
|
@@ -46,24 +47,13 @@ module Tebako
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
# Ruby patching definitions (pass1 - common)
|
49
|
-
class Pass1Patch <
|
50
|
+
class Pass1Patch < RubygemsPatch
|
50
51
|
# [TODO] looks like it does not exist in 3.1.4
|
51
52
|
# May be obsolete
|
52
53
|
TOOL_RBINSTALL_RB_PATCH = {
|
53
54
|
" next if files.empty?" => "# tebako patched next if files.empty?"
|
54
55
|
}.freeze
|
55
56
|
|
56
|
-
RUBYGEM_OPENSSL_RB_SUBST = <<~SUBST
|
57
|
-
# Start of tebako patch
|
58
|
-
require "openssl"
|
59
|
-
# End of tebako patch
|
60
|
-
autoload :OpenSSL, "openssl"
|
61
|
-
SUBST
|
62
|
-
|
63
|
-
RUBYGEM_OPENSSL_RB_PATCH = {
|
64
|
-
'autoload :OpenSSL, "openssl"' => RUBYGEM_OPENSSL_RB_SUBST
|
65
|
-
}.freeze
|
66
|
-
|
67
57
|
EXT_SETUP_PATCH = {
|
68
58
|
"#option nodynamic" => "option nodynamic"
|
69
59
|
}.freeze
|
@@ -131,9 +121,8 @@ module Tebako
|
|
131
121
|
"Logging::message \"=== Checking done. ===\\n\"" => OPENSSL_EXTCONF_RB_SUBST
|
132
122
|
}.freeze
|
133
123
|
|
134
|
-
def initialize(
|
135
|
-
super()
|
136
|
-
@mountpoint = mountpoint
|
124
|
+
def initialize(mount_point, ruby_ver)
|
125
|
+
super(mount_point)
|
137
126
|
@ruby_ver = ruby_ver
|
138
127
|
end
|
139
128
|
|
@@ -152,7 +141,7 @@ module Tebako
|
|
152
141
|
|
153
142
|
# ....................................................
|
154
143
|
# Allow only packaged gems (from within memfs)
|
155
|
-
"lib/rubygems/path_support.rb" => rubygems_path_support_patch,
|
144
|
+
"lib/rubygems/path_support.rb" => rubygems_path_support_patch(@mount_point),
|
156
145
|
|
157
146
|
# ....................................................
|
158
147
|
# Disable dynamic extensions
|
@@ -170,46 +159,10 @@ module Tebako
|
|
170
159
|
# ....................................................
|
171
160
|
# autoload :OpenSSL, "openssl"
|
172
161
|
# fails to deal with a default gem from statically linked extension
|
173
|
-
pm.store("lib/rubygems/openssl.rb",
|
162
|
+
pm.store("lib/rubygems/openssl.rb", RUBYGEMS_OPENSSL_RB_PATCH) if @ruby_ver.ruby3x?
|
174
163
|
|
175
164
|
pm.freeze
|
176
165
|
end
|
177
|
-
|
178
|
-
private
|
179
|
-
|
180
|
-
def rubygems_path_support_patch_one
|
181
|
-
<<~SUBST
|
182
|
-
@home = env["GEM_HOME"] || Gem.default_dir
|
183
|
-
# -- Start of tebako patch --
|
184
|
-
unless env["TEBAKO_PASS_THROUGH"]
|
185
|
-
@home = Gem.default_dir unless @home.index("#{@mount_point}") == 0
|
186
|
-
end
|
187
|
-
# -- End of tebako patch --
|
188
|
-
|
189
|
-
SUBST
|
190
|
-
end
|
191
|
-
|
192
|
-
def rubygems_path_support_patch_two
|
193
|
-
<<~SUBST
|
194
|
-
|
195
|
-
@path = split_gem_path env["GEM_PATH"], @home
|
196
|
-
# -- Start of tebako patch --
|
197
|
-
unless env["TEBAKO_PASS_THROUGH"]
|
198
|
-
@path.keep_if do |xpath|
|
199
|
-
xpath.index("#{@mount_point}") == 0
|
200
|
-
end
|
201
|
-
end
|
202
|
-
# -- End of tebako patch --
|
203
|
-
|
204
|
-
SUBST
|
205
|
-
end
|
206
|
-
|
207
|
-
def rubygems_path_support_patch
|
208
|
-
{
|
209
|
-
' @home = env["GEM_HOME"] || Gem.default_dir' => rubygems_path_support_patch_one,
|
210
|
-
' @path = split_gem_path env["GEM_PATH"], @home' => rubygems_path_support_patch_two
|
211
|
-
}
|
212
|
-
end
|
213
166
|
end
|
214
167
|
|
215
168
|
# Ruby patching definitions (pass1 - darwin)
|
@@ -249,23 +202,21 @@ module Tebako
|
|
249
202
|
def gnumakefile_in_patch_p1 # rubocop:disable Metrics/MethodLength
|
250
203
|
objext = @ruby_ver.ruby32? ? "$(OBJEXT)" : "@OBJEXT@"
|
251
204
|
{
|
252
|
-
"
|
253
|
-
"# tebako patched DLLWRAP += -mno-cygwin",
|
205
|
+
"$(Q) $(DLLWRAP) \\" => GNUMAKEFILE_IN_DLLTOOL_SUBST,
|
254
206
|
|
255
207
|
"$(WPROGRAM): $(RUBYW_INSTALL_NAME).res.#{objext}" =>
|
256
208
|
"$(WPROGRAM): $(RUBYW_INSTALL_NAME).res.#{objext} $(WINMAINOBJ) # tebako patched",
|
257
209
|
|
258
210
|
"$(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@" =>
|
211
|
+
|
259
212
|
"$(WINMAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ # tebako patched",
|
260
213
|
|
261
|
-
"--output-exp=$(RUBY_EXP) \\" =>
|
262
|
-
"--output-exp=$(RUBY_EXP) --output-lib=$(LIBRUBY) --output-def=tebako.def \\",
|
214
|
+
"--output-exp=$(RUBY_EXP) \\" => "# tebako patched --output-exp=$(RUBY_EXP) \\",
|
263
215
|
|
264
216
|
"--export-all $(LIBRUBY_A) $(LIBS) -o $(PROGRAM)" =>
|
265
|
-
"--export-all $(LIBRUBY_A) $(LIBS) -o
|
217
|
+
"# tebako patched --export-all $(LIBRUBY_A) $(LIBS) -o $(PROGRAM)",
|
266
218
|
|
267
|
-
"@rm -f $(PROGRAM)" =>
|
268
|
-
"@rm -f program-stub.exe # tebako patched",
|
219
|
+
"@rm -f $(PROGRAM)" => "# tebako patched @rm -f $(PROGRAM)",
|
269
220
|
|
270
221
|
" $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)" =>
|
271
222
|
"# tebako patched $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)",
|