tebako 0.5.5 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CMakeLists.txt +7 -21
- data/README.adoc +10 -10
- data/common.env +1 -2
- data/exe/tebako-packager +8 -6
- data/lib/tebako/cli_helpers.rb +5 -3
- data/lib/tebako/packager/pass2.rb +1 -1
- data/lib/tebako/packager/patch_helpers.rb +57 -1
- data/lib/tebako/packager.rb +60 -61
- data/lib/tebako/version.rb +1 -1
- data/tools/.github/workflows/lint.yml +2 -2
- data/tools/.github/workflows/test.yml +124 -0
- data/tools/.gitignore +1 -0
- data/tools/README.md +44 -0
- data/tools/ci-scripts/patch-fbthrift.sh +21 -1
- data/tools/ci-scripts/patch-folly.sh +70 -42
- data/tools/ci-scripts/tools.sh +63 -0
- data/tools/cmake-scripts/macos-environment.cmake +8 -31
- data/tools/cmake-scripts/setup-libarchive.cmake +92 -0
- data/tools/cmake-scripts/setup-libhowardhinnerdate.cmake +55 -0
- data/tools/cmake-scripts/setup-libutfcpp.cmake +56 -0
- data/tools/{ci-scripts/patch-system-includes.sh → tests/setup-libhowardhinnerdate/CMakeLists.txt} +8 -32
- data/tools/tests/setup-librachive/CMakeLists.txt +35 -0
- data/tools/tests/setup-libutfcpp/CMakeLists.txt +36 -0
- data/version.txt +1 -1
- metadata +12 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b277eb25391af787dab395176c4c8de0ce0946c4051761777819c6ba8dfc85b
|
4
|
+
data.tar.gz: fd68af8da0fd9900620627cb769a693953a91936a45f4c1049e233ad2ce250be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b93340ce7093fc7c43f1c7948b1392e73980b76ce88e9b0489d20de33f4262965dadba78fa8805597928088d9a0763074017d37f0cf538735ab4baed03503206
|
7
|
+
data.tar.gz: 798727d58f68b36d7ce2f5ce642223680c1a0f76f4f78851da95531c2cdce891eb59badbe782289631bbe9ee301e43c73c685a616582f2a07fd6319809d5606d
|
data/CMakeLists.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2021-
|
1
|
+
# Copyright (c) 2021-2024 [Ribose Inc](https://www.ribose.com).
|
2
2
|
# All rights reserved.
|
3
3
|
# This file is a part of tebako
|
4
4
|
#
|
@@ -177,7 +177,7 @@ elseif("${OSTYPE_TXT}" MATCHES "^darwin.*")
|
|
177
177
|
else(${RUBY_VER} VERSION_LESS "3.1.0")
|
178
178
|
set(OPENSSL_VER "3")
|
179
179
|
endif(${RUBY_VER} VERSION_LESS "3.1.0")
|
180
|
-
set(BUILD_OPENSSL_ROOT_DIR "${
|
180
|
+
set(BUILD_OPENSSL_ROOT_DIR "${BREW_PREFIX}/opt/openssl@${OPENSSL_VER}")
|
181
181
|
endif()
|
182
182
|
|
183
183
|
if(IS_DARWIN)
|
@@ -243,15 +243,7 @@ if(IS_MSYS)
|
|
243
243
|
endif(IS_MSYS)
|
244
244
|
|
245
245
|
def_ext_prj_g(INCBIN "348e36b")
|
246
|
-
def_ext_prj_g(DWARFS_WR "v0.4.
|
247
|
-
|
248
|
-
if (DEFINED ENV{BUNDLER_VER})
|
249
|
-
set(BUNDLER_VER $ENV{BUNDLER_VER})
|
250
|
-
set(BUNDLER_ANNOTATION "environment")
|
251
|
-
else()
|
252
|
-
set(BUNDLER_VER "2.3.22")
|
253
|
-
set(BUNDLER_ANNOTATION "default")
|
254
|
-
endif()
|
246
|
+
def_ext_prj_g(DWARFS_WR "v0.4.3")
|
255
247
|
|
256
248
|
find_library(_LIBNCURSES "libncurses.a")
|
257
249
|
if(${_LIBNCURSES} STREQUAL "_LIBNCURSES-NOTFOUND")
|
@@ -268,7 +260,6 @@ endif(${RUBY_VER} VERSION_LESS "3.2.0")
|
|
268
260
|
|
269
261
|
message("Configuration summary:")
|
270
262
|
message(STATUS "ruby: v${RUBY_VER} at ${RUBY_SOURCE_DIR}")
|
271
|
-
message(STATUS "bundler version: ${BUNDLER_VER} (${BUNDLER_ANNOTATION})")
|
272
263
|
if(WITH_OPENSSL_BUILD)
|
273
264
|
message(STATUS "openssl: building @${OPENSSL_TAG} at ${OPENSSL_SOURCE_DIR}")
|
274
265
|
endif(WITH_OPENSSL_BUILD)
|
@@ -437,9 +428,9 @@ endif()
|
|
437
428
|
set(C_FLAGS_DEST cppflags)
|
438
429
|
|
439
430
|
if(IS_DARWIN)
|
440
|
-
string(CONCAT RUBY_C_FLAGS ${RUBY_C_FLAGS} " -I${
|
441
|
-
string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -L${
|
442
|
-
set(OPENSSL_RUBY_OPTION "--with-openssl-dir=${
|
431
|
+
string(CONCAT RUBY_C_FLAGS ${RUBY_C_FLAGS} " -I${BREW_PREFIX}/opt/openssl@${OPENSSL_VER}/include -I${BREW_PREFIX}/opt/zlib/include -I${BREW_PREFIX}/include")
|
432
|
+
string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -L${BREW_PREFIX}/opt/openssl@${OPENSSL_VER}/lib -L${BREW_PREFIX}/opt/zlib/lib -L${BREW_PREFIX}/lib")
|
433
|
+
set(OPENSSL_RUBY_OPTION "--with-openssl-dir=${BREW_PREFIX}/opt/openssl@${OPENSSL_VER}")
|
443
434
|
set(C_FLAGS_DEST cflags)
|
444
435
|
else(IS_DARWIN)
|
445
436
|
string(CONCAT RUBY_L_FLAGS ${RUBY_L_FLAGS} " -static-libgcc")
|
@@ -511,7 +502,7 @@ else (${SETUP_MODE})
|
|
511
502
|
list(LENGTH GEMS GLENGTH)
|
512
503
|
|
513
504
|
add_custom_target(clean_filesystem
|
514
|
-
COMMAND ruby ${EXE}/tebako-packager deploy ${RUBY_STASH_DIR} ${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR} ${
|
505
|
+
COMMAND ruby ${EXE}/tebako-packager deploy ${RUBY_STASH_DIR} ${DATA_SRC_DIR} ${DATA_PRE_DIR} ${DATA_BIN_DIR} ${GFLENGTH}
|
515
506
|
DEPENDS ${RUBY_PRJ}
|
516
507
|
)
|
517
508
|
if(GSLENGTH GREATER 0)
|
@@ -527,8 +518,6 @@ else (${SETUP_MODE})
|
|
527
518
|
add_custom_target(source_filesystem
|
528
519
|
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${DATA_PRE_DIR} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
529
520
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TGD}
|
530
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
531
|
-
${TBD}/gem${CMD_SUFFIX} install bundler -v '${BUNDLER_VER}' --source 'https://rubygems.org/' --no-document --install-dir ${TGD}
|
532
521
|
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
533
522
|
${TBD}/bundle${CMD_SUFFIX} config set --local force_ruby_platform ${FORCE_RUBY_PLATFORM}
|
534
523
|
COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_PRE_DIR} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
@@ -572,9 +561,6 @@ else (${SETUP_MODE})
|
|
572
561
|
${CMAKE_COMMAND} -E false )
|
573
562
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${TLD}
|
574
563
|
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${FS_ROOT} -DTARGET_DIR=${TLD} -P ${CMAKE_SOURCE_DIR}/cmake/copy_dir.cmake
|
575
|
-
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
576
|
-
${TBD}/gem${CMD_SUFFIX} install bundler -v '${BUNDLER_VER}'
|
577
|
-
--source 'https://rubygems.org/' --no-document --install-dir ${TGD}
|
578
564
|
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
579
565
|
${TBD}/bundle${CMD_SUFFIX} config build.ffi --disable-system-libffi
|
580
566
|
COMMAND ${CMAKE_COMMAND} -E chdir ${TLD} ${CMAKE_COMMAND} -E env --unset=GEM_HOME --unset=GEM_PATH TEBAKO_PASS_THROUGH=1
|
data/README.adoc
CHANGED
@@ -33,18 +33,18 @@ In the future:
|
|
33
33
|
|
34
34
|
The Tebako packager is tested on the following platforms:
|
35
35
|
|
36
|
-
* Linux: Ubuntu 20.04; Alpine 3.
|
37
|
-
* macOS: macOS 11
|
36
|
+
* Linux: Ubuntu 20.04; Alpine 3.17
|
37
|
+
* macOS: macOS 11 (Big Sur), 12 (Monterey), 13 (Ventura)
|
38
38
|
* Windows: TBD
|
39
39
|
|
40
40
|
== Supported Ruby versions
|
41
41
|
|
42
42
|
The Tebako packager supports the following versions of Ruby for packaging:
|
43
43
|
|
44
|
-
* 2.7.
|
44
|
+
* 2.7.8
|
45
45
|
* 3.0.6
|
46
46
|
* 3.1.4
|
47
|
-
* 3.2.
|
47
|
+
* 3.2.3
|
48
48
|
|
49
49
|
Support of specific version including minor release requires some effort, sometimes extensive
|
50
50
|
but our goal is to be able to package all maintained Ruby releases.
|
@@ -53,7 +53,7 @@ but our goal is to be able to package all maintained Ruby releases.
|
|
53
53
|
|
54
54
|
=== Ubuntu
|
55
55
|
|
56
|
-
==== GNU C/C++
|
56
|
+
==== GNU C/C++ 10+ or Clang C/C++ 12+
|
57
57
|
|
58
58
|
==== CMake version 3.20+
|
59
59
|
|
@@ -120,7 +120,7 @@ export TZ=Etc/UTC
|
|
120
120
|
apt-get update
|
121
121
|
apt-get install -y software-properties-common
|
122
122
|
add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
123
|
-
apt-get install -y gcc-
|
123
|
+
apt-get install -y gcc-10 g++-10
|
124
124
|
|
125
125
|
apt-get install -y curl git ruby ruby-dev pkg-config bison flex make autoconf
|
126
126
|
curl https://apt.kitware.com/kitware-archive.sh | bash
|
@@ -164,7 +164,7 @@ cmmands below.
|
|
164
164
|
----
|
165
165
|
tebako press \
|
166
166
|
[-p|--prefix=<tebako-root-folder>] \
|
167
|
-
[-R|--Ruby=<2.7.
|
167
|
+
[-R|--Ruby=<2.7.8|3.0.6|3.1.4|3.2.3>] \
|
168
168
|
-r|--root=<project-root-folder> \
|
169
169
|
-e|--entry-point=<entry-point> \
|
170
170
|
[-o|--output=<packaged file name>] \
|
@@ -176,7 +176,7 @@ Where:
|
|
176
176
|
* `<tebako-root-folder>`, the Tebako setup folder (optional, defaults to current
|
177
177
|
folder)
|
178
178
|
|
179
|
-
* `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.
|
179
|
+
* `Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.1.4)
|
180
180
|
|
181
181
|
* `<project-root>`, a folder at the host source file system where project files
|
182
182
|
are located
|
@@ -214,7 +214,7 @@ invocation of press command.
|
|
214
214
|
----
|
215
215
|
tebako setup \
|
216
216
|
[-p |--prefix=<tebako-root-folder>] \
|
217
|
-
[-R |--Ruby=<2.7.
|
217
|
+
[-R |--Ruby=<2.7.8|3.0.6|3.1.4|3.2.3>]
|
218
218
|
----
|
219
219
|
|
220
220
|
Where:
|
@@ -257,7 +257,7 @@ Normally you do not need to do it since tebako packager optimizes artifacts life
|
|
257
257
|
----
|
258
258
|
tebako clean_ruby
|
259
259
|
[-p|--prefix=<tebako-root-folder>]
|
260
|
-
[-R|--Ruby=<2.7.
|
260
|
+
[-R|--Ruby=<2.7.8|3.0.6|3.1.4|3.2.3>]
|
261
261
|
----
|
262
262
|
|
263
263
|
Where:
|
data/common.env
CHANGED
data/exe/tebako-packager
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
# Copyright (c) 2023 [Ribose Inc](https://www.ribose.com).
|
4
|
+
# Copyright (c) 2023-2024 [Ribose Inc](https://www.ribose.com).
|
5
5
|
# All rights reserved.
|
6
6
|
# This file is a part of tebako
|
7
7
|
#
|
@@ -78,13 +78,15 @@ begin
|
|
78
78
|
# ARGV[2] -- DATA_SRC_DIR
|
79
79
|
# ARGV[3] -- DATA_PRE_DIR
|
80
80
|
# ARGV[4] -- DATA_BIN_DIR
|
81
|
-
# ARGV[5] --
|
82
|
-
|
83
|
-
unless ARGV.length == 7
|
81
|
+
# ARGV[5] -- GFLENGTH
|
82
|
+
unless ARGV.length == 6
|
84
83
|
raise Tebako::Error,
|
85
|
-
"tebako-packager deploy command expects
|
84
|
+
"tebako-packager deploy command expects 6 arguments, #{ARGV.length} has been provided."
|
86
85
|
end
|
87
|
-
Tebako::Packager.
|
86
|
+
Tebako::Packager.init(ARGV[1], ARGV[2], ARGV[3], ARGV[4])
|
87
|
+
# Assume that "<TARGET_BIN_DIR (TBD)>" is <DATA_SRC_DIR>/bin"
|
88
|
+
# That shall match CMakeLists.txt settings
|
89
|
+
Tebako::Packager.deploy(ARGV[2], "#{ARGV[2]}/bin", ARGV[5])
|
88
90
|
else
|
89
91
|
raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
|
90
92
|
end
|
data/lib/tebako/cli_helpers.rb
CHANGED
@@ -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
|
#
|
@@ -59,10 +59,11 @@ module Tebako
|
|
59
59
|
end
|
60
60
|
|
61
61
|
RUBY_VERSIONS = {
|
62
|
-
"2.7.
|
62
|
+
"2.7.8" => "c2dab63cbc8f2a05526108ad419efa63a67ed4074dbbcf9fc2b1ca664cb45ba0",
|
63
63
|
"3.0.6" => "6e6cbd490030d7910c0ff20edefab4294dfcd1046f0f8f47f78b597987ac683e",
|
64
64
|
"3.1.4" => "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6",
|
65
|
-
"3.2.
|
65
|
+
"3.2.3" => "af7f1757d9ddb630345988139211f1fd570ff5ba830def1cc7c468ae9b65c9ba",
|
66
|
+
"3.3.0" => "96518814d9832bece92a85415a819d4893b307db5921ae1f0f751a9a89a56b7d"
|
66
67
|
}.freeze
|
67
68
|
|
68
69
|
DEFAULT_RUBY_VERSION = "3.1.4"
|
@@ -130,6 +131,7 @@ module Tebako
|
|
130
131
|
|
131
132
|
def prefix
|
132
133
|
@prefix ||= if options["prefix"].nil?
|
134
|
+
puts "No prefix specified, using ~/.tebako"
|
133
135
|
File.expand_path("~/.tebako")
|
134
136
|
elsif options["prefix"] == "PWD"
|
135
137
|
Dir.pwd
|
@@ -140,7 +140,7 @@ module Tebako
|
|
140
140
|
# rubocop:enable Metrics/MethodLength
|
141
141
|
|
142
142
|
def mlibs_subst(ostype, deps_lib_dir, ruby_ver)
|
143
|
-
yjit_libs = PatchHelpers.
|
143
|
+
yjit_libs = PatchHelpers.ruby32only?(ruby_ver) ? "$(YJIT_LIBS) " : ""
|
144
144
|
{
|
145
145
|
"MAINLIBS = #{yjit_libs}@MAINLIBS@" =>
|
146
146
|
"# -- Start of tebako patch -- \n" \
|
@@ -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
|
#
|
@@ -34,6 +34,16 @@ module Tebako
|
|
34
34
|
# Ruby patching helpers (pass2)
|
35
35
|
module PatchHelpers
|
36
36
|
class << self
|
37
|
+
def patch_file(fname, mapping)
|
38
|
+
raise Tebako::Error, "Could not patch #{fname} because it does not exist." unless File.exist?(fname)
|
39
|
+
|
40
|
+
puts " ... patching #{fname}"
|
41
|
+
restore_and_save(fname)
|
42
|
+
contents = File.read(fname)
|
43
|
+
mapping.each { |pattern, subst| contents.sub!(pattern, subst) }
|
44
|
+
File.open(fname, "w") { |file| file << contents }
|
45
|
+
end
|
46
|
+
|
37
47
|
def get_prefix_macos(package)
|
38
48
|
out, st = Open3.capture2("brew --prefix #{package}")
|
39
49
|
raise Tebako::Error, "brew --prefix #{package} failed with code #{st.exitstatus}" unless st.exitstatus.zero?
|
@@ -51,6 +61,28 @@ module Tebako
|
|
51
61
|
out
|
52
62
|
end
|
53
63
|
|
64
|
+
def recreate(dirname)
|
65
|
+
FileUtils.rm_rf(dirname, noop: nil, verbose: nil, secure: true)
|
66
|
+
FileUtils.mkdir(dirname)
|
67
|
+
end
|
68
|
+
|
69
|
+
def restore_and_save(fname)
|
70
|
+
raise Tebako::Error, "Could not save #{fname} because it does not exist." unless File.exist?(fname)
|
71
|
+
|
72
|
+
old_fname = "#{fname}.old"
|
73
|
+
if File.exist?(old_fname)
|
74
|
+
FileUtils.rm_f(fname)
|
75
|
+
File.rename(old_fname, fname)
|
76
|
+
end
|
77
|
+
FileUtils.cp(fname, old_fname)
|
78
|
+
end
|
79
|
+
|
80
|
+
def restore_and_save_files(files, ruby_source_dir)
|
81
|
+
files.each do |fname|
|
82
|
+
restore_and_save "#{ruby_source_dir}/#{fname}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
54
86
|
def ruby3x?(ruby_ver)
|
55
87
|
ruby_ver[0] == "3"
|
56
88
|
end
|
@@ -63,6 +95,30 @@ module Tebako
|
|
63
95
|
ruby3x?(ruby_ver) && ruby_ver[2].to_i >= 2
|
64
96
|
end
|
65
97
|
|
98
|
+
def ruby32only?(ruby_ver)
|
99
|
+
ruby3x?(ruby_ver) && ruby_ver[2].to_i == 2
|
100
|
+
end
|
101
|
+
|
102
|
+
def ruby33?(ruby_ver)
|
103
|
+
ruby3x?(ruby_ver) && ruby_ver[2].to_i >= 3
|
104
|
+
end
|
105
|
+
|
106
|
+
# Sets up temporary environment variables and yields to the
|
107
|
+
# block. When the block exits, the environment variables are set
|
108
|
+
# back to their original values.
|
109
|
+
def with_env(hash)
|
110
|
+
old = {}
|
111
|
+
hash.each do |k, v|
|
112
|
+
old[k] = ENV.fetch(k, nil)
|
113
|
+
ENV[k] = v
|
114
|
+
end
|
115
|
+
begin
|
116
|
+
yield
|
117
|
+
ensure
|
118
|
+
hash.each_key { |k| ENV[k] = old[k] }
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
66
122
|
def yaml_reference(ruby_ver)
|
67
123
|
ruby32?(ruby_ver) ? "-l:libyaml.a" : ""
|
68
124
|
end
|
data/lib/tebako/packager.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
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
|
#
|
@@ -30,6 +30,7 @@ require "fileutils"
|
|
30
30
|
require_relative "error"
|
31
31
|
require_relative "packager/pass1"
|
32
32
|
require_relative "packager/pass2"
|
33
|
+
require_relative "packager/patch_helpers"
|
33
34
|
|
34
35
|
# Tebako - an executable packager
|
35
36
|
module Tebako
|
@@ -62,20 +63,45 @@ module Tebako
|
|
62
63
|
"TEBAKO_PASS_THROUGH" => "1"
|
63
64
|
}.freeze
|
64
65
|
|
66
|
+
# Magic version numbers used to ensure compatibility for Ruby 2.7.x, 3.0.x
|
67
|
+
# These are the minimal versions required to provide linux-gnu / linux-musl differentiantion by bundler
|
68
|
+
# Ruby 3.1+ default bubdler/rubygems versions work correctly out of the box
|
69
|
+
BUNDLER_VERSION = "2.4.22"
|
70
|
+
RUBYGEMS_VERSION = "3.4.22"
|
71
|
+
|
65
72
|
class << self
|
73
|
+
# Deploy
|
74
|
+
def deploy(src_dir, tbd, gflength)
|
75
|
+
puts "-- Running deploy script"
|
76
|
+
|
77
|
+
ruby_ver = ruby_version(tbd)
|
78
|
+
update_rubygems(tbd, "#{src_dir}/lib", ruby_ver, RUBYGEMS_VERSION)
|
79
|
+
install_gem tbd, "tebako-runtime"
|
80
|
+
install_gem tbd, "bundler", (PatchHelpers.ruby31?(ruby_ver) ? nil : BUNDLER_VERSION) if gflength.to_i != 0
|
81
|
+
end
|
82
|
+
|
83
|
+
# Deploy
|
84
|
+
def init(stash_dir, src_dir, pre_dir, bin_dir)
|
85
|
+
puts "-- Running init script"
|
86
|
+
|
87
|
+
puts " ... creating packaging environment at #{src_dir}"
|
88
|
+
PatchHelpers.recreate([src_dir, pre_dir, bin_dir])
|
89
|
+
FileUtils.cp_r "#{stash_dir}/.", src_dir
|
90
|
+
end
|
91
|
+
|
66
92
|
# Pass1
|
67
93
|
# Executed before Ruby build, patching ensures that Ruby itself is linked statically
|
68
94
|
def pass1(ostype, ruby_source_dir, mount_point, src_dir, ruby_ver)
|
69
95
|
puts "-- Running pass1 script"
|
70
96
|
|
71
|
-
recreate(src_dir)
|
97
|
+
PatchHelpers.recreate(src_dir)
|
72
98
|
do_patch(Pass1.get_patch_map(ostype, mount_point, ruby_ver), ruby_source_dir)
|
73
99
|
|
74
100
|
# Roll back pass2 patches
|
75
101
|
# Just in case we are recovering after some error
|
76
|
-
restore_and_save_files(FILES_TO_RESTORE, ruby_source_dir)
|
77
|
-
restore_and_save_files(FILES_TO_RESTORE_MUSL, ruby_source_dir) if ostype =~ /linux-musl/
|
78
|
-
restore_and_save_files(FILES_TO_RESTORE_MSYS, ruby_source_dir) if ostype =~ /msys/
|
102
|
+
PatchHelpers.restore_and_save_files(FILES_TO_RESTORE, ruby_source_dir)
|
103
|
+
PatchHelpers.restore_and_save_files(FILES_TO_RESTORE_MUSL, ruby_source_dir) if ostype =~ /linux-musl/
|
104
|
+
PatchHelpers.restore_and_save_files(FILES_TO_RESTORE_MSYS, ruby_source_dir) if ostype =~ /msys/
|
79
105
|
end
|
80
106
|
|
81
107
|
# Pass2
|
@@ -100,81 +126,54 @@ module Tebako
|
|
100
126
|
# end
|
101
127
|
|
102
128
|
puts " ... saving pristine ruby environment to #{stash_dir}"
|
103
|
-
recreate(stash_dir)
|
129
|
+
PatchHelpers.recreate(stash_dir)
|
104
130
|
FileUtils.cp_r "#{src_dir}/.", stash_dir
|
105
131
|
end
|
106
132
|
|
107
|
-
# Deploy
|
108
|
-
def deploy(stash_dir, src_dir, pre_dir, bin_dir, tbd)
|
109
|
-
puts "-- Running deploy script"
|
110
|
-
|
111
|
-
puts " ... creating packaging environment at #{src_dir}"
|
112
|
-
recreate([src_dir, pre_dir, bin_dir])
|
113
|
-
FileUtils.cp_r "#{stash_dir}/.", src_dir
|
114
|
-
|
115
|
-
install_gem tbd, "tebako-runtime"
|
116
|
-
end
|
117
|
-
|
118
133
|
private
|
119
134
|
|
120
|
-
def install_gem(tbd, name)
|
121
|
-
puts " ... installing #{name} gem"
|
122
|
-
with_env(DEPLOY_ENV) do
|
123
|
-
|
135
|
+
def install_gem(tbd, name, ver = nil)
|
136
|
+
puts " ... installing #{name} gem#{" version #{ver}" if ver}"
|
137
|
+
PatchHelpers.with_env(DEPLOY_ENV) do
|
138
|
+
params = ["#{tbd}/gem", "install", name.to_s]
|
139
|
+
params.push("-v", ver.to_s) if ver
|
140
|
+
|
141
|
+
out, st = Open3.capture2e(*params)
|
124
142
|
raise Tebako::Error, "Failed to install #{name} (#{st}):\n #{out}" unless st.exitstatus.zero?
|
125
143
|
end
|
126
144
|
end
|
127
145
|
|
128
146
|
def do_patch(patch_map, root)
|
129
|
-
patch_map.each { |fname, mapping| patch_file("#{root}/#{fname}", mapping) }
|
147
|
+
patch_map.each { |fname, mapping| PatchHelpers.patch_file("#{root}/#{fname}", mapping) }
|
130
148
|
end
|
131
149
|
|
132
|
-
def
|
133
|
-
|
150
|
+
def ruby_version(tbd)
|
151
|
+
ruby_version = nil
|
152
|
+
PatchHelpers.with_env(DEPLOY_ENV) do
|
153
|
+
out, st = Open3.capture2e("#{tbd}/ruby", "--version")
|
154
|
+
raise Tebako::Error, "Failed to run ruby --version" unless st.exitstatus.zero?
|
134
155
|
|
135
|
-
|
136
|
-
|
137
|
-
contents = File.read(fname)
|
138
|
-
mapping.each { |pattern, subst| contents.sub!(pattern, subst) }
|
139
|
-
File.open(fname, "w") { |file| file << contents }
|
140
|
-
end
|
141
|
-
|
142
|
-
def recreate(dirname)
|
143
|
-
FileUtils.rm_rf(dirname, noop: nil, verbose: nil, secure: true)
|
144
|
-
FileUtils.mkdir(dirname)
|
145
|
-
end
|
146
|
-
|
147
|
-
def restore_and_save(fname)
|
148
|
-
raise Tebako::Error, "Could not save #{fname} because it does not exist." unless File.exist?(fname)
|
156
|
+
match = out.match(/ruby (\d+\.\d+\.\d+)/)
|
157
|
+
raise Tebako::Error, "Failed to parse Ruby version from #{out}" unless match
|
149
158
|
|
150
|
-
|
151
|
-
if File.exist?(old_fname)
|
152
|
-
FileUtils.rm_f(fname)
|
153
|
-
File.rename(old_fname, fname)
|
159
|
+
ruby_version = match[1]
|
154
160
|
end
|
155
|
-
|
161
|
+
ruby_version
|
156
162
|
end
|
157
163
|
|
158
|
-
def
|
159
|
-
|
160
|
-
restore_and_save "#{ruby_source_dir}/#{fname}"
|
161
|
-
end
|
162
|
-
end
|
164
|
+
def update_rubygems(tbd, tld, ruby_ver, gem_ver)
|
165
|
+
return if PatchHelpers.ruby31?(ruby_ver)
|
163
166
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
old = {}
|
169
|
-
hash.each do |k, v|
|
170
|
-
old[k] = ENV.fetch(k, nil)
|
171
|
-
ENV[k] = v
|
172
|
-
end
|
173
|
-
begin
|
174
|
-
yield
|
175
|
-
ensure
|
176
|
-
hash.each { |k, _v| ENV[k] = old[k] }
|
167
|
+
puts " ... updating rubygems to #{gem_ver}"
|
168
|
+
PatchHelpers.with_env(DEPLOY_ENV) do
|
169
|
+
out, st = Open3.capture2e("#{tbd}/gem", "update", "--no-doc", "--system", gem_ver.to_s)
|
170
|
+
raise Tebako::Error, "Failed to update rubugems to #{gem_ver} (#{st}):\n #{out}" unless st.exitstatus.zero?
|
177
171
|
end
|
172
|
+
ruby_api_ver = ruby_ver.split(".")[0..1].join(".")
|
173
|
+
# Autoload cannot handle statically linked openssl extension
|
174
|
+
# Changing it to require seems to be the simplest solution
|
175
|
+
PatchHelpers.patch_file("#{tld}/ruby/site_ruby/#{ruby_api_ver}.0/rubygems/openssl.rb",
|
176
|
+
{ "autoload :OpenSSL, \"openssl\"" => "require \"openssl\"" })
|
178
177
|
end
|
179
178
|
end
|
180
179
|
end
|
data/lib/tebako/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2022, [Ribose Inc](https://www.ribose.com).
|
1
|
+
# Copyright (c) 2022-2024, [Ribose Inc](https://www.ribose.com).
|
2
2
|
# All rights reserved.
|
3
3
|
# This file is a part of tebako
|
4
4
|
#
|
@@ -35,7 +35,7 @@ jobs:
|
|
35
35
|
shellcheck:
|
36
36
|
runs-on: ubuntu-latest
|
37
37
|
steps:
|
38
|
-
- uses: actions/checkout@
|
38
|
+
- uses: actions/checkout@v4
|
39
39
|
- uses: ludeeus/action-shellcheck@master
|
40
40
|
env:
|
41
41
|
SHELLCHECK_OPTS: -x
|
@@ -0,0 +1,124 @@
|
|
1
|
+
# Copyright (c) 2024, [Ribose Inc](https://www.ribose.com).
|
2
|
+
# All rights reserved.
|
3
|
+
# This file is a part of tebako
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions
|
7
|
+
# are met:
|
8
|
+
# 1. Redistributions of source code must retain the above copyright
|
9
|
+
# notice, this list of conditions and the following disclaimer.
|
10
|
+
# 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer in the
|
12
|
+
# documentation and/or other materials provided with the distribution.
|
13
|
+
#
|
14
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
15
|
+
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
16
|
+
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
17
|
+
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS
|
18
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
19
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
20
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
21
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
22
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
23
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
24
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
25
|
+
|
26
|
+
name: test
|
27
|
+
|
28
|
+
on:
|
29
|
+
push:
|
30
|
+
branches: [ master ]
|
31
|
+
pull_request:
|
32
|
+
workflow_dispatch:
|
33
|
+
|
34
|
+
concurrency:
|
35
|
+
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
|
36
|
+
cancel-in-progress: true
|
37
|
+
|
38
|
+
jobs:
|
39
|
+
test-setup-librachive:
|
40
|
+
name: test setup-librachive on ${{ matrix.os }}
|
41
|
+
runs-on: ${{ matrix.os }}
|
42
|
+
strategy:
|
43
|
+
fail-fast: false
|
44
|
+
matrix:
|
45
|
+
os: [ ubuntu-20.04, macos-11.0 ]
|
46
|
+
steps:
|
47
|
+
- name: Checkout
|
48
|
+
uses: actions/checkout@v4
|
49
|
+
|
50
|
+
- name: Run cmake script
|
51
|
+
run: |
|
52
|
+
cmake -B build/setup-librachive -DROOT=$PWD tests/setup-librachive
|
53
|
+
cmake --build build/setup-librachive
|
54
|
+
|
55
|
+
- name: Test setup-librachive
|
56
|
+
run: |
|
57
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
58
|
+
test -f build/setup-librachive/deps/lib/pkgconfig/libarchive.pc
|
59
|
+
test -f build/setup-librachive/deps/lib/libarchive.so || test -f build/setup-librachive/deps/lib/libarchive.dylib
|
60
|
+
test -f build/setup-librachive/deps/lib/libarchive.a
|
61
|
+
test -f build/setup-librachive/deps/include/archive.h
|
62
|
+
test -f build/setup-librachive/deps/include/archive_entry.h
|
63
|
+
|
64
|
+
test-setup-libutfcpp:
|
65
|
+
name: test setup-libutfcpp on ${{ matrix.os }}
|
66
|
+
runs-on: ${{ matrix.os }}
|
67
|
+
strategy:
|
68
|
+
fail-fast: false
|
69
|
+
matrix:
|
70
|
+
os: [ ubuntu-20.04, macos-11.0 ]
|
71
|
+
steps:
|
72
|
+
- name: Checkout
|
73
|
+
uses: actions/checkout@v4
|
74
|
+
|
75
|
+
- name: Run cmake script
|
76
|
+
run: |
|
77
|
+
cmake -B build/setup-libutfcpp -DROOT=$PWD tests/setup-libutfcpp
|
78
|
+
cmake --build build/setup-libutfcpp
|
79
|
+
|
80
|
+
- name: Test setup-libutfcpp
|
81
|
+
run: |
|
82
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
83
|
+
test -f build/setup-libutfcpp/deps/include/utf8.h
|
84
|
+
test -d build/setup-libutfcpp/deps/include/utf8
|
85
|
+
|
86
|
+
test-setup-libhowardhinnerdate:
|
87
|
+
name: test setup-libhowardhinnerdate on ${{ matrix.os }}
|
88
|
+
runs-on: ${{ matrix.os }}
|
89
|
+
strategy:
|
90
|
+
fail-fast: false
|
91
|
+
matrix:
|
92
|
+
os: [ ubuntu-20.04, macos-11.0 ]
|
93
|
+
steps:
|
94
|
+
- name: Checkout
|
95
|
+
uses: actions/checkout@v4
|
96
|
+
|
97
|
+
- name: Run cmake script
|
98
|
+
run: |
|
99
|
+
cmake -B build/setup-libhowardhinnerdate -DROOT=$PWD tests/setup-libhowardhinnerdate
|
100
|
+
cmake --build build/setup-libhowardhinnerdate
|
101
|
+
|
102
|
+
- name: Test setup-libhowardhinnerdate
|
103
|
+
run: |
|
104
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
105
|
+
test -f build/setup-libhowardhinnerdate/deps/include/date/date.h
|
106
|
+
|
107
|
+
test-cross-brew-install:
|
108
|
+
name: test arm-brew-setup/install
|
109
|
+
runs-on: macos-11.0
|
110
|
+
steps:
|
111
|
+
- name: Checkout
|
112
|
+
uses: actions/checkout@v4
|
113
|
+
|
114
|
+
- name: Run arm-brew-setup
|
115
|
+
run: ci-scripts/arm-brew-setup.sh $PWD
|
116
|
+
|
117
|
+
- name: Run arm-brew-install
|
118
|
+
run: ci-scripts/arm-brew-install.sh $PWD glog
|
119
|
+
|
120
|
+
- name: Test
|
121
|
+
run: |
|
122
|
+
set -o errexit -o pipefail -o noclobber -o nounset
|
123
|
+
test -f $PWD/arm-homebrew/lib/libgflags.dylib
|
124
|
+
test -f $PWD/arm-homebrew/lib/libglog.dylib
|
data/tools/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
build/
|