tebako 0.8.5 → 0.8.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 +36 -10
- data/README.adoc +12 -3
- data/exe/tebako-packager +6 -3
- data/lib/tebako/build_helpers.rb +2 -2
- data/lib/tebako/cli.rb +10 -2
- data/lib/tebako/cli_helpers.rb +5 -1
- data/lib/tebako/packager.rb +17 -10
- data/lib/tebako/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7482a572c9c213f8c2b6b59003b7265c8668535b13de72591ef2f2750bb9a27
|
4
|
+
data.tar.gz: 2d308207651c814f42c0012a1eccf0ce02db8b4eb38f9c195c06f0cd815ba2af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15d0d729e275a6b1022159294c7a402559a34c6e3086701ca528e06ac5fc7536ed8e369061466244b0b615a40bb28aeddaa718e264e056e71e65c02c39976ded
|
7
|
+
data.tar.gz: 2c85725fe1478d2604af8a52efa44fdc2abebf66f7a854d42a033dd40fd35c0181d5a7536ecfd4d07d371e8b53f4f6d2b8685dadf0e764ef0186234ae86a6430
|
data/CMakeLists.txt
CHANGED
@@ -113,6 +113,7 @@ else(OSTYPE_RES EQUAL 0)
|
|
113
113
|
message(FATAL_ERROR "Failed to detect OSTYPE: ${OSTYPE_TXT}")
|
114
114
|
endif(OSTYPE_RES EQUAL 0)
|
115
115
|
|
116
|
+
set(IS_GNU OFF)
|
116
117
|
set(IS_MUSL OFF)
|
117
118
|
set(IS_MSYS OFF)
|
118
119
|
set(IS_DARWIN OFF)
|
@@ -121,8 +122,14 @@ set(RUBY_WITHOUT_EXT "dbm,win32,win32ole,-test-/*")
|
|
121
122
|
set(RUBY_NAME "ruby")
|
122
123
|
set(EXE_SUFFIX "")
|
123
124
|
set(DWARFS_PRELOAD OFF)
|
124
|
-
|
125
|
-
|
125
|
+
set(WITH_PATCHELF OFF)
|
126
|
+
|
127
|
+
if("${OSTYPE_TXT}" MATCHES "^linux-gnu.*")
|
128
|
+
set(IS_GNU ON)
|
129
|
+
if(REMOVE_GLIBC_PRIVATE)
|
130
|
+
set(WITH_PATCHELF ON)
|
131
|
+
endif(REMOVE_GLIBC_PRIVATE)
|
132
|
+
elseif("${OSTYPE_TXT}" MATCHES "^linux-musl.*")
|
126
133
|
set(IS_MUSL ON)
|
127
134
|
elseif("${OSTYPE_TXT}" MATCHES "^msys*")
|
128
135
|
set(IS_MSYS ON)
|
@@ -180,9 +187,7 @@ set(DATA_RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
|
180
187
|
# External projects
|
181
188
|
|
182
189
|
if ("-${RUBY_VER}" STREQUAL "-" OR "-${RUBY_HASH}" STREQUAL "-")
|
183
|
-
|
184
|
-
set(RUBY_HASH "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6")
|
185
|
-
message(STATUS "Using default Ruby version ${RUBY_VER}")
|
190
|
+
message(FATAL_ERROR "Ruby version is not specified")
|
186
191
|
endif()
|
187
192
|
|
188
193
|
set(RUBY_NAME ruby)
|
@@ -207,6 +212,8 @@ string(CONCAT RUBY_API_VER ${RUBY_VER_BASE} ".0")
|
|
207
212
|
def_ext_prj_g(DWARFS_WR "v0.5.9")
|
208
213
|
#endif(DWARFS_PRELOAD)
|
209
214
|
|
215
|
+
def_ext_prj_g(PATCHELF "65e14792061c298f1d2bc44becd48a10cbf0bc81")
|
216
|
+
|
210
217
|
set(LIBYAML_RUBY_OPTION "")
|
211
218
|
if(${RUBY_VER} VERSION_LESS "3.2.0")
|
212
219
|
set(LIBYAML_RUBY_OPTION "--enable-bundled-libyaml")
|
@@ -266,6 +273,7 @@ message(STATUS "Target local directory: ${TLD}")
|
|
266
273
|
message(STATUS "Target Gem directory:: ${TGD}")
|
267
274
|
message(STATUS "FS_MOUNT_POINT: ${FS_MOUNT_POINT}")
|
268
275
|
message(STATUS "Building for Win32 Ruby (RB_W32): ${RB_W32}")
|
276
|
+
message(STATUS "Removing GLIBC_PRIVATE reference: ${WITH_PATCHELF}")
|
269
277
|
|
270
278
|
# ...................................................................
|
271
279
|
# Other options
|
@@ -307,7 +315,7 @@ if(DWARFS_PRELOAD)
|
|
307
315
|
)
|
308
316
|
else(DWARFS_PRELOAD)
|
309
317
|
ExternalProject_Add(${DWARFS_WR_PRJ}
|
310
|
-
|
318
|
+
PREFIX ${DEPS}
|
311
319
|
GIT_REPOSITORY https://github.com/tamatebako/libdwarfs.git
|
312
320
|
GIT_TAG ${DWARFS_WR_TAG}
|
313
321
|
SOURCE_DIR ${DWARFS_WR_SOURCE_DIR}
|
@@ -328,6 +336,22 @@ else(DWARFS_PRELOAD)
|
|
328
336
|
)
|
329
337
|
endif(DWARFS_PRELOAD)
|
330
338
|
|
339
|
+
if(IS_GNU)
|
340
|
+
ExternalProject_Add(${PATCHELF_PRJ}
|
341
|
+
PREFIX ${DEPS}
|
342
|
+
GIT_REPOSITORY https://github.com/chitao1234/patchelf.git
|
343
|
+
GIT_TAG ${PATCHELF_WR_TAG}
|
344
|
+
SOURCE_DIR ${PATCHELF_SOURCE_DIR}
|
345
|
+
BINARY_DIR ${PATCHELF_BINARY_DIR}
|
346
|
+
UPDATE_COMMAND ""
|
347
|
+
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir ${PATCHELF_SOURCE_DIR} ./bootstrap.sh
|
348
|
+
COMMAND ${PATCHELF_SOURCE_DIR}/configure
|
349
|
+
--srcdir=${PATCHELF_SOURCE_DIR}
|
350
|
+
--prefix=${DEPS}
|
351
|
+
TEST_COMMAND ""
|
352
|
+
)
|
353
|
+
endif(IS_GNU)
|
354
|
+
|
331
355
|
# ...................................................................
|
332
356
|
# Ruby
|
333
357
|
|
@@ -396,6 +420,11 @@ ExternalProject_Add(${RUBY_PRJ}
|
|
396
420
|
|
397
421
|
add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ} ${LIBDWARFS_WR_PRJ})
|
398
422
|
|
423
|
+
if(IS_GNU)
|
424
|
+
add_dependencies(${RUBY_PRJ} ${PATCHELF_PRJ})
|
425
|
+
endif(IS_GNU)
|
426
|
+
|
427
|
+
|
399
428
|
if (${SETUP_MODE})
|
400
429
|
add_custom_target(setup
|
401
430
|
${CMAKE_COMMAND} -E echo "Tebako setup has completed"
|
@@ -488,16 +517,13 @@ else (${SETUP_MODE})
|
|
488
517
|
${DEPS_INCLUDE_DIR}/tebako/tebako-version.h
|
489
518
|
)
|
490
519
|
|
491
|
-
#et_target_properties(tebako-fs PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
492
|
-
#target_compile_options(tebako-fs PRIVATE -fPIE)
|
493
|
-
|
494
520
|
if(${RUBY_VER} VERSION_LESS "3.3.0" AND "${OSTYPE_TXT}" MATCHES "^msys*")
|
495
521
|
target_compile_definitions(tebako-fs PUBLIC RB_W32_PRE_33)
|
496
522
|
endif(${RUBY_VER} VERSION_LESS "3.3.0" AND "${OSTYPE_TXT}" MATCHES "^msys*")
|
497
523
|
|
498
524
|
add_dependencies(tebako-fs packaged_filesystem)
|
499
525
|
|
500
|
-
add_custom_target(tebako COMMAND ruby ${EXE}/tebako-packager finalize ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${APP_NAME} ${RUBY_VER})
|
526
|
+
add_custom_target(tebako COMMAND ruby ${EXE}/tebako-packager finalize ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${APP_NAME} ${RUBY_VER} ${DEPS_BIN_DIR}/patchelf ${WITH_PATCHELF})
|
501
527
|
add_dependencies(tebako setup tebako-fs)
|
502
528
|
|
503
529
|
endif(${SETUP_MODE})
|
data/README.adoc
CHANGED
@@ -9,6 +9,9 @@ image:https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml/ba
|
|
9
9
|
Platform tests on Cirrus:
|
10
10
|
image:https://api.cirrus-ci.com/github/tamatebako/tebako.svg?branch=main&task=ubuntu-aarch64["Ubuntu aarch64", link="https://cirrus-ci.com/github/tamatebako/tebako"]
|
11
11
|
|
12
|
+
Tools tests on GitHub:
|
13
|
+
image:https://github.com/tamatebako/tebako-ci-containers/actions/workflows/build-containers.yml/badge.svg["Tebako cobtainers", link="https://github.com/tamatebako/tebako-ci-containers/actions/workflows/build-containers.yml"]
|
14
|
+
|
12
15
|
Quality:
|
13
16
|
image:https://github.com/tamatebako/tebako/actions/workflows/lint-and-rspec.yml/badge.svg["lint and rspec", link="https://github.com/tamatebako/tebako/actions/workflows/lint-and-rspec.yml"]
|
14
17
|
image:https://codecov.io/gh/tamatebako/tebako/graph/badge.svg?token=XD3emQ5qsY["Tebako cli rspec coverage", link="https://codecov.io/gh/tamatebako/tebako"]
|
@@ -657,6 +660,7 @@ tebako press \
|
|
657
660
|
[-l|--log-level=<error|warn|debug|trace>] \
|
658
661
|
[-c|--cwd=<package current working directory>]
|
659
662
|
[-D|--devmode] \
|
663
|
+
[-P|--patchelf] \
|
660
664
|
[-t|--tebafile=<path-to-tebafile>]
|
661
665
|
----
|
662
666
|
|
@@ -689,12 +693,17 @@ If not provided, the application will start within the current folder of the hos
|
|
689
693
|
This option is required because it is not possible to change the directory to a memfs folder until the package is started, as opposed to any host folder
|
690
694
|
that can be set as the current directory before Tebako package invocation. Tebako saves original working directory in a global Ruby variable `$tebako_original_pwd`.
|
691
695
|
|
696
|
+
`devmode`:: flag that activates development mode, in which Tebako's cache and
|
697
|
+
packaging consistency checks are relaxed.
|
698
|
+
|
699
|
+
`patchelf`::
|
700
|
+
flag that removal a reference to GLIBC_PRIVATE version of libpthread from tebako package. This allows Linux Gnu packages to run against versions of
|
701
|
+
libpthread that differ from the version used for packaging. For example, package created at Ubuntu 20 system can be used on Ubuntu 22. This option makes
|
702
|
+
sense and works on Gnu Linux only. The feature is exeprimental, we may consider other approach in the future.
|
703
|
+
|
692
704
|
`tebafile`::
|
693
705
|
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
694
706
|
Please refer to the separate section below for tebafile description.
|
695
|
-
|
696
|
-
`devmode`:: flag that activates development mode, in which Tebako's cache and
|
697
|
-
packaging consistency checks are relaxed.
|
698
707
|
+
|
699
708
|
NOTES:
|
700
709
|
* Development mode is *not intended for production use* and should only be used during development.
|
data/exe/tebako-packager
CHANGED
@@ -105,12 +105,15 @@ begin
|
|
105
105
|
# ARGV[2] -- RUBY_SOURCE_DIR
|
106
106
|
# ARGV[3] -- APP_NAME
|
107
107
|
# ARGV[4] -- RUBY_VER
|
108
|
-
|
108
|
+
# ARGV[5] -- patchelf executable
|
109
|
+
# ARGV[6] -- WITH_PATHELF
|
110
|
+
unless ARGV.length == 7
|
109
111
|
raise Tebako::Error,
|
110
|
-
"tebako-packager finalize command expects
|
112
|
+
"tebako-packager finalize command expects 7 arguments, #{ARGV.length} has been provided."
|
111
113
|
end
|
112
114
|
ruby_ver = Tebako::RubyVersion.new(ARGV[4])
|
113
|
-
|
115
|
+
with_patchelf = ARGV[6].casecmp("ON").zero? || ARGV[6].casecmp("YES").zero?
|
116
|
+
Tebako::Packager.finalize(ARGV[1], ARGV[2], ARGV[3], ruby_ver, with_patchelf ? ARGV[5] : nil)
|
114
117
|
else
|
115
118
|
raise Tebako::Error, "tebako-packager cannot process #{ARGV[0]} command"
|
116
119
|
end
|
data/lib/tebako/build_helpers.rb
CHANGED
@@ -39,7 +39,7 @@ module Tebako
|
|
39
39
|
out, st = Open3.capture2e("nproc", "--all")
|
40
40
|
end
|
41
41
|
|
42
|
-
if st.exitstatus.zero?
|
42
|
+
if !st.signaled? && st.exitstatus.zero?
|
43
43
|
out.strip.to_i
|
44
44
|
else
|
45
45
|
4
|
@@ -49,7 +49,7 @@ module Tebako
|
|
49
49
|
def run_with_capture(args)
|
50
50
|
puts " ... @ #{args.join(" ")}"
|
51
51
|
out, st = Open3.capture2e(*args)
|
52
|
-
raise Tebako::Error, "Failed to run #{args.join(" ")} (#{st}):\n #{out}"
|
52
|
+
raise Tebako::Error, "Failed to run #{args.join(" ")} (#{st}):\n #{out}" if st.signaled? || !st.exitstatus.zero?
|
53
53
|
|
54
54
|
out
|
55
55
|
end
|
data/lib/tebako/cli.rb
CHANGED
@@ -46,7 +46,7 @@ module Tebako
|
|
46
46
|
package_name "Tebako"
|
47
47
|
class_option :prefix, type: :string, aliases: "-p", required: false,
|
48
48
|
desc: "A path to tebako packaging environment, '~/.tebako' ('$HOME/.tebako') by default"
|
49
|
-
class_option :devmode, type: :boolean, aliases: "-D",
|
49
|
+
class_option :devmode, type: :boolean, aliases: "-D",
|
50
50
|
desc: "Developer mode, please do not use if unsure"
|
51
51
|
class_option :tebafile, type: :string, aliases: "-t", required: false,
|
52
52
|
desc: "tebako configuration file 'tebafile', '$PWD/.tebako.yml' by default"
|
@@ -75,7 +75,13 @@ module Tebako
|
|
75
75
|
|
76
76
|
CWD_DESCRIPTION = <<~DESC
|
77
77
|
Current working directory for packaged application. This directory shall be specified relative to root.
|
78
|
-
#{" " *
|
78
|
+
#{" " * 65}# If this parameter is not set, the application will start in the current directory of the host file system.
|
79
|
+
DESC
|
80
|
+
|
81
|
+
RGP_DESCRIPTION = <<~DESC
|
82
|
+
Activates removal a reference to GLIBC_PRIVATE version of libpthread from tebako package. This allows Linux Gnu packages to run against versions of
|
83
|
+
#{" " * 65}# libpthread that differ from the version used for packaging. For example, package created at Ubuntu 20 system can be used on Ubuntu 22. This option works on Gnu Linux with
|
84
|
+
#{" " * 65}# Gnu toolchain only (not for LLVM/clang). The feature is exeprimental, we may consider other approach in the future.
|
79
85
|
DESC
|
80
86
|
|
81
87
|
desc "press", "Press tebako image"
|
@@ -91,6 +97,8 @@ module Tebako
|
|
91
97
|
method_option :Ruby, type: :string, aliases: "-R", required: false,
|
92
98
|
enum: Tebako::CliRubies::RUBY_VERSIONS.keys,
|
93
99
|
desc: "Tebako package Ruby version, #{Tebako::CliRubies::DEFAULT_RUBY_VERSION} by default"
|
100
|
+
method_option :patchelf, aliases: "-P", type: :boolean,
|
101
|
+
desc: RGP_DESCRIPTION
|
94
102
|
def press
|
95
103
|
version_cache_check unless options[:devmode]
|
96
104
|
|
data/lib/tebako/cli_helpers.rb
CHANGED
@@ -56,7 +56,7 @@ module Tebako
|
|
56
56
|
@cfg_options ||=
|
57
57
|
"-DCMAKE_BUILD_TYPE=Release -DRUBY_VER:STRING=\"#{ruby_ver}\" -DRUBY_HASH:STRING=\"#{ruby_hash}\" " \
|
58
58
|
"-DDEPS:STRING=\"#{deps}\" -G \"#{m_files}\" -B \"#{output_folder}\" -S \"#{source}\" " \
|
59
|
-
"-DTEBAKO_VERSION:STRING=\"#{Tebako::VERSION}\""
|
59
|
+
"-DREMOVE_GLIBC_PRIVATE=#{remove_glibc_private} -DTEBAKO_VERSION:STRING=\"#{Tebako::VERSION}\""
|
60
60
|
end
|
61
61
|
|
62
62
|
def clean_cache
|
@@ -174,6 +174,10 @@ module Tebako
|
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
177
|
+
def remove_glibc_private
|
178
|
+
@remove_glibc_private ||= options["patchelf"] ? "ON" : "OFF"
|
179
|
+
end
|
180
|
+
|
177
181
|
def handle_nil_prefix
|
178
182
|
env_prefix = ENV.fetch("TEBAKO_PREFIX", nil)
|
179
183
|
if env_prefix.nil?
|
data/lib/tebako/packager.rb
CHANGED
@@ -71,8 +71,7 @@ module Tebako
|
|
71
71
|
puts " ... creating Windows import library"
|
72
72
|
params = ["dlltool", "-d", def_fname(src_dir, app_name), "-D", out_fname(app_name),
|
73
73
|
"--output-lib", lib_fname(package_src_dir, ruby_ver)]
|
74
|
-
|
75
|
-
raise Tebako::Error, "Failed to create import library:\n #{out}" unless st.exitstatus.zero?
|
74
|
+
BuildHelpers.run_with_capture(params)
|
76
75
|
end
|
77
76
|
|
78
77
|
# Deploy
|
@@ -85,18 +84,16 @@ module Tebako
|
|
85
84
|
Tebako::Stripper.strip(os_type, target_dir)
|
86
85
|
end
|
87
86
|
|
88
|
-
def finalize(os_type, src_dir, app_name, ruby_ver)
|
87
|
+
def finalize(os_type, src_dir, app_name, ruby_ver, patchelf)
|
89
88
|
RubyBuilder.new(ruby_ver, src_dir).final_build
|
90
89
|
exe_suffix = Packager::PatchHelpers.exe_suffix(os_type)
|
91
90
|
src_name = File.join(src_dir, "ruby#{exe_suffix}")
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
if Packager::PatchHelpers.msys?(os_type)
|
96
|
-
FileUtils.cp(src_name, package_name)
|
97
|
-
else
|
98
|
-
Tebako::Stripper.strip_file(src_name, package_name)
|
91
|
+
unless patchelf.nil?
|
92
|
+
params = [patchelf, "--remove-needed-version", "libpthread.so.0", "GLIBC_PRIVATE", src_name]
|
93
|
+
BuildHelpers.run_with_capture(params)
|
99
94
|
end
|
95
|
+
package_name = "#{app_name}#{exe_suffix}"
|
96
|
+
strip_or_copy(os_type, src_name, package_name)
|
100
97
|
puts "Created tebako package at \"#{package_name}\""
|
101
98
|
end
|
102
99
|
|
@@ -199,6 +196,16 @@ module Tebako
|
|
199
196
|
end
|
200
197
|
ruby_version
|
201
198
|
end
|
199
|
+
|
200
|
+
def strip_or_copy(os_type, src_name, package_name)
|
201
|
+
# [TODO] On MSys strip sometimes creates a broken executable
|
202
|
+
# https://github.com/tamatebako/tebako/issues/172
|
203
|
+
if Packager::PatchHelpers.msys?(os_type)
|
204
|
+
FileUtils.cp(src_name, package_name)
|
205
|
+
else
|
206
|
+
Tebako::Stripper.strip_file(src_name, package_name)
|
207
|
+
end
|
208
|
+
end
|
202
209
|
end
|
203
210
|
end
|
204
211
|
end
|
data/lib/tebako/version.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.7
|
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-09-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|