tebako 0.6.6 → 0.7.0

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: 484389b525402e736d81e83df4bc8613128bf5d830d9b2756b033feaaee09fce
4
- data.tar.gz: bc863fa069c014e02f887ebeac297a4036157afdab0ea0a480a406864e6c3769
3
+ metadata.gz: a0c260fa919b77603c20cc5db12e51595c0a0fd0da649dd6f64d2022bebc50dc
4
+ data.tar.gz: 1bd24a7fa0d74fb44b95f0b5f41f736323553725741327b130cfadc36cb45cb6
5
5
  SHA512:
6
- metadata.gz: 84d6926fecec65501e49d2e045b64431dcdef9aa8afa395ce498f0c08bffc7625900d7f2119193849d0a972400e109bab507b62dfef5abab536d32a8c2b51370
7
- data.tar.gz: 7ad876c67e9963eae634f7436f1db236c712bd1652cd7fa69318d160cf7a5254b39d9a6ba4822c5ac2f5783fc8d913dfb9251413d81721a9c251de6072652e02
6
+ metadata.gz: 145fe0a5fe1cb275c21db9e9d4b9092e7c7b342ee43e232d1a6e61a5bc606c62329c9a6a0082843a8b7c017667fda09317c1faa2f3371687e5e64c4a49a176b2
7
+ data.tar.gz: 4708ff850fc763b41d7e1d8e84bee81d4c6a17f1653ac6f697f39e7146fe8acb60ca7922ac1ff7693086fae3f5216d82d83bd1cb97b596c9607769ce022c00f0
data/CMakeLists.txt CHANGED
@@ -235,11 +235,11 @@ endif(DWARFS_PRELOAD)
235
235
  # Filesystem locations
236
236
 
237
237
  # DATA_SRC_DIR folder is used to collect all files that need to be packaged
238
- set(DATA_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/source_filesystem)
238
+ set(DATA_SRC_DIR ${CMAKE_CURRENT_BINARY_DIR}/s)
239
239
  # DATA_PRE_DIR folder is used to build gems that need to be packaged
240
- set(DATA_PRE_DIR ${CMAKE_CURRENT_BINARY_DIR}/prepare_filesystem)
240
+ set(DATA_PRE_DIR ${CMAKE_CURRENT_BINARY_DIR}/r)
241
241
  # DATA_BIN_DIR folder is used to create packaged filesystem
242
- set(DATA_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/packaged_filesystem)
242
+ set(DATA_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/p)
243
243
  # DATA_BIN_FILE is packaged filesystem itself
244
244
  set(DATA_BIN_FILE ${DATA_BIN_DIR}/fs.bin)
245
245
  # Target binary directory
@@ -433,27 +433,31 @@ else (${SETUP_MODE})
433
433
  message("Collecting gem from gemspec ${GEMSPEC} and Gemfile")
434
434
  set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
435
435
  add_custom_target(source_filesystem
436
- COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
437
- COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
438
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
439
- ${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
440
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
441
- ${TBD}/bundle${BAT_SUFFIX} install
442
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
443
- ${TBD}/bundle${BAT_SUFFIX} exec ${TBD}/gem${CMD_SUFFIX} build ${GEMSPEC}
444
- COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
445
- ${TBD}/gem${CMD_SUFFIX} install *.gem --verbose --no-document --install-dir ${TGD}
446
- COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
436
+ COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
437
+ COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
438
+ COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
439
+ ${TBD}/bundle${BAT_SUFFIX} config set --local build.ffi --disable-system-libffi
440
+ COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
441
+ ${TBD}/bundle${BAT_SUFFIX} config set --local build.nokogiri --use-system-libraries
442
+ COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
443
+ ${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
444
+ COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
445
+ ${TBD}/bundle${BAT_SUFFIX} install
446
+ COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
447
+ ${TBD}/bundle${BAT_SUFFIX} exec ${TBD}/gem${CMD_SUFFIX} build ${GEMSPEC}
448
+ COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
449
+ ${TBD}/gem${CMD_SUFFIX} install *.gem --verbose --no-document --install-dir ${TGD}
450
+ COMMAND test -f ${DATA_SRC_DIR}${FS_ENTRY_POINT} ||
447
451
  (${CMAKE_COMMAND} -E echo "Entry point ${DATA_SRC_DIR}${FS_ENTRY_POINT} does not exist" &&
448
452
  ${CMAKE_COMMAND} -E false )
449
- DEPENDS clean_filesystem
453
+ DEPENDS clean_filesystem
450
454
  )
451
455
  else(GFLENGTH GREATER 0)
452
456
  # Found xxx.gemspec but no Gemfile
453
- message("Collecting gem from gemspec ${GEMSPEC}")
454
- set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
455
- message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
456
- add_custom_target(source_filesystem
457
+ message("Collecting gem from gemspec ${GEMSPEC}")
458
+ set(FS_ENTRY_POINT "/bin/${FS_ENTRANCE}")
459
+ message("Target entry point will be at ${FS_MOUNT_POINT}${FS_ENTRY_POINT}")
460
+ add_custom_target(source_filesystem
457
461
  COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
458
462
  COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
459
463
  COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
@@ -479,7 +483,9 @@ else (${SETUP_MODE})
479
483
  COMMAND ${CMAKE_COMMAND} -E make_directory ${TLD}
480
484
  COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${TLD} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
481
485
  COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
482
- ${TBD}/bundle${BAT_SUFFIX} config build.ffi --disable-system-libffi
486
+ ${TBD}/bundle${BAT_SUFFIX} config set --local build.ffi --disable-system-libffi
487
+ COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
488
+ ${TBD}/bundle${BAT_SUFFIX} config set --local build.nokogiri --use-system-libraries
483
489
  COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
484
490
  ${TBD}/bundle${BAT_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
485
491
  COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
@@ -544,22 +550,7 @@ else (${SETUP_MODE})
544
550
  )
545
551
 
546
552
  add_custom_target(packaged_filesystem
547
- # [TODO] Open question - whether we shall delete ruby binaries from memfs or not
548
- # For debugging purposes it is very handy to have it here
549
- #
550
- COMMAND ${CMAKE_COMMAND} -E rm -rf ${DATA_SRC_DIR}/share ${DATA_SRC_DIR}/include ${DATA_SRC_DIR}/lib/pkgconfig
551
- ${DATA_SRC_DIR}/bin/bundle${CMD_SUFFIX} ${DATA_SRC_DIR}/bin/bundle
552
- ${DATA_SRC_DIR}/bin/bundler${CMD_SUFFIX} ${DATA_SRC_DIR}/bin/bundler
553
- ${DATA_SRC_DIR}/bin/bundle${BAT_SUFFIX} ${DATA_SRC_DIR}/bin/bundler${BAT_SUFFIX}
554
- ${DATA_SRC_DIR}/bin/erb${CMD_SUFFIX} ${DATA_SRC_DIR}/bin/gem${CMD_SUFFIX}
555
- ${DATA_SRC_DIR}/bin/irb${CMD_SUFFIX} ${DATA_SRC_DIR}/bin/racc${CMD_SUFFIX}
556
- ${DATA_SRC_DIR}/bin/racc2y${CMD_SUFFIX} ${DATA_SRC_DIR}/bin/rake${BAT_SUFFIX}
557
- ${DATA_SRC_DIR}/bin/rake ${DATA_SRC_DIR}/bin/rdoc${CMD_SUFFIX}
558
- ${DATA_SRC_DIR}/bin/ri${CMD_SUFFIX} ${DATA_SRC_DIR}/bin/y2racc${CMD_SUFFIX}
559
- ${DATA_SRC_DIR}/bin/ruby${EXE_SUFFIX} ${DATA_SRC_DIR}/bin/ruby${RUBY_SUFFIX}${EXE_SUFFIX}
560
-
561
- COMMAND ${GNU_BASH} -c "rm -f ${DATA_SRC_DIR}/**/*.a"
562
- COMMAND ${GNU_BASH} -c "rm -f ${DATA_SRC_DIR}/**/*.o"
553
+ COMMAND ruby ${EXE}/tebako-packager strip ${OSTYPE_TXT} ${DATA_SRC_DIR}
563
554
  COMMAND ${GNU_BASH} -c "chmod +x ${DEPS_BIN_DIR}/mkdwarfs${EXE_SUFFIX}"
564
555
  # No progress below is critical since in reporting mode mkdwarfs tries to work directly with terminal
565
556
  # and it creates issues for stderr redirects (&2 > 1) used by Ninja and our test srcipts
data/README.adoc CHANGED
@@ -46,7 +46,7 @@ The Tebako packager supports the following versions of Ruby for packaging:
46
46
 
47
47
  * 2.7.8 (Linux, MacOS)
48
48
  * 3.0.7 (Linux, MacOS)
49
- * 3.1.4, 3.1.5 (Linux, MacOS, Windows)
49
+ * 3.1.4, 3.1.5, 3.1.6 (Linux, MacOS, Windows)
50
50
  * 3.2.3, 3.2.4 (Linux, MacOS, Windows)
51
51
 
52
52
  Support of specific version including minor release requires some effort, sometimes extensive
@@ -128,10 +128,9 @@ brew install gnu-sed bash pkg-config bison flex binutils libffi gdbm zlib ncurse
128
128
  double-conversion boost jemalloc fmt glog libevent libsodium lz4 xz libyaml openssl@3
129
129
  ----
130
130
 
131
- === Windows (2019, 2022)
131
+ === Windows (workstation 10, 11; Server 2019, 2022)
132
132
 
133
133
  The simplest approach is to use Ruby development environment provided by RubyInstaller, for example Ruby+Devkit 3.1.4-1.
134
-
135
134
  Once it is installed use the following commands:
136
135
 
137
136
  [source,sh]
@@ -142,6 +141,11 @@ Once it is installed use the following commands:
142
141
  fmt glog dlfcn gtest autotools ncurses libyaml
143
142
  ----
144
143
 
144
+ Please note that on Windows tebako may face issues related by CMake path length limitations.
145
+ (https://gitlab.kitware.com/cmake/cmake/-/issues/25936)
146
+ This error may affect not tebako itself but the gems that need to be package and use CMake to build native extensions.
147
+ There is no workaround for this issue as it lloks like is a limitation of the manifest used to build CMake executable.
148
+
145
149
  == Installation
146
150
 
147
151
  === General
@@ -275,7 +279,7 @@ based on ```tebako setup``` output. Building cache based on ```tebako press``` m
275
279
  ----
276
280
  tebako setup \
277
281
  [-p |--prefix=<tebako-root-folder>] \
278
- [-R |--Ruby=<2.7.8|3.0.7|3.1.4|3.1.5|3.2.3|3.2.4>]
282
+ [-R |--Ruby=<2.7.8|3.0.7|3.1.4|3.1.5|3.1.6|3.2.3|3.2.4>]
279
283
  ----
280
284
 
281
285
  Where:
@@ -283,7 +287,7 @@ Where:
283
287
  * `<tebako-root-folder>`, the Tebako setup folder (optional, defaults to current
284
288
  folder)
285
289
 
286
- * `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.1.5)
290
+ * `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.1.6)
287
291
 
288
292
  ==== Clean
289
293
 
data/common.env CHANGED
@@ -2,4 +2,4 @@ BUILD_TYPE=Release
2
2
  DEPS=deps
3
3
  INCBIN_TAG=348e36b
4
4
  DWARFS_WR_TAG=v0.5.2
5
- RUBY_VER=3.1.5
5
+ RUBY_VER=3.1.6
data/exe/tebako-packager CHANGED
@@ -27,6 +27,7 @@
27
27
  # POSSIBILITY OF SUCH DAMAGE.
28
28
 
29
29
  require_relative "../lib/tebako/packager"
30
+ require_relative "../lib/tebako/stripper"
30
31
 
31
32
  begin
32
33
  unless ARGV.length.positive?
@@ -57,6 +58,16 @@ begin
57
58
  end
58
59
 
59
60
  Tebako::Packager.stash(ARGV[1], ARGV[2])
61
+ when "strip"
62
+ # ARGV[0] -- command
63
+ # ARGV[1] -- OSTYPE
64
+ # ARGV[2] -- DATA_SRC_DIR
65
+ unless ARGV.length == 3
66
+ raise Tebako::Error,
67
+ "tebako-packager strip command expects 3 arguments, #{ARGV.length} has been provided."
68
+ end
69
+
70
+ Tebako::Stripper.strip(ARGV[1], ARGV[2])
60
71
  when "pass1a"
61
72
  # ARGV[0] -- command
62
73
  # ARGV[1] -- RUBY_SOURCE_DIR
@@ -99,7 +99,7 @@ module Tebako
99
99
  # rubocop:enable Metrics/MethodLength
100
100
 
101
101
  def output
102
- @output ||= File.join(prefix, "output")
102
+ @output ||= File.join(prefix, "o")
103
103
  end
104
104
 
105
105
  def package
@@ -42,11 +42,13 @@ module Tebako
42
42
  "3.0.7" => "2a3411977f2850431136b0fab8ad53af09fb74df2ee2f4fb7f11b378fe034388",
43
43
  "3.1.4" => "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6",
44
44
  "3.1.5" => "3685c51eeee1352c31ea039706d71976f53d00ab6d77312de6aa1abaf5cda2c5",
45
+ "3.1.6" => "0d0dafb859e76763432571a3109d1537d976266be3083445651dc68deed25c22",
45
46
  "3.2.3" => "af7f1757d9ddb630345988139211f1fd570ff5ba830def1cc7c468ae9b65c9ba",
46
47
  "3.2.4" => "c72b3c5c30482dca18b0f868c9075f3f47d8168eaf626d4e682ce5b59c858692"
48
+ # "3.3.3" => "83c05b2177ee9c335b631b29b8c077b4770166d02fa527f3a9f6a40d13f3cce2"
47
49
  }.freeze
48
50
 
49
- DEFAULT_RUBY_VERSION = "3.1.5"
51
+ DEFAULT_RUBY_VERSION = "3.1.6"
50
52
 
51
53
  def version_check(version)
52
54
  return if RUBY_VERSIONS.key?(version)
@@ -58,7 +58,7 @@ module Tebako
58
58
 
59
59
  def get_dir_c_patch(ostype)
60
60
  pattern = PatchHelpers.msys?(ostype) ? "/* define system APIs */" : "#ifdef HAVE_GETATTRLIST"
61
- dir_c_patch = PatchHelpers.patch_c_file(pattern)
61
+ dir_c_patch = PatchHelpers.patch_c_file_pre(pattern)
62
62
  dir_c_patch.merge!(DIR_C_BASE_PATCH)
63
63
  dir_c_patch
64
64
  end
@@ -85,11 +85,19 @@ module Tebako
85
85
  end
86
86
 
87
87
  def get_io_c_patch(ostype, ruby_ver)
88
- io_c_patch = PatchHelpers.patch_c_file("/* define system APIs */")
88
+ io_c_patch = PatchHelpers.patch_c_file_pre("/* define system APIs */")
89
89
  io_c_patch.merge!(get_io_c_msys_patch(ruby_ver)) if PatchHelpers.msys?(ostype)
90
90
  io_c_patch
91
91
  end
92
92
 
93
+ def get_util_c_patch(ruby_ver)
94
+ if PatchHelpers.ruby316?(ruby_ver)
95
+ PatchHelpers.patch_c_file_post("#endif /* !HAVE_GNU_QSORT_R */")
96
+ else
97
+ PatchHelpers.patch_c_file_pre("#ifndef S_ISDIR")
98
+ end
99
+ end
100
+
93
101
  def get_msys_mkconfig_rb_patches(ruby_ver)
94
102
  {
95
103
  " if fast[name]" => TOOLS_MKCONFIG_RB_SUBST,
@@ -117,8 +125,8 @@ module Tebako
117
125
  "tool/mkconfig.rb" => mcrb_subst,
118
126
  "dir.c" => get_dir_c_patch(ostype), "dln.c" => get_dln_c_patch(ostype, ruby_ver),
119
127
  "io.c" => get_io_c_patch(ostype, ruby_ver), "main.c" => MAIN_C_PATCH,
120
- "file.c" => PatchHelpers.patch_c_file("/* define system APIs */"),
121
- "util.c" => PatchHelpers.patch_c_file("#ifndef S_ISDIR")
128
+ "file.c" => PatchHelpers.patch_c_file_pre("/* define system APIs */"),
129
+ "util.c" => get_util_c_patch(ruby_ver)
122
130
  }
123
131
  end
124
132
 
@@ -66,12 +66,18 @@ module Tebako
66
66
  ostype =~ /msys|cygwin|mingw/
67
67
  end
68
68
 
69
- def patch_c_file(pattern)
69
+ def patch_c_file_pre(pattern)
70
70
  {
71
71
  pattern => "#{PatchLiterals::C_FILE_SUBST}\n#{pattern}"
72
72
  }
73
73
  end
74
74
 
75
+ def patch_c_file_post(pattern)
76
+ {
77
+ pattern => "#{pattern}\n\n#{PatchLiterals::C_FILE_SUBST}"
78
+ }
79
+ end
80
+
75
81
  def recreate(dirname)
76
82
  FileUtils.rm_rf(dirname, noop: nil, verbose: nil, secure: true)
77
83
  FileUtils.mkdir(dirname)
@@ -102,12 +108,16 @@ module Tebako
102
108
  ruby3x?(ruby_ver) && ruby_ver[2].to_i >= 1
103
109
  end
104
110
 
111
+ def ruby316?(ruby_ver)
112
+ ruby3x?(ruby_ver) && ruby_ver[2] == "1" && ruby_ver[4].to_i >= 6
113
+ end
114
+
105
115
  def ruby32?(ruby_ver)
106
116
  ruby3x?(ruby_ver) && ruby_ver[2].to_i >= 2
107
117
  end
108
118
 
109
119
  def ruby32only?(ruby_ver)
110
- ruby3x?(ruby_ver) && ruby_ver[2].to_i == 2
120
+ ruby3x?(ruby_ver) && ruby_ver[2] == "2"
111
121
  end
112
122
 
113
123
  def ruby33?(ruby_ver)
@@ -74,11 +74,8 @@ module Tebako
74
74
  class << self
75
75
  # Create implib
76
76
  def create_implib(src_dir, package_src_dir, app_name, ruby_ver)
77
+ create_def(src_dir, app_name)
77
78
  puts " ... creating Windows import library"
78
- File.open(def_fname(src_dir, app_name), "w") do |file|
79
- file.puts "LIBRARY #{out_fname(app_name)}"
80
- file.puts File.read(File.join(src_dir, "tebako.def"))
81
- end
82
79
  params = ["dlltool", "-d", def_fname(src_dir, app_name), "-D", out_fname(app_name),
83
80
  "--output-lib", lib_fname(package_src_dir, ruby_ver)]
84
81
  out, st = Open3.capture2e(*params)
@@ -155,6 +152,16 @@ module Tebako
155
152
 
156
153
  private
157
154
 
155
+ def create_def(src_dir, app_name)
156
+ puts " ... creating Windows def file"
157
+ File.open(def_fname(src_dir, app_name), "w") do |file|
158
+ file.puts "LIBRARY #{out_fname(app_name)}"
159
+ File.readlines(File.join(src_dir, "tebako.def")).each do |line|
160
+ file.puts line unless line.include?("DllMain")
161
+ end
162
+ end
163
+ end
164
+
158
165
  def def_fname(src_dir, app_name)
159
166
  File.join(src_dir, "#{app_name}.def")
160
167
  end
@@ -0,0 +1,94 @@
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
+ # Tebako - an executable packager
32
+ module Tebako
33
+ # Tebako packaging support (stripper)
34
+ module Stripper
35
+ DELETE_EXTENSIONS = %w[o lo obj a lib].freeze
36
+ STRIP_EXTENSIONS = %w[dll so].freeze
37
+ BIN_FILES = %w[
38
+ bundle bundler rbs erb gem irb racc racc2y rake rdoc ri y2racc rdbg typeprof
39
+ ].freeze
40
+ CMD_SUFFIX = ".cmd"
41
+ BAT_SUFFIX = ".bat"
42
+
43
+ class << self
44
+ # Strip
45
+ # Removes build artefacts, strip shared objects
46
+ # [TODO] We probably need debug option/flag to say whether we shall delete ruby binaries
47
+ # from memfs or not. For debugging purposes it is very handy to have it here
48
+ def strip(ostype, src_dir)
49
+ puts " ... stripping the output"
50
+ strip_bs(ostype, src_dir)
51
+ strip_fi(ostype, src_dir)
52
+ strip_li(ostype, src_dir)
53
+ end
54
+
55
+ private
56
+
57
+ def get_files(ostype)
58
+ exe_suffix = ostype =~ /msys/ ? ".exe" : ""
59
+ files = BIN_FILES.flat_map do |f|
60
+ [f, "#{f}#{CMD_SUFFIX}", "#{f}#{BAT_SUFFIX}"]
61
+ end
62
+
63
+ files += ["ruby#{exe_suffix}", "rubyw#{exe_suffix}"]
64
+ files
65
+ end
66
+
67
+ def strip_bs(_ostype, src_dir)
68
+ FileUtils.rm_rf([
69
+ File.join(src_dir, "share"),
70
+ File.join(src_dir, "include"),
71
+ File.join(src_dir, "lib", "pkgconfig")
72
+ ])
73
+ end
74
+
75
+ def strip_fi(ostype, src_dir)
76
+ files = get_files(ostype).map { |f| "#{src_dir}/bin/#{f}" }
77
+ FileUtils.rm(files, force: true)
78
+ end
79
+
80
+ def strip_li(ostype, src_dir)
81
+ Find.find(src_dir) do |file|
82
+ next if File.directory?(file)
83
+
84
+ extension = File.extname(file).delete_prefix(".").downcase
85
+ if DELETE_EXTENSIONS.include?(extension)
86
+ FileUtils.rm(file)
87
+ elsif STRIP_EXTENSIONS.include?(extension)
88
+ system("strip \"#{file}\"") unless ostype =~ /darwin/
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+ end
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.6.6"
29
+ VERSION = "0.7.0"
30
30
  end
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.6.6
1
+ 0.7.0
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.6.6
4
+ version: 0.7.0
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-06-03 00:00:00.000000000 Z
11
+ date: 2024-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -75,6 +75,7 @@ files:
75
75
  - lib/tebako/packager/patch_helpers.rb
76
76
  - lib/tebako/packager/patch_libraries.rb
77
77
  - lib/tebako/packager/patch_literals.rb
78
+ - lib/tebako/stripper.rb
78
79
  - lib/tebako/version.rb
79
80
  - resources/tebako-fs.cpp.in
80
81
  - resources/tebako-version.h.in
@@ -136,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
137
  - !ruby/object:Gem::Version
137
138
  version: '0'
138
139
  requirements: []
139
- rubygems_version: 3.5.9
140
+ rubygems_version: 3.5.11
140
141
  signing_key:
141
142
  specification_version: 4
142
143
  summary: Packager for Ruby executables