tebako 0.7.4 → 0.8.1

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.
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.5.4
4
+ DWARFS_WR_TAG=v0.5.7
5
5
  RUBY_VER=3.1.6
@@ -40,12 +40,10 @@ module Tebako
40
40
  RUBY_VERSIONS = {
41
41
  "2.7.8" => "c2dab63cbc8f2a05526108ad419efa63a67ed4074dbbcf9fc2b1ca664cb45ba0",
42
42
  "3.0.7" => "2a3411977f2850431136b0fab8ad53af09fb74df2ee2f4fb7f11b378fe034388",
43
- "3.1.4" => "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6",
44
- "3.1.5" => "3685c51eeee1352c31ea039706d71976f53d00ab6d77312de6aa1abaf5cda2c5",
45
43
  "3.1.6" => "0d0dafb859e76763432571a3109d1537d976266be3083445651dc68deed25c22",
46
- "3.2.3" => "af7f1757d9ddb630345988139211f1fd570ff5ba830def1cc7c468ae9b65c9ba",
47
- "3.2.4" => "c72b3c5c30482dca18b0f868c9075f3f47d8168eaf626d4e682ce5b59c858692"
48
- # "3.3.3" => "83c05b2177ee9c335b631b29b8c077b4770166d02fa527f3a9f6a40d13f3cce2"
44
+ "3.2.4" => "c72b3c5c30482dca18b0f868c9075f3f47d8168eaf626d4e682ce5b59c858692",
45
+ "3.3.3" => "83c05b2177ee9c335b631b29b8c077b4770166d02fa527f3a9f6a40d13f3cce2",
46
+ "3.3.4" => "fe6a30f97d54e029768f2ddf4923699c416cdbc3a6e96db3e2d5716c7db96a34"
49
47
  }.freeze
50
48
 
51
49
  DEFAULT_RUBY_VERSION = "3.1.6"
@@ -88,9 +88,23 @@ module Tebako
88
88
  SUBST
89
89
  }.freeze
90
90
 
91
- # DARWIN_CONFIGURE_PATCH = {
92
- # "EXTDLDFLAGS=\"-bundle_loader '\\$(BUILTRUBY)'\"" => ""
93
- # }.freeze
91
+ # The logic for statically linked extensions is broken entirely in the latest Ruby versions.
92
+ # The code below looks reasonble - we do not set -bundle_loader when building with -with-static-ext option
93
+ # However Gems bundled with Ruby just ignore with-static-ext option and build extensions as shared libraries
94
+ # So the -bundler_loader option is required for them to link.
95
+ # It is strange that it is disabled in any case because this option does not create any issues for static
96
+ # libraries.
97
+ # ---------------------------------------------------
98
+ # elif test "x$EXTSTATIC" = x
99
+ # then :
100
+ #
101
+ # # When building exts as bundles, a mach-o bundle needs to know its loader
102
+ # # program to bind symbols from the ruby executable
103
+ # EXTDLDFLAGS="-bundle_loader '\$(BUILTRUBY)'"
104
+
105
+ DARWIN_CONFIGURE_PATCH = {
106
+ "elif test \"x$EXTSTATIC\" = x" => "elif true"
107
+ }.freeze
94
108
 
95
109
  OPENSSL_EXTCONF_RB_SUBST = <<~SUBST
96
110
  # Start of tebako patch
@@ -137,11 +151,7 @@ module Tebako
137
151
  patch_map = get_base_patch_map(mount_point)
138
152
 
139
153
  # ....................................................
140
- # Fixing (bypassing) configure script bug where a variable is used before initialization
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/
154
+ patch_map.store("configure", DARWIN_CONFIGURE_PATCH) if ostype =~ /darwin/
145
155
 
146
156
  # ....................................................
147
157
  # autoload :OpenSSL, "openssl"
@@ -178,13 +188,16 @@ module Tebako
178
188
  "$(WINMAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(LIBS) -o $@ # tebako patched",
179
189
 
180
190
  "--output-exp=$(RUBY_EXP) \\" =>
181
- "--output-exp=$(RUBY_EXP) --output-lib=$(LIBRUBY) --output-def=tebako.def \\",
191
+ "--output-exp=$(RUBY_EXP) --output-lib=$(LIBRUBY) --output-def=tebako.def \\",
192
+
193
+ "--export-all $(LIBRUBY_A) $(LIBS) -o $(PROGRAM)" =>
194
+ "--export-all $(LIBRUBY_A) $(LIBS) -o program-stub.exe # tebako patched",
182
195
 
183
- " @rm -f $(PROGRAM)" =>
184
- "# tebako patched @rm -f $(PROGRAM)",
196
+ "@rm -f $(PROGRAM)" =>
197
+ "@rm -f program-stub.exe # tebako patched",
185
198
 
186
199
  " $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)" =>
187
- "# tebako patched $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)",
200
+ "# tebako patched $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) dmyext.o $(SOLIBS) -o $(PROGRAM)",
188
201
 
189
202
  "RUBYDEF = $(DLL_BASE_NAME).def" => GNUMAKEFILE_IN_WINMAIN_SUBST
190
203
  }
@@ -38,23 +38,26 @@ module Tebako
38
38
  class << self
39
39
  def get_patch_map(ostype, deps_lib_dir, ruby_ver)
40
40
  patch_map = get_patch_map_base(ostype, deps_lib_dir, ruby_ver)
41
-
42
41
  patch_map.store("thread_pthread.c", LINUX_MUSL_THREAD_PTHREAD_PATCH) if ostype =~ /linux-musl/
43
-
44
42
  if PatchHelpers.msys?(ostype)
45
43
  patch_map.merge!(get_msys_patches(ruby_ver))
46
44
  elsif PatchHelpers.ruby3x?(ruby_ver)
47
- # [TODO] Do we really need it for platforms other then Windows ??
48
45
  patch_map.store("common.mk", COMMON_MK_PATCH)
49
46
  end
50
-
51
- patch_map
47
+ extend_patch_map_r33(patch_map, ostype, deps_lib_dir, ruby_ver)
52
48
  end
53
49
 
54
50
  private
55
51
 
56
52
  include Tebako::Packager::PatchBuildsystem
57
53
  include Tebako::Packager::PatchLiterals
54
+ def extend_patch_map_r33(patch_map, ostype, deps_lib_dir, ruby_ver)
55
+ if PatchHelpers.ruby33?(ruby_ver) || PatchHelpers.msys?(ostype)
56
+ patch_map.store("config.status",
57
+ get_config_status_patch(ostype, deps_lib_dir, ruby_ver))
58
+ end
59
+ patch_map
60
+ end
58
61
 
59
62
  def get_dir_c_patch(ostype)
60
63
  pattern = PatchHelpers.msys?(ostype) ? "/* define system APIs */" : "#ifdef HAVE_GETATTRLIST"
@@ -91,21 +94,17 @@ module Tebako
91
94
  end
92
95
 
93
96
  def get_util_c_patch(ruby_ver)
94
- if PatchHelpers.ruby316?(ruby_ver)
97
+ if PatchHelpers.ruby31?(ruby_ver)
95
98
  PatchHelpers.patch_c_file_post("#endif /* !HAVE_GNU_QSORT_R */")
96
99
  else
97
100
  PatchHelpers.patch_c_file_pre("#ifndef S_ISDIR")
98
101
  end
99
102
  end
100
103
 
101
- def get_msys_mkconfig_rb_patches(ruby_ver)
104
+ def get_tool_mkconfig_rb_patch(ostype)
105
+ subst = PatchHelpers.msys?(ostype) ? TOOL_MKCONFIG_RB_SUBST_MSYS : TOOL_MKCONFIG_RB_SUBST
102
106
  {
103
- " if fast[name]" => TOOLS_MKCONFIG_RB_SUBST,
104
- "when /RUBYGEMS/; next" =>
105
- "when /RUBYGEMS/; next\n\n" \
106
- "# Start of tebako patch\n" \
107
- "when /MAINLIBS/; val = #{PatchLibraries.msys_base_libs(ruby_ver)}\n" \
108
- "# End of tebako patch"
107
+ " if fast[name]" => subst
109
108
  }
110
109
  end
111
110
 
@@ -119,10 +118,9 @@ module Tebako
119
118
  end
120
119
 
121
120
  def get_patch_map_base(ostype, deps_lib_dir, ruby_ver)
122
- mcrb_subst = PatchHelpers.msys?(ostype) ? get_msys_mkconfig_rb_patches(ruby_ver) : TOOL_MKCONFIG_RB_PATCH
123
121
  {
124
122
  "template/Makefile.in" => template_makefile_in_patch(ostype, deps_lib_dir, ruby_ver),
125
- "tool/mkconfig.rb" => mcrb_subst,
123
+ "tool/mkconfig.rb" => get_tool_mkconfig_rb_patch(ostype),
126
124
  "dir.c" => get_dir_c_patch(ostype), "dln.c" => get_dln_c_patch(ostype, ruby_ver),
127
125
  "io.c" => get_io_c_patch(ostype, ruby_ver), "main.c" => MAIN_C_PATCH,
128
126
  "file.c" => PatchHelpers.patch_c_file_pre("/* define system APIs */"),
@@ -135,7 +133,7 @@ module Tebako
135
133
  {
136
134
  "MAINLIBS = #{yjit_libs}@MAINLIBS@" =>
137
135
  "# -- Start of tebako patch -- \n" \
138
- "MAINLIBS = #{yjit_libs}#{PatchLibraries.mlibs(ostype, deps_lib_dir, ruby_ver)}" \
136
+ "MAINLIBS = #{yjit_libs}#{PatchLibraries.mlibs(ostype, deps_lib_dir, ruby_ver, true)}\n" \
139
137
  "# -- End of tebako patch -- \n"
140
138
  }
141
139
  end
@@ -57,10 +57,14 @@ module Tebako
57
57
  "$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
58
58
  "# -- End of tebako patch --"
59
59
 
60
- TEMPLATE_MAKEFILE_IN_BASE_PATTERN =
60
+ TEMPLATE_MAKEFILE_IN_BASE_PATTERN_PRE_3_3 =
61
61
  "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) " \
62
62
  "$(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@"
63
63
 
64
+ TEMPLATE_MAKEFILE_IN_BASE_PATTERN =
65
+ "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) " \
66
+ "$(LIBRUBYARG) $(MAINLIBS) $(EXTLIBS) $(OUTFLAG)$@"
67
+
64
68
  TEMPLATE_MAKEFILE_IN_BASE_PATCH =
65
69
  "# -- Start of tebako patch --\n" \
66
70
  "\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(MAINOBJ) " \
@@ -73,13 +77,23 @@ module Tebako
73
77
  "$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
74
78
  "# -- End of tebako patch --"
75
79
 
76
- def template_makefile_in_patch_two(ostype, ruby_ver)
80
+ def template_makefile_in_subst(ostype, ruby_ver)
77
81
  if PatchHelpers.msys?(ostype)
78
- { TEMPLATE_MAKEFILE_IN_BASE_PATTERN => TEMPLATE_MAKEFILE_IN_BASE_PATCH_MSYS }
79
- elsif PatchHelpers.ruby31?(ruby_ver)
80
- { TEMPLATE_MAKEFILE_IN_BASE_PATTERN => TEMPLATE_MAKEFILE_IN_BASE_PATCH }
82
+ TEMPLATE_MAKEFILE_IN_BASE_PATCH_MSYS
83
+ elsif !PatchHelpers.ruby31?(ruby_ver)
84
+ TEMPLATE_MAKEFILE_IN_BASE_PATCH_PRE_3_1
85
+ else
86
+ TEMPLATE_MAKEFILE_IN_BASE_PATCH
87
+ end
88
+ end
89
+
90
+ def template_makefile_in_patch_two(ostype, ruby_ver)
91
+ if !PatchHelpers.ruby31?(ruby_ver)
92
+ { TEMPLATE_MAKEFILE_IN_BASE_PATTERN_PRE_3_1 => template_makefile_in_subst(ostype, ruby_ver) }
93
+ elsif !PatchHelpers.ruby33?(ruby_ver)
94
+ { TEMPLATE_MAKEFILE_IN_BASE_PATTERN_PRE_3_3 => template_makefile_in_subst(ostype, ruby_ver) }
81
95
  else
82
- { TEMPLATE_MAKEFILE_IN_BASE_PATTERN_PRE_3_1 => TEMPLATE_MAKEFILE_IN_BASE_PATCH_PRE_3_1 }
96
+ { TEMPLATE_MAKEFILE_IN_BASE_PATTERN => template_makefile_in_subst(ostype, ruby_ver) }
83
97
  end
84
98
  end
85
99
 
@@ -94,10 +108,30 @@ module Tebako
94
108
  # End of tebako patch
95
109
  SUBST
96
110
 
111
+ def get_config_status_pattern(ostype)
112
+ case ostype
113
+ when /linux-/
114
+ "S[\"MAINLIBS\"]=\"-lz -lrt -lrt -ldl -lcrypt -lm -lpthread \""
115
+ when /darwin/
116
+ "S[\"MAINLIBS\"]=\"-ldl -lobjc -lpthread \""
117
+ when /msys/
118
+ "S[\"MAINLIBS\"]=\"-lshell32 -lws2_32 -liphlpapi -limagehlp -lshlwapi -lbcrypt \""
119
+ else
120
+ raise Tebako::Error, "Unknown ostype #{ostype}"
121
+ end
122
+ end
123
+
124
+ def get_config_status_patch(ostype, deps_lib_dir, ruby_ver)
125
+ {
126
+ get_config_status_pattern(ostype) =>
127
+ "S[\"MAINLIBS\"]=\"#{PatchLibraries.mlibs(ostype, deps_lib_dir, ruby_ver, false)}\""
128
+ }
129
+ end
130
+
97
131
  # Other MSYS (GNUMakefile) specific patches
98
132
  # - The same issue with libraries as for Makefile above
99
133
  # - 'Kill' ruby.exp regeneration on pass2
100
- # since we want to use outpu from pass1 for implib generation
134
+ # since we want to use output from pass1 for implib generation
101
135
  # [VERY UGLY HACK]
102
136
  # - Introduce LIBRUBY dependency on static extensions
103
137
  # This is an addition to COMMON_MK_PATCH specified above
@@ -116,10 +116,6 @@ module Tebako
116
116
  ruby3x?(ruby_ver) && ruby_ver[2].to_i >= 1
117
117
  end
118
118
 
119
- def ruby316?(ruby_ver)
120
- ruby3x?(ruby_ver) && ruby_ver[2] == "1" && ruby_ver[4].to_i >= 6
121
- end
122
-
123
119
  def ruby32?(ruby_ver)
124
120
  ruby3x?(ruby_ver) && ruby_ver[2].to_i >= 2
125
121
  end
@@ -34,37 +34,104 @@ module Tebako
34
34
  module PatchLibraries
35
35
  class << self
36
36
  # rubocop:disable Style/WordArray
37
-
38
- # NOTE: folly provides build-in implementation of jemalloc
39
-
40
37
  DARWIN_BREW_LIBS = [
41
- ["zlib", "z"], ["gdbm", "gdbm"], ["readline", "readline"], ["libffi", "ffi"],
42
- ["ncurses", "ncurses"], ["fmt", "fmt"], ["lz4", "lz4"], ["xz", "lzma"],
43
- ["libyaml", "yaml"], ["boost", "boost_chrono"], ["double-conversion", "double-conversion"]
38
+ ["zlib", "z"], ["gdbm", "gdbm"], ["readline", "readline"], ["libffi", "ffi"],
39
+ ["ncurses", "ncurses"], ["fmt", "fmt"], ["lz4", "lz4"], ["xz", "lzma"],
40
+ ["libyaml", "yaml"], ["boost", "boost_chrono"], ["double-conversion", "double-conversion"]
44
41
  ].freeze
45
42
 
46
43
  DARWIN_BREW_LIBS_PRE_31 = [["openssl@1.1", "ssl"], ["openssl@1.1", "crypto"]].freeze
47
44
 
48
45
  DARWIN_BREW_LIBS_31 = [["openssl@3", "ssl"], ["openssl@3", "crypto"]].freeze
49
46
 
50
- DARWIN_DEP_LIBS = ["glog", "gflags", "brotlienc", "brotlidec", "brotlicommon"].freeze
47
+ DARWIN_DEP_LIBS_1 = ["folly", "fsst", "metadata_thrift", "thrift_light", "xxhash", "zstd"].freeze
48
+ DARWIN_DEP_LIBS_2 = ["glog", "gflags", "brotlienc", "brotlidec", "brotlicommon"].freeze
51
49
  # rubocop:enable Style/WordArray
52
50
 
51
+ COMMON_LINUX_LIBRARIES = [
52
+ "-l:libdwarfs-wr.a", "-l:libtebako-fs.a", "-l:libdwarfs.a", "LIBCOMPRESSION",
53
+ "-l:libfolly.a", "-l:libfsst.a", "-l:libmetadata_thrift.a", "-l:libthrift_light.a",
54
+ "-l:libxxhash.a", "-l:libfmt.a", "-l:libdouble-conversion.a", "-l:libglog.a",
55
+ "-l:libgflags.a", "-l:libevent.a"
56
+ ].freeze
57
+
58
+ COMMON_ARCHIEVE_LIBRARIES = [
59
+ "-l:libarchive.a", "-l:liblz4.a", "-l:libz.a", "-l:libzstd.a",
60
+ "-l:libbrotlienc.a", "-l:libbrotlidec.a", "-l:libbrotlicommon.a", "-l:liblzma.a"
61
+ ].freeze
62
+
63
+ LINUX_GNU_LIBRARIES = [
64
+ "-l:libiberty.a", "-l:libacl.a", "-l:libssl.a", "-l:libcrypto.a",
65
+ "-l:libgdbm.a", "-l:libreadline.a", "-l:libtinfo.a", "-l:libffi.a",
66
+ "-l:libncurses.a", "-l:libjemalloc.a", "-l:libcrypt.a", "-l:libanl.a",
67
+ "LIBYAML", "-l:libboost_system.a", "-l:libboost_chrono.a", "-l:libutil.a",
68
+ "-l:libstdc++.a", "-lgcc_eh", "-l:libunwind.a", "-l:liblzma.a",
69
+ "-l:librt.a", "-ldl", "-lpthread", "-lm"
70
+ ].freeze
71
+
72
+ LINUX_MUSL_LIBRARIES = [
73
+ "-l:libiberty.a", "-l:libacl.a", "-l:libssl.a", "-l:libcrypto.a",
74
+ "-l:libreadline.a", "-l:libgdbm.a", "-l:libffi.a", "-l:libncurses.a",
75
+ "-l:libjemalloc.a", "-l:libcrypt.a", "LIBYAML", "-l:libboost_system.a",
76
+ "-l:libboost_chrono.a", "-l:librt.a", "-l:libstdc++.a", "-lgcc_eh",
77
+ " -l:libunwind.a", "-l:liblzma.a", "-ldl", "-lpthread"
78
+ ].freeze
79
+
80
+ MSYS_LIBRARIES = [
81
+ "-l:liblz4.a", "-l:libz.a", "-l:libzstd.a", "-l:liblzma.a",
82
+ "-l:libncurses.a", "-l:libunwind.a", "-l:liblzma.a", "-l:libiberty.a",
83
+ "LIBYAML", "-l:libffi.a", "-l:libboost_system-mt.a", "-l:libboost_chrono-mt.a",
84
+ "-l:libstdc++.a", "-l:libdl.a", "-static-libgcc", "-static-libstdc++",
85
+ "-l:libssl.a", "-l:libcrypto.a", "-l:libz.a", "-l:libwinpthread.a",
86
+ "-lcrypt32", "-lshlwapi", "-lwsock32", "-liphlpapi",
87
+ "-limagehlp", "-lbcrypt", "-lole32", "-loleaut32",
88
+ "-luuid", "-lws2_32"
89
+ ].freeze
90
+
91
+ def linux_gnu_libraries(ruby_ver, with_compression)
92
+ libraries = COMMON_LINUX_LIBRARIES + COMMON_ARCHIEVE_LIBRARIES + LINUX_GNU_LIBRARIES
93
+ linux_libraries(libraries, ruby_ver, with_compression)
94
+ end
95
+
96
+ def linux_musl_libraries(ruby_ver, with_compression)
97
+ libraries = COMMON_LINUX_LIBRARIES + COMMON_ARCHIEVE_LIBRARIES + LINUX_MUSL_LIBRARIES
98
+ linux_libraries(libraries, ruby_ver, with_compression)
99
+ end
100
+
101
+ def linux_libraries(libraries, ruby_ver, with_compression)
102
+ libraries.map! do |lib|
103
+ if lib == "LIBYAML"
104
+ PatchHelpers.yaml_reference(ruby_ver)
105
+ elsif lib == "LIBCOMPRESSION"
106
+ with_compression ? "-Wl,--push-state,--whole-archive -l:libdwarfs_compression.a -Wl,--pop-state" : ""
107
+ else
108
+ lib
109
+ end
110
+ end
111
+ libraries.join(" ")
112
+ end
113
+
114
+ def msys_libraries(ruby_ver, with_compression)
115
+ libraries = with_compression ? ["-Wl,-Bstatic"] : []
116
+ libraries = libraries + COMMON_LINUX_LIBRARIES + MSYS_LIBRARIES
117
+ linux_libraries(libraries, ruby_ver, with_compression)
118
+ end
119
+
53
120
  def process_brew_libs!(libs, brew_libs)
54
121
  brew_libs.each { |lib| libs << "#{PatchHelpers.get_prefix_macos(lib[0]).chop}/lib/lib#{lib[1]}.a " }
55
122
  end
56
123
 
57
- def darwin_libs(deps_lib_dir, ruby_ver)
124
+ def darwin_libraries(deps_lib_dir, ruby_ver, with_compression)
58
125
  libs = String.new
59
126
 
127
+ DARWIN_DEP_LIBS_1.each { |lib| libs << "#{deps_lib_dir}/lib#{lib}.a " }
60
128
  process_brew_libs!(libs, PatchHelpers.ruby31?(ruby_ver) ? DARWIN_BREW_LIBS_31 : DARWIN_BREW_LIBS_PRE_31)
61
129
  process_brew_libs!(libs, DARWIN_BREW_LIBS)
62
130
 
63
- DARWIN_DEP_LIBS.each { |lib| libs << "#{deps_lib_dir}/lib#{lib}.a " }
64
- <<~SUBST
65
- -ltebako-fs -ldwarfs-wr -ldwarfs -force_load #{deps_lib_dir}/libdwarfs_compression.a -lfolly -lfsst -lmetadata_thrift -lthrift_light -lxxhash \
66
- -lzstd #{libs} -ljemalloc -lc++ -lc++abi
67
- SUBST
131
+ DARWIN_DEP_LIBS_2.each { |lib| libs << "#{deps_lib_dir}/lib#{lib}.a " }
132
+
133
+ compression_lib = with_compression ? "-force_load #{deps_lib_dir}/libdwarfs_compression.a" : ""
134
+ "-ltebako-fs -ldwarfs-wr -ldwarfs #{compression_lib} #{libs} -ljemalloc -lc++ -lc++abi"
68
135
  end
69
136
 
70
137
  # .....................................................
@@ -79,66 +146,16 @@ module Tebako
79
146
  # This is fixed by ext/extmk.rb patch [TODO ?]
80
147
  # .....................................................
81
148
 
82
- def linux_common_libs
83
- <<~SUBST
84
- -l:libtebako-fs.a -l:libdwarfs-wr.a -l:libdwarfs.a -Wl,--push-state,--whole-archive -l:libdwarfs_compression.a -Wl,--pop-state -l:libfolly.a -l:libfsst.a \\
85
- -l:libmetadata_thrift.a -l:libthrift_light.a -l:libxxhash.a -l:libfmt.a -l:libdouble-conversion.a -l:libglog.a -l:libgflags.a -l:libevent.a \\
86
- SUBST
87
- end
88
-
89
- def common_enc_libs
90
- "-l:liblz4.a -l:libz.a -l:libzstd.a -l:libbrotlienc.a -l:libbrotlidec.a -l:libbrotlicommon.a -l:liblzma.a"
91
- end
92
-
93
- def linux_gnu_libs(ruby_ver)
94
- <<~SUBST
95
- #{linux_common_libs} \
96
- -l:libarchive.a -l:libiberty.a -l:libacl.a -l:libssl.a -l:libcrypto.a #{common_enc_libs} \\
97
- -l:libgdbm.a -l:libreadline.a -l:libtinfo.a -l:libffi.a -l:libncurses.a -l:libjemalloc.a -l:libcrypt.a -l:libanl.a #{PatchHelpers.yaml_reference(ruby_ver)} \\
98
- -l:libboost_system.a -l:libboost_chrono.a -l:libutil.a -l:libstdc++.a -lgcc_eh -l:libunwind.a -l:liblzma.a -l:librt.a -ldl -lpthread -lm
99
- SUBST
100
- end
101
-
102
- def linux_musl_libs(ruby_ver)
103
- <<~SUBST
104
- #{linux_common_libs} \
105
- -l:libiberty.a -l:libacl.a -l:libssl.a -l:libcrypto.a #{common_enc_libs} -l:libreadline.a \\
106
- -l:libgdbm.a -l:libffi.a -l:libncurses.a -l:libjemalloc.a -l:libcrypt.a #{PatchHelpers.yaml_reference(ruby_ver)} -l:libboost_system.a -l:libboost_chrono.a \\
107
- -l:librt.a -l:libstdc++.a -lgcc_eh -l:libunwind.a -l:liblzma.a -ldl -lpthread
108
- SUBST
109
- end
110
-
111
- # Used for mkconfig.rb
112
- def msys_base_libs(ruby_ver)
113
- <<~SUBST
114
- "-l:libtebako-fs.a -l:libdwarfs-wr.a -l:libdwarfs.a -l:libdwarfs_compression.a -l:libfolly.a -l:libfsst.a " \\
115
- "-l:libmetadata_thrift.a -l:libthrift_light.a -l:libxxhash.a -l:libfmt.a -l:libdouble-conversion.a -l:libglog.a -l:libgflags.a -l:libevent.a " \\
116
- "-l:liblz4.a -l:libz.a -l:libzstd.a -l:liblzma.a -l:libncurses.a -l:libunwind.a -l:liblzma.a -l:libiberty.a #{PatchHelpers.yaml_reference(ruby_ver)} " \\
117
- "-l:libffi.a -l:libboost_system-mt.a -l:libboost_chrono-mt.a -l:libstdc++.a -l:libdl.a -static-libgcc -static-libstdc++ -l:libssl.a -l:libcrypto.a " \\
118
- "-l:libz.a -l:libwinpthread.a -lcrypt32 -lshlwapi -lwsock32 -liphlpapi -limagehlp -lbcrypt -lole32 -loleaut32 -luuid"
119
- SUBST
120
- end
121
-
122
- # Used in Makefile
123
- def msys_libs(ruby_ver)
124
- <<~SUBST
125
- -Wl,-Bstatic #{linux_common_libs} \
126
- -l:liblz4.a -l:libz.a -l:libzstd.a -l:liblzma.a -l:libncurses.a -l:libunwind.a -l:liblzma.a -l:libiberty.a #{PatchHelpers.yaml_reference(ruby_ver)} \\
127
- -l:libffi.a -l:libboost_system-mt.a -l:libboost_chrono-mt.a -l:libstdc++.a -l:libdl.a -static-libgcc -static-libstdc++ -l:libssl.a -l:libcrypto.a -l:libz.a \\
128
- -l:libwinpthread.a -lcrypt32 -lshlwapi -lwsock32 -liphlpapi -limagehlp -lshlwapi -lbcrypt -lws2_32 -lole32 -loleaut32 -luuid
129
- SUBST
130
- end
131
-
132
- def mlibs(ostype, deps_lib_dir, ruby_ver) # rubocop:disable Metrics/MethodLength
149
+ def mlibs(ostype, deps_lib_dir, ruby_ver, with_compression) # rubocop:disable Metrics/MethodLength
133
150
  case ostype
134
151
  when /linux-gnu/
135
- linux_gnu_libs(ruby_ver)
152
+ linux_gnu_libraries(ruby_ver, with_compression)
136
153
  when /linux-musl/
137
- linux_musl_libs(ruby_ver)
154
+ linux_musl_libraries(ruby_ver, with_compression)
138
155
  when /darwin/
139
- darwin_libs(deps_lib_dir, ruby_ver)
156
+ darwin_libraries(deps_lib_dir, ruby_ver, with_compression)
140
157
  when /msys/
141
- msys_libs(ruby_ver)
158
+ msys_libraries(ruby_ver, with_compression)
142
159
  else
143
160
  raise Tebako::Error, "Unknown ostype #{ostype}"
144
161
  end
@@ -30,25 +30,23 @@ module Tebako
30
30
  module Packager
31
31
  # Ruby patching literals (pass2)
32
32
  module PatchLiterals
33
- TOOL_MKCONFIG_RB_PATCH = {
34
- " if fast[name]" => <<~SUBST
35
- # -- Start of tebako patch --
36
- v_head_comp = " CONFIG[\\"prefix\\"] \#{eq} "
37
- if v_head_comp == v[0...(v_head_comp.length)]
38
- v = "\#{v[0...(v_head_comp.length)]}'/__tebako_memfs__'
39
- "
40
- end
41
- v_head_comp = " CONFIG[\\"RUBY_EXEC_PREFIX\\"] \#{eq} "
42
- if v_head_comp == v[0...(v_head_comp.length)]
33
+ TOOL_MKCONFIG_RB_SUBST = <<~SUBST
34
+ # -- Start of tebako patch --
35
+ v_head_comp = " CONFIG[\\"prefix\\"] \#{eq} "
36
+ if v_head_comp == v[0...(v_head_comp.length)]
43
37
  v = "\#{v[0...(v_head_comp.length)]}'/__tebako_memfs__'
44
- "
45
- end
46
- # -- End of tebako patch --
47
- if fast[name]
48
- SUBST
49
- }.freeze
38
+ "
39
+ end
40
+ v_head_comp = " CONFIG[\\"RUBY_EXEC_PREFIX\\"] \#{eq} "
41
+ if v_head_comp == v[0...(v_head_comp.length)]
42
+ v = "\#{v[0...(v_head_comp.length)]}'/__tebako_memfs__'
43
+ "
44
+ end
45
+ # -- End of tebako patch --
46
+ if fast[name]
47
+ SUBST
50
48
 
51
- TOOLS_MKCONFIG_RB_SUBST = <<~SUBST
49
+ TOOL_MKCONFIG_RB_SUBST_MSYS = <<~SUBST
52
50
  # -- Start of tebako patch --
53
51
  v_head_comp = " CONFIG[\\"prefix\\"] \#{eq} "
54
52
  if v_head_comp == v[0...(v_head_comp.length)]
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.7.4"
29
+ VERSION = "0.8.1"
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.4
1
+ 0.8.1
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.4
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-24 00:00:00.000000000 Z
11
+ date: 2024-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -115,7 +115,7 @@ licenses:
115
115
  metadata:
116
116
  homepage_uri: https://github.com/tamatebako/tebako
117
117
  source_code_uri: https://github.com/tamatebako/tebako
118
- post_install_message:
118
+ post_install_message:
119
119
  rdoc_options: []
120
120
  require_paths:
121
121
  - cmake
@@ -139,8 +139,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  requirements: []
142
- rubygems_version: 3.5.11
143
- signing_key:
142
+ rubygems_version: 3.3.27
143
+ signing_key:
144
144
  specification_version: 4
145
145
  summary: Packager for Ruby executables
146
146
  test_files: []