tebako 0.5.12 → 0.6.2
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 +4 -4
- data/CMakeLists.txt +107 -196
- data/README.adoc +82 -22
- data/common.env +1 -1
- data/exe/tebako-packager +15 -9
- data/include/tebako/tebako-main.h +2 -1
- data/lib/tebako/cli.rb +25 -32
- data/lib/tebako/cli_helpers.rb +53 -44
- data/lib/tebako/cli_rubies.rb +75 -0
- data/lib/tebako/error.rb +17 -2
- data/lib/tebako/packager/pass1.rb +73 -6
- data/lib/tebako/packager/pass2.rb +63 -93
- data/lib/tebako/packager/patch_buildsystem.rb +125 -0
- data/lib/tebako/packager/patch_helpers.rb +10 -0
- data/lib/tebako/packager/patch_libraries.rb +150 -0
- data/lib/tebako/packager/patch_literals.rb +161 -91
- data/lib/tebako/packager.rb +28 -2
- data/lib/tebako/version.rb +1 -1
- data/src/tebako-main.cpp +7 -37
- data/tools/ci-scripts/patch-fbthrift.sh +3 -56
- data/tools/ci-scripts/patch-folly.sh +52 -10
- data/version.txt +1 -1
- metadata +5 -2
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# Copyright (c) 2023 [Ribose Inc](https://www.ribose.com).
|
3
|
+
# Copyright (c) 2023-2024 [Ribose Inc](https://www.ribose.com).
|
4
4
|
# All rights reserved.
|
5
5
|
# This file is a part of tebako
|
6
6
|
#
|
@@ -29,20 +29,14 @@
|
|
29
29
|
module Tebako
|
30
30
|
module Packager
|
31
31
|
# Ruby patching literals (pass2)
|
32
|
-
# rubocop:disable Metrics/ModuleLength
|
33
32
|
module PatchLiterals
|
34
33
|
TOOL_MKCONFIG_RB_PATCH = {
|
35
34
|
" if fast[name]" => <<~SUBST
|
36
35
|
# -- Start of tebako patch --
|
37
36
|
v_head_comp = " CONFIG[\\"prefix\\"] \#{eq} "
|
38
37
|
if v_head_comp == v[0...(v_head_comp.length)]
|
39
|
-
if win32
|
40
|
-
v = "\#{v[0...(v_head_comp.length)]}CONFIG[\\"RUBY_EXEC_PREFIX\\"] = '/__tebako_memfs__'
|
41
|
-
"
|
42
|
-
else
|
43
38
|
v = "\#{v[0...(v_head_comp.length)]}'/__tebako_memfs__'
|
44
39
|
"
|
45
|
-
end
|
46
40
|
end
|
47
41
|
v_head_comp = " CONFIG[\\"RUBY_EXEC_PREFIX\\"] \#{eq} "
|
48
42
|
if v_head_comp == v[0...(v_head_comp.length)]
|
@@ -54,6 +48,22 @@ module Tebako
|
|
54
48
|
SUBST
|
55
49
|
}.freeze
|
56
50
|
|
51
|
+
TOOLS_MKCONFIG_RB_SUBST = <<~SUBST
|
52
|
+
# -- Start of tebako patch --
|
53
|
+
v_head_comp = " CONFIG[\\"prefix\\"] \#{eq} "
|
54
|
+
if v_head_comp == v[0...(v_head_comp.length)]
|
55
|
+
v = "\#{v[0...(v_head_comp.length)]}CONFIG[\\"RUBY_EXEC_PREFIX\\"] = 'A:/__tebako_memfs__'
|
56
|
+
"
|
57
|
+
end
|
58
|
+
v_head_comp = " CONFIG[\\"RUBY_EXEC_PREFIX\\"] \#{eq} "
|
59
|
+
if v_head_comp == v[0...(v_head_comp.length)]
|
60
|
+
v = "\#{v[0...(v_head_comp.length)]}'A:/__tebako_memfs__'
|
61
|
+
"
|
62
|
+
end
|
63
|
+
# -- End of tebako patch --
|
64
|
+
if fast[name]
|
65
|
+
SUBST
|
66
|
+
|
57
67
|
# Alpine-specific patches https://github.com/docker-library/ruby/blob/master/3.1/alpine3.15/Dockerfile
|
58
68
|
# -- Patch no. 1 --
|
59
69
|
# https://github.com/docker-library/ruby/issues/196
|
@@ -125,6 +135,7 @@ module Tebako
|
|
125
135
|
ruby_sysinit(&argc, &argv);
|
126
136
|
/* -- Start of tebako patch -- */
|
127
137
|
if (tebako_main(&argc, &argv) != 0) {
|
138
|
+
printf("Tebako intialization failed.");
|
128
139
|
return -1;
|
129
140
|
}
|
130
141
|
/* -- End of tebako patch -- */
|
@@ -156,46 +167,62 @@ module Tebako
|
|
156
167
|
"else if (e == EIO /* tebako patch */ && !within_tebako_memfs(path)) {"
|
157
168
|
}.freeze
|
158
169
|
|
159
|
-
|
160
|
-
"
|
161
|
-
|
170
|
+
DLN_C_MSYS_PATCH_PRE32 = {
|
171
|
+
" winfile = rb_w32_mbstr_to_wstr(CP_UTF8, file, -1, NULL);" => <<~SUBST
|
172
|
+
/* -- Start of tebako patch -- */
|
173
|
+
char *f = NULL;
|
174
|
+
winfile = NULL;
|
175
|
+
if (file && within_tebako_memfs(file)) {
|
176
|
+
f = tebako_dlmap2file(file);
|
177
|
+
if (f) {
|
178
|
+
winfile = rb_w32_mbstr_to_wstr(CP_UTF8, f, -1, NULL);
|
179
|
+
free(f);
|
180
|
+
}
|
181
|
+
else {
|
182
|
+
goto failed;
|
183
|
+
}
|
184
|
+
}
|
185
|
+
else {
|
186
|
+
winfile = rb_w32_mbstr_to_wstr(CP_UTF8, file, -1, NULL);
|
187
|
+
}
|
188
|
+
/* -- End of tebako patch -- */
|
189
|
+
SUBST
|
162
190
|
}.freeze
|
163
191
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
TEMPLATE_MAKEFILE_IN_BASE_PATCH =
|
186
|
-
"# -- Start of tebako patch --\n" \
|
187
|
-
"\t\t$(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(MAINOBJ) " \
|
188
|
-
"$(EXTOBJS) $(LIBRUBYARG_STATIC) $(OUTFLAG)$@\n" \
|
189
|
-
"# -- End of tebako patch --"
|
192
|
+
DLN_C_MSYS_PATCH = {
|
193
|
+
" WCHAR *winfile = rb_w32_mbstr_to_wstr(CP_UTF8, file, -1, NULL);" => <<~SUBST
|
194
|
+
/* -- Start of tebako patch -- */
|
195
|
+
char *f = NULL;
|
196
|
+
WCHAR *winfile = NULL;
|
197
|
+
if (file && within_tebako_memfs(file)) {
|
198
|
+
f = tebako_dlmap2file(file);
|
199
|
+
if (f) {
|
200
|
+
winfile = rb_w32_mbstr_to_wstr(CP_UTF8, f, -1, NULL);
|
201
|
+
free(f);
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
goto failed;
|
205
|
+
}
|
206
|
+
}
|
207
|
+
else {
|
208
|
+
winfile = rb_w32_mbstr_to_wstr(CP_UTF8, file, -1, NULL);
|
209
|
+
}
|
210
|
+
/* -- End of tebako patch -- */
|
211
|
+
SUBST
|
212
|
+
}.freeze
|
190
213
|
|
191
214
|
C_FILE_SUBST = <<~SUBST
|
192
215
|
/* -- Start of tebako patch -- */
|
193
|
-
#ifndef NO_TEBAKO_INCLUDES
|
194
216
|
#include <tebako/tebako-config.h>
|
195
217
|
#include <tebako/tebako-defines.h>
|
196
|
-
#include <tebako/tebako-io-rb-w32.h>
|
197
218
|
#include <tebako/tebako-io.h>
|
198
|
-
|
219
|
+
/* -- End of tebako patch -- */
|
220
|
+
SUBST
|
221
|
+
|
222
|
+
C_FILE_SUBST_LESS = <<~SUBST
|
223
|
+
/* -- Start of tebako patch -- */
|
224
|
+
#include <tebako/tebako-config.h>
|
225
|
+
#include <tebako/tebako-io.h>
|
199
226
|
/* -- End of tebako patch -- */
|
200
227
|
SUBST
|
201
228
|
|
@@ -213,68 +240,111 @@ module Tebako
|
|
213
240
|
SUBST
|
214
241
|
}.freeze
|
215
242
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
"strlen(tebako_mount_point())) /* tebako patched */",
|
223
|
-
'#include "mjit.h"' =>
|
224
|
-
"#include \"mjit.h\"\n" \
|
225
|
-
"/* -- Start of tebako patch -- */\n" \
|
226
|
-
"#include <tebako/tebako-main.h>\n" \
|
227
|
-
"/* -- End of tebako patch -- */"
|
228
|
-
},
|
229
|
-
"/win32/win32.c" => {
|
230
|
-
"#undef __STRICT_ANSI__" =>
|
231
|
-
"#undef __STRICT_ANSI__\n" \
|
232
|
-
"/* -- Start of tebako patch -- */\n" \
|
233
|
-
"#define NO_TEBAKO_INCLUDES\n" \
|
234
|
-
"/* -- End of tebako patch -- */"
|
235
|
-
},
|
236
|
-
"win32/dir.h" => {
|
237
|
-
"#define opendir(s) rb_w32_opendir((s))" => "#{C_FILE_SUBST}\n#define opendir(s) rb_w32_opendir((s))"
|
238
|
-
},
|
239
|
-
"file.c" => {
|
240
|
-
" wpath = mbstr_to_wstr(CP_UTF8, path, -1, &len);" =>
|
241
|
-
"/* -- Start of tebako patch -- */\n" \
|
242
|
-
"if (tebako_file_load_ok(path)) return 1;\n" \
|
243
|
-
"/* -- End of tebako patch -- */\n" \
|
244
|
-
"wpath = mbstr_to_wstr(CP_UTF8, path, -1, &len);",
|
245
|
-
'#include "win32/file.h' =>
|
246
|
-
"#include \"win32/file.h\"\n" \
|
247
|
-
"/* -- Start of tebako patch -- */\n" \
|
248
|
-
"#include <tebako/tebako-main.h>\n" \
|
249
|
-
"/* -- End of tebako patch -- */"
|
250
|
-
}
|
243
|
+
IO_C_SUBST = <<~SUBST
|
244
|
+
/* -- Start of tebako patch -- */
|
245
|
+
if (is_tebako_file_descriptor(fd)) return;
|
246
|
+
/* -- End of tebako patch -- */
|
247
|
+
flags = fcntl(fd, F_GETFD); /* should not fail except EBADF. */
|
248
|
+
SUBST
|
251
249
|
|
250
|
+
IO_C_MSYS_BASE_PATCH = {
|
251
|
+
"#define open rb_w32_uopen" => "#define open(p, f, m) tebako_open(3, (p), (f), (m))"
|
252
252
|
}.freeze
|
253
253
|
|
254
|
-
|
255
|
-
"
|
256
|
-
|
257
|
-
|
254
|
+
IO_C_MSYS_PATCH_PRE_32 = {
|
255
|
+
"(rb_w32_io_cancelable_p((fptr)->fd) ? Qnil : rb_io_wait(fptr->self, RB_INT2NUM(RUBY_IO_READABLE), Qnil))" =>
|
256
|
+
"((is_tebako_file_descriptor((fptr)->fd) || rb_w32_io_cancelable_p((fptr)->fd)) ? \\\n" \
|
257
|
+
"Qnil : rb_io_wait(fptr->self, RB_INT2NUM(RUBY_IO_READABLE), Qnil))"
|
258
258
|
}.freeze
|
259
259
|
|
260
|
-
|
260
|
+
IO_C_MSYS_PATCH = {
|
261
|
+
"(rb_w32_io_cancelable_p((fptr)->fd) ? Qnil : rb_io_wait(fptr->self, " \
|
262
|
+
"RB_INT2NUM(RUBY_IO_READABLE), RUBY_IO_TIMEOUT_DEFAULT))" =>
|
263
|
+
"((is_tebako_file_descriptor((fptr)->fd) || rb_w32_io_cancelable_p((fptr)->fd)) ? \\\n" \
|
264
|
+
"Qnil : rb_io_wait(fptr->self, RB_INT2NUM(RUBY_IO_READABLE), RUBY_IO_TIMEOUT_DEFAULT))"
|
265
|
+
}.freeze
|
261
266
|
|
262
|
-
|
267
|
+
FILE_C_MSYS_SUBST = <<~SUBST
|
268
|
+
/* -- Start of tebako patch -- */
|
269
|
+
if (is_tebako_file_descriptor((fptr)->fd)) return ENOTSUP;
|
270
|
+
/* -- End of tebako patch -- */
|
271
|
+
while ((int)rb_thread_io_blocking_region(rb_thread_flock, op, fptr->fd) < 0) {
|
272
|
+
SUBST
|
273
|
+
|
274
|
+
FILE_C_MSYS_PATCH = {
|
275
|
+
"while ((int)rb_thread_io_blocking_region(rb_thread_flock, op, fptr->fd) < 0) {" => FILE_C_MSYS_SUBST
|
276
|
+
}.freeze
|
277
|
+
|
278
|
+
RUBY_C_MSYS_PATH_SUBST = <<~SUBST
|
279
|
+
/* -- Start of tebako patch -- */
|
280
|
+
VALUE path = within_tebako_memfs(paths) ?
|
281
|
+
rb_str_new_cstr(paths) :
|
282
|
+
RUBY_RELATIVE(paths, len);
|
283
|
+
/* -- End of tebako patch -- */
|
284
|
+
SUBST
|
263
285
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
["double-conversion", "double-conversion"]
|
269
|
-
].freeze
|
286
|
+
RUBY_C_MSYS_PATCHES = {
|
287
|
+
"#ifndef MAXPATHLEN" => "#{C_FILE_SUBST_LESS}\n#ifndef MAXPATHLEN",
|
288
|
+
"VALUE path = RUBY_RELATIVE(paths, len);" => RUBY_C_MSYS_PATH_SUBST
|
289
|
+
}.freeze
|
270
290
|
|
271
|
-
|
291
|
+
WIN32_FILE_C_MSYS_SUBST = <<~SUBST
|
292
|
+
/* -- Start of tebako patch -- */
|
293
|
+
if (tebako_file_load_ok(path)) return ret;
|
294
|
+
/* -- End of tebako patch -- */
|
295
|
+
wpath = mbstr_to_wstr(CP_UTF8, path, -1, &len);
|
296
|
+
SUBST
|
272
297
|
|
273
|
-
|
298
|
+
WIN32_FILE_C_MSYS_PATCHES = {
|
299
|
+
"#ifndef INVALID_FILE_ATTRIBUTES" => "#{C_FILE_SUBST_LESS}\n#ifndef INVALID_FILE_ATTRIBUTES",
|
300
|
+
"wpath = mbstr_to_wstr(CP_UTF8, path, -1, &len);" => WIN32_FILE_C_MSYS_SUBST
|
301
|
+
}.freeze
|
274
302
|
|
275
|
-
|
276
|
-
|
303
|
+
WIN32_WIN32_C_MSYS_SUBST = <<~SUBST
|
304
|
+
/* -- Start of tebako patch -- */
|
305
|
+
if (is_tebako_cwd()) {
|
306
|
+
char* tebako_cwd = tebako_getcwd(NULL,0);
|
307
|
+
if (tebako_cwd == NULL) {
|
308
|
+
errno = ENOMEM;
|
309
|
+
return NULL;
|
310
|
+
}
|
311
|
+
len = strlen(tebako_cwd) + 1;
|
312
|
+
|
313
|
+
if (buffer) {
|
314
|
+
if (size < len) {
|
315
|
+
free(tebako_cwd);
|
316
|
+
errno = ERANGE;
|
317
|
+
return NULL;
|
318
|
+
}
|
319
|
+
}
|
320
|
+
else {
|
321
|
+
buffer = (*alloc)(len, arg);
|
322
|
+
if (!buffer) {
|
323
|
+
free(tebako_cwd);
|
324
|
+
errno = ENOMEM;
|
325
|
+
return NULL;
|
326
|
+
}
|
327
|
+
}
|
328
|
+
translate_char(tebako_cwd, (char)0x5c, '/', CP_UTF8);
|
329
|
+
strcpy(buffer, tebako_cwd);
|
330
|
+
free(tebako_cwd);
|
331
|
+
return buffer;
|
332
|
+
}
|
333
|
+
/* -- End of tebako patch -- */
|
334
|
+
|
335
|
+
len = GetCurrentDirectoryW(0, NULL);
|
336
|
+
SUBST
|
337
|
+
|
338
|
+
WIN32_WIN32_C_MSYS_PATCHES = {
|
339
|
+
"#if defined _MSC_VER && _MSC_VER <= 1200" => "#{C_FILE_SUBST_LESS}\n#if defined _MSC_VER && _MSC_VER <= 1200",
|
340
|
+
"len = GetCurrentDirectoryW(0, NULL);" => WIN32_WIN32_C_MSYS_SUBST
|
341
|
+
}.freeze
|
342
|
+
|
343
|
+
LINUX_PATCHES = {
|
344
|
+
"ext/extmk.rb" => {
|
345
|
+
"mf.macro \"EXTLIBS\", $extlibs" => "# mf.macro \"EXTLIBS\", $extlibs tebako patched"
|
346
|
+
}
|
347
|
+
}.freeze
|
277
348
|
end
|
278
|
-
# rubocop:enable Metrics/ModuleLength
|
279
349
|
end
|
280
350
|
end
|
data/lib/tebako/packager.rb
CHANGED
@@ -48,10 +48,11 @@ module Tebako
|
|
48
48
|
|
49
49
|
FILES_TO_RESTORE_MSYS = %w[
|
50
50
|
ruby.c
|
51
|
-
win32/win32.c
|
52
51
|
win32/file.c
|
53
|
-
win32/dir.h
|
54
52
|
].freeze
|
53
|
+
# Do not need to restore cygwin/GNUmakefile.in
|
54
|
+
# because it is patched (differently) both on pass 1 and pass2
|
55
|
+
# cygwin/GNUmakefile.in
|
55
56
|
|
56
57
|
FILES_TO_RESTORE_MUSL = %w[
|
57
58
|
thread_pthread.c
|
@@ -70,6 +71,19 @@ module Tebako
|
|
70
71
|
RUBYGEMS_VERSION = "3.4.22"
|
71
72
|
|
72
73
|
class << self
|
74
|
+
# Create implib
|
75
|
+
def create_implib(src_dir, package_src_dir, app_name, ruby_ver)
|
76
|
+
puts " ... creating Windows import library"
|
77
|
+
File.open(def_fname(src_dir, app_name), "w") do |file|
|
78
|
+
file.puts "LIBRARY #{out_fname(app_name)}"
|
79
|
+
file.puts File.read(File.join(src_dir, "tebako.def"))
|
80
|
+
end
|
81
|
+
params = ["dlltool", "-d", def_fname(src_dir, app_name), "-D", out_fname(app_name),
|
82
|
+
"--output-lib", lib_fname(package_src_dir, ruby_ver)]
|
83
|
+
out, st = Open3.capture2e(*params)
|
84
|
+
raise Tebako::Error, "Failed to create import library:\n #{out}" unless st.exitstatus.zero?
|
85
|
+
end
|
86
|
+
|
73
87
|
# Deploy
|
74
88
|
def deploy(src_dir, tbd, gflength)
|
75
89
|
puts "-- Running deploy script"
|
@@ -132,6 +146,18 @@ module Tebako
|
|
132
146
|
|
133
147
|
private
|
134
148
|
|
149
|
+
def def_fname(src_dir, app_name)
|
150
|
+
File.join(src_dir, "#{app_name}.def")
|
151
|
+
end
|
152
|
+
|
153
|
+
def out_fname(app_name)
|
154
|
+
File.join("#{app_name}.exe")
|
155
|
+
end
|
156
|
+
|
157
|
+
def lib_fname(src_dir, ruby_ver)
|
158
|
+
File.join(src_dir, "lib", "libx64-ucrt-ruby#{ruby_ver[0]}#{ruby_ver[2]}0.a")
|
159
|
+
end
|
160
|
+
|
135
161
|
def install_gem(tbd, name, ver = nil)
|
136
162
|
puts " ... installing #{name} gem#{" version #{ver}" if ver}"
|
137
163
|
PatchHelpers.with_env(DEPLOY_ENV) do
|
data/lib/tebako/version.rb
CHANGED
data/src/tebako-main.cpp
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
/**
|
2
2
|
*
|
3
|
-
* Copyright (c) 2021-
|
3
|
+
* Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com).
|
4
4
|
* All rights reserved.
|
5
5
|
* This file is a part of tebako
|
6
6
|
*
|
@@ -35,6 +35,7 @@
|
|
35
35
|
#include <fcntl.h>
|
36
36
|
|
37
37
|
#include <string>
|
38
|
+
#include <cstdint>
|
38
39
|
|
39
40
|
#ifdef _WIN32
|
40
41
|
#include <winsock2.h>
|
@@ -49,6 +50,8 @@
|
|
49
50
|
#include <tebako/tebako-main.h>
|
50
51
|
#include <tebako/tebako-fs.h>
|
51
52
|
|
53
|
+
static int running_miniruby = 0;
|
54
|
+
|
52
55
|
extern "C" int tebako_main(int* argc, char*** argv) {
|
53
56
|
int ret = -1, fsret = -1;
|
54
57
|
char** new_argv = NULL;
|
@@ -58,6 +61,7 @@ extern "C" int tebako_main(int* argc, char*** argv) {
|
|
58
61
|
// Ruby build script is designed in such a way that this patch is also applied towards miniruby
|
59
62
|
// Just pass through in such case
|
60
63
|
ret = 0;
|
64
|
+
running_miniruby = -1;
|
61
65
|
}
|
62
66
|
else {
|
63
67
|
try {
|
@@ -149,40 +153,6 @@ extern "C" const char* tebako_mount_point(void) {
|
|
149
153
|
return tebako::fs_mount_point;
|
150
154
|
}
|
151
155
|
|
152
|
-
|
153
|
-
|
154
|
-
#if !defined(RUBY_WIN32_H)
|
155
|
-
struct stati128 {
|
156
|
-
_dev_t st_dev;
|
157
|
-
unsigned __int64 st_ino;
|
158
|
-
__int64 st_inohigh;
|
159
|
-
unsigned short st_mode;
|
160
|
-
short st_nlink;
|
161
|
-
short st_uid;
|
162
|
-
short st_gid;
|
163
|
-
_dev_t st_rdev;
|
164
|
-
__int64 st_size;
|
165
|
-
__time64_t st_atime;
|
166
|
-
long st_atimensec;
|
167
|
-
__time64_t st_mtime;
|
168
|
-
long st_mtimensec;
|
169
|
-
__time64_t st_ctime;
|
170
|
-
long st_ctimensec;
|
171
|
-
};
|
172
|
-
#endif
|
173
|
-
|
174
|
-
extern "C" int tebako_file_load_ok(const char *path) {
|
175
|
-
int ret = 0;
|
176
|
-
|
177
|
-
if (within_tebako_memfs(path)) {
|
178
|
-
int fd = tebako_open(2, path, O_RDONLY);
|
179
|
-
if (fd != -1) {
|
180
|
-
struct STAT_TYPE st;
|
181
|
-
ret = (tebako_fstat(fd, &st)==0) ? 1:0;
|
182
|
-
tebako_close(fd);
|
183
|
-
}
|
184
|
-
}
|
185
|
-
return ret;
|
156
|
+
extern "C" int tebako_is_running_miniruby(void) {
|
157
|
+
return running_miniruby;
|
186
158
|
}
|
187
|
-
|
188
|
-
#endif
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#! /bin/bash
|
2
|
-
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
2
|
+
# Copyright (c) 2022,2024 [Ribose Inc](https://www.ribose.com).
|
3
3
|
# All rights reserved.
|
4
4
|
# This file is a part of tebako
|
5
5
|
#
|
@@ -43,70 +43,17 @@ do_patch_multiline() {
|
|
43
43
|
"$gSed" -i "s/$re/${sbst//$'\n'/"\\n"}/g" "$1"
|
44
44
|
}
|
45
45
|
|
46
|
-
# ....................................................
|
47
|
-
# Surprise, surprise ... Upstream project shall found boost libraries for fbthrift
|
48
|
-
# https://github.com/facebook/fbthrift/commit/c23af9dee42374d43d2f10e0e07edf1c1c97c328
|
49
|
-
|
50
|
-
|
51
46
|
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "linux-musl"* || "$OSTYPE" == "msys" ]]; then
|
52
47
|
gSed="sed"
|
53
|
-
# shellcheck disable=SC2251
|
54
|
-
! IFS= read -r -d '' sbst << EOM
|
55
|
-
find_package(OpenSSL REQUIRED)
|
56
|
-
# -- Start of tebako patch --
|
57
|
-
find_package(Boost 1.65 REQUIRED COMPONENTS filesystem)
|
58
|
-
include_directories(\${Boost_INCLUDE_DIRS})
|
59
|
-
# -- End of tebako patch --
|
60
|
-
EOM
|
61
|
-
|
62
48
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
63
49
|
gSed="gsed"
|
64
|
-
|
65
|
-
# shellcheck disable=SC2251
|
66
|
-
! IFS= read -r -d '' sbst << EOM
|
67
|
-
find_package(OpenSSL REQUIRED)
|
68
|
-
# -- Start of tebako patch --
|
69
|
-
find_package(Boost 1.65 REQUIRED COMPONENTS filesystem)
|
70
|
-
include_directories(\${Boost_INCLUDE_DIRS})
|
71
|
-
# Suppress superfluous randlib warnings about \"*.a\" having no symbols on MacOSX.
|
72
|
-
set(CMAKE_C_ARCHIVE_CREATE \"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>\")
|
73
|
-
set(CMAKE_CXX_ARCHIVE_CREATE \"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>\")
|
74
|
-
set(CMAKE_C_ARCHIVE_FINISH \"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>\")
|
75
|
-
set(CMAKE_CXX_ARCHIVE_FINISH \"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>\")
|
76
|
-
# -- End of tebako patch --
|
77
|
-
EOM
|
78
|
-
|
79
50
|
else
|
80
51
|
echo "Unknown OSTYPE=$OSTYPE"
|
81
52
|
exit 1
|
82
53
|
fi
|
83
54
|
|
84
|
-
restore_and_save "$1/CMakeLists.txt"
|
85
|
-
re="find_package(OpenSSL REQUIRED)"
|
86
|
-
"$gSed" -i "s/$re/${sbst//$'\n'/"\\n"}/g" "$1/CMakeLists.txt"
|
87
|
-
|
88
|
-
# GCC 13 compatibility
|
89
|
-
# --- thrift/compiler/lib/cpp2/util.cc ---
|
90
|
-
re="#include <stdexcept>"
|
91
|
-
# shellcheck disable=SC2251
|
92
|
-
! IFS= read -r -d '' sbst << EOM
|
93
|
-
#include <stdexcept>
|
94
|
-
|
95
|
-
\/* -- Start of tebako patch -- *\/
|
96
|
-
#include <cstdint>
|
97
|
-
\/* -- End of tebako patch -- *\/
|
98
|
-
EOM
|
99
|
-
|
100
|
-
do_patch_multiline "$1/thrift/compiler/lib/cpp2/util.cc"
|
101
|
-
|
102
|
-
|
103
55
|
if [[ "$OSTYPE" == "msys" ]]; then
|
104
|
-
re="
|
105
|
-
sbst="
|
106
|
-
do_patch "$1/thrift/compiler/CMakeLists.txt" "$re" "$sbst"
|
107
|
-
|
108
|
-
re="ftruncate(file\.fd(), finalBufferSize);"
|
109
|
-
sbst="folly::portability::unistd::ftruncate(file.fd(), finalBufferSize); \/* tebako patched *\/"
|
56
|
+
re="ftruncate(file\.fd(), finalBufferSize),"
|
57
|
+
sbst="folly::portability::unistd::ftruncate(file.fd(), finalBufferSize), \/* tebako patched *\/"
|
110
58
|
do_patch "$1/thrift/lib/cpp2/frozen/FrozenUtil.h" "$re" "$sbst"
|
111
|
-
|
112
59
|
fi
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#! /bin/bash
|
2
|
-
# Copyright (c) 2022-
|
2
|
+
# Copyright (c) 2022-2024, [Ribose Inc](https://www.ribose.com).
|
3
3
|
# All rights reserved.
|
4
4
|
# This file is a part of tebako
|
5
5
|
#
|
@@ -41,6 +41,7 @@ restore_and_save() {
|
|
41
41
|
|
42
42
|
do_patch() {
|
43
43
|
restore_and_save "$1"
|
44
|
+
# echo "$GNU_SED" -i "s/$2/$3/g" "$1"
|
44
45
|
"$GNU_SED" -i "s/$2/$3/g" "$1"
|
45
46
|
}
|
46
47
|
|
@@ -316,15 +317,6 @@ EOM
|
|
316
317
|
sbst=" \/* tebako patched *\/ folly::portability::unistd::lseek(fd,"
|
317
318
|
do_patch "$1/folly/portability/SysUio.cpp" "$re" "$sbst"
|
318
319
|
|
319
|
-
# --- folly/portability/Unistd.cpp ---
|
320
|
-
re="(lseek(fd,"
|
321
|
-
sbst="( \/* tebako patched *\/ folly::portability::unistd::lseek(fd,"
|
322
|
-
do_patch "$1/folly/portability/Unistd.cpp" "$re" "$sbst"
|
323
|
-
|
324
|
-
re="lseek(fd, 0,"
|
325
|
-
sbst=" \/* tebako patched *\/ folly::portability::unistd::lseek(fd, 0,"
|
326
|
-
"$GNU_SED" -i "s/$re/$sbst/g" "$1/folly/portability/Unistd.cpp"
|
327
|
-
|
328
320
|
# --- folly/logging/ImmediateFileWriter.h ---
|
329
321
|
re="isatty(file"
|
330
322
|
sbst=" \/* tebako patched *\/ folly::portability::unistd::isatty(file"
|
@@ -402,6 +394,7 @@ EOM
|
|
402
394
|
#ifdef __MINGW32__
|
403
395
|
#include <mswsock.h>
|
404
396
|
using cmsghdr = WSACMSGHDR;
|
397
|
+
#define CMSG_SPACE WSA_CMSG_SPACE
|
405
398
|
#endif
|
406
399
|
\/* -- End of tebako patch -- *\/
|
407
400
|
|
@@ -448,7 +441,55 @@ EOM
|
|
448
441
|
sbst="#if defined(__XROS__) || defined(__MINGW32__) \/* tebako patched *\/"
|
449
442
|
"$GNU_SED" -i "s/$re/$sbst/g" "$1/folly/system/ThreadName.cpp"
|
450
443
|
|
444
|
+
# --- folly/net/NetOps.h ---
|
445
|
+
|
446
|
+
re="#include <WS2tcpip\.h> \/\/ @manual"
|
447
|
+
# shellcheck disable=SC2251
|
448
|
+
! IFS= read -r -d '' sbst << EOM
|
449
|
+
#include <WS2tcpip.h> \/\/ @manual
|
450
|
+
|
451
|
+
\/* -- Start of tebako patch -- *\/
|
452
|
+
#ifdef __MINGW32__
|
453
|
+
#include <memory>
|
454
|
+
#include <mswsock.h>
|
455
|
+
#endif
|
456
|
+
\/* -- End of tebako patch -- *\/
|
457
|
+
EOM
|
458
|
+
do_patch_multiline "$1/folly/net/NetOps.h" "$re" "$sbst"
|
459
|
+
|
460
|
+
# --- folly/Random.cpp ---
|
461
|
+
|
462
|
+
re="#include <folly\/synchronization\/RelaxedAtomic\.h>"
|
463
|
+
# shellcheck disable=SC2251
|
464
|
+
! IFS= read -r -d '' sbst << EOM
|
465
|
+
#include <folly\/synchronization\/RelaxedAtomic.h>
|
466
|
+
|
467
|
+
\/* -- Start of tebako patch -- *\/
|
468
|
+
#include <folly\/portability\/Fcntl.h>
|
469
|
+
\/* -- End of tebako patch -- *\/
|
470
|
+
EOM
|
471
|
+
do_patch_multiline "$1/folly/Random.cpp" "$re" "$sbst"
|
472
|
+
|
473
|
+
# --- folly/Utility.h ---
|
474
|
+
re="T uninit;"
|
475
|
+
sbst="T uninit = 0; \/* tebako patched *\/"
|
476
|
+
do_patch "$1/folly/Utility.h" "$re" "$sbst"
|
477
|
+
|
478
|
+
# --- folly/experimental/io/AsyncBase.cpp ---
|
479
|
+
re="CHECK_ERR(close(pollFd_));"
|
480
|
+
sbst="CHECK_ERR(folly::portability::unistd::close(pollFd_)); \/* tebako patched *\/"
|
481
|
+
do_patch "$1/folly/experimental/io/AsyncBase.cpp" "$re" "$sbst"
|
482
|
+
|
483
|
+
# --- folly/portability/Unistd.cpp ---
|
484
|
+
re="res = lseek64(fd, offset, whence);"
|
485
|
+
sbst="res = folly::portability::unistd::lseek64(fd, offset, whence); \/* tebako patched *\/ "
|
486
|
+
do_patch "$1/folly/portability/Unistd.cpp" "$re" "$sbst"
|
487
|
+
|
488
|
+
re="res = lseek(fd, offset, whence);"
|
489
|
+
sbst="res = folly::portability::unistd::lseek(fd, offset, whence); \/* tebako patched *\/ "
|
490
|
+
"$GNU_SED" -i "s/$re/$sbst/g" "$1/folly/portability/Unistd.cpp"
|
451
491
|
# ---
|
492
|
+
|
452
493
|
defined_msc_ver_to_win32 "$1/folly/external/farmhash/farmhash.cpp"
|
453
494
|
defined_msc_ver_to_win32 "$1/folly/detail/IPAddressSource.h"
|
454
495
|
defined_msc_ver_to_win32 "$1/folly/portability/Sockets.cpp"
|
@@ -471,5 +512,6 @@ EOM
|
|
471
512
|
# while gettimeofday is provided by MSys, the other two functions are lost
|
472
513
|
defined_n_win32_to_msc_ver "$1/folly/portability/SysTime.h"
|
473
514
|
defined_win32_to_msc_ver "$1/folly/portability/SysTime.cpp"
|
515
|
+
defined_win32_to_msc_ver "$1/folly/lang/Exception.cpp"
|
474
516
|
|
475
517
|
fi
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.6.2
|
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.
|
4
|
+
version: 0.6.2
|
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-
|
11
|
+
date: 2024-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -65,11 +65,14 @@ files:
|
|
65
65
|
- lib/tebako.rb
|
66
66
|
- lib/tebako/cli.rb
|
67
67
|
- lib/tebako/cli_helpers.rb
|
68
|
+
- lib/tebako/cli_rubies.rb
|
68
69
|
- lib/tebako/error.rb
|
69
70
|
- lib/tebako/packager.rb
|
70
71
|
- lib/tebako/packager/pass1.rb
|
71
72
|
- lib/tebako/packager/pass2.rb
|
73
|
+
- lib/tebako/packager/patch_buildsystem.rb
|
72
74
|
- lib/tebako/packager/patch_helpers.rb
|
75
|
+
- lib/tebako/packager/patch_libraries.rb
|
73
76
|
- lib/tebako/packager/patch_literals.rb
|
74
77
|
- lib/tebako/version.rb
|
75
78
|
- resources/tebako-fs.cpp.in
|