tebako 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CMakeLists.txt +40 -10
- data/README.adoc +9 -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: 17722a182f3df63283d1b99ede4bb8a3bae7a864eb001412165cbf7e43d2c4d5
|
4
|
+
data.tar.gz: '029dd9ec847efd8f0002b148e4db1496d6a09c005879b52ae88f088e6333e1ba'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4425672dd1e610017539d3c329ab476e6f5080a91b81f9afda7c0aabeb82f6b83fdf29b4e5e1ff9b604c7eb1d20b61b029442ab902736680c33b32ba7c66fb9c
|
7
|
+
data.tar.gz: 5144425b8ebe468462352db8da92c2ea6483a365bd88e7dd992d3d09dbac1bb0f4f57865e1e298adcc8e66ff3a90f4e21f85b9ffba6ff624fca42a05a1c5f85f
|
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,18 @@ 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
|
+
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
131
|
+
set(WITH_PATCHELF ON)
|
132
|
+
else()
|
133
|
+
message(WARNING "Elf file patching is supported for GNU toolchain only. 'patchelf' setting ignored")
|
134
|
+
endif()
|
135
|
+
endif(REMOVE_GLIBC_PRIVATE)
|
136
|
+
elseif("${OSTYPE_TXT}" MATCHES "^linux-musl.*")
|
126
137
|
set(IS_MUSL ON)
|
127
138
|
elseif("${OSTYPE_TXT}" MATCHES "^msys*")
|
128
139
|
set(IS_MSYS ON)
|
@@ -180,9 +191,7 @@ set(DATA_RES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/resources)
|
|
180
191
|
# External projects
|
181
192
|
|
182
193
|
if ("-${RUBY_VER}" STREQUAL "-" OR "-${RUBY_HASH}" STREQUAL "-")
|
183
|
-
|
184
|
-
set(RUBY_HASH "a3d55879a0dfab1d7141fdf10d22a07dbf8e5cdc4415da1bde06127d5cc3c7b6")
|
185
|
-
message(STATUS "Using default Ruby version ${RUBY_VER}")
|
194
|
+
message(FATAL_ERROR "Ruby version is not specified")
|
186
195
|
endif()
|
187
196
|
|
188
197
|
set(RUBY_NAME ruby)
|
@@ -207,6 +216,8 @@ string(CONCAT RUBY_API_VER ${RUBY_VER_BASE} ".0")
|
|
207
216
|
def_ext_prj_g(DWARFS_WR "v0.5.9")
|
208
217
|
#endif(DWARFS_PRELOAD)
|
209
218
|
|
219
|
+
def_ext_prj_g(PATCHELF "master")
|
220
|
+
|
210
221
|
set(LIBYAML_RUBY_OPTION "")
|
211
222
|
if(${RUBY_VER} VERSION_LESS "3.2.0")
|
212
223
|
set(LIBYAML_RUBY_OPTION "--enable-bundled-libyaml")
|
@@ -266,6 +277,7 @@ message(STATUS "Target local directory: ${TLD}")
|
|
266
277
|
message(STATUS "Target Gem directory:: ${TGD}")
|
267
278
|
message(STATUS "FS_MOUNT_POINT: ${FS_MOUNT_POINT}")
|
268
279
|
message(STATUS "Building for Win32 Ruby (RB_W32): ${RB_W32}")
|
280
|
+
message(STATUS "Removing GLIBC_PRIVATE reference: ${WITH_PATCHELF}")
|
269
281
|
|
270
282
|
# ...................................................................
|
271
283
|
# Other options
|
@@ -307,7 +319,7 @@ if(DWARFS_PRELOAD)
|
|
307
319
|
)
|
308
320
|
else(DWARFS_PRELOAD)
|
309
321
|
ExternalProject_Add(${DWARFS_WR_PRJ}
|
310
|
-
|
322
|
+
PREFIX ${DEPS}
|
311
323
|
GIT_REPOSITORY https://github.com/tamatebako/libdwarfs.git
|
312
324
|
GIT_TAG ${DWARFS_WR_TAG}
|
313
325
|
SOURCE_DIR ${DWARFS_WR_SOURCE_DIR}
|
@@ -328,6 +340,22 @@ else(DWARFS_PRELOAD)
|
|
328
340
|
)
|
329
341
|
endif(DWARFS_PRELOAD)
|
330
342
|
|
343
|
+
if(IS_GNU)
|
344
|
+
ExternalProject_Add(${PATCHELF_PRJ}
|
345
|
+
PREFIX ${DEPS}
|
346
|
+
GIT_REPOSITORY https://github.com/chitao1234/patchelf.git
|
347
|
+
GIT_TAG ${PATCHELF_WR_TAG}
|
348
|
+
SOURCE_DIR ${PATCHELF_SOURCE_DIR}
|
349
|
+
BINARY_DIR ${PATCHELF_BINARY_DIR}
|
350
|
+
UPDATE_COMMAND ""
|
351
|
+
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E chdir ${PATCHELF_SOURCE_DIR} ./bootstrap.sh
|
352
|
+
COMMAND ${PATCHELF_SOURCE_DIR}/configure
|
353
|
+
--srcdir=${PATCHELF_SOURCE_DIR}
|
354
|
+
--prefix=${DEPS}
|
355
|
+
TEST_COMMAND ""
|
356
|
+
)
|
357
|
+
endif(IS_GNU)
|
358
|
+
|
331
359
|
# ...................................................................
|
332
360
|
# Ruby
|
333
361
|
|
@@ -396,6 +424,11 @@ ExternalProject_Add(${RUBY_PRJ}
|
|
396
424
|
|
397
425
|
add_dependencies(${RUBY_PRJ} ${DWARFS_WR_PRJ} ${LIBDWARFS_WR_PRJ})
|
398
426
|
|
427
|
+
if(IS_GNU)
|
428
|
+
add_dependencies(${RUBY_PRJ} ${PATCHELF_PRJ})
|
429
|
+
endif(IS_GNU)
|
430
|
+
|
431
|
+
|
399
432
|
if (${SETUP_MODE})
|
400
433
|
add_custom_target(setup
|
401
434
|
${CMAKE_COMMAND} -E echo "Tebako setup has completed"
|
@@ -488,16 +521,13 @@ else (${SETUP_MODE})
|
|
488
521
|
${DEPS_INCLUDE_DIR}/tebako/tebako-version.h
|
489
522
|
)
|
490
523
|
|
491
|
-
#et_target_properties(tebako-fs PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
492
|
-
#target_compile_options(tebako-fs PRIVATE -fPIE)
|
493
|
-
|
494
524
|
if(${RUBY_VER} VERSION_LESS "3.3.0" AND "${OSTYPE_TXT}" MATCHES "^msys*")
|
495
525
|
target_compile_definitions(tebako-fs PUBLIC RB_W32_PRE_33)
|
496
526
|
endif(${RUBY_VER} VERSION_LESS "3.3.0" AND "${OSTYPE_TXT}" MATCHES "^msys*")
|
497
527
|
|
498
528
|
add_dependencies(tebako-fs packaged_filesystem)
|
499
529
|
|
500
|
-
add_custom_target(tebako COMMAND ruby ${EXE}/tebako-packager finalize ${OSTYPE_TXT} ${RUBY_SOURCE_DIR} ${APP_NAME} ${RUBY_VER})
|
530
|
+
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
531
|
add_dependencies(tebako setup tebako-fs)
|
502
532
|
|
503
533
|
endif(${SETUP_MODE})
|
data/README.adoc
CHANGED
@@ -657,6 +657,7 @@ tebako press \
|
|
657
657
|
[-l|--log-level=<error|warn|debug|trace>] \
|
658
658
|
[-c|--cwd=<package current working directory>]
|
659
659
|
[-D|--devmode] \
|
660
|
+
[-P|--patchelf] \
|
660
661
|
[-t|--tebafile=<path-to-tebafile>]
|
661
662
|
----
|
662
663
|
|
@@ -689,12 +690,17 @@ If not provided, the application will start within the current folder of the hos
|
|
689
690
|
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
691
|
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
692
|
|
693
|
+
`devmode`:: flag that activates development mode, in which Tebako's cache and
|
694
|
+
packaging consistency checks are relaxed.
|
695
|
+
|
696
|
+
`patchelf`::
|
697
|
+
flag that removal a reference to GLIBC_PRIVATE version of libpthread from tebako package. This allows Linux Gnu packages to run against versions of
|
698
|
+
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
|
699
|
+
Gnu toolchain only (not for LLVM/clang). The feature is exeprimental, we may consider other approach in the future.
|
700
|
+
|
692
701
|
`tebafile`::
|
693
702
|
the tebako configuration file (optional, defaults to `$PWD/.tebako.yml`).
|
694
703
|
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
704
|
+
|
699
705
|
NOTES:
|
700
706
|
* 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.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-
|
11
|
+
date: 2024-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|