tebako 0.7.2.rc3 → 0.7.2.rc4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99a2a477845a6154633205dd8d0420156f97c057cfb820158d0f88e432e09a85
4
- data.tar.gz: e8fb206e64c629a058620c9563bd34b274af06f8d14fdaacd7b3ad3788406536
3
+ metadata.gz: 4bfa5dde3a184cd2689178ae837ee3a5eff510cecb0ed1385617d4d3f170c707
4
+ data.tar.gz: b67d902a82ff37050ff7c273b770e96b8be23c83c9056a4e5bc88c4936d2bbb8
5
5
  SHA512:
6
- metadata.gz: 78846d4443cdd33781108b1be109b191b8f1398a882083d4c6e4840b5dcaf5a122c60ec887fd3ef3c2a2562355457e1cf7bd4bd1eff96d33b056ff78042a9414
7
- data.tar.gz: 5803abbe66b044013d221c3ca3e18f1f7fded575deca85b9b9210b4920488a3d87c5b3314f2fcb3d4c0302b634f48a18cb01c6515e6ee6985f7ece0d023ea336
6
+ metadata.gz: ce1166b1042a38f95db4f8190e5d2de55c7a62d40d3d4db990527c27199d23ffc5590af7ae094e0f8cafdfc5b0c2e9c7e3140fd6f8ad5d56dcfc8627b845a552
7
+ data.tar.gz: 398b4088288778241c404de5d68b1703d2ee42647060833b5c8c7b0b16f22223c92fe1abc7b6982b7124d57a95b732ee98a48e7ea9d913858c5ec0a396faffec
data/CMakeLists.txt CHANGED
@@ -116,9 +116,7 @@ set(IS_MUSL OFF)
116
116
  set(IS_MSYS OFF)
117
117
  set(IS_DARWIN OFF)
118
118
  set(RB_W32 OFF)
119
- set(FORCE_RUBY_PLATFORM "false")
120
- set(NOKOGIRI_OPTION "--no-use-system-libraries")
121
- set(RUBY_WITHOUT_EXT "dbm,win32,win32ole")
119
+ set(RUBY_WITHOUT_EXT "dbm,win32,win32ole,'-test-'")
122
120
  set(RUBY_NAME "ruby")
123
121
  set(RUBY_SUFFIX "")
124
122
  set(EXE_SUFFIX "")
@@ -129,14 +127,11 @@ set(DWARFS_PRELOAD OFF)
129
127
 
130
128
  if("${OSTYPE_TXT}" MATCHES "^linux-musl.*")
131
129
  set(IS_MUSL ON)
132
- set(FORCE_RUBY_PLATFORM "true")
133
130
  elseif("${OSTYPE_TXT}" MATCHES "^msys*")
134
131
  set(IS_MSYS ON)
135
- set(FORCE_RUBY_PLATFORM "true")
136
- set(NOKOGIRI_OPTION "--use-system-libraries")
137
132
  # set(DWARFS_PRELOAD ON)
138
133
  set(RB_W32 ON)
139
- set(RUBY_WITHOUT_EXT "dbm,syslog,pty,gdbm,readline")
134
+ set(RUBY_WITHOUT_EXT "dbm,syslog,pty,gdbm,readline,'-test-'")
140
135
  #set(RUBY_SUFFIX "w")
141
136
  set(EXE_SUFFIX ".exe")
142
137
  set(CMD_SUFFIX ".cmd")
@@ -274,7 +269,6 @@ message(STATUS "Building for Win32 Ruby (RB_W32): ${RB_W32}")
274
269
  # ...................................................................
275
270
  # Other options
276
271
 
277
- message(STATUS "Force Ruby platform for Gems: ${FORCE_RUBY_PLATFORM}")
278
272
  message(STATUS "Not building Ruby extensions: ${RUBY_WITHOUT_EXT}")
279
273
 
280
274
  # ...................................................................
@@ -370,7 +364,6 @@ message(STATUS "Ruby build ${C_FLAGS_DEST}='${RUBY_C_FLAGS}'")
370
364
  message(STATUS "Ruby build LDFLAGS='${RUBY_L_FLAGS}'")
371
365
  message(STATUS "openssl Ruby option='${OPENSSL_RUBY_OPTION}'")
372
366
  message(STATUS "libyaml Ruby option='${LIBYAML_RUBY_OPTION}'")
373
- message(STATUS "nokogiri build option='${NOKOGIRI_OPTION}'")
374
367
 
375
368
  ExternalProject_Add(${RUBY_PRJ}
376
369
  PREFIX ${DEPS}
@@ -418,125 +411,41 @@ else (${SETUP_MODE})
418
411
  list(LENGTH GEMFILES GFLENGTH)
419
412
  list(LENGTH GEMS GLENGTH)
420
413
 
421
- add_custom_target(clean_filesystem
422
- COMMAND ruby ${EXE}/tebako-packager deploy ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${RUBY_STASH_DIR}
423
- ${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR}
424
- ${GFLENGTH} ${APP_NAME} ${RUBY_VER}
425
- DEPENDS ${RUBY_PRJ}
426
- )
427
-
428
414
  if(GSLENGTH GREATER 0)
429
415
  if(GSLENGTH GREATER 1)
430
416
  message(FATAL_ERROR "Multiple gemspecs detected in ${FS_ROOT}")
431
417
  else(GSLENGTH GREATER 1)
432
- list(GET GEMSPECS 0 GEMSPEC)
433
- list(LENGTH GEMFILES GFLENGTH)
434
418
  if(GFLENGTH GREATER 0)
435
419
  # Found xxx.gemspec and Gemfile
436
- message("Collecting gem from gemspec ${GEMSPEC} and Gemfile")
437
420
  set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
438
- add_custom_target(source_filesystem
439
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
440
- COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
441
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
442
- ${TBD}/bundle${BAT_SUFFIX} config set --local build.ffi --disable-system-libffi
443
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
444
- ${TBD}/bundle${BAT_SUFFIX} config set --local build.nokogiri ${NOKOGIRI_OPTION}
445
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
446
- ${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
447
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
448
- ${TBD}/bundle${BAT_SUFFIX} install
449
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
450
- ${TBD}/bundle${BAT_SUFFIX} exec ${TBD}/gem${CMD_SUFFIX} build ${GEMSPEC}
451
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
452
- ${TBD}/gem${CMD_SUFFIX} install *.gem --verbose --no-document --install-dir ${TGD}
453
- COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
454
- (${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist" &&
455
- ${CMAKE_COMMAND} -E false )
456
- DEPENDS clean_filesystem
457
- )
458
421
  else(GFLENGTH GREATER 0)
459
422
  # Found xxx.gemspec but no Gemfile
460
- message("Collecting gem from gemspec ${GEMSPEC}")
461
423
  set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
462
- message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
463
- add_custom_target(source_filesystem
464
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
465
- COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
466
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
467
- ${TBD}/gem${CMD_SUFFIX} build ${GEMSPEC}
468
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
469
- ${TBD}/gem${CMD_SUFFIX} install *.gem --verbose --no-document --install-dir ${TGD}
470
- COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
471
- (${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist" &&
472
- ${CMAKE_COMMAND} -E false )
473
- DEPENDS clean_filesystem
474
- )
475
424
  endif(GFLENGTH GREATER 0)
476
425
  endif(GSLENGTH GREATER 1)
477
426
  elseif(GFLENGTH GREATER 0)
478
427
  # Found Gemfile but no gemspec
479
- message("Deploying Gemfile")
480
428
  set(FS_ENTRY_POINT "/local/${FS_ENTRANCE}")
481
- message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
482
- add_custom_target(source_filesystem
483
- COMMAND test -f ${FS_ROOT}/${FS_ENTRANCE} ||
484
- (${CMAKE_COMMAND} -E echo "Entry point ${FS_ROOT}/${FS_ENTRANCE} does not exist or is not accessible" &&
485
- ${CMAKE_COMMAND} -E false )
486
- COMMAND ${CMAKE_COMMAND} -E make_directory ${TLD}
487
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${TLD} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
488
- COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
489
- ${TBD}/bundle${BAT_SUFFIX} config set --local build.ffi --disable-system-libffi
490
- COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
491
- ${TBD}/bundle${BAT_SUFFIX} config set --local build.nokogiri ${NOKOGIRI_OPTION}
492
- COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
493
- ${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
494
- COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
495
- ${TBD}/bundle${BAT_SUFFIX} install --jobs=${NCORES}
496
- # COMMAND_EXPAND_LISTS
497
- # [TODO] Open question - how to deploy a project to source filesystem
498
- # ruby packer does bundle install --deployment --binstubs
499
- # COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
500
- # ${TBD}/bundle lock
501
- # COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
502
- # ${TBD}/bundle install --deployment --jobs=${NCORES}
503
- DEPENDS clean_filesystem
504
- )
505
429
  elseif(GLENGTH GREATER 0)
506
430
  # xxx.gem, no gemspec, no gemfile
507
- list(GET GEMS 0 GEM)
508
431
  if(GLENGTH GREATER 1)
509
432
  message(FATAL_ERROR "Multiple gems detected in ${FS_ROOT}")
510
433
  else(GLENGTH GREATER 1)
511
- message("Installing Ruby gem from ${GEM}")
512
434
  set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
513
- message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
514
- add_custom_target(source_filesystem
515
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
516
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
517
- ${TBD}/gem${CMD_SUFFIX} install ${GEM} --verbose --no-document --install-dir ${TGD}
518
- COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
519
- (${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist or is not accessible" &&
520
- ${CMAKE_COMMAND} -E false )
521
- DEPENDS clean_filesystem
522
- )
523
435
  endif(GLENGTH GREATER 1)
524
436
  else()
525
437
  # No gem, no gemspec, no gemfile
526
438
  # Simple ruby script
527
- message("Collecting simple Ruby script from ${FS_ROOT}")
528
439
  set(FS_ENTRY_POINT "/local/${FS_ENTRANCE}")
529
- message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
530
- add_custom_target(source_filesystem
531
- COMMAND test -f ${FS_ROOT}/${FS_ENTRANCE} ||
532
- (${CMAKE_COMMAND} -E echo "Entry point ${FS_ROOT}/${FS_ENTRANCE} does not exist or is not accessible" &&
533
- ${CMAKE_COMMAND} -E false )
534
- COMMAND ${CMAKE_COMMAND} -E make_directory ${TLD}
535
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${TLD} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
536
- DEPENDS clean_filesystem
537
- )
538
440
  endif()
539
441
 
442
+ add_custom_target(source_filesystem
443
+ COMMAND ruby ${EXE}/tebako-packager deploy ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${RUBY_STASH_DIR}
444
+ ${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR}
445
+ ${FS_ROOT} ${FS_ENTRANCE} ${FS_MOUNT_POINT} ${APP_NAME} ${RUBY_VER}
446
+ DEPENDS ${RUBY_PRJ}
447
+ )
448
+
540
449
  # ...................................................................
541
450
  # Packaged filesystem
542
451
 
data/exe/tebako-packager CHANGED
@@ -99,18 +99,20 @@ begin
99
99
  # ARGV[4] -- DATA_SRC_DIR
100
100
  # ARGV[5] -- DATA_PRE_DIR
101
101
  # ARGV[6] -- DATA_BIN_DIR
102
- # ARGV[7] -- GFLENGTH
103
- # ARGV[8] -- APP_NAME
104
- # ARGV[9] -- RUBY_VER
105
- unless ARGV.length == 10
102
+ # ARGV[7] -- FS_ROOT
103
+ # ARGV[8] -- FS_ENTRANCE
104
+ # ARGV[9] -- FS_MOUNT_POINT
105
+ # ARGV[10] -- APP_NAME
106
+ # ARGV[11] -- RUBY_VER
107
+ unless ARGV.length == 12
106
108
  raise Tebako::Error,
107
- "tebako-packager deploy command expects 10 arguments, #{ARGV.length} has been provided."
109
+ "tebako-packager deploy command expects 12 arguments, #{ARGV.length} has been provided."
108
110
  end
109
111
  Tebako::Packager.init(ARGV[3], ARGV[4], ARGV[5], ARGV[6])
110
- Tebako::Packager.create_implib(ARGV[2], ARGV[4], File.basename(ARGV[8]), ARGV[9]) if ARGV[1] =~ /msys/
112
+ Tebako::Packager.create_implib(ARGV[2], ARGV[4], File.basename(ARGV[10]), ARGV[11]) if ARGV[1] =~ /msys/
111
113
  # Assume that "<TARGET_BIN_DIR (TBD)>" is <DATA_SRC_DIR>/bin"
112
114
  # That shall match CMakeLists.txt settings
113
- Tebako::Packager.deploy(ARGV[4], ARGV[9], ARGV[7])
115
+ Tebako::Packager.deploy(ARGV[1], ARGV[4], ARGV[5], ARGV[11], ARGV[7], ARGV[8], ARGV[9])
114
116
 
115
117
  else
116
118
  raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
data/lib/tebako/cli.rb CHANGED
@@ -84,7 +84,7 @@ module Tebako
84
84
  enum: Tebako::CliRubies::RUBY_VERSIONS.keys,
85
85
  desc: "Tebako package Ruby version, #{Tebako::CliRubies::DEFAULT_RUBY_VERSION} by default"
86
86
  def press
87
- (clean_output unless version_match?) unless options[:devmode]
87
+ version_cache_check unless options[:devmode]
88
88
 
89
89
  puts press_announce
90
90
  do_press
@@ -99,7 +99,7 @@ module Tebako
99
99
  enum: Tebako::CliRubies::RUBY_VERSIONS.keys,
100
100
  desc: "Tebako package Ruby version, #{Tebako::CliRubies::DEFAULT_RUBY_VERSION} by default."
101
101
  def setup
102
- (clean_output unless version_match?) unless options[:devmode]
102
+ version_cache_check unless options[:devmode]
103
103
 
104
104
  puts "Setting up tebako packaging environment"
105
105
  do_setup
@@ -204,20 +204,42 @@ module Tebako
204
204
  @version_key ||= "#{Tebako::VERSION} at #{source}"
205
205
  end
206
206
 
207
- def version_match? # rubocop:disable Metrics/MethodLength
208
- begin
209
- version_file_path = File.join(prefix, E_VERSION_FILE)
210
- file_version = File.open(version_file_path, &:readline).strip
211
- rs = file_version == version_key
212
- unless rs
213
- puts "CMake cache was created by a gem version #{file_version} " \
214
- "and cannot be used for gem version #{version_key}"
215
- end
216
- rescue StandardError
217
- # In case of any error (e.g., file not readable), return false
218
- rs = false
207
+ def version_cache
208
+ version_file_path = File.join(prefix, E_VERSION_FILE)
209
+ file_version = File.open(version_file_path, &:readline).strip
210
+
211
+ file_version.match(/(?<version>.+) at (?<source>.+)/)
212
+ end
213
+
214
+ def version_cache_check
215
+ match_data = version_cache
216
+
217
+ return version_unknown unless match_data
218
+
219
+ if match_data[:version] != Tebako::VERSION
220
+ version_mismatch(match_data[:version])
221
+ elsif match_data[:source] != source
222
+ version_source_mismatch(match_data[:source])
219
223
  end
220
- rs
224
+ rescue StandardError
225
+ version_unknown
226
+ end
227
+
228
+ def version_mismatch(cached_version)
229
+ puts "Tebako cache was created by a gem version #{cached_version} " \
230
+ "and cannot be used for gem version #{Tebako::VERSION}"
231
+ clean_cache
232
+ end
233
+
234
+ def version_source_mismatch(cached_source)
235
+ puts "CMake cache was created for a different source directory '#{cached_source}' " \
236
+ "and cannot be used for '#{source}'"
237
+ clean_output
238
+ end
239
+
240
+ def version_unknown
241
+ puts "CMake cache version was not recognized, cleaning up"
242
+ clean_cache
221
243
  end
222
244
  end
223
245
  end
@@ -0,0 +1,281 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 [Ribose Inc](https://www.ribose.com).
4
+ # All rights reserved.
5
+ # This file is a part of tebako
6
+ #
7
+ # Redistribution and use in source and binary forms, with or without
8
+ # modification, are permitted provided that the following conditions
9
+ # are met:
10
+ # 1. Redistributions of source code must retain the above copyright
11
+ # notice, this list of conditions and the following disclaimer.
12
+ # 2. Redistributions in binary form must reproduce the above copyright
13
+ # notice, this list of conditions and the following disclaimer in the
14
+ # documentation and/or other materials provided with the distribution.
15
+ #
16
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
+ # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18
+ # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
20
+ # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26
+ # POSSIBILITY OF SUCH DAMAGE.
27
+
28
+ require "fileutils"
29
+ require "find"
30
+
31
+ require_relative "error"
32
+
33
+ # Tebako - an executable packager
34
+ module Tebako
35
+ # Magic version numbers used to ensure compatibility for Ruby 2.7.x, 3.0.x
36
+ # These are the minimal versions required to provide linux-gnu / linux-musl differentiation by bundler
37
+ # Ruby 3.1+ default rubygems versions work correctly out of the box
38
+ BUNDLER_VERSION = "2.4.22"
39
+ RUBYGEMS_VERSION = "3.4.22"
40
+
41
+ # Tebako packaging support (deployer)
42
+ class DeployHelper # rubocop:disable Metrics/ClassLength
43
+ def initialize(fs_root, fs_entrance, fs_mount_point, target_dir, pre_dir)
44
+ @fs_root = fs_root
45
+ @fs_entrance = fs_entrance
46
+ @fs_mount_point = fs_mount_point
47
+ @target_dir = target_dir
48
+ @pre_dir = pre_dir
49
+ @verbose = ENV["VERBOSE"] == "yes" || ENV["VERBOSE"] == "true"
50
+ end
51
+
52
+ attr_reader :bundler_command, :gem_command, :gem_home
53
+
54
+ def config(os_type, ruby_ver)
55
+ @ruby_ver = ruby_ver
56
+ @os_type = os_type
57
+
58
+ @tbd = File.join(@target_dir, "bin")
59
+ @tgd = @gem_home = File.join(@target_dir, "lib", "ruby", "gems", ruby_api_version)
60
+ @tld = File.join(@target_dir, "local")
61
+
62
+ lookup_files
63
+ configure_scenario
64
+ configure_commands
65
+ end
66
+
67
+ def deploy
68
+ install_gem("tebako-runtime")
69
+ install_gem("bundler", Tebako::BUNDLER_VERSION) if needs_bundler?
70
+
71
+ deploy_solution
72
+ end
73
+
74
+ def deploy_env
75
+ { "GEM_HOME" => gem_home,
76
+ "GEM_PATH" => gem_home,
77
+ "TEBAKO_PASS_THROUGH" => "1" }
78
+ end
79
+
80
+ def install_gem(name, ver = nil)
81
+ puts " ... installing #{name} gem#{" version #{ver}" if ver}"
82
+
83
+ params = [@gem_command, "install", name.to_s]
84
+ params.push("-v", ver.to_s) if ver
85
+ ["--no-document", "--install-dir", @tgd].each do |param|
86
+ params.push(param)
87
+ end
88
+ run_with_capture_v(params)
89
+ end
90
+
91
+ def ruby_api_version
92
+ @ruby_api_version ||= "#{@ruby_ver.split(".")[0..1].join(".")}.0"
93
+ end
94
+
95
+ def needs_bundler?
96
+ @gf_length.positive?
97
+ end
98
+
99
+ def update_rubygems
100
+ puts " ... updating rubygems to #{Tebako::RUBYGEMS_VERSION}"
101
+ run_with_capture_v([@gem_command, "update", "--no-doc", "--system", Tebako::RUBYGEMS_VERSION])
102
+ end
103
+
104
+ private
105
+
106
+ def bundle_config
107
+ run_with_capture_v([@bundler_command, "config", "set", "--local", "build.ffi", "--disable-system-libffi"])
108
+ run_with_capture_v([@bundler_command, "config", "set", "--local", "build.nokogiri", @nokogiri_option])
109
+ run_with_capture_v([@bundler_command, "config", "set", "--local", "force_ruby_platform", @force_ruby_platform])
110
+ end
111
+
112
+ def check_entry_point(entry_point_root)
113
+ fs_entry_point = File.join(entry_point_root, @fs_entrance)
114
+ puts " ... target entry point will be at #{File.join(@fs_mount_point, fs_entry_point)}"
115
+
116
+ return if File.exist?(File.join(@target_dir, fs_entry_point))
117
+
118
+ raise Tebako::Error.new("Entry point #{fs_entry_point} does not exist or is not accessible", 106)
119
+ end
120
+
121
+ def collect_and_deploy_gem(gemspec)
122
+ puts " ... Collecting gem from gemspec #{gemspec}"
123
+
124
+ copy_files(@pre_dir)
125
+
126
+ Dir.chdir(@pre_dir) do
127
+ run_with_capture_v([@gem_command, "build", gemspec])
128
+ install_all_gems_or_fail
129
+ end
130
+
131
+ check_entry_point("bin")
132
+ end
133
+
134
+ def collect_and_deploy_gem_and_gemfile(gemspec)
135
+ puts " ... collecting gem from gemspec #{gemspec} and Gemfile"
136
+
137
+ copy_files(@pre_dir)
138
+
139
+ Dir.chdir(@pre_dir) do
140
+ bundle_config
141
+ puts " *** It may take a long time for a big project. It takes REALLY long time on Windows ***"
142
+ run_with_capture_v([@bundler_command, "install", "--jobs=#{ncores}"])
143
+ run_with_capture_v([@bundler_command, "exec", @gem_command, "build", gemspec])
144
+ install_all_gems_or_fail
145
+ end
146
+
147
+ check_entry_point("bin")
148
+ end
149
+
150
+ def configure_commands
151
+ @cmd_suffix = @os_type =~ /msys/ ? ".cmd" : ""
152
+ @bat_suffix = @os_type =~ /msys/ ? ".bat" : ""
153
+
154
+ @gem_command = File.join(@tbd, "gem#{@cmd_suffix}")
155
+ @bundler_command = File.join(@tbd, "bundle#{@bat_suffix}")
156
+
157
+ @force_ruby_platform = @os_type =~ /msys|linux-musl/ ? "true" : "false"
158
+ @nokogiri_option = @os_type =~ /msys/ ? "--use-system-libraries" : "--no-use-system-libraries"
159
+ end
160
+
161
+ def configure_scenario
162
+ case @gs_length
163
+ when 0
164
+ configure_scenario_no_gemspec
165
+ when 1
166
+ @scenario = @gf_length.positive? ? :gemspec_and_gemfile : :gemspec
167
+ else
168
+ raise Tebako::Error, "Multiple Ruby gemspecs found in #{@fs_root}"
169
+ end
170
+ end
171
+
172
+ def configure_scenario_no_gemspec
173
+ @scenario = if @gf_length.positive?
174
+ :gemfile
175
+ elsif @g_length.positive?
176
+ :gem
177
+ else
178
+ :simple_script
179
+ end
180
+ end
181
+
182
+ def copy_files(dest)
183
+ FileUtils.mkdir_p(dest)
184
+ if Dir.exist?(@fs_root) && File.readable?(@fs_root)
185
+ begin
186
+ FileUtils.cp_r(File.join(@fs_root, "."), dest)
187
+ rescue StandardError
188
+ raise Tebako::Error.new("#{@fs_root} is not accessible or does not exist.", 107)
189
+ end
190
+ return
191
+ end
192
+ raise Tebako::Error.new("#{@fs_root} is not accessible or is not a directory.", 107)
193
+ end
194
+
195
+ def deploy_gem(gem)
196
+ puts " ... installing Ruby gem from #{gem}"
197
+ copy_files(@pre_dir)
198
+ Dir.chdir(@pre_dir) { install_gem(gem) }
199
+ check_entry_point("bin")
200
+ end
201
+
202
+ def deploy_gemfile
203
+ puts " ... deploying Gemfile"
204
+ copy_files(@tld)
205
+
206
+ Dir.chdir(@tld) do
207
+ bundle_config
208
+ puts " *** It may take a long time for a big project. It takes REALLY long time on Windows ***"
209
+ run_with_capture_v([@bundler_command, "install", "--jobs=#{ncores}"])
210
+ end
211
+
212
+ check_entry_point("local")
213
+ end
214
+
215
+ def deploy_simple_script
216
+ puts " ... collecting simple Ruby script from #{@fs_root}"
217
+ copy_files(@tld)
218
+ check_entry_point("local")
219
+ end
220
+
221
+ def deploy_solution # rubocop:disable Metrics/MethodLength
222
+ case @scenario
223
+ when :simple_script
224
+ deploy_simple_script
225
+ when :gem
226
+ deploy_gem(Dir.glob(File.join(@fs_root, "*.gem")).first)
227
+ when :gemfile
228
+ deploy_gemfile
229
+ when :gemspec
230
+ collect_and_deploy_gem(Dir.glob(File.join(@fs_root, "*.gemspec")).first)
231
+ when :gemspec_and_gemfile
232
+ collect_and_deploy_gem_and_gemfile(Dir.glob(File.join(@fs_root, "*.gemspec")).first)
233
+ end
234
+ end
235
+
236
+ def install_all_gems_or_fail
237
+ gem_files = Dir.glob("*.gem").map { |file| File.expand_path(file) }
238
+ raise Tebako::Error, "No gem files found after build" if gem_files.empty?
239
+
240
+ gem_files.each { |gem_file| install_gem(gem_file) }
241
+ end
242
+
243
+ def lookup_files
244
+ @gs_length = Dir.glob(File.join(@fs_root, "*.gemspec")).length
245
+ @gf_length = Dir.glob(File.join(@fs_root, "Gemfile")).length
246
+ @g_length = Dir.glob(File.join(@fs_root, "*.gem")).length
247
+ end
248
+
249
+ def ncores
250
+ if RUBY_PLATFORM.include?("darwin")
251
+ out, st = Open3.capture2e("sysctl", "-n", "hw.ncpu")
252
+ else
253
+ out, st = Open3.capture2e("nproc", "--all")
254
+ end
255
+
256
+ @ncores ||= if st.exitstatus.zero?
257
+ out.strip.to_i
258
+ else
259
+ 4
260
+ end
261
+ end
262
+
263
+ def run_with_capture(args)
264
+ puts " ... @ #{args.join(" ")}"
265
+ out, st = Open3.capture2e(*args)
266
+ raise Tebako::Error, "Failed to run #{args.join(" ")} (#{st}):\n #{out}" unless st.exitstatus.zero?
267
+
268
+ out
269
+ end
270
+
271
+ def run_with_capture_v(args)
272
+ if @verbose
273
+ args_v = args.dup
274
+ args_v.push("--verbose")
275
+ puts run_with_capture(args_v)
276
+ else
277
+ run_with_capture(args)
278
+ end
279
+ end
280
+ end
281
+ end
data/lib/tebako/error.rb CHANGED
@@ -32,7 +32,9 @@ module Tebako
32
32
  102 => "'tebako setup' build step failed",
33
33
  103 => "'tebako press' configure step failed",
34
34
  104 => "'tebako press' build step failed",
35
- 105 => "Failed to map MSys path to Windows"
35
+ 105 => "Failed to map MSys path to Windows",
36
+ 106 => "Entry point does not exist or is not accessible",
37
+ 107 => "Project root does not exist or is not accessible"
36
38
  }.freeze
37
39
 
38
40
  class << self
@@ -88,9 +88,9 @@ module Tebako
88
88
  SUBST
89
89
  }.freeze
90
90
 
91
- DARWIN_CONFIGURE_PATCH = {
92
- "EXTDLDFLAGS=\"-bundle_loader '\\$(BUILTRUBY)'\"" => ""
93
- }.freeze
91
+ # DARWIN_CONFIGURE_PATCH = {
92
+ # "EXTDLDFLAGS=\"-bundle_loader '\\$(BUILTRUBY)'\"" => ""
93
+ # }.freeze
94
94
 
95
95
  OPENSSL_EXTCONF_RB_SUBST = <<~SUBST
96
96
  # Start of tebako patch
@@ -138,7 +138,10 @@ module Tebako
138
138
 
139
139
  # ....................................................
140
140
  # Fixing (bypassing) configure script bug where a variable is used before initialization
141
- patch_map.store("configure", DARWIN_CONFIGURE_PATCH) if ostype =~ /darwin/
141
+ # On MacOS it generates bod EXTDLDFLAGS WITH -bundle_loader <missing parameter>
142
+ # However, it loooks likes EXTDLDFLAGS are just redundant for final Ruby linkage, so we are
143
+ # just removing it on pass 2 (at least for now)
144
+ # patch_map.store("configure", DARWIN_CONFIGURE_PATCH) if ostype =~ /darwin/
142
145
 
143
146
  # ....................................................
144
147
  # autoload :OpenSSL, "openssl"
@@ -53,7 +53,7 @@ module Tebako
53
53
 
54
54
  TEMPLATE_MAKEFILE_IN_BASE_PATCH_PRE_3_1 =
55
55
  "# -- Start of tebako patch --\n" \
56
- "\t\t$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) " \
56
+ "\t\t$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(MAINOBJ) " \
57
57
  "$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
58
58
  "# -- End of tebako patch --"
59
59
 
@@ -63,13 +63,13 @@ module Tebako
63
63
 
64
64
  TEMPLATE_MAKEFILE_IN_BASE_PATCH =
65
65
  "# -- Start of tebako patch --\n" \
66
- "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(MAINOBJ) " \
66
+ "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(MAINOBJ) " \
67
67
  "$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
68
68
  "# -- End of tebako patch --"
69
69
 
70
70
  TEMPLATE_MAKEFILE_IN_BASE_PATCH_MSYS =
71
71
  "# -- Start of tebako patch --\n" \
72
- "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(RUBY_EXP) $(MAINOBJ) " \
72
+ "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(RUBY_EXP) $(MAINOBJ) " \
73
73
  "$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
74
74
  "# -- End of tebako patch --"
75
75
 
@@ -26,8 +26,11 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  require "fileutils"
29
+ require "find"
30
+ require "pathname"
29
31
 
30
32
  require_relative "error"
33
+ require_relative "deploy_helper"
31
34
  require_relative "packager/pass1"
32
35
  require_relative "packager/pass1a"
33
36
  require_relative "packager/pass2"
@@ -59,12 +62,6 @@ module Tebako
59
62
  thread_pthread.c
60
63
  ].freeze
61
64
 
62
- # Magic version numbers used to ensure compatibility for Ruby 2.7.x, 3.0.x
63
- # These are the minimal versions required to provide linux-gnu / linux-musl differentiation by bundler
64
- # Ruby 3.1+ default rubygems versions work correctly out of the box
65
- BUNDLER_VERSION = "2.4.22"
66
- RUBYGEMS_VERSION = "3.4.22"
67
-
68
65
  class << self
69
66
  # Create implib
70
67
  def create_implib(src_dir, package_src_dir, app_name, ruby_ver)
@@ -77,18 +74,18 @@ module Tebako
77
74
  end
78
75
 
79
76
  # Deploy
80
- def deploy(target_dir, ruby_ver, gflength)
77
+ def deploy(os_type, target_dir, pre_dir, ruby_ver, fs_root, fs_entrance, fs_mount_point) # rubocop:disable Metrics/ParameterLists
81
78
  puts "-- Running deploy script"
82
79
 
83
- ruby_api_ver = ruby_api_version(ruby_ver)
84
- gem_home = "#{target_dir}/lib/ruby/gems/#{ruby_api_ver}"
85
-
86
- deploy_env = { "GEM_HOME" => gem_home, "GEM_PATH" => gem_home, "TEBAKO_PASS_THROUGH" => "1" }
80
+ deploy_helper = Tebako::DeployHelper.new(fs_root, fs_entrance, fs_mount_point, target_dir, pre_dir)
81
+ deploy_helper.config(os_type, ruby_ver)
87
82
 
88
- PatchHelpers.with_env(deploy_env) do
89
- update_rubygems(target_dir, ruby_api_ver, RUBYGEMS_VERSION) unless PatchHelpers.ruby31?(ruby_ver)
90
- install_gem(target_dir, "tebako-runtime")
91
- install_gem(target_dir, "bundler", BUNDLER_VERSION) if gflength.to_i != 0
83
+ PatchHelpers.with_env(deploy_helper.deploy_env) do
84
+ unless PatchHelpers.ruby31?(ruby_ver)
85
+ deploy_helper.update_rubygems
86
+ patch_after_rubygems_update(target_dir, deploy_helper.ruby_api_version)
87
+ end
88
+ deploy_helper.deploy
92
89
  end
93
90
  end
94
91
 
@@ -174,24 +171,10 @@ module Tebako
174
171
  File.join(src_dir, "lib", "libx64-ucrt-ruby#{ruby_ver[0]}#{ruby_ver[2]}0.a")
175
172
  end
176
173
 
177
- def install_gem(target_dir, name, ver = nil)
178
- puts " ... installing #{name} gem#{" version #{ver}" if ver}"
179
-
180
- params = ["#{target_dir}/bin/gem", "install", name.to_s]
181
- params.push("-v", ver.to_s) if ver
182
-
183
- out, st = Open3.capture2e(*params)
184
- raise Tebako::Error, "Failed to install #{name} (#{st}):\n #{out}" unless st.exitstatus.zero?
185
- end
186
-
187
174
  def do_patch(patch_map, root)
188
175
  patch_map.each { |fname, mapping| PatchHelpers.patch_file("#{root}/#{fname}", mapping) }
189
176
  end
190
177
 
191
- def ruby_api_version(ruby_ver)
192
- "#{ruby_ver.split(".")[0..1].join(".")}.0"
193
- end
194
-
195
178
  def ruby_version(tbd)
196
179
  ruby_version = nil
197
180
  PatchHelpers.with_env(DEPLOY_ENV) do
@@ -206,11 +189,7 @@ module Tebako
206
189
  ruby_version
207
190
  end
208
191
 
209
- def update_rubygems(target_dir, ruby_api_ver, gem_ver)
210
- puts " ... updating rubygems to #{gem_ver}"
211
- out, st = Open3.capture2e("#{target_dir}/bin/gem", "update", "--no-doc", "--system", gem_ver.to_s)
212
- raise Tebako::Error, "Failed to update rubugems to #{gem_ver} (#{st}):\n #{out}" unless st.exitstatus.zero?
213
-
192
+ def patch_after_rubygems_update(target_dir, ruby_api_ver)
214
193
  # Autoload cannot handle statically linked openssl extension
215
194
  # Changing it to require seems to be the simplest solution
216
195
  PatchHelpers.patch_file("#{target_dir}/lib/ruby/site_ruby/#{ruby_api_ver}/rubygems/openssl.rb",
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.7.2.rc3"
29
+ VERSION = "0.7.2.rc4"
30
30
  end
@@ -42,7 +42,7 @@ jobs:
42
42
  strategy:
43
43
  fail-fast: false
44
44
  matrix:
45
- os: [ ubuntu-20.04, macos-12 ]
45
+ os: [ ubuntu-20.04, macos-11.0 ]
46
46
  steps:
47
47
  - name: Checkout
48
48
  uses: actions/checkout@v4
@@ -67,7 +67,7 @@ jobs:
67
67
  strategy:
68
68
  fail-fast: false
69
69
  matrix:
70
- os: [ ubuntu-20.04, macos-12 ]
70
+ os: [ ubuntu-20.04, macos-11.0 ]
71
71
  steps:
72
72
  - name: Checkout
73
73
  uses: actions/checkout@v4
@@ -89,7 +89,7 @@ jobs:
89
89
  strategy:
90
90
  fail-fast: false
91
91
  matrix:
92
- os: [ ubuntu-20.04, macos-12 ]
92
+ os: [ ubuntu-20.04, macos-11.0 ]
93
93
  steps:
94
94
  - name: Checkout
95
95
  uses: actions/checkout@v4
@@ -106,7 +106,7 @@ jobs:
106
106
 
107
107
  test-cross-brew-install:
108
108
  name: test arm-brew-setup/install
109
- runs-on: macos-12
109
+ runs-on: macos-11.0
110
110
  steps:
111
111
  - name: Checkout
112
112
  uses: actions/checkout@v4
@@ -122,24 +122,3 @@ jobs:
122
122
  set -o errexit -o pipefail -o noclobber -o nounset
123
123
  test -f $PWD/arm-homebrew/lib/libgflags.dylib
124
124
  test -f $PWD/arm-homebrew/lib/libglog.dylib
125
-
126
- test-macos-environment-script:
127
- name: test macos-environment.cmake on ${{ matrix.os }}
128
- runs-on: ${{ matrix.os }}
129
- strategy:
130
- fail-fast: false
131
- matrix:
132
- os: [ macos-12, macos-13, macos-14 ]
133
-
134
- steps:
135
- - name: Checkout
136
- uses: actions/checkout@v4
137
-
138
- - name: Checkout
139
- uses: actions/checkout@v4
140
-
141
- - name: Install packages
142
- run: brew install flex bison bash
143
-
144
- - name: Run CMake test
145
- run: cmake -B test.build -S tests/cmake
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2021-2024, [Ribose Inc](https://www.ribose.com).
1
+ # Copyright (c) 2021-2023, [Ribose Inc](https://www.ribose.com).
2
2
  # All rights reserved.
3
3
  # This file is a part of tamatebako
4
4
  #
@@ -25,32 +25,14 @@
25
25
  #
26
26
 
27
27
  if (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
28
-
29
- function(find_and_set_homebrew_prefix package_name pkg_name executable_name)
30
- execute_process(
31
- COMMAND brew --prefix ${package_name}
32
- RESULT_VARIABLE BREW_${pkg_name}_RESULT
33
- OUTPUT_VARIABLE BREW_${pkg_name}_PREFIX_TMP
34
- OUTPUT_STRIP_TRAILING_WHITESPACE
35
- )
36
- if (BREW_${pkg_name}_RESULT EQUAL 0 AND EXISTS "${BREW_${pkg_name}_PREFIX_TMP}")
37
- set(BREW_${pkg_name}_PREFIX "${BREW_${pkg_name}_PREFIX_TMP}" CACHE PATH "${package_name} prefix")
38
- message(STATUS "Found ${package_name} keg installed by Homebrew at ${BREW_${pkg_name}_PREFIX}")
39
- set(${executable_name} "${BREW_${pkg_name}_PREFIX}/bin/${package_name}" CACHE FILEPATH "${executable_name} executable")
40
- endif()
41
- endfunction()
42
-
43
-
44
28
  execute_process(
45
29
  COMMAND brew --prefix
46
30
  RESULT_VARIABLE BREW_PREFIX_RES
47
- OUTPUT_VARIABLE BREW_PREFIX_TMP
31
+ OUTPUT_VARIABLE BREW_PREFIX
48
32
  OUTPUT_STRIP_TRAILING_WHITESPACE
49
33
  )
50
- if(NOT (BREW_PREFIX_RES EQUAL 0 AND EXISTS ${BREW_PREFIX_TMP}))
34
+ if(NOT (BREW_PREFIX_RES EQUAL 0 AND EXISTS ${BREW_PREFIX}))
51
35
  message(FATAL "Could not find build brew setup")
52
- else()
53
- set(BREW_PREFIX "${BREW_PREFIX_TMP}" CACHE PATH "Brew installation prefix")
54
36
  endif()
55
37
 
56
38
  message(STATUS "Using brew environment at ${BREW_PREFIX}")
@@ -58,12 +40,41 @@ if (CMAKE_HOST_SYSTEM_NAME MATCHES "Darwin")
58
40
  set(OPENSSL_ROOT_DIR "${BREW_PREFIX}/opt/openssl@3")
59
41
  set(CMAKE_PREFIX_PATH "${BREW_PREFIX}")
60
42
  include_directories("${OPENSSL_ROOT_DIR}/include")
61
- include_directories("${BREW_PREFIX}/include")
43
+ include_directories("${TARGET_BREW_PREFIX}/include")
62
44
 
63
45
  # https://stackoverflow.com/questions/53877344/cannot-configure-cmake-to-look-for-homebrew-installed-version-of-bison
64
- find_and_set_homebrew_prefix("bison" "BISON" "BISON_EXECUTABLE")
65
- find_and_set_homebrew_prefix("flex" "FLEX" "FLEX_EXECUTABLE")
66
- find_and_set_homebrew_prefix("bash" "BASH" "GNU_BASH")
46
+ execute_process(
47
+ COMMAND brew --prefix bison
48
+ RESULT_VARIABLE BREW_BISON
49
+ OUTPUT_VARIABLE BREW_BISON_PREFIX
50
+ OUTPUT_STRIP_TRAILING_WHITESPACE
51
+ )
52
+ if (BREW_BISON EQUAL 0 AND EXISTS "${BREW_BISON_PREFIX}")
53
+ message(STATUS "Found Bison keg installed by Homebrew at ${BREW_BISON_PREFIX}")
54
+ set(BISON_EXECUTABLE "${BREW_BISON_PREFIX}/bin/bison")
55
+ endif()
56
+
57
+ execute_process(
58
+ COMMAND brew --prefix flex
59
+ RESULT_VARIABLE BREW_FLEX
60
+ OUTPUT_VARIABLE BREW_FLEX_PREFIX
61
+ OUTPUT_STRIP_TRAILING_WHITESPACE
62
+ )
63
+ if (BREW_FLEX EQUAL 0 AND EXISTS "${BREW_FLEX_PREFIX}")
64
+ message(STATUS "Found Flex keg installed by Homebrew at ${BREW_FLEX_PREFIX}")
65
+ set(FLEX_EXECUTABLE "${BREW_FLEX_PREFIX}/bin/flex")
66
+ endif()
67
+
68
+ execute_process(
69
+ COMMAND brew --prefix bash
70
+ RESULT_VARIABLE BREW_BASH
71
+ OUTPUT_VARIABLE BREW_BASH_PREFIX
72
+ OUTPUT_STRIP_TRAILING_WHITESPACE
73
+ )
74
+ if (BREW_BASH EQUAL 0 AND EXISTS "${BREW_BASH_PREFIX}")
75
+ message(STATUS "Found GNU bash keg installed by Homebrew at ${BREW_BASH_PREFIX}")
76
+ set(GNU_BASH "${BREW_BASH_PREFIX}/bin/bash")
77
+ endif()
67
78
 
68
79
  # Suppress superfluous randlib warnings about "*.a" having no symbols on MacOSX.
69
80
  set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tebako
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2.rc3
4
+ version: 0.7.2.rc4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-03 00:00:00.000000000 Z
11
+ date: 2024-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -66,6 +66,7 @@ files:
66
66
  - lib/tebako/cli.rb
67
67
  - lib/tebako/cli_helpers.rb
68
68
  - lib/tebako/cli_rubies.rb
69
+ - lib/tebako/deploy_helper.rb
69
70
  - lib/tebako/error.rb
70
71
  - lib/tebako/packager.rb
71
72
  - lib/tebako/packager/pass1.rb
@@ -103,7 +104,6 @@ files:
103
104
  - tools/cmake-scripts/setup-openssl.cmake
104
105
  - tools/cmake-scripts/version.cmake
105
106
  - tools/include/pro-statvfs.h
106
- - tools/tests/cmake/CMakeLists.txt
107
107
  - tools/tests/setup-libhowardhinnerdate/CMakeLists.txt
108
108
  - tools/tests/setup-librachive/CMakeLists.txt
109
109
  - tools/tests/setup-libutfcpp/CMakeLists.txt
@@ -1,81 +0,0 @@
1
- # Copyright (c) 2024, [Ribose Inc](https://www.ribose.com).
2
- # All rights reserved.
3
- # This file is a part of tebako
4
- #
5
- # Redistribution and use in source and binary forms, with or without
6
- # modification, are permitted provided that the following conditions
7
- # are met:
8
- # 1. Redistributions of source code must retain the above copyright
9
- # notice, this list of conditions and the following disclaimer.
10
- # 2. Redistributions in binary form must reproduce the above copyright
11
- # notice, this list of conditions and the following disclaimer in the
12
- # documentation and/or other materials provided with the distribution.
13
- #
14
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15
- # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16
- # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17
- # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
18
- # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21
- # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22
- # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24
- # POSSIBILITY OF SUCH DAMAGE.
25
-
26
- cmake_minimum_required(VERSION 3.15)
27
- project(cmake-tests)
28
-
29
-
30
- # Adjust the path to where your macos-environment.cmake is located
31
- include("${CMAKE_CURRENT_LIST_DIR}/../../cmake-scripts/macos-environment.cmake")
32
-
33
- # Function to check if a variable is set (not empty)
34
- function(check_variable_set VAR_NAME)
35
- if(NOT ${VAR_NAME})
36
- message(FATAL_ERROR "${VAR_NAME} is not set.")
37
- endif()
38
- endfunction()
39
-
40
- # Function to check if a file/directory exists at the path specified by a variable
41
- function(check_exists VAR_NAME TYPE)
42
- if(NOT EXISTS "${${VAR_NAME}}")
43
- if(TYPE STREQUAL "FILE")
44
- message(FATAL_ERROR "The file specified in ${VAR_NAME} does not exist: ${${VAR_NAME}}")
45
- elseif(TYPE STREQUAL "DIRECTORY")
46
- message(FATAL_ERROR "The directory specified in ${VAR_NAME} does not exist: ${${VAR_NAME}}")
47
- endif()
48
- endif()
49
- endfunction()
50
-
51
- message(STATUS "BREW_PREFIX: ${BREW_PREFIX}")
52
- check_variable_set(BREW_PREFIX)
53
- check_exists(BREW_PREFIX DIRECTORY)
54
-
55
- message(STATUS "OPENSSL_ROOT_DIR: ${OPENSSL_ROOT_DIR}")
56
- check_variable_set(OPENSSL_ROOT_DIR)
57
- check_exists(OPENSSL_ROOT_DIR DIRECTORY)
58
-
59
- message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH}")
60
- check_variable_set(CMAKE_PREFIX_PATH)
61
- check_exists(CMAKE_PREFIX_PATH DIRECTORY)
62
-
63
- message(STATUS "BREW_BISON_PREFIX: ${BREW_BISON_PREFIX}")
64
- check_variable_set(BREW_BISON_PREFIX)
65
- check_exists(BREW_BISON_PREFIX DIRECTORY)
66
-
67
- message(STATUS "BREW_FLEX_PREFIX: ${BREW_FLEX_PREFIX}")
68
- check_variable_set(BREW_FLEX_PREFIX)
69
- check_exists(BREW_FLEX_PREFIX DIRECTORY)
70
-
71
- message(STATUS "FLEX_EXECUTABLE: ${FLEX_EXECUTABLE}")
72
- check_variable_set(FLEX_EXECUTABLE)
73
- check_exists(FLEX_EXECUTABLE FILE)
74
-
75
- message(STATUS "BREW_BASH_PREFIX: ${BREW_BASH_PREFIX}")
76
- check_variable_set(BREW_BASH_PREFIX)
77
- check_exists(BREW_BASH_PREFIX DIRECTORY)
78
-
79
- message(STATUS "GNU_BASH: ${GNU_BASH}")
80
- check_variable_set(GNU_BASH)
81
- check_exists(GNU_BASH FILE)