tebako 0.7.3 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,12 +28,13 @@
28
28
  require "fileutils"
29
29
  require "find"
30
30
 
31
+ require_relative "packager/patch_helpers"
32
+
31
33
  # Tebako - an executable packager
32
34
  module Tebako
33
35
  # Tebako packaging support (stripper)
34
36
  module Stripper
35
- DELETE_EXTENSIONS = %w[o lo obj a lib].freeze
36
- STRIP_EXTENSIONS = %w[dll so].freeze
37
+ DELETE_EXTENSIONS = %w[o lo obj a la lib].freeze
37
38
  BIN_FILES = %w[
38
39
  bundle bundler rbs erb gem irb racc racc2y rake rdoc ri y2racc rdbg typeprof
39
40
  ].freeze
@@ -47,15 +48,29 @@ module Tebako
47
48
  # from memfs or not. For debugging purposes it is very handy to have it here
48
49
  def strip(ostype, src_dir)
49
50
  puts " ... stripping the output"
50
- strip_bs(ostype, src_dir)
51
+ strip_bs(src_dir)
51
52
  strip_fi(ostype, src_dir)
52
53
  strip_li(ostype, src_dir)
53
54
  end
54
55
 
56
+ def strip_file(file_in, file_out = nil)
57
+ params = ["strip", "-S", file_in]
58
+ params << "-o" << file_out unless file_out.nil?
59
+ out, st = Open3.capture2e(*params)
60
+
61
+ # Some gems (well, libmspack) has bundled extensions for several architectures)
62
+ # Getting something like:
63
+ # strip: Unable to recognise the format of the input file
64
+ # `/tmp/cirrus-ci-build/o/s/lib/ruby/gems/3.1.0/gems/libmspack-0.11.0/ext/x86_64-linux/libmspack.so'
65
+ # on aarch64
66
+
67
+ puts "Warning: could not strip #{file_in}:\n #{out}" unless st.exitstatus.zero?
68
+ end
69
+
55
70
  private
56
71
 
57
72
  def get_files(ostype)
58
- exe_suffix = ostype =~ /msys/ ? ".exe" : ""
73
+ exe_suffix = Packager::PatchHelpers.exe_suffix(ostype)
59
74
  files = BIN_FILES.flat_map do |f|
60
75
  [f, "#{f}#{CMD_SUFFIX}", "#{f}#{BAT_SUFFIX}"]
61
76
  end
@@ -64,7 +79,7 @@ module Tebako
64
79
  files
65
80
  end
66
81
 
67
- def strip_bs(_ostype, src_dir)
82
+ def strip_bs(src_dir)
68
83
  FileUtils.rm_rf([
69
84
  File.join(src_dir, "share"),
70
85
  File.join(src_dir, "include"),
@@ -78,17 +93,25 @@ module Tebako
78
93
  end
79
94
 
80
95
  def strip_li(ostype, src_dir)
96
+ sext = strip_extensions(ostype)
81
97
  Find.find(src_dir) do |file|
82
98
  next if File.directory?(file)
83
99
 
84
100
  extension = File.extname(file).delete_prefix(".").downcase
85
101
  if DELETE_EXTENSIONS.include?(extension)
86
102
  FileUtils.rm(file)
87
- elsif STRIP_EXTENSIONS.include?(extension)
88
- system("strip \"#{file}\"") unless ostype =~ /darwin/
103
+ elsif sext.include?(extension) # && !Packager::PatchHelpers.msys?(ostype)
104
+ strip_file(file)
89
105
  end
90
106
  end
91
107
  end
108
+
109
+ def strip_extensions(ostype)
110
+ sext = ["so"]
111
+ sext << "dll" if Packager::PatchHelpers.msys?(ostype)
112
+ sext << "dylib" << "bundle" if Packager::PatchHelpers.macos?(ostype)
113
+ sext
114
+ end
92
115
  end
93
116
  end
94
117
  end
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.7.3"
29
+ VERSION = "0.8.0"
30
30
  end
data/src/tebako-main.cpp CHANGED
@@ -156,3 +156,10 @@ extern "C" const char* tebako_mount_point(void) {
156
156
  extern "C" int tebako_is_running_miniruby(void) {
157
157
  return running_miniruby;
158
158
  }
159
+
160
+ #ifdef RB_W32_PRE_33
161
+ extern "C" ssize_t rb_w32_pread(int /* fd */, void* /* buf */, size_t /* size */, size_t /* offset */)
162
+ {
163
+ return -1;
164
+ }
165
+ #endif
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.8.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.7.3
4
+ version: 0.8.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-07-20 00:00:00.000000000 Z
11
+ date: 2024-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor