From 6ef800e030514438ba941ec2961ea38fab991ee2 Mon Sep 17 00:00:00 2001 From: Fabrice Le Fessant Date: Thu, 16 Mar 2023 11:48:11 +0100 Subject: [PATCH 1/2] Version 0.9.2 with dune-flags field in package program --- VERSION | 2 +- skeletons/packages/library/dune_ | 5 +++++ skeletons/packages/program/dune_ | 4 ++++ skeletons/packages/program/linking_flags.sh | 3 +++ skeletons/packages/program/package.toml | 3 +++ skeletons/projects/virtual/scripts/static-build.sh | 4 +++- 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index f374f66..2003b63 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.9.1 +0.9.2 diff --git a/skeletons/packages/library/dune_ b/skeletons/packages/library/dune_ index 2642908..877ffd1 100644 --- a/skeletons/packages/library/dune_ +++ b/skeletons/packages/library/dune_ @@ -4,7 +4,11 @@ (name !{library-name}) (public_name !{name}) (wrapped !{pack-modules}) + ; use field 'dune-libraries' to add libraries without opam deps (libraries !{dune-libraries} !(package-dune-libraries)) + ; use field 'dune-flags' to set this value + (flags (!(dune-flags:default::standard))) + ; use field 'dune-stanzas' to add more stanzas here !{dune-stanzas} !(package-dune-stanzas) ) @@ -13,4 +17,5 @@ (documentation (package !{package-name})) !{package-dune-installs} +; use field 'dune-trailer' to add more stuff here !(package-dune-trailer) diff --git a/skeletons/packages/program/dune_ b/skeletons/packages/program/dune_ index 6352ca0..f47f3be 100644 --- a/skeletons/packages/program/dune_ +++ b/skeletons/packages/program/dune_ @@ -3,7 +3,10 @@ (name main) (public_name !{program-name}) (package !{name}) + ; use field 'dune-libraries' to add libraries without opam deps (libraries !{dune-libraries} !(package-dune-libraries)) + (flags (!(dune-flags:default::standard))) + ; use field 'dune-stanzas' to add more stanzas here !{dune-stanzas} !(package-dune-stanzas) ) @@ -28,4 +31,5 @@ (documentation (package !{package-name})) !{package-dune-installs} +; use field 'dune-trailer' to add more stuff here !(package-dune-trailer) diff --git a/skeletons/packages/program/linking_flags.sh b/skeletons/packages/program/linking_flags.sh index c86e018..7c775b5 100644 --- a/skeletons/packages/program/linking_flags.sh +++ b/skeletons/packages/program/linking_flags.sh @@ -52,6 +52,8 @@ case $(uname -s) in Linux) case $(. /etc/os-release && echo $ID) in alpine) + # Use `static-alpine-clibs` field to add libs more here + # (or `static-clibs` for both Linux and Macos) COMMON_LIBS="!(static-alpine-clibs) camlstr unix c" # `m` and `pthread` are built-in musl echo2 '(-noautolink' @@ -68,6 +70,7 @@ case $(uname -s) in esac ;; Darwin) + # Use `static-macos-clibs` field to add libs more here COMMON_LIBS="!(static-macos-clibs) unix" # `m` and `pthread` are built-in in libSystem echo2 '(-noautolink' diff --git a/skeletons/packages/program/package.toml b/skeletons/packages/program/package.toml index 2893ce5..14c2038 100644 --- a/skeletons/packages/program/package.toml +++ b/skeletons/packages/program/package.toml @@ -2,3 +2,6 @@ skeleton := "program" kind := "program" + +[fields] +dune-flags = ":standard (:include linking.sexp)" diff --git a/skeletons/projects/virtual/scripts/static-build.sh b/skeletons/projects/virtual/scripts/static-build.sh index 9ff0742..d5ea402 100755 --- a/skeletons/projects/virtual/scripts/static-build.sh +++ b/skeletons/projects/virtual/scripts/static-build.sh @@ -10,7 +10,9 @@ cd $(dirname "$0")/.. set -o pipefail git ls-files -z | xargs -0 tar c | \ - docker run --rm -i \ +docker run --rm -i \ + # Use `docker-alpine-image` field to replace ocamlpro/ocaml:4.13 + # and `docker-alpine-packages` to add more apk packages !(docker-alpine-image:default:ocamlpro/ocaml:4.13) \ sh -uexc \ 'tar x >&2 && From cdd7d7adb2f678838a6ae1244c2c95ad8c287899 Mon Sep 17 00:00:00 2001 From: Fabrice Le Fessant Date: Mon, 3 Apr 2023 20:54:34 +0200 Subject: [PATCH 2/2] Fixes in js packages --- CHANGES.md | 9 +++++++++ README.md | 14 ++++++++++++++ skeletons/packages/js_driver/dune_ | 5 ++--- skeletons/packages/js_driver/skeleton.toml | 2 +- skeletons/packages/js_library/dune_ | 1 - skeletons/packages/js_library/skeleton.toml | 2 +- skeletons/packages/js_program/dune_ | 5 ++--- skeletons/packages/js_program/skeleton.toml | 2 +- skeletons/projects/virtual/skeleton.toml | 3 +++ 9 files changed, 33 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b8d5823..baca5e2 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,13 @@ +Version 0.9.2 (2023-??-??) +* Packages: + * New field `dune-flags`, with value `:standard` by default +* Package `program` and `driver`: + * Field `dune-flags` initialized to `:standard (:include linking.sexp)` +* Package `js_program`, `js_driver` and `js_library`: + * Remove default preprocessor in dune_ + * Use !{program-name} as dune name + Version 0.9.1 (2023-03-13) * Add CHANGES.md * `virtual` project skeletons (inherited by all): diff --git a/README.md b/README.md index 3921b97..bfc714f 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,17 @@ Versioned files for `drom` +## How to update + +1. Modify the files you need to +2. Push in a branch +3. Test using `--share-version :` where `` is a remote + to your local GIT repository from + `$HOME/.config/drom/shares/7413cde042d5d886501c908e2ea77f6d` + and `` is the branch you want to test +4. Edit the files: + * `VERSION`: the new version of this branch + * `LATEST`: a *stable* version that users are advised to use + * `DROM_VERSION`: if `drom` must be upgraded to use this version +5. Push to `master` and remote tag the version + diff --git a/skeletons/packages/js_driver/dune_ b/skeletons/packages/js_driver/dune_ index 7e77804..9df3d33 100644 --- a/skeletons/packages/js_driver/dune_ +++ b/skeletons/packages/js_driver/dune_ @@ -1,15 +1,14 @@ ; generated by drom from package skeleton 'js_driver' (executable - (name main) + (name !{library-name}) (libraries !{dune-libraries} !(package-dune-libraries)) (modes js) - (preprocess (pps js_of_ocaml-ppx)) !{dune-stanzas} ) (install - (files (main.bc.js as www/js/!{name}.js)) + (files (!{library-name}.bc.js as www/js/!{name}.js)) (section share) (package !{name})) diff --git a/skeletons/packages/js_driver/skeleton.toml b/skeletons/packages/js_driver/skeleton.toml index 1262b72..c9137f7 100644 --- a/skeletons/packages/js_driver/skeleton.toml +++ b/skeletons/packages/js_driver/skeleton.toml @@ -4,4 +4,4 @@ inherits = "virtual" [file] dune_ = { file = "dune", skips = [ "@dune" ] } -"main.ml" = { skips = [ "@code" ] } +"main.ml" = { skips = [ "@code" ], create = true } diff --git a/skeletons/packages/js_library/dune_ b/skeletons/packages/js_library/dune_ index 66aa68a..47f8114 100644 --- a/skeletons/packages/js_library/dune_ +++ b/skeletons/packages/js_library/dune_ @@ -5,7 +5,6 @@ (public_name !{name}) (wrapped !{pack-modules}) (libraries !{dune-libraries} !(package-dune-libraries)) - (preprocess (pps js_of_ocaml-ppx)) (modes byte) !{dune-stanzas} !(package-dune-stanzas) diff --git a/skeletons/packages/js_library/skeleton.toml b/skeletons/packages/js_library/skeleton.toml index 3c80501..a5263c2 100644 --- a/skeletons/packages/js_library/skeleton.toml +++ b/skeletons/packages/js_library/skeleton.toml @@ -4,4 +4,4 @@ inherits = "virtual" [file] dune_ = { file = "dune", skips = [ "@dune" ] } -"main.ml" = { skips = [ "@code" ] } +"main.ml" = { skips = [ "@code" ], create = true } diff --git a/skeletons/packages/js_program/dune_ b/skeletons/packages/js_program/dune_ index 8095187..0749bca 100644 --- a/skeletons/packages/js_program/dune_ +++ b/skeletons/packages/js_program/dune_ @@ -1,15 +1,14 @@ ; generated by drom from package skeleton 'js_program' (executable - (name main) + (name !{library-name}) (libraries !{dune-libraries} !(package-dune-libraries)) (modes js) - (preprocess (pps js_of_ocaml-ppx)) !{dune-stanzas} ) (install - (files (main.bc.js as www/js/!{name}.js)) + (files (!{library-name}.bc.js as www/js/!{name}.js)) (section share) (package !{name})) diff --git a/skeletons/packages/js_program/skeleton.toml b/skeletons/packages/js_program/skeleton.toml index 9f5ffd2..64b2855 100644 --- a/skeletons/packages/js_program/skeleton.toml +++ b/skeletons/packages/js_program/skeleton.toml @@ -4,4 +4,4 @@ inherits = "virtual" [file] dune_ = { file = "dune", skips = [ "@dune" ] } -"main.ml" = { skips = [ "@code" ] } +"main.ml" = { file = "!{library-name}.ml", skips = [ "@code" ], create = true } diff --git a/skeletons/projects/virtual/skeleton.toml b/skeletons/projects/virtual/skeleton.toml index 75e5d50..5447e8f 100644 --- a/skeletons/projects/virtual/skeleton.toml +++ b/skeletons/projects/virtual/skeleton.toml @@ -8,6 +8,9 @@ name = "virtual" "CHANGES.md" = { file = "CHANGES.md", create = true } +"README.md" = { + file = "README.md", create = true + } "dot_ocp-indent" = { file = ".ocp-indent", create = true,