From 048f8420dd50d4c05428cba2e920609851b5e21b Mon Sep 17 00:00:00 2001 From: Winford Date: Thu, 11 Dec 2025 02:29:56 +0000 Subject: [PATCH 1/3] Also cleanup doc artifacts with make clean Update Makefile to remove the generated doc artifacts along with regular build files when cleaning. Signed-off-by: Winford --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ed705a4..180a616 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ## -## Copyright (c) 2020 dushin.net +## Copyright (c) 2019 dushin.net ## All rights reserved. ## ## SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later @@ -31,6 +31,7 @@ rel: clean: rm -rf _build + rm -fr doc publish: doc rebar3 as publish hex publish --doc-dir docs From 9616cd4abea4feb4d8c2fbdc398924469cfc273b Mon Sep 17 00:00:00 2001 From: Winford Date: Thu, 11 Dec 2025 01:24:33 +0000 Subject: [PATCH 2/3] Set locale in publish docs workflow Some runners use native name encoding of latin1, Elixir (and ex_doc) expect utf-8 encoding. This is fixed by setting the LANG environmant variable to C.UTF-8 and ensuring the locale is generated. Signed-off-by: Winford --- .github/workflows/publish_docs.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/publish_docs.yml b/.github/workflows/publish_docs.yml index fa65966..46b511d 100644 --- a/.github/workflows/publish_docs.yml +++ b/.github/workflows/publish_docs.yml @@ -21,6 +21,9 @@ permissions: pages: write id-token: write +env: + LANG: C.UTF-8 + jobs: build: @@ -28,6 +31,11 @@ jobs: container: erlang:28 steps: + - name: "Set locale" + run: | + sudo locale-gen C.UTF-8 + sudo update-locale LANG="C.UTF-8" + - name: "Checkout code" uses: actions/checkout@v5 From e9676e7862e7ed134b73cd736656fad5367f258c Mon Sep 17 00:00:00 2001 From: Winford Date: Wed, 10 Dec 2025 23:10:04 +0000 Subject: [PATCH 3/3] Update documentation with `--lib` option Adds documentation for the newly added `lib` option for both cli and api usage. Signed-off-by: Winford --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 972595a..104107c 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ On-line help is available via the `help` sub-command: []+ is a list of one or more input files, and are among the following: [--prune|-p] Prune dependencies + [--lib|-l] Create a library avm, with no start module [--start|-s ] Start module [--remove_lines|-r] Remove line number information from AVM files @@ -135,11 +136,21 @@ Note that beam files specified are stripped of their path information, inside of #### Start Entrypoint -If you are building an application that provides a start entrypoint (as opposed to a library, suitable for inclusion in another AVM file), then at least one beam module in an AVM file must contain a `start/0` entry-point, i.e., a function called `start` with arity 0. AtomVM will use this entry-point as the first function to execute, when starting. +If you are building an application that provides a start entrypoint (as opposed to a library, +suitable for inclusion in another AVM file), then at least one beam module in an AVM file must +contain a `start/0` (i.e., a function called `start` with arity 0) or `main/1` entry-point. AtomVM +will use this entry-point as the first function to execute, when starting. -> Note. It is conventional, but not required, that the first beam file in an AVM file contains the `start/0` entry-point. AtomVM will use the first BEAM file that contains an exported `start/0` function as the entry-point for the application. +When explicitly setting the `--start` module no other module will be tagged as an entrypoint, even +if multiple modules export `start/0`. -If your application has multiple modules with exported `start/0` functions, you may use the `--start ` (alternatively, `-s `) option to specify the module you would like placed first in your AVM file. The `` parameter should be the module name (without the `.beam` suffix, e.g., `main`). +> Note. It is conventional, but not required, that the first beam file in an AVM file contains the +`start/0` entry-point. + +If your application has multiple modules with exported `start/0` functions, or you are creating an +escript with a `main/1`, you may use the `--start ` (alternatively, `-s `) option +to specify the entrypoint module. The `` parameter should be the module name (without the +`.beam` suffix, e.g., `main`). A previously created AVM file file may be supplied as input (including the same file specified as output, for example). The contents of any input AVM files will be included in the output AVM file. For example, if you are building a library of BEAM files (for example, none of which contain a `start/0` entry-point), you may want to archive these into an AVM file, which can be used for downstream applications. @@ -149,6 +160,12 @@ In addition, you may specify a "normal" (i.e., non-beam or non-AVM) file. Norma > Note. It is conventional in AtomVM for normal files to have the path `/priv/`. +#### Creating Libraries + +Libraries can be packed using the `--lib` (alternatively, `-l`) option. This will create a packed +avm archive without auto selecting a start module, even if one or more of the included modules +export `start/0`. + #### Pruning If you specify the `--prune` (alternatively, `-p`) flag, then `packbeam` will only include beam files that are transitively dependent on the entry-point beam. Transitive dependencies are determined by imports, as well as use of an atom in a module (e.g, as the result of a dynamic function call, based on a module name). @@ -241,6 +258,7 @@ Alternatively, you may specify a set of options with the `packbeam_api:create/3` | Key | Type | Default | Description | |-----|------|---------|-------------| | `prune` | `boolean()` | `false` | Specify whether to prune the output AVM file. Pruned AVM files can take considerably less space and hence may lead to faster development times. | +| `lib` | `boolean()` | `false` | Create a library (no entrypoint) | | `start` | `module()` | n/a | Specify the start module, if it can't be determined automatically from the application. | | `application` | `module()` | n/a | Specify the application module. The `.app` file will be encoded and included as an element in the AVM file with the path `/priv/application.bin` | | `include_lines` | `boolean()` | `true` | Specify whether to include line number information in generated AVM files. |