tebako 0.7.4 → 0.8.0
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 +13 -17
- data/README.adoc +656 -174
- data/common.env +1 -1
- data/lib/tebako/cli_rubies.rb +3 -5
- data/lib/tebako/packager/pass1.rb +7 -4
- data/lib/tebako/packager/pass2.rb +14 -16
- data/lib/tebako/packager/patch_buildsystem.rb +41 -7
- data/lib/tebako/packager/patch_helpers.rb +0 -4
- data/lib/tebako/packager/patch_libraries.rb +82 -62
- data/lib/tebako/packager/patch_literals.rb +15 -17
- data/lib/tebako/version.rb +1 -1
- data/src/tebako-main.cpp +7 -0
- data/version.txt +1 -1
- metadata +2 -2
data/README.adoc
CHANGED
@@ -1,70 +1,416 @@
|
|
1
|
-
= Tebako:
|
1
|
+
= Tebako: An advanced image packager for interpretive languages
|
2
2
|
|
3
|
+
Platform tests on GitHub:
|
3
4
|
image:https://github.com/tamatebako/tebako/actions/workflows/ubuntu.yml/badge.svg["Ubuntu amd64", link="https://github.com/tamatebako/tebako/actions/workflows/ubuntu.yml"]
|
4
5
|
image:https://github.com/tamatebako/tebako/actions/workflows/alpine.yml/badge.svg["Alpine", link="https://github.com/tamatebako/tebako/actions/workflows/alpine.yml"]
|
5
|
-
image:https://github.com/tamatebako/tebako/actions/workflows/macos.yml/badge.svg["
|
6
|
+
image:https://github.com/tamatebako/tebako/actions/workflows/macos.yml/badge.svg["macOS amd64", link="https://github.com/tamatebako/tebako/actions/workflows/macos.yml"]
|
6
7
|
image:https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml/badge.svg["Windows msys", link="https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml"]
|
7
8
|
|
9
|
+
Platform tests on Cirrus:
|
8
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"]
|
9
11
|
|
12
|
+
Quality:
|
10
13
|
image:https://github.com/tamatebako/tebako/actions/workflows/lint.yml/badge.svg["lint", link="https://github.com/tamatebako/tebako/actions/workflows/lint.yml"]
|
11
14
|
|
12
15
|
== Purpose
|
13
16
|
|
14
|
-
Tebako is an executable packager
|
15
|
-
|
17
|
+
Tebako is an advanced executable packager designed for applications written in
|
18
|
+
interpretive languages.
|
16
19
|
|
17
|
-
|
18
|
-
|
19
|
-
packaged software from a point in the file system.
|
20
|
+
It simplifies distribution and deployment by packaging your entire project with
|
21
|
+
a bundled runtime into a single, performant, executable binary.
|
20
22
|
|
21
|
-
|
23
|
+
== Architecture
|
22
24
|
|
23
|
-
|
24
|
-
* Support signing of the binary on macOS (via notarization)
|
25
|
+
A Tebako-packaged binary is effectively a self-executing container-in-a-file.
|
25
26
|
|
26
|
-
|
27
|
+
The packaged binary contains the following components:
|
27
28
|
|
28
|
-
*
|
29
|
-
|
30
|
-
|
31
|
-
|
29
|
+
* An on-file filesystem (OFFS) containing all the project files and
|
30
|
+
dependencies in DwarFS format.
|
31
|
+
|
32
|
+
* A runtime environment that includes the necessary libraries and interpreters,
|
33
|
+
with patched filesystem calls that redirect access of project files to the
|
34
|
+
on-file filesystem.
|
32
35
|
|
33
|
-
|
36
|
+
* An executable loader that loads the on-file filesystem in memory and executes
|
37
|
+
the project.
|
38
|
+
|
39
|
+
|
40
|
+
== Supported runtimes, platforms and architectures
|
41
|
+
|
42
|
+
Tebako artifacts can be built and executed on the following platforms and
|
43
|
+
architectures.
|
44
|
+
|
45
|
+
.Supported platforms and architectures
|
46
|
+
[cols="3", options="header"]
|
47
|
+
|===
|
48
|
+
| Platform and version | Architectures | Build system
|
34
49
|
|
35
|
-
|
50
|
+
3+| **Linux**
|
51
|
+
| Ubuntu 20.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
|
52
|
+
| Alpine 3.17 | amd64 | gcc/g+\+: default; clang/clang++: default
|
36
53
|
|
37
|
-
|
38
|
-
|
39
|
-
|
54
|
+
3+| **macOS**
|
55
|
+
| macOS 12 (Monterey) | amd64 | xcode: [13.1, 14.3.1]
|
56
|
+
| macOS 13 (Ventura) | amd64, aarch64 | xcode: [13.1, 14.3.1]
|
57
|
+
| macOS 14 (Sonoma) | amd64, aarch64 | xcode: [13.1, 14.3.1, 15.4]
|
40
58
|
|
41
|
-
|
59
|
+
3+| **Windows**
|
60
|
+
| Windows 10 | amd64 | MinGW ucrt64
|
61
|
+
| Windows 11 | amd64 | MinGW ucrt64
|
62
|
+
| Windows Server 2019 | amd64 | MinGW ucrt64
|
63
|
+
| Windows Server 2022 | amd64 | MinGW ucrt64
|
42
64
|
|
43
|
-
|
65
|
+
|===
|
66
|
+
|
67
|
+
[NOTE]
|
68
|
+
====
|
69
|
+
Windows build caveats:
|
70
|
+
|
71
|
+
* Tebako may face errors related to CMake path length limitations (https://gitlab.kitware.com/cmake/cmake/-/issues/25936).
|
44
72
|
This error may affect not tebako itself but the gems that need to be package and use CMake to build native extensions.
|
45
73
|
There is no workaround for this issue as it looks like is a limitation of the manifest used to build CMake executable.
|
74
|
+
|
46
75
|
* MSys strip utility creates broken executable when tebako image is processed. Linking with '-s' flag produces unusable
|
47
76
|
executables as well.
|
48
77
|
Until this issue (https://github.com/tamatebako/tebako/issues/172) is resolved we plan to produce an Windows executable
|
49
78
|
with debug information unstripped. You can opt to run 'strip -S' manually, it most cases it works.
|
79
|
+
====
|
80
|
+
|
81
|
+
|
82
|
+
.Supported Ruby versions
|
83
|
+
[cols="2", options="header"]
|
84
|
+
|===
|
85
|
+
| Ruby version | Supported platforms
|
86
|
+
|
87
|
+
| 2.7.8 | Linux, macOS
|
88
|
+
| 3.0.7 | Linux, macOS
|
89
|
+
| 3.1.{4,5,6} | Linux, macOS, Windows
|
90
|
+
| 3.2.{3,4} | Linux, macOS, Windows
|
91
|
+
| 3.3.{3,4} | Linux, macOS, Windows
|
92
|
+
|
93
|
+
|===
|
94
|
+
|
95
|
+
NOTE: Our goal is to support all maintained Ruby releases, including minor versions.
|
96
|
+
|
97
|
+
== Future plans
|
98
|
+
|
99
|
+
* Downloading new DwarFS images to be stored in the local home directory
|
100
|
+
* Allowing loading multiple DwarFS images in a stacked way
|
101
|
+
* Supporting a COW mechanism that the newly written files are stored
|
102
|
+
in a separate image that can be loaded on top of the read-only file systems.
|
103
|
+
|
104
|
+
|
105
|
+
== FAQ
|
106
|
+
|
107
|
+
=== Why use Tebako?
|
108
|
+
|
109
|
+
Tebako is particularly useful for developers who need to:
|
110
|
+
|
111
|
+
* Distribute applications without requiring users to have specific runtimes installed.
|
112
|
+
* Simplify the deployment process by packaging all dependencies into one binary.
|
113
|
+
* Ensure consistency across different environments by using a single executable.
|
114
|
+
* Flexibility to support different runtime versions on the user's machine.
|
115
|
+
|
116
|
+
|
117
|
+
=== How do I know I need Tebako?
|
118
|
+
|
119
|
+
You might need Tebako if you:
|
120
|
+
|
121
|
+
* Want to package your application into a single, self-contained binary.
|
122
|
+
* Want to avoid the complexities of managing runtime environments on target machines.
|
123
|
+
* Distribute software to environments where installing runtimes and their dependencies is challenging.
|
124
|
+
* Require a streamlined way to deliver applications to end-users.
|
125
|
+
* Need to ensure that your application runs consistently across different environments and architectures.
|
126
|
+
|
127
|
+
|
128
|
+
=== What is DwarFS?
|
129
|
+
|
130
|
+
https://github.com/mhx/dwarfs[DwarFS] is a fast, high compression read-only
|
131
|
+
user-land file system designed for efficient storage and access of large
|
132
|
+
collections of files.
|
133
|
+
|
134
|
+
It is used by Tebako to package applications into a compact and efficient format.
|
135
|
+
|
136
|
+
Tebako uses https://github.com/tamatebako/libdwarfs[libdwarfs], the library
|
137
|
+
form of https://github.com/mhx/dwarfs[DwarFS], developed for the Tebako project.
|
138
|
+
|
139
|
+
=== When is Tebako better than comparable solutions?
|
140
|
+
|
141
|
+
Tebako offers several advantages over comparable solutions for supported
|
142
|
+
interpretive languages.
|
143
|
+
|
144
|
+
They are listed in order of the degree of virtualization below.
|
145
|
+
|
146
|
+
Tebako stands out by providing a lightweight runtime bundling approach that
|
147
|
+
simplifies distribution and deployment while offering flexibility and
|
148
|
+
efficiency.
|
149
|
+
|
150
|
+
It eliminates the need for users to have specific runtimes installed and ensures
|
151
|
+
consistency across different environments.
|
152
|
+
|
153
|
+
With Tebako, you can package your entire project with a bundled runtime into a
|
154
|
+
single, performant, executable binary.
|
155
|
+
|
156
|
+
[cols="a,3a,3a"]
|
157
|
+
|===
|
158
|
+
| Solution | Pros | Cons
|
159
|
+
|
160
|
+
| Virtual machines (VMs)
|
161
|
+
|
|
162
|
+
- Provides full isolation and compatibility across environments
|
163
|
+
|
|
164
|
+
- Requires a separate VM installation for each application
|
165
|
+
- Heavy resource consumption for virtualization
|
166
|
+
|
167
|
+
| Docker
|
168
|
+
|
|
169
|
+
- Provides portable containers
|
170
|
+
- Isolates entire applications and their dependencies
|
171
|
+
- Supports easy deployment and scalability
|
172
|
+
|
|
173
|
+
- Requires Docker installation and management
|
174
|
+
- Requires administrative rights on machine
|
175
|
+
- Containerization overhead
|
176
|
+
|
177
|
+
| *Tebako*
|
178
|
+
|
|
179
|
+
- Packages all files and dependencies into a single binary
|
180
|
+
- Supports multiple operating systems and architectures
|
181
|
+
- Provides efficient packaging and execution with DwarFS
|
182
|
+
- Offers security features like signing on macOS
|
183
|
+
- Simplifies distribution and deployment
|
184
|
+
- Native running speed
|
185
|
+
|
|
186
|
+
- Initial packaging time longer than Ruby gems
|
187
|
+
- Minor runtime overhead
|
188
|
+
|
189
|
+
| Ruby Gems
|
190
|
+
|
|
191
|
+
- Easy installation of Ruby libraries
|
192
|
+
- Provides user-side version control and dependency management
|
193
|
+
|
|
194
|
+
- Requires Ruby installation and gem management
|
195
|
+
- Runtime execution dependent on the user's installed Ruby version and gems
|
196
|
+
|
197
|
+
|===
|
198
|
+
|
199
|
+
|
200
|
+
== Usage
|
201
|
+
|
202
|
+
=== Command-line interface
|
203
|
+
|
204
|
+
Tebako works by packaging your project into a single executable binary that
|
205
|
+
includes all the necessary dependencies.
|
206
|
+
|
207
|
+
The way to work with Tebako is through its command-line interface (CLI).
|
208
|
+
It provides the following commands:
|
209
|
+
|
210
|
+
`setup`::
|
211
|
+
Prepares the Tebako packaging environment.
|
212
|
+
|
213
|
+
`press`::
|
214
|
+
Packages a project into a single executable binary.
|
50
215
|
|
51
|
-
|
216
|
+
`clean`::
|
217
|
+
Removes Tebako artifacts.
|
52
218
|
|
53
|
-
|
219
|
+
`clean_ruby`::
|
220
|
+
Removes Tebako Ruby artifacts.
|
54
221
|
|
55
|
-
|
56
|
-
|
57
|
-
* 3.1.4, 3.1.5, 3.1.6 (Linux, MacOS, Windows)
|
58
|
-
* 3.2.3, 3.2.4 (Linux, MacOS, Windows)
|
222
|
+
`hash`::
|
223
|
+
Calculates the Tebako script hash for use as a cache key in CI/CD environments.
|
59
224
|
|
60
|
-
|
61
|
-
|
225
|
+
`extract`::
|
226
|
+
Extracts the filesystem from a Tebako package.
|
62
227
|
|
63
|
-
|
228
|
+
`version`::
|
229
|
+
Displays the Tebako version.
|
64
230
|
|
65
|
-
|
231
|
+
`help`::
|
232
|
+
Displays the help message.
|
66
233
|
|
67
|
-
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
== Usage
|
238
|
+
|
239
|
+
=== General
|
240
|
+
|
241
|
+
Tebako can be used in two ways:
|
242
|
+
|
243
|
+
* Through the Tebako container
|
244
|
+
* Local installation
|
245
|
+
|
246
|
+
Please refer to the <<installation>> section on how to install Tebako.
|
247
|
+
|
248
|
+
|
249
|
+
[[installation]]
|
250
|
+
== Installation
|
251
|
+
|
252
|
+
=== General
|
253
|
+
|
254
|
+
Installation of Tebako is only needed in order to package an application.
|
255
|
+
|
256
|
+
There is no need to install anything for users who run the packaged application.
|
257
|
+
|
258
|
+
|
259
|
+
=== Using Docker
|
260
|
+
|
261
|
+
==== General
|
262
|
+
|
263
|
+
If you have Docker installed and available, the easiest way to run Tebako is
|
264
|
+
through the official Docker containers.
|
265
|
+
|
266
|
+
Docker containers with preinstalled Tebako packaging environments for Ubuntu and
|
267
|
+
Alpine Linux are available at
|
268
|
+
https://github.com/tamatebako/tebako-ci-containers[tebako-ci-containers].
|
269
|
+
|
270
|
+
|
271
|
+
==== Pull the container
|
272
|
+
|
273
|
+
Pull the Tebako container image.
|
274
|
+
|
275
|
+
[source,sh]
|
276
|
+
----
|
277
|
+
docker pull ghcr.io/tamatebako/tebako-<container_tag>:latest
|
278
|
+
----
|
279
|
+
|
280
|
+
`<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
|
281
|
+
|
282
|
+
|
283
|
+
==== Running Tebako commands in the container
|
284
|
+
|
285
|
+
Simply prefix the Tebako command with `docker run` and the container image.
|
286
|
+
|
287
|
+
[source,sh]
|
288
|
+
----
|
289
|
+
docker run -v <application_folder>:/mnt/w \
|
290
|
+
-t ghcr.io/tamatebako/tebako-<container_tag>:latest \
|
291
|
+
tebako {command} {parameters}
|
292
|
+
----
|
293
|
+
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
==== Packaging from outside the container
|
298
|
+
|
299
|
+
To package your application from outside the container, just run a single Docker
|
300
|
+
command.
|
301
|
+
|
302
|
+
This command mounts the application folder into the container and runs the
|
303
|
+
`tebako press` command, specifying the application root, entry point, output
|
304
|
+
location, and Ruby version.
|
305
|
+
|
306
|
+
[source,sh]
|
307
|
+
----
|
308
|
+
docker run -v <application_folder>:/mnt/w \
|
309
|
+
-t ghcr.io/tamatebako/tebako-<container_tag>:latest \
|
310
|
+
tebako press <tebako-press-parameters>
|
311
|
+
----
|
312
|
+
|
313
|
+
`<application_folder>`:: is the path to your application folder.
|
314
|
+
|
315
|
+
`<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
|
316
|
+
|
317
|
+
|
318
|
+
[example]
|
319
|
+
====
|
320
|
+
Assume that you have a Ruby application in the `fontist` folder of the current
|
321
|
+
directory.
|
322
|
+
|
323
|
+
You can package it to `./fontist-package` using the following command:
|
324
|
+
|
325
|
+
[source,sh]
|
326
|
+
----
|
327
|
+
docker run -v $PWD:/mnt/w \
|
328
|
+
-t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
|
329
|
+
tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.4
|
330
|
+
----
|
331
|
+
====
|
332
|
+
|
333
|
+
==== Packaging from inside the container
|
334
|
+
|
335
|
+
It is also possible to package an application from inside the Tebako container.
|
336
|
+
|
337
|
+
Start and enter the container interactively.
|
338
|
+
|
339
|
+
[source,sh]
|
340
|
+
----
|
341
|
+
docker run -it --rm -v <application_folder>:/mnt/w \
|
342
|
+
ghcr.io/tamatebako/tebako-<container_tag>:latest bash
|
343
|
+
----
|
344
|
+
|
345
|
+
`<application_folder>`:: is the path to your application folder.
|
346
|
+
|
347
|
+
`<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
|
348
|
+
|
349
|
+
|
350
|
+
Once inside, run the `tebako press` command:
|
351
|
+
|
352
|
+
[source,sh]
|
353
|
+
----
|
354
|
+
tebako press <tebako press parameters>
|
355
|
+
----
|
356
|
+
|
357
|
+
[example]
|
358
|
+
====
|
359
|
+
Assume that you have a Ruby application in the `fontist` folder of the current
|
360
|
+
directory.
|
361
|
+
|
362
|
+
You can package it to `./fontist-package` using the following command:
|
363
|
+
|
364
|
+
[source,sh]
|
365
|
+
----
|
366
|
+
$ docker run -it --rm -v $PWD:/mnt/w ghcr.io/tamatebako/tebako-<container_tag>:latest bash
|
367
|
+
|
368
|
+
# Inside the container:
|
369
|
+
$ tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.4
|
370
|
+
----
|
371
|
+
====
|
372
|
+
|
373
|
+
|
374
|
+
=== Local installation
|
375
|
+
|
376
|
+
==== General
|
377
|
+
|
378
|
+
There are cases where Docker may not be suitable for your needs, such as:
|
379
|
+
|
380
|
+
. Admin privileges: Running Docker requires administrative privileges, which
|
381
|
+
means Docker may not be available to users on their machines.
|
382
|
+
|
383
|
+
. Performance penalty: Docker introduces a performance penalty due to the
|
384
|
+
overhead of running containers. This can be a concern when packaging complex
|
385
|
+
applications that require heavy memory usage.
|
386
|
+
|
387
|
+
In such cases, you can choose to install Tebako locally.
|
388
|
+
|
389
|
+
Tebako is distributed as a Ruby gem. A Ruby environment is necessary.
|
390
|
+
|
391
|
+
|
392
|
+
[source,sh]
|
393
|
+
----
|
394
|
+
$ gem install tebako
|
395
|
+
----
|
396
|
+
|
397
|
+
|
398
|
+
==== Prerequisites
|
399
|
+
|
400
|
+
These prerequisites are needed only for users who want to install Tebako on
|
401
|
+
their machine and build all Tebako components locally.
|
402
|
+
|
403
|
+
If you use Docker, there is no need to set up these prerequisites.
|
404
|
+
|
405
|
+
===== Ubuntu 20.04
|
406
|
+
|
407
|
+
====== General
|
408
|
+
|
409
|
+
There are several prerequisites that need to be installed on Ubuntu 20.04 for
|
410
|
+
Tebako to work correctly.
|
411
|
+
|
412
|
+
|
413
|
+
====== GNU C/C++ 10+ or Clang C/C++ 12+
|
68
414
|
|
69
415
|
[source,sh]
|
70
416
|
----
|
@@ -82,12 +428,14 @@ update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 150
|
|
82
428
|
update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 150
|
83
429
|
----
|
84
430
|
|
85
|
-
|
431
|
+
====== CMake version 3.20+
|
86
432
|
|
87
|
-
Tebako
|
433
|
+
Tebako requires CMake at a version of at least 3.20+.
|
88
434
|
|
89
|
-
If
|
435
|
+
If such CMake version is not available as a default package, set it up as
|
436
|
+
follows.
|
90
437
|
|
438
|
+
.Installing CMake 3.20+
|
91
439
|
[source,sh]
|
92
440
|
----
|
93
441
|
apt-get remove --purge --auto-remove cmake
|
@@ -98,7 +446,7 @@ curl https://apt.kitware.com/kitware-archive.sh | bash
|
|
98
446
|
apt-get install cmake
|
99
447
|
----
|
100
448
|
|
101
|
-
|
449
|
+
====== Other development tools and libraries
|
102
450
|
|
103
451
|
[source,sh]
|
104
452
|
----
|
@@ -113,7 +461,16 @@ apt-get -y install sudo git curl build-essential pkg-config bison flex autoconf
|
|
113
461
|
libutfcpp-dev
|
114
462
|
----
|
115
463
|
|
116
|
-
|
464
|
+
===== Alpine 3.17
|
465
|
+
|
466
|
+
====== General
|
467
|
+
|
468
|
+
There are several prerequisites that need to be installed on Alpine 3.17 for
|
469
|
+
Tebako to work correctly.
|
470
|
+
|
471
|
+
====== APK packages
|
472
|
+
|
473
|
+
Run the following command to install all prerequisites.
|
117
474
|
|
118
475
|
[source,sh]
|
119
476
|
----
|
@@ -127,117 +484,178 @@ apk --no-cache --upgrade add build-base cmake git bash autoconf boost-static \
|
|
127
484
|
brotli-static jemalloc-dev fmt-dev xz-static
|
128
485
|
----
|
129
486
|
|
130
|
-
|
487
|
+
===== macOS
|
488
|
+
|
489
|
+
====== General
|
490
|
+
|
491
|
+
There are several prerequisites that need to be installed on macOS for Tebako to work correctly.
|
492
|
+
|
493
|
+
The following instructions work for:
|
494
|
+
|
495
|
+
* macOS 12 (Monterey) through macOS 14 (Sonoma)
|
496
|
+
|
497
|
+
|
498
|
+
====== Homebrew packages
|
499
|
+
|
500
|
+
We use Homebrew to install the necessary packages on macOS.
|
131
501
|
|
132
502
|
[source,sh]
|
133
503
|
----
|
134
504
|
brew update
|
135
|
-
brew install gnu-sed bash pkg-config bison flex binutils libffi gdbm zlib
|
136
|
-
double-conversion boost jemalloc fmt glog libevent libsodium lz4 xz
|
505
|
+
brew install gnu-sed bash pkg-config bison flex binutils libffi gdbm zlib \
|
506
|
+
ncurses double-conversion boost jemalloc fmt glog libevent libsodium lz4 xz \
|
507
|
+
libyaml openssl@3
|
137
508
|
----
|
138
509
|
|
139
|
-
|
510
|
+
====== Bison 3+
|
511
|
+
|
512
|
+
Tebako requires Bison 3+.
|
140
513
|
|
141
|
-
|
142
|
-
|
514
|
+
On macOS 14, the default Bison version is 2.3, and the Homebrew formula is keg-only,
|
515
|
+
which means that the full path to the Bison binary must be used to utilize the
|
516
|
+
correct version.
|
517
|
+
|
518
|
+
Run the following command prior to using Tebako, or add it into your shell
|
519
|
+
profile.
|
143
520
|
|
144
521
|
[source,sh]
|
145
522
|
----
|
146
523
|
export PATH="$(brew --prefix bison)/bin:$PATH"
|
147
524
|
----
|
148
525
|
|
149
|
-
|
526
|
+
===== Windows
|
150
527
|
|
151
|
-
|
152
|
-
Once it is installed use the following commands:
|
528
|
+
====== General
|
153
529
|
|
154
|
-
|
155
|
-
----
|
156
|
-
ridk enable ucrt64
|
157
|
-
pacman -S git tar bison flex toolchain make cmake
|
158
|
-
boost diffutils libevent double-conversion
|
159
|
-
fmt glog dlfcn gtest autotools ncurses libyaml
|
160
|
-
----
|
530
|
+
There are several prerequisites that need to be installed on macOS for Tebako to work correctly.
|
161
531
|
|
162
|
-
|
532
|
+
The following instructions work for:
|
163
533
|
|
164
|
-
|
534
|
+
* Windows 10, 11
|
535
|
+
* Windows Server 2019, 2022
|
165
536
|
|
166
|
-
|
167
|
-
Additionally, Docker containers for Ubuntu and Alpine Linux with a preinstalled Tebako packaging environment
|
168
|
-
are available at https://github.com/orgs/tamatebako/packages.
|
537
|
+
====== Ruby
|
169
538
|
|
170
|
-
|
539
|
+
To run Tebako you need to have Ruby installed.
|
540
|
+
It is simplest to use the Ruby development environment provided by
|
541
|
+
https://rubyinstaller.org[RubyInstaller].
|
171
542
|
|
172
|
-
|
543
|
+
For example, Ruby+Devkit 3.1.4-1.
|
544
|
+
|
545
|
+
====== MinGW ucrt64
|
173
546
|
|
174
|
-
|
547
|
+
Enable MinGW ucrt64 and install the necessary packages.
|
548
|
+
|
549
|
+
The `ridk` command originates from the RubyInstaller installation.
|
175
550
|
|
176
551
|
[source,sh]
|
177
552
|
----
|
178
|
-
|
553
|
+
$ ridk enable ucrt64
|
554
|
+
$ pacman -S git tar bison flex toolchain make cmake
|
555
|
+
boost diffutils libevent double-conversion
|
556
|
+
fmt glog dlfcn gtest autotools ncurses libyaml
|
179
557
|
----
|
180
558
|
|
181
|
-
=== Tebako Root Folder (aka Prefix) Selection
|
182
559
|
|
183
|
-
The prefix in Tebako determines the base directory for the Tebako setup. It is an essential part of configuring how Tebako operates within your system.
|
184
|
-
The selection of the prefix follows a specific order of precedence to ensure flexibility and ease of use:
|
185
560
|
|
186
|
-
|
561
|
+
== Usage
|
562
|
+
|
563
|
+
=== Tebako root folder (aka prefix) selection
|
564
|
+
|
565
|
+
The Tebako prefix determines the base directory for the Tebako setup.
|
566
|
+
|
567
|
+
It is an essential part of configuring how Tebako operates within your system.
|
568
|
+
|
569
|
+
The selection of the Tebako prefix follows a specific order of precedence to
|
570
|
+
ensure flexibility and ease of use:
|
571
|
+
|
572
|
+
. *User-specified prefix*:
|
573
|
+
The most direct way to set the root folder is by specifying it through a
|
574
|
+
command-line argument.
|
575
|
+
|
576
|
+
. *Current Working Directory (PWD)*:
|
577
|
+
If the prefix option is explicitly set to `PWD`, Tebako uses the current working
|
578
|
+
directory as Tebako root folder.
|
579
|
+
|
580
|
+
. *Environment variable (`TEBAKO_PREFIX`)*:
|
581
|
+
In the absence of a user-specified option, Tebako looks for an environment
|
582
|
+
variable named `TEBAKO_PREFIX`. If found, its value is used as the root folder.
|
187
583
|
|
188
|
-
. *
|
584
|
+
. *Default value*:
|
585
|
+
If no prefix is specified and the `TEBAKO_DIR` environment variable is not set,
|
586
|
+
Tebako defaults to using a directory named `.tebako` in the user's home
|
587
|
+
directory.
|
189
588
|
|
190
|
-
. *Environment Variable (TEBAKO_PREFIX)*: In the absence of a user-specified option, Tebako looks for an environment variable named `TEBAKO_PREFIX`. If found, its value is used as the root folder.
|
191
589
|
|
192
|
-
|
590
|
+
Path Expansion: Regardless of the method used to set the Tebako prefix, Tebako
|
591
|
+
expands the provided path to an absolute path. This expansion includes resolving
|
592
|
+
relative paths based on the current working directory and expanding user
|
593
|
+
directory shortcuts like `~`.
|
193
594
|
|
194
595
|
|
195
|
-
|
196
|
-
|
596
|
+
=== Commands
|
597
|
+
|
598
|
+
Tebako provides several commands to manage the packaging and deployment process.
|
197
599
|
|
198
600
|
==== Press
|
199
601
|
|
200
|
-
This command "presses" a Ruby project using the Tebako
|
201
|
-
folder (`<tebako-root-folder>`).
|
202
|
-
|
203
|
-
builds the and creates packaging environment. This is a lengthly task that can take significant
|
204
|
-
time, up to 1 hour.
|
205
|
-
Upon the next invocation tebako will use previously created packaging environment. The press process
|
206
|
-
itself takes minutes.
|
207
|
-
You can manage setup of packaging environment manually; please refer to description of setup and clean
|
208
|
-
cmmands below.
|
602
|
+
This command "presses" a Ruby project using the Tebako components built in the Tebako
|
603
|
+
root folder (`<tebako-root-folder>`).
|
604
|
+
|
209
605
|
|
210
|
-
[
|
606
|
+
[NOTE]
|
607
|
+
====
|
608
|
+
The first invocation of the `press` command can take up to an hour as it sets up
|
609
|
+
the packaging environment and collects the required dependencies. Subsequent
|
610
|
+
invocations are much faster.
|
611
|
+
====
|
612
|
+
|
613
|
+
Upon the next invocation tebako will use previously created packaging
|
614
|
+
environment. The press process itself takes minutes.
|
615
|
+
|
616
|
+
You can manage setup of packaging environment manually; please refer to
|
617
|
+
description of setup and clean commands below.
|
618
|
+
|
619
|
+
[source,sh]
|
211
620
|
----
|
212
|
-
tebako press
|
621
|
+
tebako press \
|
622
|
+
-e|--entry-point=<entry-point> \
|
623
|
+
-r|--root=<project-root-folder> \
|
213
624
|
[-p|--prefix=<tebako-root-folder>] \
|
214
|
-
[-R|--Ruby=<
|
215
|
-
-
|
216
|
-
-e|--entry-point=<entry-point> \
|
217
|
-
[-o|--output=<packaged file name>] \
|
625
|
+
[-R|--Ruby=<ruby-version>] \
|
626
|
+
[-o|--output=<packaged-file-name>] \
|
218
627
|
[-l|--log-level=<error|warn|debug|trace>] \
|
219
628
|
[-D|--devmode]
|
220
629
|
----
|
221
630
|
|
222
631
|
Where:
|
223
632
|
|
224
|
-
|
633
|
+
`<tebako-root-folder>`::
|
634
|
+
the Tebako root folder (see details in the Tebako Root Folder Selection section)
|
225
635
|
|
226
|
-
|
636
|
+
`Ruby`::
|
637
|
+
This parameter defines Ruby version that will be packaged (optional, defaults to
|
638
|
+
`3.1.6`)
|
227
639
|
|
228
|
-
|
229
|
-
are located
|
640
|
+
`<project-root>`::
|
641
|
+
a folder at the host source file system where project files are located
|
230
642
|
|
231
|
-
|
232
|
-
|
643
|
+
`<entry-point>`::
|
644
|
+
an executable file (binary executable or script) that shall be started when
|
645
|
+
packaged file is called
|
233
646
|
|
234
|
-
|
235
|
-
point base name
|
647
|
+
`output`::
|
648
|
+
the output file name (optional, defaults to `<current folder>/<entry point base name>`)
|
236
649
|
|
237
|
-
|
650
|
+
`log-level`::
|
651
|
+
logging level for the Tebako built-in memory filesystem driver
|
652
|
+
(optional, defaults to `error`)
|
238
653
|
|
239
|
-
|
240
|
-
|
654
|
+
`devmode`:: flag that activates development mode, in which Tebako's cache and
|
655
|
+
packaging consistency checks are relaxed.
|
656
|
+
+
|
657
|
+
NOTE: Development mode is *not intended for production use* and should only be
|
658
|
+
used during development.
|
241
659
|
|
242
660
|
[example]
|
243
661
|
====
|
@@ -252,47 +670,54 @@ tebako press \
|
|
252
670
|
|
253
671
|
==== Setup
|
254
672
|
|
255
|
-
|
256
|
-
|
673
|
+
This command sets up the Tebako packaging environment.
|
674
|
+
|
675
|
+
Collects required packages, builds the and creates packaging environment. This
|
676
|
+
is a lengthy task that can take significant time, up to 1 hour.
|
677
|
+
|
257
678
|
Tebako supports several configurations at a single system given that their root
|
258
|
-
directories differ and
|
679
|
+
directories differ and multiple Ruby versions within single configuration
|
680
|
+
|
681
|
+
This command is optional, tebako creates packaging environment automatically
|
682
|
+
upon the first invocation of press command.
|
259
683
|
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
based on ```tebako setup``` output. Building cache based on ```tebako press``` may create inconsistent environment upon restore.
|
684
|
+
However, if you plan to use tebako in CI/CD environment with caching it is
|
685
|
+
highly recommended to build cache based on `tebako setup` output. Building cache
|
686
|
+
based on `tebako press` may create inconsistent environment upon restore.
|
264
687
|
|
265
|
-
[source]
|
688
|
+
[source,sh]
|
266
689
|
----
|
267
|
-
tebako setup
|
268
|
-
[-p
|
269
|
-
[-R
|
270
|
-
[-D
|
690
|
+
$ tebako setup \
|
691
|
+
[-p|--prefix=<tebako-root-folder>] \
|
692
|
+
[-R|--Ruby=<ruby-version>] \
|
693
|
+
[-D|--devmode]
|
271
694
|
----
|
272
695
|
|
273
696
|
Where:
|
274
697
|
|
275
|
-
|
698
|
+
`<tebako-root-folder>`:: the Tebako root folder (see details in the Tebako Root Folder Selection section)
|
276
699
|
|
277
|
-
|
700
|
+
`Ruby` parameter defines Ruby version that will be packaged (optional, defaults to 3.1.6)
|
278
701
|
|
279
|
-
|
702
|
+
`devmode` flag activates development mode, in which Tebako's cache and packaging consistency checks are relaxed.
|
280
703
|
Please note that this mode is not intended for production use and should only be used during development.
|
281
704
|
|
282
705
|
==== Clean
|
283
706
|
|
284
|
-
This command
|
707
|
+
This command cleans up all Tebako artifacts in the specified prefix directory.
|
708
|
+
|
709
|
+
NOTE: These artifacts are created by the `setup` and `press` commands.
|
285
710
|
Normally you do not need to do it since tebako packager optimizes artifacts lifecycle on its own.
|
286
711
|
|
287
|
-
[source]
|
712
|
+
[source,sh]
|
288
713
|
----
|
289
|
-
tebako clean \
|
714
|
+
$ tebako clean \
|
290
715
|
[-p|--prefix=<tebako-root-folder>]
|
291
716
|
----
|
292
717
|
|
293
718
|
Where:
|
294
719
|
|
295
|
-
|
720
|
+
`<tebako-root-folder>`:: the Tebako root folder (see details in the Tebako Root Folder Selection section)
|
296
721
|
|
297
722
|
[example]
|
298
723
|
====
|
@@ -302,23 +727,32 @@ tebako clean --prefix='~/.tebako'
|
|
302
727
|
----
|
303
728
|
====
|
304
729
|
|
305
|
-
==== Clean ruby
|
306
730
|
|
307
|
-
|
308
|
-
|
731
|
+
==== Clean Ruby
|
732
|
+
|
733
|
+
This command cleans up only the Ruby artifacts from the specified prefix
|
734
|
+
directory.
|
735
|
+
|
736
|
+
NOTE: These artifacts are created by the `setup` and `press` commands.
|
737
|
+
Normally you do not need to do it, since Tebako packager optimizes artifacts
|
738
|
+
lifecycle on its own.
|
739
|
+
|
740
|
+
NOTE: Compiled DwarFS libraries are not cleaned.
|
309
741
|
|
310
|
-
[source]
|
742
|
+
[source,sh]
|
311
743
|
----
|
312
|
-
tebako clean_ruby
|
313
|
-
[-p|--prefix=<tebako-root-folder>]
|
314
|
-
[-R|--Ruby=<
|
744
|
+
$ tebako clean_ruby
|
745
|
+
[-p|--prefix=<tebako-root-folder>] \
|
746
|
+
[-R|--Ruby=<ruby-version>]
|
315
747
|
----
|
316
748
|
|
317
749
|
Where:
|
318
750
|
|
319
|
-
|
320
|
-
folder)
|
321
|
-
|
751
|
+
`<tebako-root-folder>`::
|
752
|
+
the Tebako setup folder (optional, defaults to current folder)
|
753
|
+
|
754
|
+
`Ruby`::
|
755
|
+
defines Ruby version that will cleaned (optional, cleans all versions by default)
|
322
756
|
|
323
757
|
[example]
|
324
758
|
====
|
@@ -329,45 +763,30 @@ tebako clean_ruby --prefix='~/.tebako'
|
|
329
763
|
====
|
330
764
|
|
331
765
|
==== Build script hash
|
332
|
-
Hash command will calculate tebako script hash that may be used as a cache key in CI/CD environment like GitHub Actions
|
333
766
|
|
334
|
-
|
767
|
+
This command outputs a hash value for the Tebako build script, which can be used
|
768
|
+
as a cache key in CI/CD pipelines.
|
769
|
+
|
770
|
+
[source,sh]
|
335
771
|
----
|
336
|
-
tebako hash
|
772
|
+
$ tebako hash
|
337
773
|
----
|
338
774
|
|
339
|
-
=== Exit codes
|
340
|
-
|
341
|
-
[cols,"a,a"]
|
342
|
-
|===
|
343
|
-
| Code | Condition
|
344
|
-
|
345
|
-
| 0 | No error
|
346
|
-
| 1 | Invalid command line
|
347
|
-
| 101 | `tebako setup` failed at configuration step
|
348
|
-
| 102 | `tebako setup` failed at build step
|
349
|
-
| 103 | `tebako press` failed at configuration step
|
350
|
-
| 104 | `tebako press` failed at build step
|
351
|
-
| 253 | Unsupported Ruby version
|
352
|
-
| 254 | Unsupported operating systems
|
353
|
-
| 255 | Internal error
|
354
|
-
|
355
|
-
|===
|
356
775
|
|
357
|
-
|
776
|
+
=== Image extraction
|
358
777
|
|
359
|
-
Tebako provides an option to an extract filesystem from a package to
|
360
|
-
folder for verification or execution.
|
778
|
+
Tebako provides an option to an extract its DwarFS filesystem from a package to
|
779
|
+
a local folder for verification or execution.
|
361
780
|
|
362
781
|
[source,sh]
|
363
782
|
----
|
364
|
-
<tebako-packaged-executable> --tebako-extract [<root folder for extracted filesystem>]
|
783
|
+
$ <tebako-packaged-executable> --tebako-extract [<root folder for extracted filesystem>]
|
365
784
|
----
|
366
785
|
|
367
786
|
Where,
|
368
787
|
|
369
|
-
|
370
|
-
|
788
|
+
`<root folder for extracted filesystem>`::
|
789
|
+
The root folder for the extracted filesystem (optional, defaults to `source_filesystem`)
|
371
790
|
|
372
791
|
[example]
|
373
792
|
====
|
@@ -387,47 +806,67 @@ require 'fileutils'
|
|
387
806
|
FileUtils.copy_entry '<in-memory filesystem root>', ARGV[2] || 'source_filesystem'
|
388
807
|
----
|
389
808
|
|
390
|
-
|
809
|
+
=== Exit codes
|
391
810
|
|
392
|
-
|
393
|
-
|
811
|
+
The Tebako CLI exits with different exit codes to indicate the status of the
|
812
|
+
operation. The following table lists the possible exit codes and their meanings.
|
394
813
|
|
395
|
-
|
396
|
-
|
814
|
+
.Tebako CLI exit codes
|
815
|
+
[cols="a,a"]
|
816
|
+
|===
|
817
|
+
| Code | Condition
|
397
818
|
|
398
|
-
|
399
|
-
|
819
|
+
| 0 | No error
|
820
|
+
| 1 | Invalid command line
|
821
|
+
| 101 | `tebako setup` failed at configuration step
|
822
|
+
| 102 | `tebako setup` failed at build step
|
823
|
+
| 103 | `tebako press` failed at configuration step
|
824
|
+
| 104 | `tebako press` failed at build step
|
825
|
+
| 253 | Unsupported Ruby version
|
826
|
+
| 254 | Unsupported operating systems
|
827
|
+
| 255 | Internal error
|
400
828
|
|
401
|
-
[cols="a,a,a,a"]
|
402
829
|
|===
|
403
|
-
| Scenario | `*.gemspec` | `Gemfile` | `*.gem`
|
404
830
|
|
405
|
-
| 1 | No | No | No
|
406
|
-
| 2 | No | No | One
|
407
|
-
| 3 | One | No | Any
|
408
|
-
| 4 | One | One | Any
|
409
|
-
| 5 | No | One | Any
|
410
|
-
| Error | No | No |Two or more
|
411
|
-
| Error |Two or more| Any | Any
|
412
831
|
|
413
|
-
|
832
|
+
== Packaging scenarios with Ruby
|
833
|
+
|
834
|
+
Tebako for Ruby supports the following packaging scenarios.
|
835
|
+
|
836
|
+
This is high-level description of the Tebako Ruby packaging mechanism.
|
837
|
+
|
838
|
+
NOTE: These scenarios were inspired by the `ruby-packer` approach.
|
414
839
|
|
415
|
-
|
416
|
-
|
840
|
+
NOTE: Tebako Ruby is created independently from `ruby-packer`, no line of code
|
841
|
+
was copied from `ruby-packer`.
|
417
842
|
|
418
|
-
|
843
|
+
Depending on the configuration files that are present in the root project folder, the Tebako Ruby packager supports different packaging scenarios.
|
844
|
+
|
845
|
+
These scenarios differ in what files are packaged and where the entry point is located.
|
846
|
+
|
847
|
+
Here is a summary of the scenarios:
|
848
|
+
|
849
|
+
[cols="a,2a,4a,3a,a,a,a"]
|
419
850
|
|===
|
420
|
-
| Scenario | Description | Packaging | Entry point
|
851
|
+
| Scenario | Description | Packaging | Entry point | `*.gemspec` | `Gemfile` | `*.gem`
|
421
852
|
|
422
853
|
| 1
|
423
854
|
| Simple ruby script
|
424
855
|
| Copy `<project-root>` with all sub-folders to packaged filesystem
|
425
856
|
| `<mount_point>/local/<entry_point base name>`
|
857
|
+
| No
|
858
|
+
| No
|
859
|
+
| No
|
860
|
+
|
426
861
|
|
427
862
|
| 2
|
428
863
|
| Packaged gem
|
429
864
|
| Install the gem with `gem install` to packaged filesystem
|
430
865
|
| `<mount_point>/bin/<entry_point base name>` (i.e., binstub is expected)
|
866
|
+
| No
|
867
|
+
| No
|
868
|
+
| One
|
869
|
+
|
431
870
|
|
432
871
|
| 3
|
433
872
|
| Gem source, no `bundler`
|
@@ -436,6 +875,10 @@ located, as follows:
|
|
436
875
|
. Install it with `gem install` to packaged filesystem
|
437
876
|
|
438
877
|
| `<mount_point>/bin/<entry_point base name>` (i.e., binstub is expected)
|
878
|
+
| One
|
879
|
+
| No
|
880
|
+
| Any
|
881
|
+
|
439
882
|
|
440
883
|
| 4
|
441
884
|
| Gem source, `bundler`
|
@@ -445,15 +888,43 @@ located, as follows:
|
|
445
888
|
. Install it with `gem install` to packaged file system
|
446
889
|
|
447
890
|
| `<mount_point>/bin/<entry_point base name>` (i.e., binstub is expected)
|
891
|
+
| One
|
892
|
+
| One
|
893
|
+
| Any
|
894
|
+
|
448
895
|
|
449
896
|
| 5
|
450
897
|
| Rails project
|
451
898
|
| Deploy project to packaged filesystem using `bundle install`
|
452
899
|
| `<mount_point>/local/<entry_point base name>`
|
900
|
+
| No
|
901
|
+
| One
|
902
|
+
| Any
|
903
|
+
|
904
|
+
|
905
|
+
| Error
|
906
|
+
| Error: Two or more `*.gem` files present
|
907
|
+
| -
|
908
|
+
| -
|
909
|
+
| No
|
910
|
+
| No
|
911
|
+
| Two or more
|
912
|
+
|
913
|
+
|
914
|
+
| Error
|
915
|
+
| Error: Two or more `*.gemspec` files present
|
916
|
+
| -
|
917
|
+
| -
|
918
|
+
| Two or more
|
919
|
+
| Any
|
920
|
+
| Any
|
453
921
|
|
454
922
|
|===
|
455
923
|
|
456
924
|
|
925
|
+
These scenarios determine how the project is packaged and where the entry point is located within the packaged filesystem.
|
926
|
+
|
927
|
+
|
457
928
|
== Trivia: origin of name
|
458
929
|
|
459
930
|
"tamatebako" (玉手箱) is the treasure box given to Urashima Taro in the Ryugu,
|
@@ -466,3 +937,14 @@ the said treasure box (storing gems inside a treasure box).
|
|
466
937
|
|
467
938
|
Since "tamatebako" is rather long for the non-Japanese speaker, we use "tebako"
|
468
939
|
(手箱, also "tehako") instead, the generic term for a personal box.
|
940
|
+
|
941
|
+
== Contributing
|
942
|
+
|
943
|
+
We welcome contributions! Please see our contributing guidelines for more
|
944
|
+
information.
|
945
|
+
|
946
|
+
== License
|
947
|
+
|
948
|
+
Copyright Ribose. All rights reserved.
|
949
|
+
|
950
|
+
Tebako is released under the BSD 2-Clause License. See the LICENSE file for details.
|