diff --git a/ChangeLog b/ChangeLog
index 43775a2..c3807bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [0.6.2] (Unreleased)
+
+- Add `relx` stanzas to create a standalone release of the `packbeam` utility
+
## [0.6.1]
- Added `extract` sub-command
diff --git a/Makefile b/Makefile
index b301be8..718e8f2 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
## All rights reserved.
##
-all: compile escript edoc etest
+all: compile escript edoc etest release
compile:
rebar3 compile
@@ -19,6 +19,10 @@ etest:
rebar3 proper --cover
rebar3 cover --verbose
+release:
+ rebar3 release
+ rebar3 tar
+
clean:
rm -rf _build
diff --git a/README.md b/README.md
index e0237f2..a89124a 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# packbeam
+# `atomvvm_packbeam`
An Erlang Escript and OTP library used to generate an AtomVM AVM file from a set of files (beam files, previously built AVM files, or even arbitrary data files).
@@ -15,19 +15,37 @@ Building Packbeam requires Erlang/OTP 22 or later, for compatibility with AtomVM
# Build
-To build, run
+To build a release, run the following commands:
- shell$ rebar3 escriptize
+ shell$ rebar3 release
+ shell$ rebar3 tar
-or
+These commands will create an Erlang tar archive containing a versioned release of the `atomvm_packbeam` tool, e.g.,
- shell$ make escript
+ ...
+ ===> Tarball successfully created: _build/prod/rel/atomvm_packbeam/atomvm_packbeam-0.6.2.tar.gz
-These commands will create an Erlang `escript` file called `packbeam` under
+in your local working directory.
- _build/default/bin/packbeam
+> IMPORTANT! The files in this tar archive do not contain the `atomvm_packbeam` prefix, so extracting these files without care will create a `bin` and `lib` directory in the location into which files from the archive is extracted. See the example below before proceeding!
-in your local working directory.
+You can then copy this tar file to any compatible system and extract the contents into a local directory. E.g.,
+
+ shell$ mkdir /opt/atomvm_packbeam-0.6.2
+ shell$ cp _build/prod/rel/atomvm_packbeam/atomvm_packbeam-0.6.2.tar.gz /opt/atomvm_packbeam-0.6.2/.
+ shell$ cd /opt/atomvm_packbeam-0.6.2
+ shell$ tar xf atomvm_packbeam-0.6.2.tar.gz
+ ...
+
+Set your `PATH` environment variable to include the `bin` directory of this unpacked archive, and you should then be able to run the `packbeam` command included therein.
+
+For example:
+
+ shell$ export PATH=/opt/atomvm_packbeam-0.6.2/bin:$PATH
+ shell$ packbeam help
+ Syntax:
+ packbeam
+ ...
# `packbeam` command
diff --git a/rebar.config b/rebar.config
index 59effef..30d210f 100644
--- a/rebar.config
+++ b/rebar.config
@@ -5,8 +5,8 @@
{erl_opts, [no_debug_info]}.
{deps, []}.
-{escript_incl_apps, [packbeam]}.
-{escript_main_app, packbeam}.
+{escript_incl_apps, [atomvm_packbeam]}.
+{escript_main_app, atomvm_packbeam}.
{escript_name, packbeam}.
{escript_emu_args, "%%! +sbtu +A1\n"}.
@@ -28,3 +28,21 @@
]}
]}
]}.
+
+{relx, [
+ {release, {atomvm_packbeam, "0.6.2"}, [
+ kernel,
+ stdlib,
+ atomvm_packbeam
+ ]},
+ {mode, prod},
+ {generate_start_script, false},
+ {overlay, [
+ {copy, "src/packbeam.erl", "bin/packbeam.escript"}
+ ]}
+]}.
+
+%% copy and rename escript next to `packbeam.escript` (See escript man page)
+{post_hooks, [
+ {release, "cp ${REBAR_BUILD_DIR}/rel/atomvm_packbeam/erts-${ERLANG_ERTS_VER}/bin/escript ${REBAR_BUILD_DIR}/rel/atomvm_packbeam/bin/packbeam"}
+]}.
diff --git a/src/packbeam.app.src b/src/atomvm_packbeam.app.src
similarity index 95%
rename from src/packbeam.app.src
rename to src/atomvm_packbeam.app.src
index e06c057..e18acaf 100644
--- a/src/packbeam.app.src
+++ b/src/atomvm_packbeam.app.src
@@ -16,11 +16,11 @@
%%
{
application,
- packbeam,
+ atomvm_packbeam,
[
{description,
"An escript and library to manipulate (create, list, delete) AtomVM PackBeam files"},
- {vsn, "0.6.1"},
+ {vsn, "0.6.2"},
{registered, []},
{applications, [kernel, stdlib]},
{env, []},
diff --git a/test/prop_packbeam.erl b/test/prop_packbeam.erl
index 7a910bf..83af604 100644
--- a/test/prop_packbeam.erl
+++ b/test/prop_packbeam.erl
@@ -18,7 +18,7 @@
-include_lib("proper/include/proper.hrl").
-define(BUILD_DIR, "_build/").
--define(TEST_BEAM_DIR, "_build/test/lib/packbeam/test/").
+-define(TEST_BEAM_DIR, "_build/test/lib/atomvm_packbeam/test/").
%%
diff --git a/test/test_packbeam.erl b/test/test_packbeam.erl
index cdee645..104149c 100644
--- a/test/test_packbeam.erl
+++ b/test/test_packbeam.erl
@@ -20,7 +20,7 @@
-include_lib("eunit/include/eunit.hrl").
-define(BUILD_DIR, "_build/").
--define(TEST_BEAM_DIR, "_build/test/lib/packbeam/test/").
+-define(TEST_BEAM_DIR, "_build/test/lib/atomvm_packbeam/test/").
packbeam_create_simple_test() ->
AVMFile = dest_dir("packbeam_create_simple_test.avm"),