diff --git a/.github/workflows/build-wasm_of_ocaml.yml b/.github/workflows/build-wasm_of_ocaml.yml index 7f5e1eb65..e0f394dc6 100644 --- a/.github/workflows/build-wasm_of_ocaml.yml +++ b/.github/workflows/build-wasm_of_ocaml.yml @@ -107,9 +107,6 @@ jobs: ref: feaf8f831051fd5f316963b28efd728cf0b0eca1 path: jane-street/opam-repository - - name: Pin dune - run: opam pin add -n dune.3.17 https://github.com/ocaml/dune.git - - name: Pin wasm_of_ocaml working-directory: ./wasm_of_ocaml run: opam pin -n --with-version `< VERSION` . diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 580e6e264..1bf899719 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -112,10 +112,6 @@ jobs: dune-cache: true opam-pin: false - - name: Pin dune - run: | - opam pin add dune.3.17 https://github.com/ocaml/dune.git - - run: opam install conf-pkg-config if: runner.os == 'Windows' @@ -164,4 +160,4 @@ jobs: branch: wikidoc folder: doc-dev clean: true - target-folder: doc/dev/ \ No newline at end of file + target-folder: doc/dev/ diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 36f9a8c5e..e912e7b97 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -17,9 +17,6 @@ jobs: with: ocaml-compiler: "5.2" dune-cache: true - - name: Pin dune - run: | - opam pin add -n dune.3.17 https://github.com/ocaml/dune.git - uses: ocaml/setup-ocaml/lint-opam@v3 lint-fmt: @@ -32,9 +29,6 @@ jobs: with: ocaml-compiler: "5.2" dune-cache: true - - name: Pin dune - run: | - opam pin add -n dune.3.17 https://github.com/ocaml/dune.git - uses: ocaml/setup-ocaml/lint-fmt@v3 lint-runtime: diff --git a/README.md b/README.md index 35e78b431..ee5c69df1 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,8 @@ The following commands will perform a minimal installation: ``` git clone https://github.com/ocaml-wasm/wasm_of_ocaml cd wasm_of_ocaml -opam pin add -n --with-version 3.17 https://github.com/ocaml/dune.git -opam pin add -n --with-version 5.8.2-wasm . -opam install wasm_of_ocaml-compiler +opam pin add -n --with-version 6.0.0 . +opam install dune.3.17.0 wasm_of_ocaml-compiler ``` You may want to install additional packages. For instance: diff --git a/benchmarks/sources/ml/dune b/benchmarks/sources/ml/dune index 86d08b50c..31b138c56 100644 --- a/benchmarks/sources/ml/dune +++ b/benchmarks/sources/ml/dune @@ -1,14 +1,49 @@ (executables - (names almabench bdd binary_trees boyer boyer_no_exc fannkuch_redux_2 - fannkuch_redux fft fib hamming kb kb_no_exc loop nucleic quicksort raytrace - soli splay takc taku)) + (names + almabench + bdd + binary_trees + boyer + boyer_no_exc + fannkuch_redux_2 + fannkuch_redux + fft + fib + hamming + kb + kb_no_exc + loop + nucleic + quicksort + raytrace + soli + splay + takc + taku)) (alias (name benchmark) - (deps almabench.exe bdd.exe binary_trees.exe boyer.exe boyer_no_exc.exe - fannkuch_redux_2.exe fannkuch_redux.exe fft.exe fib.exe hamming.exe kb.exe - kb_no_exc.exe loop.exe nucleic.exe quicksort.exe raytrace.exe soli.exe - splay.exe takc.exe taku.exe)) + (deps + almabench.exe + bdd.exe + binary_trees.exe + boyer.exe + boyer_no_exc.exe + fannkuch_redux_2.exe + fannkuch_redux.exe + fft.exe + fib.exe + hamming.exe + kb.exe + kb_no_exc.exe + loop.exe + nucleic.exe + quicksort.exe + raytrace.exe + soli.exe + splay.exe + takc.exe + taku.exe)) (env (_ diff --git a/compiler/bin-js_of_ocaml/dune b/compiler/bin-js_of_ocaml/dune index 772ff23d7..f246e9d57 100644 --- a/compiler/bin-js_of_ocaml/dune +++ b/compiler/bin-js_of_ocaml/dune @@ -51,7 +51,10 @@ (install (section man) (package js_of_ocaml-compiler) - (files js_of_ocaml.1 js_of_ocaml-link.1 js_of_ocaml-build-fs.1 + (files + js_of_ocaml.1 + js_of_ocaml-link.1 + js_of_ocaml-build-fs.1 js_of_ocaml-build-runtime.1)) ;; Generate and install runtime.js for compatibility reasons diff --git a/compiler/bin-wasm_of_ocaml/dune b/compiler/bin-wasm_of_ocaml/dune index ea5833d69..cd5f1a468 100644 --- a/compiler/bin-wasm_of_ocaml/dune +++ b/compiler/bin-wasm_of_ocaml/dune @@ -23,8 +23,11 @@ (rule (target wa_runtime.ml) - (deps gen/gen.exe ../../runtime/wasm/runtime.wasm - ../../runtime/wasm/runtime.js ../../runtime/wasm/deps.json) + (deps + gen/gen.exe + ../../runtime/wasm/runtime.wasm + ../../runtime/wasm/runtime.js + ../../runtime/wasm/deps.json) (action (with-stdout-to %{target} diff --git a/compiler/lib-dynlink/dune b/compiler/lib-dynlink/dune index 0f96313ef..84788e768 100644 --- a/compiler/lib-dynlink/dune +++ b/compiler/lib-dynlink/dune @@ -6,5 +6,7 @@ (foreign_stubs (language c) (names stubs)) - (libraries js_of_ocaml-compiler js_of_ocaml-compiler.runtime + (libraries + js_of_ocaml-compiler + js_of_ocaml-compiler.runtime compiler-libs.bytecomp)) diff --git a/compiler/lib/dune b/compiler/lib/dune index 29c37de04..075e08643 100644 --- a/compiler/lib/dune +++ b/compiler/lib/dune @@ -2,7 +2,11 @@ (name js_of_ocaml_compiler) (public_name js_of_ocaml-compiler) (synopsis "Js_of_ocaml compiler library") - (libraries compiler-libs.common compiler-libs.bytecomp menhirLib sedlex + (libraries + compiler-libs.common + compiler-libs.bytecomp + menhirLib + sedlex yojson) (flags (:standard -w -7-37 -safe-string)) @@ -13,9 +17,21 @@ (menhir (modules js_parser) - (flags --table --external-tokens Js_token --explain --unused-token TAnnot - --unused-token TComment --unused-token TCommentLineDirective --unused-token - T_ERROR --unused-token T_AT)) + (flags + --table + --external-tokens + Js_token + --explain + --unused-token + TAnnot + --unused-token + TComment + --unused-token + TCommentLineDirective + --unused-token + T_ERROR + --unused-token + T_AT)) (menhir (modules annot_parser) diff --git a/compiler/tests-check-prim/dune b/compiler/tests-check-prim/dune index 4b786374d..5a0767a94 100644 --- a/compiler/tests-check-prim/dune +++ b/compiler/tests-check-prim/dune @@ -23,7 +23,11 @@ (action (with-stdout-to %{targets} - (run %{bin:js_of_ocaml} check-runtime +dynlink.js +toplevel.js + (run + %{bin:js_of_ocaml} + check-runtime + +dynlink.js + +toplevel.js %{dep:main.bc})))) (rule @@ -37,7 +41,11 @@ (action (with-stdout-to %{targets} - (run %{bin:js_of_ocaml} check-runtime +dynlink.js +toplevel.js + (run + %{bin:js_of_ocaml} + check-runtime + +dynlink.js + +toplevel.js %{dep:unix.bc})))) (rule @@ -51,7 +59,11 @@ (action (with-stdout-to %{targets} - (run %{bin:js_of_ocaml} check-runtime +dynlink.js +toplevel.js + (run + %{bin:js_of_ocaml} + check-runtime + +dynlink.js + +toplevel.js %{dep:unix.bc})))) (rule @@ -63,7 +75,11 @@ (action (with-stdout-to %{targets} - (run %{bin:js_of_ocaml} check-runtime +dynlink.js +toplevel.js + (run + %{bin:js_of_ocaml} + check-runtime + +dynlink.js + +toplevel.js %{dep:main.bc})))) (rule @@ -77,7 +93,11 @@ (action (with-stdout-to %{targets} - (run %{bin:js_of_ocaml} check-runtime +dynlink.js +toplevel.js + (run + %{bin:js_of_ocaml} + check-runtime + +dynlink.js + +toplevel.js %{dep:unix.bc})))) (rule @@ -91,5 +111,9 @@ (action (with-stdout-to %{targets} - (run %{bin:js_of_ocaml} check-runtime +dynlink.js +toplevel.js + (run + %{bin:js_of_ocaml} + check-runtime + +dynlink.js + +toplevel.js %{dep:unix.bc})))) diff --git a/compiler/tests-dynlink-js/dune b/compiler/tests-dynlink-js/dune index b21c3df8e..da871999b 100644 --- a/compiler/tests-dynlink-js/dune +++ b/compiler/tests-dynlink-js/dune @@ -39,8 +39,13 @@ (target main.js) (enabled_if %{env:js-enabled=}) (action - (run %{bin:js_of_ocaml} --linkall %{read-strings:effects_flags.txt} -o - %{target} %{dep:main.bc}))) + (run + %{bin:js_of_ocaml} + --linkall + %{read-strings:effects_flags.txt} + -o + %{target} + %{dep:main.bc}))) (rule (target plugin.cmo) @@ -50,19 +55,28 @@ (rule (target plugin.js) (action - (run %{bin:js_of_ocaml} %{read-strings:effects_flags.txt} + (run + %{bin:js_of_ocaml} + %{read-strings:effects_flags.txt} %{dep:./plugin.cmo}))) (rule (target plugin2.cma) (action - (run %{bin:ocamlc} -a %{dep:./plugin2a.ml} %{dep:./plugin2b.ml} -o + (run + %{bin:ocamlc} + -a + %{dep:./plugin2a.ml} + %{dep:./plugin2b.ml} + -o plugin2.cma))) (rule (target plugin2.js) (action - (run %{bin:js_of_ocaml} %{read-strings:effects_flags.txt} + (run + %{bin:js_of_ocaml} + %{read-strings:effects_flags.txt} %{dep:./plugin2.cma}))) (rule diff --git a/compiler/tests-dynlink/dune b/compiler/tests-dynlink/dune index e22a5dcbe..37de0cb1c 100644 --- a/compiler/tests-dynlink/dune +++ b/compiler/tests-dynlink/dune @@ -10,7 +10,14 @@ (enabled_if %{env:js-enabled=}) (deps plugin.cmo export) (action - (run %{bin:js_of_ocaml} --dynlink --export export --pretty -o %{target} + (run + %{bin:js_of_ocaml} + --dynlink + --export + export + --pretty + -o + %{target} %{dep:main.bc}))) (rule diff --git a/compiler/tests-full/dune b/compiler/tests-full/dune index 17668b782..5effacad3 100644 --- a/compiler/tests-full/dune +++ b/compiler/tests-full/dune @@ -3,7 +3,12 @@ (enabled_if (= %{ocaml_version} "5.2.0")) (action - (run %{bin:js_of_ocaml} --pretty --debuginfo %{lib:stdlib:stdlib.cma} -o + (run + %{bin:js_of_ocaml} + --pretty + --debuginfo + %{lib:stdlib:stdlib.cma} + -o %{targets}))) (rule @@ -26,7 +31,12 @@ (targets fs.output.js) (deps file1 file2) (action - (run %{bin:js_of_ocaml} build-fs -o %{targets} file1:/static/file1 + (run + %{bin:js_of_ocaml} + build-fs + -o + %{targets} + file1:/static/file1 file2:/static/dir/file2))) (rule diff --git a/compiler/tests-jsoo/dune b/compiler/tests-jsoo/dune index ab6d5dfd4..26f79c928 100644 --- a/compiler/tests-jsoo/dune +++ b/compiler/tests-jsoo/dune @@ -34,8 +34,14 @@ (library (name jsoo_testsuite) (modules - (:standard \ test_io test_floats test_marshal_compressed test_parsing - calc_parser calc_lexer)) + (:standard + \ + test_io + test_floats + test_marshal_compressed + test_parsing + calc_parser + calc_lexer)) (libraries unix compiler-libs.common js_of_ocaml-compiler) (foreign_stubs (language c) diff --git a/compiler/tests-ocaml/lib-effects/dune b/compiler/tests-ocaml/lib-effects/dune index 9d0b78283..102566633 100644 --- a/compiler/tests-ocaml/lib-effects/dune +++ b/compiler/tests-ocaml/lib-effects/dune @@ -18,9 +18,28 @@ (tests (build_if (>= %{ocaml_version} 5)) - (names cmphash marshal effects evenodd manylive overflow partial reperform - sched shallow_state_io shallow_state test10 test11 test1 test2 test3 test4 - test5 test6 test_lazy used_cont) + (names + cmphash + marshal + effects + evenodd + manylive + overflow + partial + reperform + sched + shallow_state_io + shallow_state + test10 + test11 + test1 + test2 + test3 + test4 + test5 + test6 + test_lazy + used_cont) (modules (:standard \ unhandled_unlinked)) (modes js wasm)) diff --git a/dune b/dune index 1aacb7538..1bd709e8a 100644 --- a/dune +++ b/dune @@ -55,7 +55,9 @@ (action (with-stdout-to %{targets} - (run %{dep:tools/version/gen/gen.exe} %{dep:VERSION} + (run + %{dep:tools/version/gen/gen.exe} + %{dep:VERSION} %{dep:tools/version/GIT-VERSION})))) (data_only_dirs _wikidoc doc-dev) diff --git a/dune-project b/dune-project index 6be93f23c..d21f14b03 100644 --- a/dune-project +++ b/dune-project @@ -93,7 +93,7 @@ (ocaml (>= 4.08)) (js_of_ocaml-compiler (= :version)) (ocamlfind (>= 1.5.1)) - (cohttp-lwt-unix :with-test) + (cohttp-lwt-unix (and (>= 6.0.0) :with-test)) (graphics :with-test) (num :with-test) (ppx_expect (and (>= v0.14.2) :with-test)) diff --git a/examples/boulderdash/dune b/examples/boulderdash/dune index 64ff9f3c7..952ee4939 100644 --- a/examples/boulderdash/dune +++ b/examples/boulderdash/dune @@ -10,8 +10,17 @@ (deps (glob_files maps/*.map)) (action - (run %{bin:js_of_ocaml} --source-map %{dep:boulderdash.bc} -o %{targets} - --pretty --file %{dep:maps.txt} --file maps))) + (run + %{bin:js_of_ocaml} + --source-map + %{dep:boulderdash.bc} + -o + %{targets} + --pretty + --file + %{dep:maps.txt} + --file + maps))) (alias (name default) diff --git a/examples/cubes/dune b/examples/cubes/dune index 970d3f0b4..56d43c509 100644 --- a/examples/cubes/dune +++ b/examples/cubes/dune @@ -8,7 +8,12 @@ (rule (targets cubes.js) (action - (run %{bin:js_of_ocaml} --source-map %{dep:cubes.bc} -o %{targets} + (run + %{bin:js_of_ocaml} + --source-map + %{dep:cubes.bc} + -o + %{targets} --pretty))) (alias diff --git a/examples/graph_viewer/dune b/examples/graph_viewer/dune index 86f8d8edd..b22b3d62c 100644 --- a/examples/graph_viewer/dune +++ b/examples/graph_viewer/dune @@ -3,7 +3,15 @@ (libraries js_of_ocaml-lwt) (modes byte) (modules - (:standard \ scene_extents svg main viewer converter dot_lexer dot_graph + (:standard + \ + scene_extents + svg + main + viewer + converter + dot_lexer + dot_graph dot_render)) (preprocess (pps js_of_ocaml-ppx))) @@ -13,8 +21,15 @@ (rule (targets viewer_js.js) (action - (run %{bin:js_of_ocaml} --source-map %{dep:viewer_js.bc} -o %{targets} - --pretty --file %{dep:scene.json}))) + (run + %{bin:js_of_ocaml} + --source-map + %{dep:viewer_js.bc} + -o + %{targets} + --pretty + --file + %{dep:scene.json}))) (alias (name default) diff --git a/examples/hyperbolic/dune b/examples/hyperbolic/dune index 732e15c39..f1fb55f99 100644 --- a/examples/hyperbolic/dune +++ b/examples/hyperbolic/dune @@ -8,8 +8,18 @@ (rule (targets hypertree.js) (action - (run %{bin:js_of_ocaml} --source-map %{dep:hypertree.bc} -o %{targets} - --pretty --file %{dep:image_info.json} --file %{dep:messages.json} --file + (run + %{bin:js_of_ocaml} + --source-map + %{dep:hypertree.bc} + -o + %{targets} + --pretty + --file + %{dep:image_info.json} + --file + %{dep:messages.json} + --file %{dep:tree.json}))) (alias diff --git a/examples/namespace/dune b/examples/namespace/dune index 310d7102c..f61600725 100644 --- a/examples/namespace/dune +++ b/examples/namespace/dune @@ -6,20 +6,44 @@ (rule (target a.js) (action - (run %{bin:js_of_ocaml} %{dep:./a.bc} --wrap-with-fun implemA -o a.js - --pretty --target-env browser --no-extern-fs))) + (run + %{bin:js_of_ocaml} + %{dep:./a.bc} + --wrap-with-fun + implemA + -o + a.js + --pretty + --target-env + browser + --no-extern-fs))) (rule (target a-iife.js) (action - (run %{bin:js_of_ocaml} %{dep:./a.bc} -o a-iife.js --target-env browser + (run + %{bin:js_of_ocaml} + %{dep:./a.bc} + -o + a-iife.js + --target-env + browser --no-extern-fs))) (rule (target b.js) (action - (run %{bin:js_of_ocaml} %{dep:./b.bc} --wrap-with-fun implemB -o b.js - --pretty --target-env browser --no-extern-fs))) + (run + %{bin:js_of_ocaml} + %{dep:./b.bc} + --wrap-with-fun + implemB + -o + b.js + --pretty + --target-env + browser + --no-extern-fs))) (alias (name default) diff --git a/examples/planet/dune b/examples/planet/dune index 108465e9e..30e038884 100644 --- a/examples/planet/dune +++ b/examples/planet/dune @@ -8,7 +8,12 @@ (rule (targets planet.js) (action - (run %{bin:js_of_ocaml} --source-map %{dep:planet.bc} -o %{targets} + (run + %{bin:js_of_ocaml} + --source-map + %{dep:planet.bc} + -o + %{targets} --pretty))) (alias diff --git a/examples/separate_compilation/dune b/examples/separate_compilation/dune index 1cf2ae460..8f0cc22b6 100644 --- a/examples/separate_compilation/dune +++ b/examples/separate_compilation/dune @@ -27,31 +27,56 @@ (rule (targets lib1.cma.js) (action - (run %{bin:js_of_ocaml} --pretty --source-map %{dep:lib1.cma} -o + (run + %{bin:js_of_ocaml} + --pretty + --source-map + %{dep:lib1.cma} + -o %{targets}))) (rule (targets module1.js) (action - (run %{bin:js_of_ocaml} --pretty --source-map %{dep:module1.cmo} -o + (run + %{bin:js_of_ocaml} + --pretty + --source-map + %{dep:module1.cmo} + -o %{targets}))) (rule (targets module2.js) (action - (run %{bin:js_of_ocaml} --pretty --source-map %{dep:module2.cmo} -o + (run + %{bin:js_of_ocaml} + --pretty + --source-map + %{dep:module2.cmo} + -o %{targets}))) (rule (targets stdlib.cma.js) (action - (run %{bin:js_of_ocaml} --pretty --source-map %{lib:stdlib:stdlib.cma} -o + (run + %{bin:js_of_ocaml} + --pretty + --source-map + %{lib:stdlib:stdlib.cma} + -o %{targets}))) (rule (targets std_exit.js) (action - (run %{bin:js_of_ocaml} --pretty --source-map %{lib:stdlib:std_exit.cmo} -o + (run + %{bin:js_of_ocaml} + --pretty + --source-map + %{lib:stdlib:std_exit.cmo} + -o %{targets}))) (rule @@ -62,9 +87,18 @@ (rule (targets bin.js) (action - (run %{bin:js_of_ocaml} link --pretty %{dep:myruntime.js} - %{dep:stdlib.cma.js} %{dep:lib1.cma.js} %{dep:module1.js} - %{dep:module2.js} %{dep:std_exit.js} -o %{targets}))) + (run + %{bin:js_of_ocaml} + link + --pretty + %{dep:myruntime.js} + %{dep:stdlib.cma.js} + %{dep:lib1.cma.js} + %{dep:module1.js} + %{dep:module2.js} + %{dep:std_exit.js} + -o + %{targets}))) (rule (target bin.actual) @@ -83,5 +117,11 @@ (alias (name default) (enabled_if %{env:js-enabled=}) - (deps myruntime.js stdlib.cma.js std_exit.js module2.js module1.js bin.js + (deps + myruntime.js + stdlib.cma.js + std_exit.js + module2.js + module1.js + bin.js index.html)) diff --git a/examples/webgl/dune b/examples/webgl/dune index 28d4d3b42..8025ac85f 100644 --- a/examples/webgl/dune +++ b/examples/webgl/dune @@ -8,8 +8,15 @@ (rule (targets webgldemo.js) (action - (run %{bin:js_of_ocaml} --source-map %{dep:webgldemo.bc} -o %{targets} - --pretty --file %{dep:monkey.model}))) + (run + %{bin:js_of_ocaml} + --source-map + %{dep:webgldemo.bc} + -o + %{targets} + --pretty + --file + %{dep:monkey.model}))) (alias (name default) diff --git a/js_of_ocaml-toplevel.opam b/js_of_ocaml-toplevel.opam index c1423b680..b2daa598b 100644 --- a/js_of_ocaml-toplevel.opam +++ b/js_of_ocaml-toplevel.opam @@ -16,7 +16,7 @@ depends: [ "ocaml" {>= "4.08"} "js_of_ocaml-compiler" {= version} "ocamlfind" {>= "1.5.1"} - "cohttp-lwt-unix" {with-test} + "cohttp-lwt-unix" {>= "6.0.0" & with-test} "graphics" {with-test} "num" {with-test} "ppx_expect" {>= "v0.14.2" & with-test} diff --git a/ppx/ppx_deriving_json/tests/dune b/ppx/ppx_deriving_json/tests/dune index b861e7eb7..2e9ac5492 100644 --- a/ppx/ppx_deriving_json/tests/dune +++ b/ppx/ppx_deriving_json/tests/dune @@ -1,6 +1,9 @@ (executables (names main) - (libraries ppxlib toplevel_expect_test js_of_ocaml.deriving + (libraries + ppxlib + toplevel_expect_test + js_of_ocaml.deriving js_of_ocaml-ppx_deriving_json) (modes byte) (link_flags (-linkall))) diff --git a/runtime/js/dune b/runtime/js/dune index 4984c3f57..f31ffd1b6 100644 --- a/runtime/js/dune +++ b/runtime/js/dune @@ -1,8 +1,32 @@ (install (section lib) (package js_of_ocaml-compiler) - (files bigarray.js bigstring.js dynlink.js fs.js fs_fake.js fs_node.js gc.js - graphics.js ieee_754.js int64.js internalMod.js io.js jslib.js - jslib_js_of_ocaml.js lexing.js marshal.js md5.js mlBytes.js nat.js - parsing.js stdlib.js toplevel.js unix.js weak.js domain.js prng.js sync.js + (files + bigarray.js + bigstring.js + dynlink.js + fs.js + fs_fake.js + fs_node.js + gc.js + graphics.js + ieee_754.js + int64.js + internalMod.js + io.js + jslib.js + jslib_js_of_ocaml.js + lexing.js + marshal.js + md5.js + mlBytes.js + nat.js + parsing.js + stdlib.js + toplevel.js + unix.js + weak.js + domain.js + prng.js + sync.js runtime_events.js)) diff --git a/runtime/wasm/dune b/runtime/wasm/dune index 118546efb..90422c0f9 100644 --- a/runtime/wasm/dune +++ b/runtime/wasm/dune @@ -33,9 +33,20 @@ (target runtime.wasm) (deps runtime.merged.wasm) (action - (run wasm-opt -g --enable-gc --enable-exception-handling - --enable-reference-types --enable-tail-call --enable-strings - --enable-multivalue --enable-bulk-memory %{deps} -O3 -o %{target}))) + (run + wasm-opt + -g + --enable-gc + --enable-exception-handling + --enable-reference-types + --enable-tail-call + --enable-strings + --enable-multivalue + --enable-bulk-memory + %{deps} + -O3 + -o + %{target}))) (rule (target runtime.merged.wasm) @@ -48,9 +59,19 @@ "which wasm-merge > /dev/null || (echo 'Error: Binaryen tools not found in the PATH'; false)") (bash "wasm-merge --version | grep -q 'version \\(11[89]\\|1[2-9][0-9]\\)' || (echo 'Error: Binaryen version 118 or greater is currently required'; false)") - (run wasm-merge -g --enable-gc --enable-exception-handling - --enable-reference-types --enable-tail-call --enable-strings - --enable-multivalue --enable-bulk-memory %{read-lines:args} -o %{target})))) + (run + wasm-merge + -g + --enable-gc + --enable-exception-handling + --enable-reference-types + --enable-tail-call + --enable-strings + --enable-multivalue + --enable-bulk-memory + %{read-lines:args} + -o + %{target})))) (rule (target args) diff --git a/tools/sourcemap/dune b/tools/sourcemap/dune index 3fcda6f57..e23b801e4 100644 --- a/tools/sourcemap/dune +++ b/tools/sourcemap/dune @@ -1,6 +1,8 @@ (executables (names jsoo_sourcemap) - (libraries js_of_ocaml-compiler compiler-libs.common + (libraries + js_of_ocaml-compiler + compiler-libs.common js_of_ocaml-compiler.findlib-support) (flags (:standard -safe-string))) diff --git a/toplevel/bin/dune b/toplevel/bin/dune index ce9282740..a23648824 100644 --- a/toplevel/bin/dune +++ b/toplevel/bin/dune @@ -2,5 +2,7 @@ (names jsoo_mkcmis jsoo_mktop jsoo_listunits) (public_names jsoo_mkcmis jsoo_mktop jsoo_listunits) (package js_of_ocaml-toplevel) - (libraries js_of_ocaml-compiler js_of_ocaml-compiler.findlib-support + (libraries + js_of_ocaml-compiler + js_of_ocaml-compiler.findlib-support js_of_ocaml-compiler.runtime-files)) diff --git a/toplevel/examples/eval/dune b/toplevel/examples/eval/dune index 899147a9c..76fc91026 100644 --- a/toplevel/examples/eval/dune +++ b/toplevel/examples/eval/dune @@ -19,8 +19,15 @@ (targets eval.js) (enabled_if %{env:js-enabled=}) (action - (run %{bin:js_of_ocaml} --export %{dep:export.txt} --toplevel --pretty - %{dep:eval.bc} -o %{targets}))) + (run + %{bin:js_of_ocaml} + --export + %{dep:export.txt} + --toplevel + --pretty + %{dep:eval.bc} + -o + %{targets}))) (alias (name default) diff --git a/toplevel/examples/lwt_toplevel/dune b/toplevel/examples/lwt_toplevel/dune index 57dc89684..13a604886 100644 --- a/toplevel/examples/lwt_toplevel/dune +++ b/toplevel/examples/lwt_toplevel/dune @@ -69,7 +69,11 @@ (action (with-stdout-to %{target} - (run ocamlfind query tyxml.functor -format + (run + ocamlfind + query + tyxml.functor + -format "%d/html_types.cmi:/static/cmis/")))) (rule @@ -80,15 +84,26 @@ (rule (targets test_dynlink.js) (action - (run %{bin:js_of_ocaml} --pretty --toplevel - %{read-strings:effects_flags.txt} %{dep:test_dynlink.cmo}))) + (run + %{bin:js_of_ocaml} + --pretty + --toplevel + %{read-strings:effects_flags.txt} + %{dep:test_dynlink.cmo}))) (rule (target test_lib_jsoo.js) (action - (run %{bin:js_of_ocaml} --pretty --toplevel --include-runtime - %{read-strings:effects_flags.txt} %{dep:test_lib/stubs.js} - %{dep:test_lib/test_lib_jsoo.cma} -o %{target}))) + (run + %{bin:js_of_ocaml} + --pretty + --toplevel + --include-runtime + %{read-strings:effects_flags.txt} + %{dep:test_lib/stubs.js} + %{dep:test_lib/test_lib_jsoo.cma} + -o + %{target}))) (rule (targets export.txt) @@ -100,11 +115,27 @@ (package js_of_ocaml-tyxml) (package js_of_ocaml-toplevel)) (action - (run jsoo_listunits -o %{targets} stdlib graphics str dynlink - js_of_ocaml-compiler.runtime js_of_ocaml-lwt.graphics - js_of_ocaml-ppx.as-lib js_of_ocaml.deriving lwt tyxml.functor - tyxml.functor:html_types.cmi react reactiveData js_of_ocaml - js_of_ocaml-lwt js_of_ocaml-tyxml js_of_ocaml-toplevel))) + (run + jsoo_listunits + -o + %{targets} + stdlib + graphics + str + dynlink + js_of_ocaml-compiler.runtime + js_of_ocaml-lwt.graphics + js_of_ocaml-ppx.as-lib + js_of_ocaml.deriving + lwt + tyxml.functor + tyxml.functor:html_types.cmi + react + reactiveData + js_of_ocaml + js_of_ocaml-lwt + js_of_ocaml-tyxml + js_of_ocaml-toplevel))) (executable (name effects_flags) @@ -128,11 +159,30 @@ (targets toplevel.js) (enabled_if %{env:js-enabled=}) (action - (run %{bin:js_of_ocaml} compile --pretty %{read-strings:effects_flags.txt} - --Werror --target-env browser --file %{dep:examples.ml} --file - %{dep:test_dynlink.cmo} --file %{dep:test_dynlink.js} --file - %{dep:test_lib_jsoo.js} --export %{dep:export.txt} --toplevel --disable - shortvar %{dep:toplevel.bc} -o %{targets}))) + (run + %{bin:js_of_ocaml} + compile + --pretty + %{read-strings:effects_flags.txt} + --Werror + --target-env + browser + --file + %{dep:examples.ml} + --file + %{dep:test_dynlink.cmo} + --file + %{dep:test_dynlink.js} + --file + %{dep:test_lib_jsoo.js} + --export + %{dep:export.txt} + --toplevel + --disable + shortvar + %{dep:toplevel.bc} + -o + %{targets}))) (alias (name default) diff --git a/toplevel/examples/server/server.ml b/toplevel/examples/server/server.ml index d14cf2c22..4ddb58c8a 100644 --- a/toplevel/examples/server/server.ml +++ b/toplevel/examples/server/server.ml @@ -31,7 +31,7 @@ let server () = >>= fun () -> Server.respond_file ~headers:header_plain_user_charset ~fname () with _ -> (* send static file *) - let fname = Server.resolve_file ~docroot:"." ~uri in + let fname = Path.resolve_local_file ~docroot:"." ~uri in Lwt_io.eprintf "static: %s\n" fname >>= fun () -> let headers = diff --git a/toplevel/lib/dune b/toplevel/lib/dune index e5946b494..8a9d23c49 100644 --- a/toplevel/lib/dune +++ b/toplevel/lib/dune @@ -2,7 +2,10 @@ (name js_of_ocaml_toplevel) (public_name js_of_ocaml-toplevel) (synopsis "Js_of_ocaml toplevel library") - (libraries js_of_ocaml-compiler js_of_ocaml-compiler.dynlink - compiler-libs.bytecomp compiler-libs.toplevel) + (libraries + js_of_ocaml-compiler + js_of_ocaml-compiler.dynlink + compiler-libs.bytecomp + compiler-libs.toplevel) (preprocess (pps ppx_optcomp_light))) diff --git a/toplevel/test/dune b/toplevel/test/dune index ee4a69476..b56071400 100644 --- a/toplevel/test/dune +++ b/toplevel/test/dune @@ -15,8 +15,16 @@ (rule (targets test_toplevel.js) (action - (run %{bin:js_of_ocaml} --export %{dep:export.txt} --toplevel --disable - shortvar %{dep:test_toplevel.bc} -o %{targets}))) + (run + %{bin:js_of_ocaml} + --export + %{dep:export.txt} + --toplevel + --disable + shortvar + %{dep:test_toplevel.bc} + -o + %{targets}))) (rule (target test_toplevel.actual)