From 523918939a359934505ef66c2eae622676e9b0ab Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 21 Jul 2025 09:59:59 +0100 Subject: [PATCH 1/3] Unify patches across all js_of_ocaml packages --- .../wasm_of_ocaml-sourcemap-contents.patch | 17 ++++++ .../js_of_ocaml-compiler.6.0.1+ox/opam | 5 ++ .../js_of_ocaml-ppx.6.0.1+ox/.opam.swp | Bin 0 -> 16384 bytes .../files/js_of_ocaml-obj_stubs.patch | 49 ++++++++++++++++++ ...s_of_ocaml-version-directive-removal.patch | 10 ++++ .../js_of_ocaml-ppx.6.0.1+ox/opam | 10 ++++ .../files/js_of_ocaml-obj_stubs.patch | 49 ++++++++++++++++++ ...s_of_ocaml-version-directive-removal.patch | 10 ++++ .../js_of_ocaml-toplevel.6.0.1+ox/opam | 10 ++++ .../files/js_of_ocaml-obj_stubs.patch | 49 ++++++++++++++++++ ...s_of_ocaml-version-directive-removal.patch | 10 ++++ .../js_of_ocaml/js_of_ocaml.6.0.1+ox/opam | 10 ++++ 12 files changed, 229 insertions(+) create mode 100644 packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/wasm_of_ocaml-sourcemap-contents.patch create mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/.opam.swp create mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch create mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch create mode 100644 packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch create mode 100644 packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch create mode 100644 packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch create mode 100644 packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/wasm_of_ocaml-sourcemap-contents.patch b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/wasm_of_ocaml-sourcemap-contents.patch new file mode 100644 index 0000000000..dccaf3e0c3 --- /dev/null +++ b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/wasm_of_ocaml-sourcemap-contents.patch @@ -0,0 +1,17 @@ +--- a/compiler/bin-wasm_of_ocaml/compile.ml ++++ b/compiler/bin-wasm_of_ocaml/compile.ml +@@ -226,8 +226,14 @@ + Option.iter sm ~f:(fun sm -> + if not sourcemap_don't_inline_content + then ++ let rewrite = ++ match Build_path_prefix_map.get_build_path_prefix_map () with ++ | Some map -> let map = Build_path_prefix_map.flip map in (fun path -> Build_path_prefix_map.rewrite map path) ++ | None -> Fun.id ++ in + Wasm_source_map.iter_sources sm (fun i j file -> ++ let file = rewrite file in + if Sys.file_exists file && not (Sys.is_directory file) + then + let sm = Fs.read_file file in + Zip.add_entry diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam index cdb149c190..df39720a78 100644 --- a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam +++ b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam @@ -73,6 +73,7 @@ patches: [ "js_of_ocaml-jane-street-5.2-compatibility.patch" "js_of_ocaml-migrate-labeled-tuples-shims.patch" "js_of_ocaml-floatarray_create_local.patch" + "wasm_of_ocaml-sourcemap-contents.patch" "js_of_ocaml-jane-street-const_null-support.patch" "js_of_ocaml-float32.patch" "js_of_ocaml-caml_array_append.patch" @@ -194,6 +195,10 @@ extra-files: [ "js_of_ocaml-floatarray_create_local.patch" "sha256=f17e392acc941dde475cb7be0654037df9b8d550aeae0d96b65394e4c4a1d4ca" ] + [ + "wasm_of_ocaml-sourcemap-contents.patch" + "sha256=93b7dddf6313836ce02fbe762c40380e20daefdd8b87ec885ee0f4ef779ad76b" + ] [ "js_of_ocaml-jane-street-const_null-support.patch" "sha256=e708cdc01c0cef3fce1cb9f31b33324977dcca1c166601905fcac1ef10262c3a" diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/.opam.swp b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/.opam.swp new file mode 100644 index 0000000000000000000000000000000000000000..308cf85a1487913567f46e97d71421172b7c217a GIT binary patch literal 16384 zcmeHNOQ2 zz0QngD`X|OaG@ZWh(SfgAZ}!YfU9iW=prC4qK-s25jXMmRiAV3J!kGccP_XPrJM87 z=bU={e|_~=)nE0Ous?s{6MAep8lHD)+OPh3bM~{Vzr5#x7d36GD%HPtePrKcRo_~9 zC3${A?k}Ojjf8e6->7O{m<`ocn{`#QXI8tC7x_lb+JAP1O?w5n1$+(2flmXMfR6ztaQhva z_6Oj5Km+6e0UGev`!wx&;M>60ffjfIcnJ90y_)tC@J--p-~w zoCW@Y!;d$B*ML6)w}1vHfi2)s;4e5}`4jMa;O9UM#Jx02$iaN`AmsRDYFSE`pc|j*Jfchwnybw)g4ikRr*luY1(sp9UPk0^nifo$N!F0;vK_*OpQ75~OF9|Xcv~Fa^ij2$>dwyu zpO(6bGNO|5NkhzUvLW8lWVo=kRPi#aMK*1a$IQ8)98*iz*RUJ2on^&30m}^l ze*=3M3?j?3Zf}j4hD@I4)io272W+iG{vE=1{5H4N32OI>j*Fa3C56}7nz~Dq<7!#j zm#{wYxh5BcO?u=+@0oRz6`9gtUFITF)9f(0nqsdbStVpvH7tADP&=5rvaU6v)|6h8 zJ1Y~~g_MKY9hxp>U9|$CY~K{PKWEbF5L@ol!BA(sovGPzsjee=>ZaPs5^5)HFHSTQ zr3D65QDc~=DK%8ewd6tn#rmN1F#S^*NLDE8=dcKvcbZM_G8D5@c4V4?+CIyZNxH7D zRYwl3YB4AEt?Ku^d6`qRb-21X*`ES&g>enr!<0yiMH>_JK+rmk&?9POw3BIGiIsVD zxdTt-5Uk8!haGd=!o8Ap?E<@!>n;o7O5QaK*5JC#7pj|cS7YJ02!|XJNf^gI3x($q zN#+Tbz)2BlLM-%!ou({tZ4%rI5-)IANE9SdBAn2ZYR!~0lG|-xY|d+*bzR+VZfs29 zJ@mqY_8XOKvniF!7f&~MBWIW!Hh4r)f+aYJ1Ma87OA^8082Ipzgu|o2^|>1hCajJ( z*7S=?VB5$|t#5Muy0)v#97d7}omB!(wkhqOyCu&DzkFhk|cghQ3vaRyQ8cu<&3;M)KoH zB@O+$>TwfaZz_M`pbpFnZD(B3uS2Pu+EC+xPf-m8_4#vH9>tA@jK%+WU4QJHZa7wK z*@pf>eUPKZoa$}^BL;I+4aWfmhKxJ7@yjgtXjb?-hn3F7EmxCgVv&3u;%v+FEE_k6 zjX})PxIt6T>5Bmib&z-elJPw2FrxPb4H_{Ey)smzyr})8xwf9=gh)$BxdVf{CHm>m zdrgO*#_2k5BWv59T6BFSmkKS6)2f>3ih;uQ1b-U^FMEzV)@aO5M%N5&Ruxp^UiE)a zh3b6ciBDaGH)xwx1GfNE6^!KK{6FX5Km7|AKKpU~(s?z*4~cnJZmYG4b|uwnAvUx; zlT@})=d#B8ZdNslkxTOtr+35){ZW|J<4eta%+LysX$qj`6q%vylZRKx^{myozVFQG zX;T$*4fXvsT<(nV8UYvB&-*r4g3gwJ4YsZOPK5C={+HSAfcy3G_5=Z9?s zHFsCk(A4-vktI7;_vH<3VaP~2uwrevbbpwDo-{PI|9=Vl@Cf^Lwg2Cb-~Sl<{T~1? z0M7s}U;z&UZ(z^=ec-#mbHFz6e&9jiy};|J>p9?Cz&C(rfyaPNK*Yi^NX2M+^r~sbDb< zdJ@<35m>Uhbkh*$I)bNU$5H4oTEucz12RYBc3zq~l<>d_{WJ~`CF8zurORV)Z+n4oT^@>1 zN*`i+$4N_fg{k^#wjUt1KUZ%khzWuCPuIqoLL&$zXAP7191QV literal 0 HcmV?d00001 diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch new file mode 100644 index 0000000000..abc1cf740b --- /dev/null +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch @@ -0,0 +1,49 @@ +--- a/runtime/js/obj.js ++++ b/runtime/js/obj.js +@@ -44,6 +44,22 @@ + return +Array.isArray(x); + } + ++//Provides: caml_obj_is_stack ++function caml_obj_is_stack(x) { ++ return 0; ++} ++ ++//Provides: caml_succ_scannable_prefix_len ++function caml_succ_scannable_prefix_len(x) { ++ return 0; ++} ++ ++//Provides: caml_obj_uniquely_reachable_words ++//Requires: caml_failwith ++function caml_obj_uniquely_reachable_words(x) { ++ caml_failwith("Obj.uniquely_reachable_words is not available in javascript."); ++} ++ + //Provides: caml_obj_tag + //Requires: caml_is_ml_bytes, caml_is_ml_string + function caml_obj_tag(x) { +--- a/runtime/wasm/obj.wat ++++ b/runtime/wasm/obj.wat +@@ -101,6 +101,21 @@ + (global $double_array_tag (export "double_array_tag") i32 (i32.const 254)) + (global $custom_tag i32 (i32.const 255)) + ++ (func (export "caml_obj_is_stack") ++ (param (ref eq)) (result (ref eq)) ++ (ref.i31 (i32.const 0))) ++ ++ (func (export "caml_succ_scannable_prefix_len") ++ (param (ref eq)) (result (ref eq)) ++ (ref.i31 (i32.const 0))) ++ ++ (@string $unique_words_unsupported "Obj.uniquely_reachable_words is not available in wasm.") ++ ++ (func (export "caml_obj_uniquely_reachable_words") ++ (param (ref eq)) (result (ref eq)) ++ (call $caml_failwith (global.get $unique_words_unsupported)) ++ (ref.i31 (i32.const 0))) ++ + (func $caml_is_closure (export "caml_is_closure") + (param $v (ref eq)) (result i32) + (i32.or (ref.test (ref $closure) (local.get $v)) diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch new file mode 100644 index 0000000000..37cd43ed47 --- /dev/null +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch @@ -0,0 +1,10 @@ +--- a/runtime/js/stdlib.js ++++ b/runtime/js/stdlib.js +@@ -302,7 +302,6 @@ + } + + //Provides: caml_process_pending_actions_with_root +-//Version: >= 5.3 + function caml_process_pending_actions_with_root(extra_root) { + return 0; + } diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam index 8e329d3a70..0b4c3ef4ef 100644 --- a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam @@ -70,6 +70,8 @@ patches: [ "js_of_ocaml-5.3-tests-runtime.patch" "js_of_ocaml-caml_bigstring_strncmp.patch" "wasm_of_ocaml-stub-caml_ml_set_channel_refill.patch" + "js_of_ocaml-version-directive-removal.patch" + "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" ] @@ -214,6 +216,14 @@ extra-files: [ "wasm_of_ocaml-stub-caml_ml_set_channel_refill.patch" "sha256=005bce63009b9539b65036b22a7b7cc531755c7caa3cf1ed8d8697698090e136" ] + [ + "js_of_ocaml-version-directive-removal.patch" + "sha256=4b1565454d0b61bc2450ab7b5fff8c5c82babc104ea6b7b9a5446eb9a929740c" + ] + [ + "js_of_ocaml-obj_stubs.patch" + "sha256=9e9064f255c065a3152f665bd5b464040f3cfbbd2580aa4bb6e17be9c2b7fcc8" + ] [ "js_of_ocaml-float32-2.patch" "sha256=3ff1eda6175f96cc3a5b2c2ae1ee395c9317d248554282c5f157c723a9fae32f" diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch new file mode 100644 index 0000000000..abc1cf740b --- /dev/null +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch @@ -0,0 +1,49 @@ +--- a/runtime/js/obj.js ++++ b/runtime/js/obj.js +@@ -44,6 +44,22 @@ + return +Array.isArray(x); + } + ++//Provides: caml_obj_is_stack ++function caml_obj_is_stack(x) { ++ return 0; ++} ++ ++//Provides: caml_succ_scannable_prefix_len ++function caml_succ_scannable_prefix_len(x) { ++ return 0; ++} ++ ++//Provides: caml_obj_uniquely_reachable_words ++//Requires: caml_failwith ++function caml_obj_uniquely_reachable_words(x) { ++ caml_failwith("Obj.uniquely_reachable_words is not available in javascript."); ++} ++ + //Provides: caml_obj_tag + //Requires: caml_is_ml_bytes, caml_is_ml_string + function caml_obj_tag(x) { +--- a/runtime/wasm/obj.wat ++++ b/runtime/wasm/obj.wat +@@ -101,6 +101,21 @@ + (global $double_array_tag (export "double_array_tag") i32 (i32.const 254)) + (global $custom_tag i32 (i32.const 255)) + ++ (func (export "caml_obj_is_stack") ++ (param (ref eq)) (result (ref eq)) ++ (ref.i31 (i32.const 0))) ++ ++ (func (export "caml_succ_scannable_prefix_len") ++ (param (ref eq)) (result (ref eq)) ++ (ref.i31 (i32.const 0))) ++ ++ (@string $unique_words_unsupported "Obj.uniquely_reachable_words is not available in wasm.") ++ ++ (func (export "caml_obj_uniquely_reachable_words") ++ (param (ref eq)) (result (ref eq)) ++ (call $caml_failwith (global.get $unique_words_unsupported)) ++ (ref.i31 (i32.const 0))) ++ + (func $caml_is_closure (export "caml_is_closure") + (param $v (ref eq)) (result i32) + (i32.or (ref.test (ref $closure) (local.get $v)) diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch new file mode 100644 index 0000000000..37cd43ed47 --- /dev/null +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch @@ -0,0 +1,10 @@ +--- a/runtime/js/stdlib.js ++++ b/runtime/js/stdlib.js +@@ -302,7 +302,6 @@ + } + + //Provides: caml_process_pending_actions_with_root +-//Version: >= 5.3 + function caml_process_pending_actions_with_root(extra_root) { + return 0; + } diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam index 3ab118d373..e1fa155cef 100644 --- a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam @@ -73,6 +73,8 @@ patches: [ "js_of_ocaml-5.3-tests-runtime.patch" "js_of_ocaml-caml_bigstring_strncmp.patch" "wasm_of_ocaml-stub-caml_ml_set_channel_refill.patch" + "js_of_ocaml-version-directive-removal.patch" + "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" ] @@ -217,6 +219,14 @@ extra-files: [ "wasm_of_ocaml-stub-caml_ml_set_channel_refill.patch" "sha256=005bce63009b9539b65036b22a7b7cc531755c7caa3cf1ed8d8697698090e136" ] + [ + "js_of_ocaml-version-directive-removal.patch" + "sha256=4b1565454d0b61bc2450ab7b5fff8c5c82babc104ea6b7b9a5446eb9a929740c" + ] + [ + "js_of_ocaml-obj_stubs.patch" + "sha256=9e9064f255c065a3152f665bd5b464040f3cfbbd2580aa4bb6e17be9c2b7fcc8" + ] [ "js_of_ocaml-float32-2.patch" "sha256=3ff1eda6175f96cc3a5b2c2ae1ee395c9317d248554282c5f157c723a9fae32f" diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch new file mode 100644 index 0000000000..abc1cf740b --- /dev/null +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-obj_stubs.patch @@ -0,0 +1,49 @@ +--- a/runtime/js/obj.js ++++ b/runtime/js/obj.js +@@ -44,6 +44,22 @@ + return +Array.isArray(x); + } + ++//Provides: caml_obj_is_stack ++function caml_obj_is_stack(x) { ++ return 0; ++} ++ ++//Provides: caml_succ_scannable_prefix_len ++function caml_succ_scannable_prefix_len(x) { ++ return 0; ++} ++ ++//Provides: caml_obj_uniquely_reachable_words ++//Requires: caml_failwith ++function caml_obj_uniquely_reachable_words(x) { ++ caml_failwith("Obj.uniquely_reachable_words is not available in javascript."); ++} ++ + //Provides: caml_obj_tag + //Requires: caml_is_ml_bytes, caml_is_ml_string + function caml_obj_tag(x) { +--- a/runtime/wasm/obj.wat ++++ b/runtime/wasm/obj.wat +@@ -101,6 +101,21 @@ + (global $double_array_tag (export "double_array_tag") i32 (i32.const 254)) + (global $custom_tag i32 (i32.const 255)) + ++ (func (export "caml_obj_is_stack") ++ (param (ref eq)) (result (ref eq)) ++ (ref.i31 (i32.const 0))) ++ ++ (func (export "caml_succ_scannable_prefix_len") ++ (param (ref eq)) (result (ref eq)) ++ (ref.i31 (i32.const 0))) ++ ++ (@string $unique_words_unsupported "Obj.uniquely_reachable_words is not available in wasm.") ++ ++ (func (export "caml_obj_uniquely_reachable_words") ++ (param (ref eq)) (result (ref eq)) ++ (call $caml_failwith (global.get $unique_words_unsupported)) ++ (ref.i31 (i32.const 0))) ++ + (func $caml_is_closure (export "caml_is_closure") + (param $v (ref eq)) (result i32) + (i32.or (ref.test (ref $closure) (local.get $v)) diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch new file mode 100644 index 0000000000..37cd43ed47 --- /dev/null +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-version-directive-removal.patch @@ -0,0 +1,10 @@ +--- a/runtime/js/stdlib.js ++++ b/runtime/js/stdlib.js +@@ -302,7 +302,6 @@ + } + + //Provides: caml_process_pending_actions_with_root +-//Version: >= 5.3 + function caml_process_pending_actions_with_root(extra_root) { + return 0; + } diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam index a394cc27a5..d14831eb2c 100644 --- a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam @@ -70,6 +70,8 @@ patches: [ "js_of_ocaml-5.3-tests-runtime.patch" "js_of_ocaml-caml_bigstring_strncmp.patch" "wasm_of_ocaml-stub-caml_ml_set_channel_refill.patch" + "js_of_ocaml-version-directive-removal.patch" + "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" ] @@ -214,6 +216,14 @@ extra-files: [ "wasm_of_ocaml-stub-caml_ml_set_channel_refill.patch" "sha256=005bce63009b9539b65036b22a7b7cc531755c7caa3cf1ed8d8697698090e136" ] + [ + "js_of_ocaml-version-directive-removal.patch" + "sha256=4b1565454d0b61bc2450ab7b5fff8c5c82babc104ea6b7b9a5446eb9a929740c" + ] + [ + "js_of_ocaml-obj_stubs.patch" + "sha256=9e9064f255c065a3152f665bd5b464040f3cfbbd2580aa4bb6e17be9c2b7fcc8" + ] [ "js_of_ocaml-float32-2.patch" "sha256=3ff1eda6175f96cc3a5b2c2ae1ee395c9317d248554282c5f157c723a9fae32f" From 7aefc10c3c3f7f27b6cf89f9af1c6a57e1a844f8 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 21 Jul 2025 10:59:43 +0100 Subject: [PATCH 2/3] Remove js_of_ocaml-ocaml_version-ppx.patch --- .../files/js_of_ocaml-ocaml_version-ppx.patch | 24 ------------------ .../js_of_ocaml-compiler.6.0.1+ox/opam | 5 ---- .../js_of_ocaml-ppx.6.0.1+ox/.opam.swp | Bin 16384 -> 0 bytes .../files/js_of_ocaml-ocaml_version-ppx.patch | 24 ------------------ .../js_of_ocaml-ppx.6.0.1+ox/opam | 5 ---- .../files/js_of_ocaml-ocaml_version-ppx.patch | 24 ------------------ .../js_of_ocaml-toplevel.6.0.1+ox/opam | 5 ---- .../files/js_of_ocaml-ocaml_version-ppx.patch | 24 ------------------ .../js_of_ocaml/js_of_ocaml.6.0.1+ox/opam | 5 ---- 9 files changed, 116 deletions(-) delete mode 100644 packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch delete mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/.opam.swp delete mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch delete mode 100644 packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch delete mode 100644 packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch deleted file mode 100644 index d82b9d1fb8..0000000000 --- a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/toplevel/lib/jsooTop.ml -+++ b/toplevel/lib/jsooTop.ml -@@ -65,6 +65,7 @@ - p := !p + len''; - len'' - -+[%%if ocaml_version < (4, 14, 0)] - let use ffp content = - let fname, oc = - Filename.open_temp_file ~mode:[ Open_binary ] "jsoo_toplevel" "fake_stdin" -@@ -78,10 +79,11 @@ - with e -> - Sys.remove fname; - raise e --[@@if ocaml_version < (4, 14, 0)] -+[%%endif] - -+[%%if ocaml_version >= (4, 14, 0)] - let use ffp content = Toploop.use_silently ffp (String content) --[@@if ocaml_version >= (4, 14, 0)] -+[%%endif] - - let execute printval ?pp_code ?highlight_location pp_answer s = - let lb = Lexing.from_function (refill_lexbuf s (ref 0) pp_code) in diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam index df39720a78..63a6bb0eaa 100644 --- a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam +++ b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam @@ -53,7 +53,6 @@ patches: [ "js_of_ocaml-add-unboxed-and-float-block.patch" "js_of_ocaml-ident-is_global.patch" "js_of_ocaml-remove-float-externals.patch" - "js_of_ocaml-ocaml_version-ppx.patch" "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "js_of_ocaml-fix-build_fs.patch" "js_of_ocaml-iarray-primitives.patch" @@ -115,10 +114,6 @@ extra-files: [ "js_of_ocaml-remove-float-externals.patch" "sha256=a3aa95ee08210377c1470e5bf0f832bc27ad98299bca22c7a88eb9fd6c32e655" ] - [ - "js_of_ocaml-ocaml_version-ppx.patch" - "sha256=df6bcb6da8aa3dfd6bd0a178679987d41c400ec1803f4a66659cfc822d1b280f" - ] [ "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "sha256=00d38ead67c67220351605d72c2b3a4e3faa8053087ef8ab47b7067b42900ba9" diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/.opam.swp b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/.opam.swp deleted file mode 100644 index 308cf85a1487913567f46e97d71421172b7c217a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeHNOQ2 zz0QngD`X|OaG@ZWh(SfgAZ}!YfU9iW=prC4qK-s25jXMmRiAV3J!kGccP_XPrJM87 z=bU={e|_~=)nE0Ous?s{6MAep8lHD)+OPh3bM~{Vzr5#x7d36GD%HPtePrKcRo_~9 zC3${A?k}Ojjf8e6->7O{m<`ocn{`#QXI8tC7x_lb+JAP1O?w5n1$+(2flmXMfR6ztaQhva z_6Oj5Km+6e0UGev`!wx&;M>60ffjfIcnJ90y_)tC@J--p-~w zoCW@Y!;d$B*ML6)w}1vHfi2)s;4e5}`4jMa;O9UM#Jx02$iaN`AmsRDYFSE`pc|j*Jfchwnybw)g4ikRr*luY1(sp9UPk0^nifo$N!F0;vK_*OpQ75~OF9|Xcv~Fa^ij2$>dwyu zpO(6bGNO|5NkhzUvLW8lWVo=kRPi#aMK*1a$IQ8)98*iz*RUJ2on^&30m}^l ze*=3M3?j?3Zf}j4hD@I4)io272W+iG{vE=1{5H4N32OI>j*Fa3C56}7nz~Dq<7!#j zm#{wYxh5BcO?u=+@0oRz6`9gtUFITF)9f(0nqsdbStVpvH7tADP&=5rvaU6v)|6h8 zJ1Y~~g_MKY9hxp>U9|$CY~K{PKWEbF5L@ol!BA(sovGPzsjee=>ZaPs5^5)HFHSTQ zr3D65QDc~=DK%8ewd6tn#rmN1F#S^*NLDE8=dcKvcbZM_G8D5@c4V4?+CIyZNxH7D zRYwl3YB4AEt?Ku^d6`qRb-21X*`ES&g>enr!<0yiMH>_JK+rmk&?9POw3BIGiIsVD zxdTt-5Uk8!haGd=!o8Ap?E<@!>n;o7O5QaK*5JC#7pj|cS7YJ02!|XJNf^gI3x($q zN#+Tbz)2BlLM-%!ou({tZ4%rI5-)IANE9SdBAn2ZYR!~0lG|-xY|d+*bzR+VZfs29 zJ@mqY_8XOKvniF!7f&~MBWIW!Hh4r)f+aYJ1Ma87OA^8082Ipzgu|o2^|>1hCajJ( z*7S=?VB5$|t#5Muy0)v#97d7}omB!(wkhqOyCu&DzkFhk|cghQ3vaRyQ8cu<&3;M)KoH zB@O+$>TwfaZz_M`pbpFnZD(B3uS2Pu+EC+xPf-m8_4#vH9>tA@jK%+WU4QJHZa7wK z*@pf>eUPKZoa$}^BL;I+4aWfmhKxJ7@yjgtXjb?-hn3F7EmxCgVv&3u;%v+FEE_k6 zjX})PxIt6T>5Bmib&z-elJPw2FrxPb4H_{Ey)smzyr})8xwf9=gh)$BxdVf{CHm>m zdrgO*#_2k5BWv59T6BFSmkKS6)2f>3ih;uQ1b-U^FMEzV)@aO5M%N5&Ruxp^UiE)a zh3b6ciBDaGH)xwx1GfNE6^!KK{6FX5Km7|AKKpU~(s?z*4~cnJZmYG4b|uwnAvUx; zlT@})=d#B8ZdNslkxTOtr+35){ZW|J<4eta%+LysX$qj`6q%vylZRKx^{myozVFQG zX;T$*4fXvsT<(nV8UYvB&-*r4g3gwJ4YsZOPK5C={+HSAfcy3G_5=Z9?s zHFsCk(A4-vktI7;_vH<3VaP~2uwrevbbpwDo-{PI|9=Vl@Cf^Lwg2Cb-~Sl<{T~1? z0M7s}U;z&UZ(z^=ec-#mbHFz6e&9jiy};|J>p9?Cz&C(rfyaPNK*Yi^NX2M+^r~sbDb< zdJ@<35m>Uhbkh*$I)bNU$5H4oTEucz12RYBc3zq~l<>d_{WJ~`CF8zurORV)Z+n4oT^@>1 zN*`i+$4N_fg{k^#wjUt1KUZ%khzWuCPuIqoLL&$zXAP7191QV diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch deleted file mode 100644 index d82b9d1fb8..0000000000 --- a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/toplevel/lib/jsooTop.ml -+++ b/toplevel/lib/jsooTop.ml -@@ -65,6 +65,7 @@ - p := !p + len''; - len'' - -+[%%if ocaml_version < (4, 14, 0)] - let use ffp content = - let fname, oc = - Filename.open_temp_file ~mode:[ Open_binary ] "jsoo_toplevel" "fake_stdin" -@@ -78,10 +79,11 @@ - with e -> - Sys.remove fname; - raise e --[@@if ocaml_version < (4, 14, 0)] -+[%%endif] - -+[%%if ocaml_version >= (4, 14, 0)] - let use ffp content = Toploop.use_silently ffp (String content) --[@@if ocaml_version >= (4, 14, 0)] -+[%%endif] - - let execute printval ?pp_code ?highlight_location pp_answer s = - let lb = Lexing.from_function (refill_lexbuf s (ref 0) pp_code) in diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam index 0b4c3ef4ef..f88a8c96b6 100644 --- a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam @@ -42,7 +42,6 @@ patches: [ "js_of_ocaml-add-unboxed-and-float-block.patch" "js_of_ocaml-ident-is_global.patch" "js_of_ocaml-remove-float-externals.patch" - "js_of_ocaml-ocaml_version-ppx.patch" "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "js_of_ocaml-fix-build_fs.patch" "js_of_ocaml-iarray-primitives.patch" @@ -104,10 +103,6 @@ extra-files: [ "js_of_ocaml-remove-float-externals.patch" "sha256=a3aa95ee08210377c1470e5bf0f832bc27ad98299bca22c7a88eb9fd6c32e655" ] - [ - "js_of_ocaml-ocaml_version-ppx.patch" - "sha256=df6bcb6da8aa3dfd6bd0a178679987d41c400ec1803f4a66659cfc822d1b280f" - ] [ "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "sha256=00d38ead67c67220351605d72c2b3a4e3faa8053087ef8ab47b7067b42900ba9" diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch deleted file mode 100644 index d82b9d1fb8..0000000000 --- a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/toplevel/lib/jsooTop.ml -+++ b/toplevel/lib/jsooTop.ml -@@ -65,6 +65,7 @@ - p := !p + len''; - len'' - -+[%%if ocaml_version < (4, 14, 0)] - let use ffp content = - let fname, oc = - Filename.open_temp_file ~mode:[ Open_binary ] "jsoo_toplevel" "fake_stdin" -@@ -78,10 +79,11 @@ - with e -> - Sys.remove fname; - raise e --[@@if ocaml_version < (4, 14, 0)] -+[%%endif] - -+[%%if ocaml_version >= (4, 14, 0)] - let use ffp content = Toploop.use_silently ffp (String content) --[@@if ocaml_version >= (4, 14, 0)] -+[%%endif] - - let execute printval ?pp_code ?highlight_location pp_answer s = - let lb = Lexing.from_function (refill_lexbuf s (ref 0) pp_code) in diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam index e1fa155cef..930529f6ca 100644 --- a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam @@ -45,7 +45,6 @@ patches: [ "js_of_ocaml-add-unboxed-and-float-block.patch" "js_of_ocaml-ident-is_global.patch" "js_of_ocaml-remove-float-externals.patch" - "js_of_ocaml-ocaml_version-ppx.patch" "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "js_of_ocaml-fix-build_fs.patch" "js_of_ocaml-iarray-primitives.patch" @@ -107,10 +106,6 @@ extra-files: [ "js_of_ocaml-remove-float-externals.patch" "sha256=a3aa95ee08210377c1470e5bf0f832bc27ad98299bca22c7a88eb9fd6c32e655" ] - [ - "js_of_ocaml-ocaml_version-ppx.patch" - "sha256=df6bcb6da8aa3dfd6bd0a178679987d41c400ec1803f4a66659cfc822d1b280f" - ] [ "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "sha256=00d38ead67c67220351605d72c2b3a4e3faa8053087ef8ab47b7067b42900ba9" diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch deleted file mode 100644 index d82b9d1fb8..0000000000 --- a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-ocaml_version-ppx.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- a/toplevel/lib/jsooTop.ml -+++ b/toplevel/lib/jsooTop.ml -@@ -65,6 +65,7 @@ - p := !p + len''; - len'' - -+[%%if ocaml_version < (4, 14, 0)] - let use ffp content = - let fname, oc = - Filename.open_temp_file ~mode:[ Open_binary ] "jsoo_toplevel" "fake_stdin" -@@ -78,10 +79,11 @@ - with e -> - Sys.remove fname; - raise e --[@@if ocaml_version < (4, 14, 0)] -+[%%endif] - -+[%%if ocaml_version >= (4, 14, 0)] - let use ffp content = Toploop.use_silently ffp (String content) --[@@if ocaml_version >= (4, 14, 0)] -+[%%endif] - - let execute printval ?pp_code ?highlight_location pp_answer s = - let lb = Lexing.from_function (refill_lexbuf s (ref 0) pp_code) in diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam index d14831eb2c..ec8bf2d711 100644 --- a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam @@ -42,7 +42,6 @@ patches: [ "js_of_ocaml-add-unboxed-and-float-block.patch" "js_of_ocaml-ident-is_global.patch" "js_of_ocaml-remove-float-externals.patch" - "js_of_ocaml-ocaml_version-ppx.patch" "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "js_of_ocaml-fix-build_fs.patch" "js_of_ocaml-iarray-primitives.patch" @@ -104,10 +103,6 @@ extra-files: [ "js_of_ocaml-remove-float-externals.patch" "sha256=a3aa95ee08210377c1470e5bf0f832bc27ad98299bca22c7a88eb9fd6c32e655" ] - [ - "js_of_ocaml-ocaml_version-ppx.patch" - "sha256=df6bcb6da8aa3dfd6bd0a178679987d41c400ec1803f4a66659cfc822d1b280f" - ] [ "js_of_ocaml-test-diffs-caused-by-build-differences.patch" "sha256=00d38ead67c67220351605d72c2b3a4e3faa8053087ef8ab47b7067b42900ba9" From 97c0750314578ee8d74564611ccdae4f3ac06047 Mon Sep 17 00:00:00 2001 From: Jon Ludlam Date: Mon, 21 Jul 2025 11:28:07 +0100 Subject: [PATCH 3/3] Add Patrick's js_of_ocaml toplevel patches --- .../files/js_of_ocaml-top-effects.patch | 16 ++ .../files/js_of_ocaml-toplevel.patch | 208 ++++++++++++++++++ .../js_of_ocaml-compiler.6.0.1+ox/opam | 10 + .../files/js_of_ocaml-top-effects.patch | 16 ++ .../files/js_of_ocaml-toplevel.patch | 208 ++++++++++++++++++ .../js_of_ocaml-ppx.6.0.1+ox/opam | 10 + .../files/js_of_ocaml-top-effects.patch | 16 ++ .../files/js_of_ocaml-toplevel.patch | 208 ++++++++++++++++++ .../js_of_ocaml-toplevel.6.0.1+ox/opam | 10 + .../files/js_of_ocaml-top-effects.patch | 16 ++ .../files/js_of_ocaml-toplevel.patch | 208 ++++++++++++++++++ .../js_of_ocaml/js_of_ocaml.6.0.1+ox/opam | 10 + 12 files changed, 936 insertions(+) create mode 100644 packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-top-effects.patch create mode 100644 packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-toplevel.patch create mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-top-effects.patch create mode 100644 packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-toplevel.patch create mode 100644 packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-top-effects.patch create mode 100644 packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-toplevel.patch create mode 100644 packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-top-effects.patch create mode 100644 packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-toplevel.patch diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-top-effects.patch b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-top-effects.patch new file mode 100644 index 0000000000..d2f36b6d7b --- /dev/null +++ b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-top-effects.patch @@ -0,0 +1,16 @@ +diff --git a/runtime/js/jslib.js b/runtime/js/jslib.js +index 6a711bbb1d..081361a841 100644 +--- a/runtime/js/jslib.js ++++ b/runtime/js/jslib.js +@@ -134,8 +134,9 @@ function caml_jsoo_flags_use_js_string(unit) { + } + + //Provides: caml_jsoo_flags_effects ++//Requires: caml_string_of_jsstring + function caml_jsoo_flags_effects(unit) { +- return CONFIG("effects"); ++ return caml_string_of_jsstring(CONFIG("effects")); + } + + //Provides: caml_wrap_exception const (mutable) + diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-toplevel.patch b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-toplevel.patch new file mode 100644 index 0000000000..c291dee46c --- /dev/null +++ b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/files/js_of_ocaml-toplevel.patch @@ -0,0 +1,208 @@ +diff --git a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +index 140a53b..d857289 100644 +--- a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml ++++ b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +@@ -4,7 +4,7 @@ module J = Jsoo_runtime.Js + + type bytecode_sections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } +diff --git a/compiler/lib/link_js.ml b/compiler/lib/link_js.ml +index 68f0c32..3ec9ddc 100644 +--- a/compiler/lib/link_js.ml ++++ b/compiler/lib/link_js.ml +@@ -426,7 +426,7 @@ let link ~output ~linkall ~mklib ~toplevel ~files ~resolve_sourcemap_url ~(sourc + List.fold_left units ~init:StringSet.empty ~f:(fun acc (u : Unit_info.t) -> + StringSet.union acc (StringSet.of_list u.primitives)) + in +- let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[] in ++ let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[||] in + let b = Buffer.create 100 in + let fmt = Pretty_print.to_buffer b in + Driver.configure fmt; +diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml +index 79e0c8f..bf8751a 100644 +--- a/compiler/lib/parse_bytecode.ml ++++ b/compiler/lib/parse_bytecode.ml +@@ -35,6 +35,9 @@ let predefined_exceptions = + + let new_closure_repr = Ocaml_version.compare Ocaml_version.current [ 4; 12 ] >= 0 + ++let crc_name v = Import_info.name v |> Compilation_unit.Name.to_string ++let crc_crc v = Import_info.crc v ++ + (* Read and manipulate debug section *) + module Debug : sig + type t +@@ -76,11 +79,11 @@ module Debug : sig + -> unit + + val read : +- t -> crcs:(string * string option) list -> includes:string list -> in_channel -> unit ++ t -> crcs:Import_info.t list -> includes:string list -> in_channel -> unit + + val read_event_list : + t +- -> crcs:(string * string option) list ++ -> crcs:Import_info.t list + -> includes:string list + -> orig:int + -> in_channel +@@ -146,6 +149,7 @@ end = struct + | Some _ as x -> x + | None -> Fs.find_in_path paths (name ^ ".ml") + ++ + let read_event + ~paths + ~crcs +@@ -216,7 +220,7 @@ end = struct + fun debug ~crcs ~includes ~orig ic -> + let crcs = + let t = Hashtbl.create 17 in +- List.iter crcs ~f:(fun (m, crc) -> Hashtbl.add t m crc); ++ List.iter crcs ~f:(fun i -> Hashtbl.add t (crc_name i) (crc_crc i)); + t + in + let evl : debug_event list = input_value ic in +@@ -2520,7 +2524,7 @@ module Toc : sig + + val read_data : t -> in_channel -> Obj.t array + +- val read_crcs : t -> in_channel -> (string * Digest.t option) list ++ val read_crcs : t -> in_channel -> Import_info.t array + + val read_prim : t -> in_channel -> string + +@@ -2570,9 +2574,10 @@ end = struct + let read_crcs toc ic = + ignore (seek_section toc ic "CRCS"); + let orig_crcs : Import_info.t array = input_value ic in +- List.map (Array.to_list orig_crcs) ~f:(fun import -> +- Import_info.name import |> Compilation_unit.Name.to_string, +- Import_info.crc import) ++ orig_crcs ++ (* List.map (Array.to_list orig_crcs) ~f:(fun import -> *) ++ (* Import_info.name import |> Compilation_unit.Name.to_string, *) ++ (* Import_info.crc import) *) + + let read_prim toc ic = + let prim_size = seek_section toc ic "PRIM" in +@@ -2587,12 +2592,13 @@ let read_primitives toc ic = + + type bytesections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } + [@@ocaml.warning "-unused-field"] + ++ + let from_exe + ?(includes = []) + ~linkall +@@ -2625,7 +2631,7 @@ let from_exe + | Some l -> List.mem s ~set:l + | None -> true) + in +- let crcs = List.filter ~f:(fun (unit, _crc) -> keep unit) orig_crcs in ++ let crcs = List.filter ~f:(fun info -> keep (crc_name info)) (Array.to_list orig_crcs) in + let symbols = + Ocaml_compiler.Symtable.GlobalMap.filter + (function +@@ -2690,7 +2696,7 @@ let from_exe + |> Array.of_list + in + (* Include linking information *) +- let sections = { symb = symbols; crcs; prim = primitives; dlpt = [] } in ++ let sections = { symb = symbols; crcs = Array.of_list crcs; prim = primitives; dlpt = [] } in + let gdata = Var.fresh () in + let need_gdata = ref false in + let infos = +diff --git a/compiler/lib/parse_bytecode.mli b/compiler/lib/parse_bytecode.mli +index 7bcc822..b34113b 100644 +--- a/compiler/lib/parse_bytecode.mli ++++ b/compiler/lib/parse_bytecode.mli +@@ -91,5 +91,5 @@ val predefined_exceptions : unit -> Code.program * Unit_info.t + val link_info : + symbols:Ocaml_compiler.Symtable.GlobalMap.t + -> primitives:StringSet.t +- -> crcs:(string * Digest.t option) list ++ -> crcs:Import_info.t array + -> Code.program +diff --git a/runtime/js/capsule.js b/runtime/js/capsule.js +new file mode 100644 +index 0000000..0c02acc +--- /dev/null ++++ b/runtime/js/capsule.js +@@ -0,0 +1,14 @@ ++//Provides: caml_capsule_mutex_new ++function caml_capsule_mutex_new () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_lock ++function caml_capsule_mutex_lock () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_unlock ++function caml_capsule_mutex_unlock () { ++ return 0; ++} +diff --git a/runtime/js/dune b/runtime/js/dune +index f31ffd1..7e76a14 100644 +--- a/runtime/js/dune ++++ b/runtime/js/dune +@@ -4,6 +4,7 @@ + (files + bigarray.js + bigstring.js ++ capsule.js + dynlink.js + fs.js + fs_fake.js +diff --git a/runtime/js/float32.js b/runtime/js/float32.js +index 0c60d3d..74bb433 100644 +--- a/runtime/js/float32.js ++++ b/runtime/js/float32.js +@@ -12,6 +12,11 @@ + by native programs and vice versa. + */ + ++//Provides: caml_is_boot_compiler ++function caml_is_boot_compiler(x) { ++ return 0; ++} ++ + //Provides: caml_float_of_float32 const + function caml_float_of_float32(x) { + return x; +diff --git a/runtime/js/toplevel.js b/runtime/js/toplevel.js +index 2e4547e..adaffd3 100644 +--- a/runtime/js/toplevel.js ++++ b/runtime/js/toplevel.js +@@ -94,7 +94,7 @@ function jsoo_toplevel_init_reloc(f) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_ba_to_typed_array + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: >= 5.2 ++//Version: >= 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); +@@ -107,7 +107,7 @@ function caml_reify_bytecode(code, debug, _digest) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_uint8_array_of_bytes + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: < 5.2 ++//Version: < 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); diff --git a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam index 63a6bb0eaa..4668c125b9 100644 --- a/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam +++ b/packages/js_of_ocaml-compiler/js_of_ocaml-compiler.6.0.1+ox/opam @@ -84,6 +84,8 @@ patches: [ "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" + "js_of_ocaml-top-effects.patch" + "js_of_ocaml-toplevel.patch" ] extra-files: [ [ @@ -238,4 +240,12 @@ extra-files: [ "dune.patch" "sha256=f76da998ab76de56309bd0da3e4db1fb496d6d235d7a0ac2f78e3bafe098714e" ] + [ + "js_of_ocaml-top-effects.patch" + "sha256=638247bd3f7bacb99612353b29c0afdcc48598c5771a52602a96baabbc141370" + ] + [ + "js_of_ocaml-toplevel.patch" + "sha256=56c305aa9ed8cb35e9a3bee9fb17aaae244522bacb54a78115b03182a746b7b2" + ] ] diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-top-effects.patch b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-top-effects.patch new file mode 100644 index 0000000000..d2f36b6d7b --- /dev/null +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-top-effects.patch @@ -0,0 +1,16 @@ +diff --git a/runtime/js/jslib.js b/runtime/js/jslib.js +index 6a711bbb1d..081361a841 100644 +--- a/runtime/js/jslib.js ++++ b/runtime/js/jslib.js +@@ -134,8 +134,9 @@ function caml_jsoo_flags_use_js_string(unit) { + } + + //Provides: caml_jsoo_flags_effects ++//Requires: caml_string_of_jsstring + function caml_jsoo_flags_effects(unit) { +- return CONFIG("effects"); ++ return caml_string_of_jsstring(CONFIG("effects")); + } + + //Provides: caml_wrap_exception const (mutable) + diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-toplevel.patch b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-toplevel.patch new file mode 100644 index 0000000000..c291dee46c --- /dev/null +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/files/js_of_ocaml-toplevel.patch @@ -0,0 +1,208 @@ +diff --git a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +index 140a53b..d857289 100644 +--- a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml ++++ b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +@@ -4,7 +4,7 @@ module J = Jsoo_runtime.Js + + type bytecode_sections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } +diff --git a/compiler/lib/link_js.ml b/compiler/lib/link_js.ml +index 68f0c32..3ec9ddc 100644 +--- a/compiler/lib/link_js.ml ++++ b/compiler/lib/link_js.ml +@@ -426,7 +426,7 @@ let link ~output ~linkall ~mklib ~toplevel ~files ~resolve_sourcemap_url ~(sourc + List.fold_left units ~init:StringSet.empty ~f:(fun acc (u : Unit_info.t) -> + StringSet.union acc (StringSet.of_list u.primitives)) + in +- let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[] in ++ let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[||] in + let b = Buffer.create 100 in + let fmt = Pretty_print.to_buffer b in + Driver.configure fmt; +diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml +index 79e0c8f..bf8751a 100644 +--- a/compiler/lib/parse_bytecode.ml ++++ b/compiler/lib/parse_bytecode.ml +@@ -35,6 +35,9 @@ let predefined_exceptions = + + let new_closure_repr = Ocaml_version.compare Ocaml_version.current [ 4; 12 ] >= 0 + ++let crc_name v = Import_info.name v |> Compilation_unit.Name.to_string ++let crc_crc v = Import_info.crc v ++ + (* Read and manipulate debug section *) + module Debug : sig + type t +@@ -76,11 +79,11 @@ module Debug : sig + -> unit + + val read : +- t -> crcs:(string * string option) list -> includes:string list -> in_channel -> unit ++ t -> crcs:Import_info.t list -> includes:string list -> in_channel -> unit + + val read_event_list : + t +- -> crcs:(string * string option) list ++ -> crcs:Import_info.t list + -> includes:string list + -> orig:int + -> in_channel +@@ -146,6 +149,7 @@ end = struct + | Some _ as x -> x + | None -> Fs.find_in_path paths (name ^ ".ml") + ++ + let read_event + ~paths + ~crcs +@@ -216,7 +220,7 @@ end = struct + fun debug ~crcs ~includes ~orig ic -> + let crcs = + let t = Hashtbl.create 17 in +- List.iter crcs ~f:(fun (m, crc) -> Hashtbl.add t m crc); ++ List.iter crcs ~f:(fun i -> Hashtbl.add t (crc_name i) (crc_crc i)); + t + in + let evl : debug_event list = input_value ic in +@@ -2520,7 +2524,7 @@ module Toc : sig + + val read_data : t -> in_channel -> Obj.t array + +- val read_crcs : t -> in_channel -> (string * Digest.t option) list ++ val read_crcs : t -> in_channel -> Import_info.t array + + val read_prim : t -> in_channel -> string + +@@ -2570,9 +2574,10 @@ end = struct + let read_crcs toc ic = + ignore (seek_section toc ic "CRCS"); + let orig_crcs : Import_info.t array = input_value ic in +- List.map (Array.to_list orig_crcs) ~f:(fun import -> +- Import_info.name import |> Compilation_unit.Name.to_string, +- Import_info.crc import) ++ orig_crcs ++ (* List.map (Array.to_list orig_crcs) ~f:(fun import -> *) ++ (* Import_info.name import |> Compilation_unit.Name.to_string, *) ++ (* Import_info.crc import) *) + + let read_prim toc ic = + let prim_size = seek_section toc ic "PRIM" in +@@ -2587,12 +2592,13 @@ let read_primitives toc ic = + + type bytesections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } + [@@ocaml.warning "-unused-field"] + ++ + let from_exe + ?(includes = []) + ~linkall +@@ -2625,7 +2631,7 @@ let from_exe + | Some l -> List.mem s ~set:l + | None -> true) + in +- let crcs = List.filter ~f:(fun (unit, _crc) -> keep unit) orig_crcs in ++ let crcs = List.filter ~f:(fun info -> keep (crc_name info)) (Array.to_list orig_crcs) in + let symbols = + Ocaml_compiler.Symtable.GlobalMap.filter + (function +@@ -2690,7 +2696,7 @@ let from_exe + |> Array.of_list + in + (* Include linking information *) +- let sections = { symb = symbols; crcs; prim = primitives; dlpt = [] } in ++ let sections = { symb = symbols; crcs = Array.of_list crcs; prim = primitives; dlpt = [] } in + let gdata = Var.fresh () in + let need_gdata = ref false in + let infos = +diff --git a/compiler/lib/parse_bytecode.mli b/compiler/lib/parse_bytecode.mli +index 7bcc822..b34113b 100644 +--- a/compiler/lib/parse_bytecode.mli ++++ b/compiler/lib/parse_bytecode.mli +@@ -91,5 +91,5 @@ val predefined_exceptions : unit -> Code.program * Unit_info.t + val link_info : + symbols:Ocaml_compiler.Symtable.GlobalMap.t + -> primitives:StringSet.t +- -> crcs:(string * Digest.t option) list ++ -> crcs:Import_info.t array + -> Code.program +diff --git a/runtime/js/capsule.js b/runtime/js/capsule.js +new file mode 100644 +index 0000000..0c02acc +--- /dev/null ++++ b/runtime/js/capsule.js +@@ -0,0 +1,14 @@ ++//Provides: caml_capsule_mutex_new ++function caml_capsule_mutex_new () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_lock ++function caml_capsule_mutex_lock () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_unlock ++function caml_capsule_mutex_unlock () { ++ return 0; ++} +diff --git a/runtime/js/dune b/runtime/js/dune +index f31ffd1..7e76a14 100644 +--- a/runtime/js/dune ++++ b/runtime/js/dune +@@ -4,6 +4,7 @@ + (files + bigarray.js + bigstring.js ++ capsule.js + dynlink.js + fs.js + fs_fake.js +diff --git a/runtime/js/float32.js b/runtime/js/float32.js +index 0c60d3d..74bb433 100644 +--- a/runtime/js/float32.js ++++ b/runtime/js/float32.js +@@ -12,6 +12,11 @@ + by native programs and vice versa. + */ + ++//Provides: caml_is_boot_compiler ++function caml_is_boot_compiler(x) { ++ return 0; ++} ++ + //Provides: caml_float_of_float32 const + function caml_float_of_float32(x) { + return x; +diff --git a/runtime/js/toplevel.js b/runtime/js/toplevel.js +index 2e4547e..adaffd3 100644 +--- a/runtime/js/toplevel.js ++++ b/runtime/js/toplevel.js +@@ -94,7 +94,7 @@ function jsoo_toplevel_init_reloc(f) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_ba_to_typed_array + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: >= 5.2 ++//Version: >= 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); +@@ -107,7 +107,7 @@ function caml_reify_bytecode(code, debug, _digest) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_uint8_array_of_bytes + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: < 5.2 ++//Version: < 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); diff --git a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam index f88a8c96b6..2107f9509a 100644 --- a/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam +++ b/packages/js_of_ocaml-ppx/js_of_ocaml-ppx.6.0.1+ox/opam @@ -73,6 +73,8 @@ patches: [ "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" + "js_of_ocaml-top-effects.patch" + "js_of_ocaml-toplevel.patch" ] extra-files: [ [ @@ -227,4 +229,12 @@ extra-files: [ "dune.patch" "sha256=f76da998ab76de56309bd0da3e4db1fb496d6d235d7a0ac2f78e3bafe098714e" ] + [ + "js_of_ocaml-top-effects.patch" + "sha256=638247bd3f7bacb99612353b29c0afdcc48598c5771a52602a96baabbc141370" + ] + [ + "js_of_ocaml-toplevel.patch" + "sha256=56c305aa9ed8cb35e9a3bee9fb17aaae244522bacb54a78115b03182a746b7b2" + ] ] diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-top-effects.patch b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-top-effects.patch new file mode 100644 index 0000000000..d2f36b6d7b --- /dev/null +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-top-effects.patch @@ -0,0 +1,16 @@ +diff --git a/runtime/js/jslib.js b/runtime/js/jslib.js +index 6a711bbb1d..081361a841 100644 +--- a/runtime/js/jslib.js ++++ b/runtime/js/jslib.js +@@ -134,8 +134,9 @@ function caml_jsoo_flags_use_js_string(unit) { + } + + //Provides: caml_jsoo_flags_effects ++//Requires: caml_string_of_jsstring + function caml_jsoo_flags_effects(unit) { +- return CONFIG("effects"); ++ return caml_string_of_jsstring(CONFIG("effects")); + } + + //Provides: caml_wrap_exception const (mutable) + diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-toplevel.patch b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-toplevel.patch new file mode 100644 index 0000000000..c291dee46c --- /dev/null +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/files/js_of_ocaml-toplevel.patch @@ -0,0 +1,208 @@ +diff --git a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +index 140a53b..d857289 100644 +--- a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml ++++ b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +@@ -4,7 +4,7 @@ module J = Jsoo_runtime.Js + + type bytecode_sections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } +diff --git a/compiler/lib/link_js.ml b/compiler/lib/link_js.ml +index 68f0c32..3ec9ddc 100644 +--- a/compiler/lib/link_js.ml ++++ b/compiler/lib/link_js.ml +@@ -426,7 +426,7 @@ let link ~output ~linkall ~mklib ~toplevel ~files ~resolve_sourcemap_url ~(sourc + List.fold_left units ~init:StringSet.empty ~f:(fun acc (u : Unit_info.t) -> + StringSet.union acc (StringSet.of_list u.primitives)) + in +- let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[] in ++ let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[||] in + let b = Buffer.create 100 in + let fmt = Pretty_print.to_buffer b in + Driver.configure fmt; +diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml +index 79e0c8f..bf8751a 100644 +--- a/compiler/lib/parse_bytecode.ml ++++ b/compiler/lib/parse_bytecode.ml +@@ -35,6 +35,9 @@ let predefined_exceptions = + + let new_closure_repr = Ocaml_version.compare Ocaml_version.current [ 4; 12 ] >= 0 + ++let crc_name v = Import_info.name v |> Compilation_unit.Name.to_string ++let crc_crc v = Import_info.crc v ++ + (* Read and manipulate debug section *) + module Debug : sig + type t +@@ -76,11 +79,11 @@ module Debug : sig + -> unit + + val read : +- t -> crcs:(string * string option) list -> includes:string list -> in_channel -> unit ++ t -> crcs:Import_info.t list -> includes:string list -> in_channel -> unit + + val read_event_list : + t +- -> crcs:(string * string option) list ++ -> crcs:Import_info.t list + -> includes:string list + -> orig:int + -> in_channel +@@ -146,6 +149,7 @@ end = struct + | Some _ as x -> x + | None -> Fs.find_in_path paths (name ^ ".ml") + ++ + let read_event + ~paths + ~crcs +@@ -216,7 +220,7 @@ end = struct + fun debug ~crcs ~includes ~orig ic -> + let crcs = + let t = Hashtbl.create 17 in +- List.iter crcs ~f:(fun (m, crc) -> Hashtbl.add t m crc); ++ List.iter crcs ~f:(fun i -> Hashtbl.add t (crc_name i) (crc_crc i)); + t + in + let evl : debug_event list = input_value ic in +@@ -2520,7 +2524,7 @@ module Toc : sig + + val read_data : t -> in_channel -> Obj.t array + +- val read_crcs : t -> in_channel -> (string * Digest.t option) list ++ val read_crcs : t -> in_channel -> Import_info.t array + + val read_prim : t -> in_channel -> string + +@@ -2570,9 +2574,10 @@ end = struct + let read_crcs toc ic = + ignore (seek_section toc ic "CRCS"); + let orig_crcs : Import_info.t array = input_value ic in +- List.map (Array.to_list orig_crcs) ~f:(fun import -> +- Import_info.name import |> Compilation_unit.Name.to_string, +- Import_info.crc import) ++ orig_crcs ++ (* List.map (Array.to_list orig_crcs) ~f:(fun import -> *) ++ (* Import_info.name import |> Compilation_unit.Name.to_string, *) ++ (* Import_info.crc import) *) + + let read_prim toc ic = + let prim_size = seek_section toc ic "PRIM" in +@@ -2587,12 +2592,13 @@ let read_primitives toc ic = + + type bytesections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } + [@@ocaml.warning "-unused-field"] + ++ + let from_exe + ?(includes = []) + ~linkall +@@ -2625,7 +2631,7 @@ let from_exe + | Some l -> List.mem s ~set:l + | None -> true) + in +- let crcs = List.filter ~f:(fun (unit, _crc) -> keep unit) orig_crcs in ++ let crcs = List.filter ~f:(fun info -> keep (crc_name info)) (Array.to_list orig_crcs) in + let symbols = + Ocaml_compiler.Symtable.GlobalMap.filter + (function +@@ -2690,7 +2696,7 @@ let from_exe + |> Array.of_list + in + (* Include linking information *) +- let sections = { symb = symbols; crcs; prim = primitives; dlpt = [] } in ++ let sections = { symb = symbols; crcs = Array.of_list crcs; prim = primitives; dlpt = [] } in + let gdata = Var.fresh () in + let need_gdata = ref false in + let infos = +diff --git a/compiler/lib/parse_bytecode.mli b/compiler/lib/parse_bytecode.mli +index 7bcc822..b34113b 100644 +--- a/compiler/lib/parse_bytecode.mli ++++ b/compiler/lib/parse_bytecode.mli +@@ -91,5 +91,5 @@ val predefined_exceptions : unit -> Code.program * Unit_info.t + val link_info : + symbols:Ocaml_compiler.Symtable.GlobalMap.t + -> primitives:StringSet.t +- -> crcs:(string * Digest.t option) list ++ -> crcs:Import_info.t array + -> Code.program +diff --git a/runtime/js/capsule.js b/runtime/js/capsule.js +new file mode 100644 +index 0000000..0c02acc +--- /dev/null ++++ b/runtime/js/capsule.js +@@ -0,0 +1,14 @@ ++//Provides: caml_capsule_mutex_new ++function caml_capsule_mutex_new () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_lock ++function caml_capsule_mutex_lock () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_unlock ++function caml_capsule_mutex_unlock () { ++ return 0; ++} +diff --git a/runtime/js/dune b/runtime/js/dune +index f31ffd1..7e76a14 100644 +--- a/runtime/js/dune ++++ b/runtime/js/dune +@@ -4,6 +4,7 @@ + (files + bigarray.js + bigstring.js ++ capsule.js + dynlink.js + fs.js + fs_fake.js +diff --git a/runtime/js/float32.js b/runtime/js/float32.js +index 0c60d3d..74bb433 100644 +--- a/runtime/js/float32.js ++++ b/runtime/js/float32.js +@@ -12,6 +12,11 @@ + by native programs and vice versa. + */ + ++//Provides: caml_is_boot_compiler ++function caml_is_boot_compiler(x) { ++ return 0; ++} ++ + //Provides: caml_float_of_float32 const + function caml_float_of_float32(x) { + return x; +diff --git a/runtime/js/toplevel.js b/runtime/js/toplevel.js +index 2e4547e..adaffd3 100644 +--- a/runtime/js/toplevel.js ++++ b/runtime/js/toplevel.js +@@ -94,7 +94,7 @@ function jsoo_toplevel_init_reloc(f) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_ba_to_typed_array + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: >= 5.2 ++//Version: >= 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); +@@ -107,7 +107,7 @@ function caml_reify_bytecode(code, debug, _digest) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_uint8_array_of_bytes + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: < 5.2 ++//Version: < 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); diff --git a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam index 930529f6ca..7c920967f9 100644 --- a/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam +++ b/packages/js_of_ocaml-toplevel/js_of_ocaml-toplevel.6.0.1+ox/opam @@ -76,6 +76,8 @@ patches: [ "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" + "js_of_ocaml-top-effects.patch" + "js_of_ocaml-toplevel.patch" ] extra-files: [ [ @@ -230,4 +232,12 @@ extra-files: [ "dune.patch" "sha256=f76da998ab76de56309bd0da3e4db1fb496d6d235d7a0ac2f78e3bafe098714e" ] + [ + "js_of_ocaml-top-effects.patch" + "sha256=638247bd3f7bacb99612353b29c0afdcc48598c5771a52602a96baabbc141370" + ] + [ + "js_of_ocaml-toplevel.patch" + "sha256=56c305aa9ed8cb35e9a3bee9fb17aaae244522bacb54a78115b03182a746b7b2" + ] ] diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-top-effects.patch b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-top-effects.patch new file mode 100644 index 0000000000..d2f36b6d7b --- /dev/null +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-top-effects.patch @@ -0,0 +1,16 @@ +diff --git a/runtime/js/jslib.js b/runtime/js/jslib.js +index 6a711bbb1d..081361a841 100644 +--- a/runtime/js/jslib.js ++++ b/runtime/js/jslib.js +@@ -134,8 +134,9 @@ function caml_jsoo_flags_use_js_string(unit) { + } + + //Provides: caml_jsoo_flags_effects ++//Requires: caml_string_of_jsstring + function caml_jsoo_flags_effects(unit) { +- return CONFIG("effects"); ++ return caml_string_of_jsstring(CONFIG("effects")); + } + + //Provides: caml_wrap_exception const (mutable) + diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-toplevel.patch b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-toplevel.patch new file mode 100644 index 0000000000..c291dee46c --- /dev/null +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/files/js_of_ocaml-toplevel.patch @@ -0,0 +1,208 @@ +diff --git a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +index 140a53b..d857289 100644 +--- a/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml ++++ b/compiler/lib-dynlink/js_of_ocaml_compiler_dynlink.ml +@@ -4,7 +4,7 @@ module J = Jsoo_runtime.Js + + type bytecode_sections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } +diff --git a/compiler/lib/link_js.ml b/compiler/lib/link_js.ml +index 68f0c32..3ec9ddc 100644 +--- a/compiler/lib/link_js.ml ++++ b/compiler/lib/link_js.ml +@@ -426,7 +426,7 @@ let link ~output ~linkall ~mklib ~toplevel ~files ~resolve_sourcemap_url ~(sourc + List.fold_left units ~init:StringSet.empty ~f:(fun acc (u : Unit_info.t) -> + StringSet.union acc (StringSet.of_list u.primitives)) + in +- let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[] in ++ let code = Parse_bytecode.link_info ~symbols:!sym ~primitives ~crcs:[||] in + let b = Buffer.create 100 in + let fmt = Pretty_print.to_buffer b in + Driver.configure fmt; +diff --git a/compiler/lib/parse_bytecode.ml b/compiler/lib/parse_bytecode.ml +index 79e0c8f..bf8751a 100644 +--- a/compiler/lib/parse_bytecode.ml ++++ b/compiler/lib/parse_bytecode.ml +@@ -35,6 +35,9 @@ let predefined_exceptions = + + let new_closure_repr = Ocaml_version.compare Ocaml_version.current [ 4; 12 ] >= 0 + ++let crc_name v = Import_info.name v |> Compilation_unit.Name.to_string ++let crc_crc v = Import_info.crc v ++ + (* Read and manipulate debug section *) + module Debug : sig + type t +@@ -76,11 +79,11 @@ module Debug : sig + -> unit + + val read : +- t -> crcs:(string * string option) list -> includes:string list -> in_channel -> unit ++ t -> crcs:Import_info.t list -> includes:string list -> in_channel -> unit + + val read_event_list : + t +- -> crcs:(string * string option) list ++ -> crcs:Import_info.t list + -> includes:string list + -> orig:int + -> in_channel +@@ -146,6 +149,7 @@ end = struct + | Some _ as x -> x + | None -> Fs.find_in_path paths (name ^ ".ml") + ++ + let read_event + ~paths + ~crcs +@@ -216,7 +220,7 @@ end = struct + fun debug ~crcs ~includes ~orig ic -> + let crcs = + let t = Hashtbl.create 17 in +- List.iter crcs ~f:(fun (m, crc) -> Hashtbl.add t m crc); ++ List.iter crcs ~f:(fun i -> Hashtbl.add t (crc_name i) (crc_crc i)); + t + in + let evl : debug_event list = input_value ic in +@@ -2520,7 +2524,7 @@ module Toc : sig + + val read_data : t -> in_channel -> Obj.t array + +- val read_crcs : t -> in_channel -> (string * Digest.t option) list ++ val read_crcs : t -> in_channel -> Import_info.t array + + val read_prim : t -> in_channel -> string + +@@ -2570,9 +2574,10 @@ end = struct + let read_crcs toc ic = + ignore (seek_section toc ic "CRCS"); + let orig_crcs : Import_info.t array = input_value ic in +- List.map (Array.to_list orig_crcs) ~f:(fun import -> +- Import_info.name import |> Compilation_unit.Name.to_string, +- Import_info.crc import) ++ orig_crcs ++ (* List.map (Array.to_list orig_crcs) ~f:(fun import -> *) ++ (* Import_info.name import |> Compilation_unit.Name.to_string, *) ++ (* Import_info.crc import) *) + + let read_prim toc ic = + let prim_size = seek_section toc ic "PRIM" in +@@ -2587,12 +2592,13 @@ let read_primitives toc ic = + + type bytesections = + { symb : Ocaml_compiler.Symtable.GlobalMap.t +- ; crcs : (string * Digest.t option) list ++ ; crcs : Import_info.t array + ; prim : string list + ; dlpt : string list + } + [@@ocaml.warning "-unused-field"] + ++ + let from_exe + ?(includes = []) + ~linkall +@@ -2625,7 +2631,7 @@ let from_exe + | Some l -> List.mem s ~set:l + | None -> true) + in +- let crcs = List.filter ~f:(fun (unit, _crc) -> keep unit) orig_crcs in ++ let crcs = List.filter ~f:(fun info -> keep (crc_name info)) (Array.to_list orig_crcs) in + let symbols = + Ocaml_compiler.Symtable.GlobalMap.filter + (function +@@ -2690,7 +2696,7 @@ let from_exe + |> Array.of_list + in + (* Include linking information *) +- let sections = { symb = symbols; crcs; prim = primitives; dlpt = [] } in ++ let sections = { symb = symbols; crcs = Array.of_list crcs; prim = primitives; dlpt = [] } in + let gdata = Var.fresh () in + let need_gdata = ref false in + let infos = +diff --git a/compiler/lib/parse_bytecode.mli b/compiler/lib/parse_bytecode.mli +index 7bcc822..b34113b 100644 +--- a/compiler/lib/parse_bytecode.mli ++++ b/compiler/lib/parse_bytecode.mli +@@ -91,5 +91,5 @@ val predefined_exceptions : unit -> Code.program * Unit_info.t + val link_info : + symbols:Ocaml_compiler.Symtable.GlobalMap.t + -> primitives:StringSet.t +- -> crcs:(string * Digest.t option) list ++ -> crcs:Import_info.t array + -> Code.program +diff --git a/runtime/js/capsule.js b/runtime/js/capsule.js +new file mode 100644 +index 0000000..0c02acc +--- /dev/null ++++ b/runtime/js/capsule.js +@@ -0,0 +1,14 @@ ++//Provides: caml_capsule_mutex_new ++function caml_capsule_mutex_new () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_lock ++function caml_capsule_mutex_lock () { ++ return 0; ++} ++ ++//Provides: caml_capsule_mutex_unlock ++function caml_capsule_mutex_unlock () { ++ return 0; ++} +diff --git a/runtime/js/dune b/runtime/js/dune +index f31ffd1..7e76a14 100644 +--- a/runtime/js/dune ++++ b/runtime/js/dune +@@ -4,6 +4,7 @@ + (files + bigarray.js + bigstring.js ++ capsule.js + dynlink.js + fs.js + fs_fake.js +diff --git a/runtime/js/float32.js b/runtime/js/float32.js +index 0c60d3d..74bb433 100644 +--- a/runtime/js/float32.js ++++ b/runtime/js/float32.js +@@ -12,6 +12,11 @@ + by native programs and vice versa. + */ + ++//Provides: caml_is_boot_compiler ++function caml_is_boot_compiler(x) { ++ return 0; ++} ++ + //Provides: caml_float_of_float32 const + function caml_float_of_float32(x) { + return x; +diff --git a/runtime/js/toplevel.js b/runtime/js/toplevel.js +index 2e4547e..adaffd3 100644 +--- a/runtime/js/toplevel.js ++++ b/runtime/js/toplevel.js +@@ -94,7 +94,7 @@ function jsoo_toplevel_init_reloc(f) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_ba_to_typed_array + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: >= 5.2 ++//Version: >= 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); +@@ -107,7 +107,7 @@ function caml_reify_bytecode(code, debug, _digest) { + //Requires: caml_callback + //Requires: caml_string_of_uint8_array, caml_uint8_array_of_bytes + //Requires: jsoo_toplevel_compile, caml_failwith +-//Version: < 5.2 ++//Version: < 5.3 + function caml_reify_bytecode(code, debug, _digest) { + if (!jsoo_toplevel_compile) { + caml_failwith("Toplevel not initialized (jsoo_toplevel_compile)"); diff --git a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam index ec8bf2d711..8dacb8ffdc 100644 --- a/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam +++ b/packages/js_of_ocaml/js_of_ocaml.6.0.1+ox/opam @@ -73,6 +73,8 @@ patches: [ "js_of_ocaml-obj_stubs.patch" "js_of_ocaml-float32-2.patch" "dune.patch" + "js_of_ocaml-top-effects.patch" + "js_of_ocaml-toplevel.patch" ] extra-files: [ [ @@ -227,4 +229,12 @@ extra-files: [ "dune.patch" "sha256=f76da998ab76de56309bd0da3e4db1fb496d6d235d7a0ac2f78e3bafe098714e" ] + [ + "js_of_ocaml-top-effects.patch" + "sha256=638247bd3f7bacb99612353b29c0afdcc48598c5771a52602a96baabbc141370" + ] + [ + "js_of_ocaml-toplevel.patch" + "sha256=56c305aa9ed8cb35e9a3bee9fb17aaae244522bacb54a78115b03182a746b7b2" + ] ]