erlware/joxa — pull request #50 by dch (2013-03-11 07:34:58+00:00)
Title: support building escriptized joxa on windows

This isn't ready to commit yet, but might be close enough for somebody else to finish off. I've asked if there's a way to tell rebar to:

- support multiple output targets (generate both joxa and joxa.cmd)
- use platform-specific escript_* targets

Else this would need to be done in post_hooks somehow.

This rebar tweak produces a valid escript `joxa` archive for windows, that can simply be renamed to `joxa.cmd` and is ready to run. This can be built on unix, it doesn't need a windows development environment.

```
diff --git i/rebar.config w/rebar.config
index 8c546c7..28de4e7 100644
--- i/rebar.config
+++ w/rebar.config
@@ -17,6 +17,9 @@
{escript_incl_apps,
[erlware_commons, getopt]}.

-{escript_emu_args, "%%!\n"}.
+
+{escript_shebang, "@echo off & setlocal & path=%~dp0;%path%; & escript.exe \"%~dpn0.cmd\" %* & endlocal & goto :eof\n"}.
+{escript_comment, "%% -*- erlang -*-\n"}.
+{escript_emu_args, "%%! -smp enable\n"}.

{post_hooks, [{compile, "make jxa"}]}.
```