tebako 0.12.16 → 0.13.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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/CMakeLists.txt +2 -2
  3. data/CODE_OF_CONDUCT.adoc +128 -0
  4. data/CONTRIBUTING.adoc +294 -0
  5. data/Gemfile +1 -1
  6. data/INSTALLATION.adoc +231 -0
  7. data/LICENSE.md +33 -0
  8. data/README.adoc +291 -486
  9. data/Rakefile +1 -1
  10. data/cmake/copy_dir.cmake +1 -1
  11. data/common.env +1 -1
  12. data/exe/tebako +1 -1
  13. data/exe/tebako-packager +1 -1
  14. data/include/tebako/tebako-fs.h +1 -1
  15. data/include/tebako/tebako-main.h +1 -1
  16. data/lib/tebako/build_helpers.rb +1 -1
  17. data/lib/tebako/cache_manager.rb +1 -1
  18. data/lib/tebako/cli.rb +1 -1
  19. data/lib/tebako/cli_helpers.rb +1 -1
  20. data/lib/tebako/codegen.rb +1 -1
  21. data/lib/tebako/deploy_helper.rb +8 -7
  22. data/lib/tebako/error.rb +1 -1
  23. data/lib/tebako/options_manager.rb +1 -1
  24. data/lib/tebako/package_descriptor.rb +1 -1
  25. data/lib/tebako/packager/pass1_patch.rb +1 -1
  26. data/lib/tebako/packager/pass1a_patch.rb +1 -1
  27. data/lib/tebako/packager/pass2_patch.rb +1 -1
  28. data/lib/tebako/packager/pass2_patch_crt.rb +1 -1
  29. data/lib/tebako/packager/pass2msys_patch.rb +1 -1
  30. data/lib/tebako/packager/patch.rb +1 -1
  31. data/lib/tebako/packager/patch_buildsystem.rb +1 -1
  32. data/lib/tebako/packager/patch_helpers.rb +1 -1
  33. data/lib/tebako/packager/patch_libraries.rb +1 -1
  34. data/lib/tebako/packager/patch_literals.rb +1 -1
  35. data/lib/tebako/packager/patch_main.rb +1 -1
  36. data/lib/tebako/packager/rubygems_patch.rb +1 -1
  37. data/lib/tebako/packager.rb +1 -1
  38. data/lib/tebako/packager_lite.rb +1 -1
  39. data/lib/tebako/ruby_builder.rb +1 -1
  40. data/lib/tebako/ruby_version.rb +3 -2
  41. data/lib/tebako/scenario_manager.rb +1 -1
  42. data/lib/tebako/stripper.rb +1 -1
  43. data/lib/tebako/version.rb +2 -2
  44. data/lib/tebako.rb +1 -1
  45. data/src/tebako-main.cpp +1 -1
  46. data/tebako.gemspec +1 -1
  47. data/tools/.github/workflows/build-containers.yml +190 -0
  48. data/tools/.github/workflows/lint.yml +3 -3
  49. data/tools/.github/workflows/test.yml +150 -11
  50. data/tools/ci-scripts/arm-brew-install.sh +1 -1
  51. data/tools/ci-scripts/arm-brew-setup.sh +1 -1
  52. data/tools/ci-scripts/level-up.sh +1 -1
  53. data/tools/ci-scripts/patch-fbthrift.sh +1 -1
  54. data/tools/ci-scripts/patch-folly.sh +2 -2
  55. data/tools/ci-scripts/tools.sh +1 -1
  56. data/tools/ci-scripts/x86-brew-install.sh +1 -1
  57. data/tools/ci-scripts/x86-brew-setup.sh +1 -1
  58. data/tools/cmake-scripts/def-external-project.cmake +1 -1
  59. data/tools/cmake-scripts/macos-environment.cmake +2 -2
  60. data/tools/cmake-scripts/msys-environment.cmake +1 -1
  61. data/tools/cmake-scripts/setup-libarchive.cmake +1 -1
  62. data/tools/cmake-scripts/setup-libfmt.cmake +1 -1
  63. data/tools/cmake-scripts/setup-libhowardhinnerdate.cmake +1 -1
  64. data/tools/cmake-scripts/setup-libutfcpp.cmake +2 -2
  65. data/tools/cmake-scripts/setup-openssl-1.1.1.cmake +1 -1
  66. data/tools/docker/alpine-3.17-dev.Dockerfile +49 -0
  67. data/tools/docker/tools/tools.sh +66 -0
  68. data/tools/docker/ubuntu-20.04-dev.Dockerfile +51 -0
  69. data/tools/dwarfs-test-helper/CMakeLists.txt +1 -1
  70. data/tools/include/pro-statvfs.h +1 -1
  71. data/tools/tests/cmake/CMakeLists.txt +1 -1
  72. data/tools/tests/setup-libfmt/CMakeLists.txt +1 -1
  73. data/tools/tests/setup-libhowardhinnerdate/CMakeLists.txt +1 -1
  74. data/tools/tests/setup-librachive/CMakeLists.txt +1 -1
  75. data/tools/tests/setup-libutfcpp/CMakeLists.txt +1 -1
  76. data/tools/tests/setup-openssl/CMakeLists.txt +1 -1
  77. metadata +10 -2
data/README.adoc CHANGED
@@ -1,20 +1,38 @@
1
1
  = Tebako: An advanced image packager for interpretive languages
2
2
 
3
- Platform tests on GitHub:
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"]
5
- image:https://github.com/tamatebako/tebako/actions/workflows/alpine.yml/badge.svg["Alpine", link="https://github.com/tamatebako/tebako/actions/workflows/alpine.yml"]
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"]
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"]
3
+ .Continuous Integration Status
4
+ [cols="1,1,3"]
5
+ |===
6
+ |*Platform Tests* |Architecture |Status
7
+
8
+ .2+|Ubuntu
9
+ |amd64 | image:https://github.com/tamatebako/tebako/actions/workflows/ubuntu.yml/badge.svg["Ubuntu amd64", link="https://github.com/tamatebako/tebako/actions/workflows/ubuntu.yml"]
10
+ |arm64 |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
+
12
+ |Alpine
13
+ |amd64 |image:https://github.com/tamatebako/tebako/actions/workflows/alpine.yml/badge.svg["Alpine", link="https://github.com/tamatebako/tebako/actions/workflows/alpine.yml"]
14
+
15
+ |macOS
16
+ |amd64 + arm64
17
+ |image:https://github.com/tamatebako/tebako/actions/workflows/macos.yml/badge.svg["macOS amd64 + arm64", link="https://github.com/tamatebako/tebako/actions/workflows/macos.yml"]
18
+
19
+ |Windows MSYS2
20
+ |amd64 |image:https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml/badge.svg["Windows MSYS2", link="https://github.com/tamatebako/tebako/actions/workflows/windows-msys.yml"]
21
+
22
+ 3+|*Tools Tests*
23
+
24
+ |Tebako containers
25
+ | |image:https://github.com/tamatebako/tebako-ci-containers/actions/workflows/build-containers.yml/badge.svg["Tebako containers", link="https://github.com/tamatebako/tebako-ci-containers/actions/workflows/build-containers.yml"]
26
+
27
+ 3+|*Quality*
8
28
 
9
- Platform tests on Cirrus:
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"]
29
+ |Lint and RSpec
30
+ | |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"]
11
31
 
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"]
32
+ |Code Coverage
33
+ | |image:https://codecov.io/gh/tamatebako/tebako/graph/badge.svg?token=XD3emQ5qsY["Tebako CLI RSpec coverage", link="https://codecov.io/gh/tamatebako/tebako"]
34
+ |===
14
35
 
15
- Quality:
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"]
17
- image:https://codecov.io/gh/tamatebako/tebako/graph/badge.svg?token=XD3emQ5qsY["Tebako cli rspec coverage", link="https://codecov.io/gh/tamatebako/tebako"]
18
36
 
19
37
  == Purpose
20
38
 
@@ -56,6 +74,8 @@ architectures.
56
74
 
57
75
  3+| **Linux**
58
76
  | Ubuntu 20.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
77
+ | Ubuntu 22.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
78
+ | Ubuntu 24.04 | amd64, aarch64 | gcc/g+\+: 10; clang/clang++: 12
59
79
  | Alpine 3.17 | amd64 | gcc/g+\+: default; clang/clang++: default
60
80
 
61
81
  3+| **macOS**
@@ -106,7 +126,7 @@ higher.
106
126
  | 3.1.6 | Linux, macOS, Windows
107
127
  | 3.2.{4,5,6,7} | Linux, macOS, Windows
108
128
  | 3.3.{3,4,5,6,7} | Linux, macOS, Windows
109
- | 3.4.1 | Linux, macOS, Windows
129
+ | 3.4.{1,2} | Linux, macOS, Windows
110
130
 
111
131
  |===
112
132
 
@@ -131,7 +151,8 @@ macOS packages are forward portable across different macOS versions.
131
151
  A Tebako executable package built on macOS 13 (Ventura) can be executed on
132
152
  macOS 14 (Sonoma), but not vice versa.
133
153
 
134
- `x86_64` macOS packages can be run on Apple M (ARM) systems.
154
+ macOS packages compiled on `x86_64` can be run on Apple M (ARM64/aarch64)
155
+ systems.
135
156
 
136
157
 
137
158
  === Linux distributions using `musl`
@@ -286,456 +307,80 @@ single, performant, executable binary.
286
307
  |===
287
308
 
288
309
 
289
- == Usage
290
-
291
- === Command-line interface
292
-
293
- Tebako works by packaging your project into a single executable binary that
294
- includes all the necessary dependencies.
295
-
296
- The way to work with Tebako is through its command-line interface (CLI).
297
- It provides the following commands:
298
-
299
- `setup`::
300
- Prepares the Tebako packaging environment.
301
-
302
- `press`::
303
- Packages a project into a single executable binary.
304
-
305
- `clean`::
306
- Removes Tebako artifacts.
307
-
308
- `clean_ruby`::
309
- Removes Tebako Ruby artifacts.
310
-
311
- `hash`::
312
- Calculates the Tebako script hash for use as a cache key in CI/CD environments.
313
-
314
- `version`::
315
- Displays the Tebako version.
316
-
317
- `help`::
318
- Displays the help message.
319
-
320
-
321
- == Usage
322
-
323
- === General
324
-
325
- Tebako can be used in two ways:
326
-
327
- * Through the Tebako container
328
- * Local installation
329
-
330
- Please refer to the <<installation>> section on how to install Tebako.
331
-
332
-
333
- [[installation]]
334
310
  == Installation
335
311
 
336
312
  === General
337
313
 
338
- Installation of Tebako is only needed in order to package an application.
339
-
340
- There is no need to install anything for users who run the packaged application.
341
-
342
-
343
- === Using Docker
344
-
345
- ==== General
346
-
347
- If you have Docker installed and available, the easiest way to run Tebako is
348
- through the official Docker containers.
349
-
350
- Docker containers with preinstalled Tebako packaging environments for Ubuntu and
351
- Alpine Linux are available at
352
- https://github.com/tamatebako/tebako-ci-containers[tebako-ci-containers].
353
-
354
-
355
- ==== Pull the container
356
-
357
- Pull the Tebako container image.
358
-
359
- [source,sh]
360
- ----
361
- docker pull ghcr.io/tamatebako/tebako-<container_tag>:latest
362
- ----
363
-
364
- `<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
314
+ Tebako installation is only required for packaging applications.
365
315
 
316
+ Users who run packaged applications do not need to install anything.
366
317
 
367
- ==== Running Tebako commands in the container
318
+ Tebako can be used for packaging in two ways:
368
319
 
369
- Simply prefix the Tebako command with `docker run` and the container image.
370
-
371
- [source,sh]
372
- ----
373
- docker run -v <application_folder>:/mnt/w \
374
- -t ghcr.io/tamatebako/tebako-<container_tag>:latest \
375
- tebako {command} {parameters}
376
- ----
377
-
378
- ==== Packaging from outside the container
379
-
380
- To package your application from outside the container, just run a single Docker
381
- command.
382
-
383
- This command mounts the application folder into the container and runs the
384
- `tebako press` command, specifying the application root, entry point, output
385
- location, and Ruby version.
386
-
387
- [source,sh]
388
- ----
389
- docker run -v <application_folder>:/mnt/w \
390
- -t ghcr.io/tamatebako/tebako-<container_tag>:latest \
391
- tebako press <tebako-press-parameters>
392
- ----
393
-
394
- `<application_folder>`:: is the path to your application folder.
395
-
396
- `<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
397
-
398
-
399
- [example]
400
- ====
401
- Assume that you have a Ruby application in the `fontist` folder of the current
402
- directory.
403
-
404
- You can package it to `./fontist-package` using the following command:
405
-
406
- [source,sh]
407
- ----
408
- docker run -v $PWD:/mnt/w \
409
- -t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
410
- tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.4
411
- ----
412
- ====
413
-
414
- ==== Packaging from inside the container
415
-
416
- It is also possible to package an application from inside the Tebako container.
417
-
418
- Start and enter the container interactively.
419
-
420
- [source,sh]
421
- ----
422
- docker run -it --rm -v <application_folder>:/mnt/w \
423
- ghcr.io/tamatebako/tebako-<container_tag>:latest bash
424
- ----
425
-
426
- `<application_folder>`:: is the path to your application folder.
427
-
428
- `<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
429
-
430
-
431
- Once inside, run the `tebako press` command:
432
-
433
- [source,sh]
434
- ----
435
- tebako press <tebako press parameters>
436
- ----
437
-
438
- [example]
439
- ====
440
- Assume that you have a Ruby application in the `fontist` folder of the current
441
- directory.
442
-
443
- You can package it to `./fontist-package` using the following command:
444
-
445
- [source,sh]
446
- ----
447
- $ docker run -it --rm -v $PWD:/mnt/w ghcr.io/tamatebako/tebako-<container_tag>:latest bash
448
-
449
- # Inside the container:
450
- $ tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.4
451
- ----
452
- ====
320
+ * Through the link:https://github.com/tamatebako/tebako-ci-containers[Tebako CI docker containers]
321
+ * Through local installation
453
322
 
323
+ Installation for both GNU and musl Linux distributions may heavily depend on the OS version,
324
+ so we recommend using link:https://github.com/tamatebako/tebako-ci-containers[Tebako CI docker containers]
325
+ for Linux packaging.
454
326
 
455
327
  === Local installation
456
328
 
457
- ==== General
458
-
459
- There are cases where Docker may not be suitable for your needs, such as:
460
-
461
- . Admin privileges: Running Docker requires administrative privileges, which
462
- means Docker may not be available to users on their machines.
463
-
464
- . Performance penalty: Docker introduces a performance penalty due to the
465
- overhead of running containers. This can be a concern when packaging complex
466
- applications that require heavy memory usage.
467
-
468
- In such cases, you can choose to install Tebako locally.
469
-
470
- Tebako is distributed as a Ruby gem. A Ruby environment is necessary.
471
-
472
-
473
- [source,sh]
474
- ----
475
- $ gem install tebako
476
- ----
477
-
478
-
479
- ==== Prerequisites
480
-
481
- These prerequisites are needed only for users who want to install Tebako on
482
- their machine and build all Tebako components locally.
329
+ To use Tebako on macOS or Windows, you need to install it locally.
483
330
 
484
- If you use Docker, there is no need to set up these prerequisites.
331
+ On Linux, there may be cases where Docker is not suitable for your needs, such as:
485
332
 
486
- ===== Ubuntu 20.04
333
+ 1. Administrative privileges: Running Docker requires administrative privileges,
334
+ which may not be available to all users on their machines.
487
335
 
488
- ====== General
336
+ 2. Performance impact: Docker introduces performance overhead due to
337
+ containerization. This can be a concern when packaging complex
338
+ applications that require significant memory resources.
489
339
 
490
- There are several prerequisites that need to be installed on Ubuntu 20.04 for
491
- Tebako to work correctly.
340
+ In such cases, you can choose to install Tebako locally on Linux as well.
492
341
 
342
+ Please refer to the separate document link:INSTALLATION.adoc[INSTALLATION.adoc]
343
+ for instructions on how to install Tebako.
493
344
 
494
- ====== GNU C/C++ 10+ or Clang C/C++ 12+
495
-
496
- [source,sh]
497
- ----
498
- apt install -y gcc-10 g++-10
499
- update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
500
- update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
501
- ----
502
-
503
- or
504
-
505
- [source,sh]
506
- ----
507
- apt install -y clang-12
508
- update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 150
509
- update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-12 150
510
- ----
511
-
512
- ====== CMake version 3.20+
513
-
514
- Tebako requires CMake at a version of at least 3.20+.
515
-
516
- If such CMake version is not available as a default package, set it up as
517
- follows.
518
-
519
- .Installing CMake 3.20+
520
- [source,sh]
521
- ----
522
- apt-get remove --purge --auto-remove cmake
523
- apt-get update
524
- apt-get install -y software-properties-common lsb-release curl
525
- apt-get clean all
526
- curl https://apt.kitware.com/kitware-archive.sh | bash
527
- apt-get install cmake
528
- ----
529
-
530
- ====== Other development tools and libraries
531
-
532
- [source,sh]
533
- ----
534
- apt-get -y install sudo git curl build-essential pkg-config bison flex autoconf \
535
- binutils-dev libevent-dev acl-dev libfmt-dev libjemalloc-dev libiberty-dev \
536
- libdouble-conversion-dev liblz4-dev liblzma-dev libssl-dev libunwind-dev \
537
- libboost-filesystem-dev libboost-program-options-dev libboost-system-dev \
538
- libboost-iostreams-dev libboost-date-time-dev libboost-context-dev \
539
- libboost-regex-dev libboost-thread-dev libbrotli-dev libdwarf-dev libelf-dev \
540
- libgoogle-glog-dev libffi-dev libgdbm-dev libyaml-dev libncurses-dev \
541
- libreadline-dev libncurses-dev libreadline-dev ruby-dev ruby-bundler \
542
- libutfcpp-dev
543
- ----
544
-
545
- ===== Alpine 3.17
546
-
547
- ====== General
548
-
549
- There are several prerequisites that need to be installed on Alpine 3.17 for
550
- Tebako to work correctly.
551
-
552
- ====== APK packages
553
-
554
- Run the following command to install all prerequisites.
555
-
556
- [source,sh]
557
- ----
558
- apk --no-cache --upgrade add build-base cmake git bash autoconf boost-static \
559
- boost-dev flex-dev bison make binutils-dev libevent-dev acl-dev sed python3 \
560
- pkgconfig lz4-dev openssl-dev zlib-dev xz ninja zip unzip curl libdwarf-dev \
561
- libunwind-dev gflags-dev elfutils-dev libevent-static openssl-libs-static \
562
- lz4-static xz-dev zlib-static libunwind-static acl-static tar libffi-dev \
563
- gdbm-dev yaml-dev yaml-static ncurses-dev ncurses-static readline-dev \
564
- readline-static p7zip ruby-dev gcompat gettext-dev gperf brotli-dev \
565
- brotli-static jemalloc-dev fmt-dev xz-static
566
- ----
567
-
568
- ===== macOS
569
-
570
- ====== General
571
-
572
- There are several prerequisites that need to be installed on macOS for Tebako to work correctly.
573
-
574
- The following instructions work for:
575
-
576
- * macOS 13 (Ventura) through macOS 15 (Sequoia)
577
-
578
-
579
- ====== Homebrew packages
580
-
581
- We use Homebrew to install the necessary packages on macOS.
582
-
583
- Tebako provides a `Brewfile` at the repository root that you can install all
584
- dependencies using the `brew bundle` command.
585
-
586
- [source,sh]
587
- ----
588
- $ brew bundle
589
- ----
590
-
591
- Alternatively, you can install the packages manually.
592
-
593
- [source,sh]
594
- ----
595
- $ brew update
596
- $ brew install gnu-sed bash pkg-config bison flex binutils libffi gdbm zlib \
597
- ncurses double-conversion boost jemalloc fmt glog libevent libsodium lz4 xz \
598
- libyaml openssl@3
599
- ----
600
-
601
- ====== Bison 3+
602
-
603
- Tebako requires Bison 3+.
604
-
605
- On macOS 14, the default Bison version is 2.3, and the Homebrew formula is
606
- keg-only, which means that the full path to the Bison binary must be used to
607
- utilize the correct version.
608
-
609
- Run the following command prior to using Tebako, or add it into your shell
610
- profile.
611
-
612
- [source,sh]
613
- ----
614
- export PATH="$(brew --prefix bison)/bin:$PATH"
615
- ----
616
-
617
- ====== jemalloc library build
618
-
619
- On macOS, the `libdwarfs` build script creates an additional `jemalloc`
620
- installation. This is done to satisfy the magic applied by folly during linking
621
- but uses a static library.
622
-
623
- If the `jemalloc` library is built within an emulated environment (QEMU,
624
- Rosetta, etc.), there are known issues
625
- (link:https://github.com/jemalloc/jemalloc/issues/1997[jemalloc issue #1997])
626
- where `jemalloc` incorrectly detects the number of significant virtual address
627
- bits and therefore defines them wrongly (`lg-vaddr` parameter).
628
-
629
- Technically, these issues can be fixed by explicitly setting the
630
- `--with-lg-vaddr` parameter for the `jemalloc` build. However, we decided not to
631
- automate this since we do not feel that we can provide reasonable test coverage.
632
-
633
- Instead, our build script accepts the `LG_VADDR` environment variable and passes
634
- it to the jemalloc build as `--with-lg-vaddr=${LG_VADDR}`.
635
-
636
- The `LG_VADDR` parameter specifies the number of significant virtual address
637
- bits, which can vary based on the CPU architecture and emulation status.
638
-
639
- This is a simple example script to set `LG_VADDR`.
640
-
641
- NOTE: This is provided for illustration only.
642
-
643
- [example]
644
- ====
645
- [source,sh]
646
- ----
647
- #!/bin/bash
648
-
649
- # Check the CPU architecture
650
- ARCH=$(uname -m)
651
-
652
- # Check if running under Rosetta 2 emulation
653
- if [[ "$ARCH" == "x86_64" && $(sysctl -n sysctl.proc_translated) == "1" ]]; then
654
- echo "Running on Apple Silicon under Rosetta 2 emulation"
655
- export LG_VADDR=39
656
- elif [[ "$ARCH" == "arm64" ]]; then
657
- echo "Running on Apple Silicon"
658
- export LG_VADDR=39
659
- else
660
- echo "Running on Intel Silicon"
661
- export LG_VADDR=48
662
- fi
663
-
664
- echo "Setting lg-vaddr to $LG_VADDR"
665
- ----
666
- ====
667
-
668
-
669
- ===== Windows
670
-
671
- ====== General
345
+ == Usage
672
346
 
673
- The following instructions work for:
347
+ === Command-line interface
674
348
 
675
- * Windows 10, 11
676
- * Windows Server 2019, 2022
349
+ Tebako works by packaging your project into a single executable binary that
350
+ includes all the necessary dependencies.
677
351
 
678
- ====== Ruby
352
+ You interact with Tebako through its command-line interface (CLI),
353
+ which provides the following commands:
679
354
 
680
- To run Tebako you need to have Ruby installed.
681
- It is simplest to use the Ruby development environment provided by
682
- https://rubyinstaller.org[RubyInstaller].
355
+ Basic use:
683
356
 
684
- For example, Ruby+Devkit 3.1.4-1.
357
+ `press`::
358
+ Packages a project into a single executable binary.
359
+ See <<press>> section for details.
685
360
 
686
- ====== MinGW ucrt64
361
+ Advanced use:
687
362
 
688
- Enable MinGW ucrt64 and install the necessary packages.
363
+ `setup`::
364
+ Runs post-install setup and creates the Tebako packaging environment.
365
+ See <<setup>> section for details.
689
366
 
690
- The `ridk` command originates from the RubyInstaller installation.
367
+ `clean`::
368
+ Removes Tebako artifacts.
369
+ See <<clean>> section for details.
691
370
 
692
- [source,sh]
693
- ----
694
- $ ridk enable ucrt64
695
- $ pacman -S git tar bison flex toolchain make cmake
696
- boost diffutils libevent double-conversion
697
- fmt glog dlfcn gtest autotools ncurses libyaml
698
- ----
371
+ `clean_ruby`::
372
+ Removes Tebako Ruby artifacts.
373
+ See <<clean_ruby>> section for details.
699
374
 
375
+ `hash`::
376
+ Calculates the Tebako script hash for use as a cache key in CI/CD environments.
377
+ See <<hash>> section for details.
700
378
 
379
+ `help`::
380
+ Displays the help message.
701
381
 
702
382
  == Packaging
703
383
 
704
- [[root-folder-selection]]
705
- === Tebako root folder (aka prefix) selection
706
-
707
- The Tebako prefix determines the base directory for the tebako packaging environment. It contain build artifacts for
708
- Tebako run-time, libraries and other components and is an essential part of configuring how Tebako operates within your system.
709
-
710
- The selection of the Tebako prefix follows a specific order of precedence to
711
- ensure flexibility and ease of use:
712
-
713
- . *User-specified prefix*:
714
- The most direct way to set the root folder is by specifying it through a
715
- command-line argument.
716
-
717
- . *Current Working Directory (PWD)*:
718
- If the prefix option is explicitly set to `PWD`, Tebako uses the current working
719
- directory as Tebako root folder.
720
-
721
- . *Environment variable (`TEBAKO_PREFIX`)*:
722
- In the absence of a user-specified option, Tebako looks for an environment
723
- variable named `TEBAKO_PREFIX`. If found, its value is used as the root folder.
724
-
725
- . *Default value*:
726
- If no prefix is specified and the `TEBAKO_DIR` environment variable is not set,
727
- Tebako defaults to using a directory named `.tebako` in the user's home
728
- directory.
729
-
730
- Path Expansion: Regardless of the method used to set the Tebako prefix, Tebako
731
- expands the provided path to an absolute path. This expansion includes resolving
732
- relative paths based on the current working directory and expanding user
733
- directory shortcuts like `~`.
734
-
735
- Please do not use Tebako prefix under your application root (`--root` parameter). It is not an error
736
- but it will cause Tebako to place all build-time artifacts to tebako package dramatically increasing its size.
737
- You do not need it unless under very special circumstances like tebako packaging tebako itself.
738
-
739
384
  === Commands
740
385
 
741
386
  Tebako provides several commands to manage the packaging and deployment process.
@@ -862,6 +507,8 @@ to be separately packaged.
862
507
  `application`::: Create the application package only. The output file is named according to the `-o` option.
863
508
  `runtime`::: Create the runtime package only. The output file is named according to the `-o` option.
864
509
 
510
+ More information on the `mode` option is available in the <<Tebako runtime and application packages. Splitting and bundling.>> section.
511
+
865
512
  `--ref`::
866
513
  (optional)
867
514
  Defaults to `tebako-runtime`.
@@ -895,21 +542,20 @@ tebako press \
895
542
 
896
543
  ==== Setup
897
544
 
898
- This command sets up the Tebako packaging environment.
545
+ Tebako requires post-install setup after gem installation .
546
+ Post-intall setup is called automatically during the first packaging.
547
+ There is no need run setup manually unless you need pristine Tebako
548
+ packaging environment to implement caching strategy.
549
+ We recommended to build cache based on `tebako setup` output. Building cache
550
+ based on `tebako press` may create inconsistent environment upon restore.
551
+
899
552
 
900
- Collects required packages, builds the and creates packaging environment. This
553
+ Setup collects required packages, builds the and creates packaging environment. This
901
554
  is a lengthy task that can take significant time, up to 1 hour.
902
555
 
903
556
  Tebako supports several configurations at a single system given that their root
904
557
  directories differ and multiple Ruby versions within single configuration
905
558
 
906
- This command is optional, tebako creates packaging environment automatically
907
- upon the first invocation of press command.
908
-
909
- However, if you plan to use tebako in CI/CD environment with caching it is
910
- highly recommended to build cache based on `tebako setup` output. Building cache
911
- based on `tebako press` may create inconsistent environment upon restore.
912
-
913
559
  [source,sh]
914
560
  ----
915
561
  $ tebako setup \
@@ -965,7 +611,7 @@ tebako clean --prefix='~/.tebako'
965
611
  ----
966
612
  ====
967
613
 
968
-
614
+ <<clean_ruby>>
969
615
  ==== Clean Ruby
970
616
 
971
617
  This command cleans up only the Ruby artifacts from the specified prefix
@@ -1007,6 +653,7 @@ tebako clean_ruby --prefix='~/.tebako'
1007
653
  ----
1008
654
  ====
1009
655
 
656
+ <<hash>>
1010
657
  ==== Build script hash
1011
658
 
1012
659
  This command outputs a hash value for the Tebako build script, which can be used
@@ -1017,6 +664,117 @@ as a cache key in CI/CD pipelines.
1017
664
  $ tebako hash
1018
665
  ----
1019
666
 
667
+ === Using Docker
668
+
669
+ ==== General
670
+
671
+ If you have Docker installed and available, the easiest way to run Tebako is
672
+ through the official Docker containers.
673
+
674
+ Docker containers with preinstalled Tebako packaging environments for Ubuntu and
675
+ Alpine Linux are available at
676
+ https://github.com/tamatebako/tebako-ci-containers[tebako-ci-containers].
677
+
678
+
679
+ ==== Pull the container
680
+
681
+ Pull the Tebako container image.
682
+
683
+ [source,sh]
684
+ ----
685
+ docker pull ghcr.io/tamatebako/tebako-<container_tag>:latest
686
+ ----
687
+
688
+ `<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
689
+
690
+
691
+ ==== Running Tebako commands in the container
692
+
693
+ Simply prefix the Tebako command with `docker run` and the container image.
694
+
695
+ [source,sh]
696
+ ----
697
+ docker run -v <application_folder>:/mnt/w \
698
+ -t ghcr.io/tamatebako/tebako-<container_tag>:latest \
699
+ tebako {command} {parameters}
700
+ ----
701
+
702
+ ==== Packaging from outside the container
703
+
704
+ To package your application from outside the container, just run a single Docker
705
+ command.
706
+
707
+ This command mounts the application folder into the container and runs the
708
+ `tebako press` command, specifying the application root, entry point, output
709
+ location, and Ruby version.
710
+
711
+ [source,sh]
712
+ ----
713
+ docker run -v <application_folder>:/mnt/w \
714
+ -t ghcr.io/tamatebako/tebako-<container_tag>:latest \
715
+ tebako press <tebako-press-parameters>
716
+ ----
717
+
718
+ `<application_folder>`:: is the path to your application folder.
719
+
720
+ `<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
721
+
722
+
723
+ [example]
724
+ ====
725
+ Assume that you have a Ruby application in the `fontist` folder of the current
726
+ directory.
727
+
728
+ You can package it to `./fontist-package` using the following command:
729
+
730
+ [source,sh]
731
+ ----
732
+ docker run -v $PWD:/mnt/w \
733
+ -t ghcr.io/tamatebako/tebako-ubuntu-20.04:latest \
734
+ tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.4
735
+ ----
736
+ ====
737
+
738
+ ==== Packaging from inside the container
739
+
740
+ It is also possible to package an application from inside the Tebako container.
741
+
742
+ Start and enter the container interactively.
743
+
744
+ [source,sh]
745
+ ----
746
+ docker run -it --rm -v <application_folder>:/mnt/w \
747
+ ghcr.io/tamatebako/tebako-<container_tag>:latest bash
748
+ ----
749
+
750
+ `<application_folder>`:: is the path to your application folder.
751
+
752
+ `<container_tag>`:: is the desired image tag (e.g., `ubuntu-20.04` or `alpine-3.17`).
753
+
754
+
755
+ Once inside, run the `tebako press` command:
756
+
757
+ [source,sh]
758
+ ----
759
+ tebako press <tebako press parameters>
760
+ ----
761
+
762
+ [example]
763
+ ====
764
+ Assume that you have a Ruby application in the `fontist` folder of the current
765
+ directory.
766
+
767
+ You can package it to `./fontist-package` using the following command:
768
+
769
+ [source,sh]
770
+ ----
771
+ $ docker run -it --rm -v $PWD:/mnt/w ghcr.io/tamatebako/tebako-<container_tag>:latest bash
772
+
773
+ # Inside the container:
774
+ $ tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=3.2.4
775
+ ----
776
+ ====
777
+
1020
778
  === Tebako configuration file
1021
779
 
1022
780
  It is possible to provide all or some options for the `tebako
@@ -1047,7 +805,20 @@ options:
1047
805
  ----
1048
806
  ====
1049
807
 
1050
- === Options prefernce order
808
+ [[root-folder-selection]]
809
+ === Tebako root folder (aka prefix) selection
810
+
811
+ The Tebako prefix determines the base directory for the tebako packaging environment. It contain build artifacts for
812
+ Tebako run-time, libraries and other components and is an essential part of configuring how Tebako operates within your system.
813
+
814
+ The selection of the Tebako prefix follows a specific order of precedence to
815
+ ensure flexibility and ease of use as described in the next section.
816
+
817
+ Please do not use Tebako prefix under your application root (`--root` parameter). It is not an error
818
+ but it will cause Tebako to place all build-time artifacts to tebako package dramatically increasing its size.
819
+ You do not need it unless under very special circumstances like tebako packaging tebako itself.
820
+
821
+ === Options preference order
1051
822
 
1052
823
  Tebako supports several methods to set options. The table below show preference order and limitations for specific options.
1053
824
  samller order means higher proirity.
@@ -1213,41 +984,12 @@ Here is a summary of the scenarios:
1213
984
 
1214
985
  These scenarios determine how the project is packaged and where the entry point is located within the packaged filesystem.
1215
986
 
1216
- == Run-time options
987
+ == Tebako runtime and application packages. Splitting and bundling.
1217
988
 
1218
989
  === General
1219
990
 
1220
- Generally Tebako package passes command line options to the packaged application.
1221
-
1222
- [example]
1223
- ====
1224
- For example, if the package was created with the following command
1225
-
1226
- [source,sh]
1227
- ----
1228
- tebako press \
1229
- --root='~/projects/myproject' \
1230
- --entry=start.rb \
1231
- --output=/temp/myproject.tebako
1232
- ----
1233
- running
1234
-
1235
- [source,sh]
1236
- ----
1237
- /temp/myproject.tebako --option --parameter value
1238
- ----
1239
-
1240
- will be translated by Tebako bootstrap code to
1241
-
1242
- [source,sh]
1243
- ----
1244
- myproject --option --parameter value
1245
- ----
1246
- ====
1247
-
1248
- However there are several command-line parameters that are intercepted processed
1249
- by Tebako bootstrap code as described below.
1250
-
991
+ Tebako provides a method either to create a single bundle package that contains Ruby run-time and the application or create separate
992
+ reusable runtime package and application package that can be deployed without a runtime.
1251
993
 
1252
994
  === Creating a bundle package
1253
995
 
@@ -1394,10 +1136,68 @@ Hello, Maxim!
1394
1136
  ----
1395
1137
  ====
1396
1138
 
1139
+ == Packaging Ruby Gems with Post-Installation Requirements
1140
+
1141
+ Unlike the traditional approach to Ruby program distribution, Tebako is designed with a clear separation between the build and
1142
+ target environments. We assume that a Tebako package created in the build environment should remain independent of it and run unchanged
1143
+ in the target environment.
1144
+
1145
+ While this approach is appealing, it imposes certain limitations on some Ruby gems, including Tebako itself. Specifically, gems that
1146
+ require a post-installation setup step often establish a strong dependency on the target environment. This setup might involve installing
1147
+ native libraries, linking to existing system components, or otherwise relying on the target system’s configuration.
1148
+
1149
+ To be packaged by Tebako, gems that require post-installation setup must meet two additional requirements:
1150
+
1151
+ 1. *Ability to run post-installation setup from a read-only filesystem, outside the gem installation folder.*
1152
+ For example, Tebako uses the location specified by the `prefix` parameter to create any necessary files during post-installation.
1153
+
1154
+ 2. *Automatic execution of the post-installation setup when required.*
1155
+ For instance, when the `tebako press` command is executed, it first checks whether `tebako setup` has been run and triggers it if necessary.
1156
+
1157
+ By adhering to these principles, gems that require post-installation setup will not only be compatible with Tebako but will also provide a more
1158
+ robust and consistent runtime experience, allowing them to run seamlessly across different environments.
1159
+
1160
+
1161
+ == Run-time options
1162
+
1163
+ === General
1164
+
1165
+ Generally, Tebako packages pass command line options to the packaged application.
1166
+
1167
+ [example]
1168
+ ====
1169
+ For example, if the package was created with the following command
1170
+
1171
+ [source,sh]
1172
+ ----
1173
+ tebako press \
1174
+ --root='~/projects/myproject' \
1175
+ --entry=start.rb \
1176
+ --output=/temp/myproject.tebako
1177
+ ----
1178
+ running
1179
+
1180
+ [source,sh]
1181
+ ----
1182
+ /temp/myproject.tebako --option --parameter value
1183
+ ----
1184
+
1185
+ will be translated by Tebako bootstrap code to
1186
+
1187
+ [source,sh]
1188
+ ----
1189
+ myproject --option --parameter value
1190
+ ----
1191
+ ====
1192
+
1193
+ However, there are several command-line parameters that are intercepted and processed
1194
+ by Tebako bootstrap code as described below.
1195
+
1196
+
1397
1197
  === Image extraction (`--tebako-extract` option)
1398
1198
 
1399
1199
  Tebako provides an option to extract its DwarFS filesystem from a package to
1400
- a local folder for verification or execution.
1200
+ a local folder for verification or examination.
1401
1201
 
1402
1202
  [source,sh]
1403
1203
  ----
@@ -1450,11 +1250,11 @@ change the paths for temporary files, caches, and sockets.
1450
1250
  To address this inevitable limitation for Ruby applications,
1451
1251
  Tebako provides an option to mount a host folder to the memfs tree.
1452
1252
 
1453
- When using Tebako, consider the packaging scenario mentioned above, as it
1454
- defines the layout of the application tree.
1253
+ When using Tebako, be aware of how your application's directory structure is packaged,
1254
+ as this affects which paths may need mounting.
1455
1255
 
1456
- The `--tebako-extract` option may be useful for understanding the placement of
1457
- files and folders.
1256
+ You can use the `--tebako-extract` option described earlier to better understand
1257
+ your application's file structure before deciding which folders to mount.
1458
1258
 
1459
1259
  [example]
1460
1260
  ====
@@ -1479,8 +1279,8 @@ The `--tebako-mount` option has the following syntax:
1479
1279
  The `--tebako-mount` option can be repeated multiple times to mount more than
1480
1280
  one object. The `memfs path` is relative to the memfs root, and it is
1481
1281
  recommended to use absolute paths for host objects. Both directories and files
1482
- can be mounted in this way. Tebako allows overlaying existing memfs objects, so
1483
- there are no significant limitations.
1282
+ can be mounted in this way. Tebako allows you to overlay host directories on existing memfs objects,
1283
+ providing a flexible solution for handling read-write requirements in packaged applications.
1484
1284
 
1485
1285
  == Trivia: origin of name
1486
1286
 
@@ -1497,11 +1297,16 @@ Since "tamatebako" is rather long for the non-Japanese speaker, we use "tebako"
1497
1297
 
1498
1298
  == Contributing
1499
1299
 
1500
- We welcome contributions! Please see our contributing guidelines for more
1501
- information.
1300
+ We welcome contributions!
1301
+
1302
+ Please see our link:CONTRIBUTING.adoc[contribution guidelines] and our
1303
+ link:CODE_OF_CONDUCT.adoc[code of conduct] for more information,.
1304
+
1305
+ NOTE: Our guidelines are aligned with the contribution guidelines from the RNP project.
1502
1306
 
1503
1307
  == License
1504
1308
 
1505
1309
  Copyright Ribose. All rights reserved.
1506
1310
 
1507
- Tebako is released under the BSD 2-Clause License. See the LICENSE file for details.
1311
+ Tebako is released under the BSD 2-Clause License. See the
1312
+ link:LICENSE.md[LICENSE.md] file for details.