Skip to content

Commit

Permalink
Merge pull request #4 from atomvm/release
Browse files Browse the repository at this point in the history
  • Loading branch information
UncleGrumpy committed Oct 13, 2023
2 parents 5947bdf + c592014 commit a4017c5
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 15 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## All rights reserved.
##

all: compile escript edoc etest
all: compile escript edoc etest release

compile:
rebar3 compile
Expand All @@ -19,6 +19,10 @@ etest:
rebar3 proper --cover
rebar3 cover --verbose

release:
rebar3 release
rebar3 tar

clean:
rm -rf _build

Expand Down
34 changes: 26 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# packbeam
# `atomvvm_packbeam`

An Erlang Escript and OTP library used to generate an <a href="http://github.com/bettio/AtomVM">AtomVM</a> AVM file from a set of files (beam files, previously built AVM files, or even arbitrary data files).

Expand All @@ -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 <sub-command> <options> <args>
...

# `packbeam` command

Expand Down
22 changes: 20 additions & 2 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -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"}.

Expand All @@ -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"}
]}.
4 changes: 2 additions & 2 deletions src/packbeam.app.src → src/atomvm_packbeam.app.src
Original file line number Diff line number Diff line change
Expand Up @@ -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, []},
Expand Down
2 changes: 1 addition & 1 deletion test/prop_packbeam.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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/").


%%
Expand Down
2 changes: 1 addition & 1 deletion test/test_packbeam.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down

0 comments on commit a4017c5

Please sign in to comment.