Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for building standalone executable with warp #69

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ _build
*.iml
rebar3.crashdump
*~
warp/aesophia_cli
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,22 @@ EXAMPLES:
Test
---
$ ./test/test_cli.sh

Building a standalone executable
---

The escript built above requires an Erlang distribution on the target system to run.

It's also possible to package everything into a single executable using Warp (https://github.com/dgiagio/warp/tree/master/examples/erlang):

$ ./rebar3 escriptize

$ ./rebar3 release

$ warp-packer -a linux-x64 -i _build/default/rel/aesophia_cli -e launch -o warp/aesophia_cli

The standalone executable warp/aesophia_cli can now be copied to an x86 linux system without Erlang installed.

Warp also supports windows x86, but this is not tested.

Warp currently does not support arm64.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sad

10 changes: 10 additions & 0 deletions rebar.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@
{profiles, [{test,
[{erl_opts, [debug_info]}
]}]}.

{relx, [{release, { aesophia_cli, "7.0.1" },
[sasl, aesophia_cli, aesophia, aeserialization, eblake2]},

{dev_mode, false},
{include_erts, true}, % To include Erlang runtime system
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is possible to include Erlang runtime into executable, why do we need warp in macOS and Linux?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a single executable like a C program. It creates a self extracting tar file with the command

{extended_start_script, true}, % Should be true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why it should be true


{overlay, [{template, "./warp/launch", "launch"},
{copy, "_build/default/bin/aesophia_cli", "aesophia_cli"}]}]}.
7 changes: 7 additions & 0 deletions warp/launch
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

DIR="$(cd "$(dirname "$0")" ; pwd -P)"
APP=$DIR/bin/{{release_name}}

exec $APP escript aesophia_cli $@