tebako 0.12.8 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6fc41804877504ff6a5c4852c33237a4516a3e5a61711b4e354acff3a020a4ae
4
- data.tar.gz: 0a7d32d49c1c5e0f290c7a81b37b09c5d6c6d9f2380c0321c3e648335289ce8f
3
+ metadata.gz: '009ef5486538fdd768a0b44c2833236a1f4f5a86ec9a00d89608d4eb601a06d1'
4
+ data.tar.gz: 3e2fde5102b5dfc56d9ea8cb9ab133133634e5e586de593f2183ba67c2504eb4
5
5
  SHA512:
6
- metadata.gz: 594cf3bcf5d805a12468dcf25929c51edef69c647833c1cf4c2772b1c0f29567bf882d744d8ee7925544e4d588c5cb8db31dffc231cd37543dde87c12744f1b0
7
- data.tar.gz: 37bba93e6cf95f145a3dcc695fcae4363ce0580f4fea52e8892a88859a95a9e87d1131deed408d929551d73cf44f6b19294fcc594668a36b7a5a1ba6662200ed
6
+ metadata.gz: 7ffba2ca2bdd4724bdce1cf7179383028dbeea2e38d3c1ae070f25809eabfcb7bd16a1ed4550895259423d42ae8b190db2438f135cda439b28af9c2004192999
7
+ data.tar.gz: 49c62bfdbe3312f7582cc67b9b9766ec1fe38aee715a7888a8de61764b338b2fb21dc35cf2b91f1f96948b9baf5ab9d3ad5758737e91728420f754736ecebc7c
data/CMakeLists.txt CHANGED
@@ -177,7 +177,7 @@ string(CONCAT RUBY_API_VER ${RUBY_VER_BASE} ".0")
177
177
  # list(GET LIBDWARFS_WR_VER_COMPONENTS 2 LIBDWARFS_WR_VER_PATCH)
178
178
  # set (LIBDWARFS_WR_VER_M ${LIBDWARFS_WR_VER_MAJOR}.${LIBDWARFS_WR_VER_MINOR}.${LIBDWARFS_WR_VER_PATCH})
179
179
  #else(DWARFS_PRELOAD)
180
- def_ext_prj_g(DWARFS_WR "v0.9.2")
180
+ def_ext_prj_g(DWARFS_WR "v0.9.3")
181
181
  #endif(DWARFS_PRELOAD)
182
182
 
183
183
  def_ext_prj_g(PATCHELF "65e14792061c298f1d2bc44becd48a10cbf0bc81")
@@ -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 \
@@ -380,7 +380,7 @@ ExternalProject_Add(${RUBY_PRJ}
380
380
  INSTALL_COMMAND ""
381
381
  )
382
382
 
383
- # add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ})
383
+ add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ})
384
384
 
385
385
  if (${SETUP_MODE})
386
386
  add_custom_target(setup
@@ -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 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${APP_NAME} ${RUBY_VER} ${DEPS_BIN_DIR}/patchelf ${WITH_PATCHELF})
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
@@ -105,7 +105,7 @@ higher.
105
105
  | 3.0.7 | Linux, macOS
106
106
  | 3.1.6 | Linux, macOS, Windows
107
107
  | 3.2.{4,5,6} | Linux, macOS, Windows
108
- | 3.3.{3,4,5,6} | Linux, macOS, Windows
108
+ | 3.3.{3,4,5,6,7} | Linux, macOS, Windows
109
109
  | 3.4.1 | Linux, macOS, Windows
110
110
 
111
111
  |===
@@ -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
- == Package Ruby version selection rules
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 Rules
1084
+ .Package Ruby version selection rules
1085
1085
  [cols="3", options="header"]
1086
1086
  |===
1087
- | Gemfile requirement\--Ruby option | Specified | Not specified
1087
+ | Gemfile requirement
1088
+ | `--Ruby` option given
1089
+ | `--Ruby` option absent
1088
1090
 
1089
- | Specified | The version specified by --Ruby option if it is supported and satisfies Gemfile requirement; error otherwise | The minimal supported Ruby option that satisfies Gemfile requirement; error otherwise
1090
- | Not specified | The version specified by --Ruby option if it is supported; error otherwise | Default Tebako Ruby version (3.2.6).
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
- == Packaging scenarios with Ruby
1096
-
1097
- Tebako for Ruby supports the following packaging scenarios.
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
- This is high-level description of the Tebako Ruby packaging mechanism.
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
- NOTE: These scenarios were inspired by the `ruby-packer` approach.
1116
+ |===
1102
1117
 
1103
- NOTE: Tebako Ruby is created independently from `ruby-packer`, no line of code
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/common.env CHANGED
@@ -1,5 +1,5 @@
1
1
  BUILD_TYPE=Release
2
2
  DEPS=deps
3
3
  INCBIN_TAG=348e36b
4
- DWARFS_WR_TAG=v0.9.2
4
+ DWARFS_WR_TAG=v0.9.3
5
5
  RUBY_VER=3.2.6
data/exe/tebako-packager CHANGED
@@ -70,19 +70,18 @@ begin
70
70
 
71
71
  when "finalize"
72
72
  # ARGV[0] -- command
73
- # ARGV[1] -- OSTYPE
74
- # ARGV[2] -- RUBY_SOURCE_DIR
75
- # ARGV[3] -- APP_NAME
76
- # ARGV[4] -- RUBY_VER
77
- # ARGV[5] -- patchelf executable
78
- # ARGV[6] -- WITH_PATHELF
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 7 arguments, #{ARGV.length} has been provided."
80
+ "tebako-packager finalize command expects 6 arguments, #{ARGV.length} has been provided."
82
81
  end
83
- ruby_ver = Tebako::RubyVersion.new(ARGV[4])
84
- with_patchelf = ARGV[6].casecmp("ON").zero? || ARGV[6].casecmp("YES").zero?
85
- Tebako::Packager.finalize(ARGV[1], ARGV[2], ARGV[3], ruby_ver, with_patchelf ? ARGV[5] : nil)
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
@@ -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/_ruby#{suffix}*"
70
- nms = "stash#{suffix}*"
71
- FileUtils.rm_rf(Dir.glob(File.join(om.deps, nmr)), secure: true)
72
- FileUtils.rm_rf(Dir.glob(File.join(om.deps, nms)), secure: true)
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
- opts += " '--entry-point'" if options["entry-point"].nil?
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
@@ -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(options_manager.b_env)
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(options_manager.b_env)
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
@@ -62,14 +62,12 @@ module Tebako
62
62
  end
63
63
 
64
64
  def deploy_mk(opt, scm)
65
- <<~SUBST
66
- begin
67
- #{deploy_mk_inner(opt, scm)}
68
- rescue Tebako::Error => e
69
- puts "tebako-packager failed: \#{e.message} [\#{e.error_code}]"
70
- exit(e.error_code)
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
- rv = Tebako::RubyVersion.new("#{opt.ruby_ver}")
106
- Tebako::Packager::init("#{opt.stash_dir}", "#{opt.data_src_dir}",
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
@@ -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 < ScenarioManager # rubocop:disable Metrics/ClassLength
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 :bundler_command, :gem_command, :gem_home
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", BUNDLER_VERSION) if needs_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
- patch_after_rubygems_update(@target_dir, @ruby_ver.api_version)
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, "config", "set", "--local", "build.nokogiri",
121
- @nokogiri_option])
122
- BuildHelpers.run_with_capture_v([@bundler_command, "config", "set", "--local", "force_ruby_platform",
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=#{@ncores}"])
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=#{@ncores}"])
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 RUBY_PLATFORM =~ /msys|mingw|cygwin/
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