tebako 0.6.5 → 0.6.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d02ef72aa920ed26d95b18dce3f2b0dc60aa66633d83876fd03e0da9161d5cf
4
- data.tar.gz: c1524406708fe09d25a800537af70f0df315ece0e41e9a6146739d201680fe2e
3
+ metadata.gz: 484389b525402e736d81e83df4bc8613128bf5d830d9b2756b033feaaee09fce
4
+ data.tar.gz: bc863fa069c014e02f887ebeac297a4036157afdab0ea0a480a406864e6c3769
5
5
  SHA512:
6
- metadata.gz: 751def113919ecca7b08900b246042b76942af841d40fb3db41da7bb7926ac30ce6c107b43864a3c2fca4ac1abdb0a700d99977e1562fa0405022cb6e6f09caf
7
- data.tar.gz: 9a3c9d1d09f4e7c7704e093926f63b629ad62bc34e9f5ed505af03dc6697072a4b26decb77bdc46c9f5723ec9fd831c73dadb1afcabd5449cae13cc37636e33e
6
+ metadata.gz: 84d6926fecec65501e49d2e045b64431dcdef9aa8afa395ce498f0c08bffc7625900d7f2119193849d0a972400e109bab507b62dfef5abab536d32a8c2b51370
7
+ data.tar.gz: 7ad876c67e9963eae634f7436f1db236c712bd1652cd7fa69318d160cf7a5254b39d9a6ba4822c5ac2f5783fc8d913dfb9251413d81721a9c251de6072652e02
data/CMakeLists.txt CHANGED
@@ -360,7 +360,7 @@ else(IS_DARWIN)
360
360
 
361
361
  if(RB_W32)
362
362
  string(CONCAT RUBY_C_FLAGS ${RUBY_C_FLAGS} " -DRB_W32=1")
363
- string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -L${TLIBD}")
363
+ string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -l:libstdc++.a -L${TLIBD}")
364
364
  endif(RB_W32)
365
365
  endif(IS_DARWIN)
366
366
 
@@ -388,6 +388,7 @@ ExternalProject_Add(${RUBY_PRJ}
388
388
  --prefix=${DATA_SRC_DIR} \
389
389
  ${C_FLAGS_DEST}=\"${RUBY_C_FLAGS}\" \
390
390
  LDFLAGS=\"${RUBY_L_FLAGS}\""
391
+ COMMAND ruby ${EXE}/tebako-packager pass1a ${RUBY_SOURCE_DIR}
391
392
  BUILD_COMMAND make ${RUBY_MAKEFILE} -j${NCORES}
392
393
  INSTALL_COMMAND make ${RUBY_MAKEFILE} install
393
394
  COMMAND ${GNU_BASH} -c "ruby ${EXE}/tebako-packager pass2 ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${DEPS_LIB_DIR} ${DATA_SRC_DIR} ${RUBY_STASH_DIR} ${RUBY_VER}"
data/exe/tebako-packager CHANGED
@@ -57,6 +57,14 @@ begin
57
57
  end
58
58
 
59
59
  Tebako::Packager.stash(ARGV[1], ARGV[2])
60
+ when "pass1a"
61
+ # ARGV[0] -- command
62
+ # ARGV[1] -- RUBY_SOURCE_DIR
63
+ unless ARGV.length == 2
64
+ raise Tebako::Error,
65
+ "tebako-packager pass1a command expects 2 arguments, #{ARGV.length} has been provided."
66
+ end
67
+ Tebako::Packager.pass1a(ARGV[1])
60
68
  when "pass2"
61
69
  # ARGV[0] -- command
62
70
  # ARGV[1] -- OSTYPE
@@ -150,7 +150,7 @@ module Tebako
150
150
  # Generate export definitions; use WinMain to build rubyw.exe
151
151
  patch_map.store("cygwin/GNUmakefile.in", get_gnumakefile_in_patch_p1(ruby_ver))
152
152
  # ....................................................
153
- # RUBY_EXPORT=1 (shall ve set for static builds but is missing in openssl extension)
153
+ # RUBY_EXPORT=1 (shall be set for static builds but is missing in openssl extension)
154
154
  patch_map.store("ext/openssl/extconf.rb", OPENSSL_EXTCONF_RB_PATCH)
155
155
  end
156
156
 
@@ -0,0 +1,46 @@
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_relative "patch_literals"
29
+
30
+ # Tebako - an executable packager
31
+ module Tebako
32
+ module Packager
33
+ # Ruby patching definitions (pass1a)
34
+ module Pass1A
35
+ class << self
36
+ def get_patch_map # rubocop:disable Naming/AccessorMethodName
37
+ {
38
+ "gem_prelude.rb" => GEM_PRELUDE_RB_PATCH
39
+ }
40
+ end
41
+
42
+ include Tebako::Packager::PatchLiterals
43
+ end
44
+ end
45
+ end
46
+ end
@@ -115,7 +115,6 @@ module Tebako
115
115
  {
116
116
  "template/Makefile.in" => template_makefile_in_patch(ostype, deps_lib_dir, ruby_ver),
117
117
  "tool/mkconfig.rb" => mcrb_subst,
118
- "gem_prelude.rb" => GEM_PRELUDE_RB_PATCH,
119
118
  "dir.c" => get_dir_c_patch(ostype), "dln.c" => get_dln_c_patch(ostype, ruby_ver),
120
119
  "io.c" => get_io_c_patch(ostype, ruby_ver), "main.c" => MAIN_C_PATCH,
121
120
  "file.c" => PatchHelpers.patch_c_file("/* define system APIs */"),
@@ -40,6 +40,7 @@ module Tebako
40
40
  puts " ... patching #{fname}"
41
41
  restore_and_save(fname)
42
42
  contents = File.read(fname)
43
+
43
44
  mapping.each { |pattern, subst| contents.sub!(pattern, subst) }
44
45
  File.open(fname, "w") { |file| file << contents }
45
46
  end
@@ -29,6 +29,7 @@ require "fileutils"
29
29
 
30
30
  require_relative "error"
31
31
  require_relative "packager/pass1"
32
+ require_relative "packager/pass1a"
32
33
  require_relative "packager/pass2"
33
34
  require_relative "packager/patch_helpers"
34
35
 
@@ -111,13 +112,21 @@ module Tebako
111
112
  PatchHelpers.recreate(src_dir)
112
113
  do_patch(Pass1.get_patch_map(ostype, mount_point, ruby_ver), ruby_source_dir)
113
114
 
114
- # Roll back pass2 patches
115
+ # Roll back pass1a, pass2 patches
115
116
  # Just in case we are recovering after some error
116
117
  PatchHelpers.restore_and_save_files(FILES_TO_RESTORE, ruby_source_dir)
117
118
  PatchHelpers.restore_and_save_files(FILES_TO_RESTORE_MUSL, ruby_source_dir) if ostype =~ /linux-musl/
118
119
  PatchHelpers.restore_and_save_files(FILES_TO_RESTORE_MSYS, ruby_source_dir) if ostype =~ /msys/
119
120
  end
120
121
 
122
+ # Pass1A
123
+ # Patch gem_prelude.rb
124
+ def pass1a(ruby_source_dir)
125
+ puts "-- Running pass1a script"
126
+
127
+ do_patch(Pass1A.get_patch_map, ruby_source_dir)
128
+ end
129
+
121
130
  # Pass2
122
131
  # Creates packaging environment, patching ensures that tebako package is linked statically
123
132
  def pass2(ostype, ruby_source_dir, deps_lib_dir, ruby_ver)
@@ -26,5 +26,5 @@
26
26
  # POSSIBILITY OF SUCH DAMAGE.
27
27
 
28
28
  module Tebako
29
- VERSION = "0.6.5"
29
+ VERSION = "0.6.6"
30
30
  end
@@ -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="if(WIN32)"
105
- sbst="if(MSVC) # tebako patched"
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-2023, [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
  #
@@ -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.6.5
1
+ 0.6.6
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.5
4
+ version: 0.6.6
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-05-15 00:00:00.000000000 Z
11
+ date: 2024-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -69,6 +69,7 @@ files:
69
69
  - lib/tebako/error.rb
70
70
  - lib/tebako/packager.rb
71
71
  - lib/tebako/packager/pass1.rb
72
+ - lib/tebako/packager/pass1a.rb
72
73
  - lib/tebako/packager/pass2.rb
73
74
  - lib/tebako/packager/patch_buildsystem.rb
74
75
  - lib/tebako/packager/patch_helpers.rb