Dune: feature-wish: `#! /usr/bin/env dune-run`

Created on 26 Feb 2019  路  1Comment  路  Source: ocaml/dune

Something to build executables in $TMPDIR and run them which could look like:

#! /usr/bin/env dune-run
#! dune-run --libraries cmdliner,base

let () = print_string "Hello world\n"

(the second-line of #! is what nix-shell does also
http://chriswarbo.net/projects/nixos/nix_shell_shebangs.html )

Most helpful comment

Why not, but we might as well use the same syntax as dune files rather than invent something new:

#! /usr/bin/env dune run
#! (libraries cmdliner base) (preprocess (pps ppx_sexp_conv)) ...

...

We should also compile that in the xdg cache dir, to avoid recompiling it on every run. For instance in ~/.cache/dune/scripts/<hash-of-file-contents>/.

>All comments

Why not, but we might as well use the same syntax as dune files rather than invent something new:

#! /usr/bin/env dune run
#! (libraries cmdliner base) (preprocess (pps ppx_sexp_conv)) ...

...

We should also compile that in the xdg cache dir, to avoid recompiling it on every run. For instance in ~/.cache/dune/scripts/<hash-of-file-contents>/.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kyldvs picture kyldvs  路  7Comments

c-cube picture c-cube  路  7Comments

rgrinberg picture rgrinberg  路  6Comments

inumanag picture inumanag  路  4Comments

mmottl picture mmottl  路  4Comments