diff --git a/.github/actions/setup-ocaml/action.yml b/.github/actions/setup-ocaml/action.yml index b9eb3f1ef8e..b2520bbb5ec 100644 --- a/.github/actions/setup-ocaml/action.yml +++ b/.github/actions/setup-ocaml/action.yml @@ -82,7 +82,7 @@ runs: run: | dependency_flags_key="${DEPENDENCY_FLAGS//--/}" dependency_flags_key="${dependency_flags_key// /_}" - dependency_hash="${{ hashFiles('*.opam', '.github/opam-repository/repo', '.github/opam-repository/packages/**') }}" + dependency_hash="${{ hashFiles('*.opam') }}" key="$CACHE_PREFIX-$OS-3.9.0-$COMPILER-$dependency_flags_key-$dependency_hash" echo "value=${key//,/-}" >> "$GITHUB_OUTPUT" echo "setup-version=3.9.0" >> "$GITHUB_OUTPUT" @@ -131,7 +131,6 @@ runs: env: DEPENDENCY_FLAGS: ${{ inputs.dependency-flags }} run: | - opam repository add rescript-overrides "$GITHUB_WORKSPACE/.github/opam-repository" read -ra dependency_flags <<< "$DEPENDENCY_FLAGS" if [[ "$RUNNER_OS" == "Windows" ]]; then export AR=x86_64-w64-mingw32-ar diff --git a/.github/opam-repository/README.md b/.github/opam-repository/README.md deleted file mode 100644 index 35e088bb9a0..00000000000 --- a/.github/opam-repository/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# ReScript opam overrides - -This repository contains narrowly scoped dependency fixes needed by CI before -they are available from the main opam repository. - -The Luv 0.5.14 override preserves the ARM64 musl compiler's -`-mno-outline-atomics` requirement while building vendored libuv. Without it, -the static executable fails to link because libuv refers to glibc's internal -`__getauxval` symbol. The patch should be contributed upstream and this -override removed once a fixed Luv release is available. - -Luv 0.5.14 also vendors libuv 1.48.0. Evaluating and contributing an update to -a current libuv 1.x release is a separate upstream follow-up; changing the -vendored library is intentionally outside the OCaml rewatch port. diff --git a/.github/opam-repository/packages/luv/luv.0.5.14/files/arm64-musl-outline-atomics.patch b/.github/opam-repository/packages/luv/luv.0.5.14/files/arm64-musl-outline-atomics.patch deleted file mode 100644 index 674f1b37c4c..00000000000 --- a/.github/opam-repository/packages/luv/luv.0.5.14/files/arm64-musl-outline-atomics.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/src/c/dune -+++ b/src/c/dune -@@ -82,8 +82,14 @@ - (action (progn - (bash "cp -r vendor/configure/* vendor/libuv/") - (chdir vendor/libuv (progn - (bash -- "sh configure --host `ocamlc -config | awk '/^host:/ {print $NF}'` \ -- 'CC=%{cc}' CFLAGS=-DNDEBUG --silent --enable-silent-rules") -+ "architecture=`ocamlc -config-var architecture` -+ c_compiler=`ocamlc -config-var c_compiler` -+ extra_cflags= -+ case \"$architecture:$c_compiler\" in -+ arm64:*musl*) extra_cflags=-mno-outline-atomics ;; -+ esac -+ sh configure --host `ocamlc -config | awk '/^host:/ {print $NF}'` \ -+ 'CC=%{cc}' CFLAGS=\"-DNDEBUG $extra_cflags\" --silent --enable-silent-rules") - (ignore-outputs (bash - "$([ '%{os_type}' = Unix ] && echo %{make} || echo make) V=0 -j 4 \ - -o aclocal.m4 -o Makefile.in -o configure \ diff --git a/.github/opam-repository/packages/luv/luv.0.5.14/opam b/.github/opam-repository/packages/luv/luv.0.5.14/opam deleted file mode 100644 index e64c76a6dd5..00000000000 --- a/.github/opam-repository/packages/luv/luv.0.5.14/opam +++ /dev/null @@ -1,42 +0,0 @@ -opam-version: "2.0" -name: "luv" -version: "0.5.14" -synopsis: "Binding to libuv: cross-platform asynchronous I/O" -description: """\ -Luv is a binding to libuv, the cross-platform C library that does -asynchronous I/O in Node.js and runs its main loop. - -Besides asynchronous I/O, libuv also supports multiprocessing and -multithreading. Multiple event loops can be run in different threads. libuv also -exposes a lot of other functionality, amounting to a full OS API, and an -alternative to the standard module Unix.""" -maintainer: "Anton Bachin " -authors: "Anton Bachin " -license: "MIT" -homepage: "https://github.com/aantron/luv" -doc: "https://aantron.github.io/luv" -bug-reports: "https://github.com/aantron/luv/issues" -depends: [ - "base-unix" {build} - "ctypes" {>= "0.14.0"} - "dune" {>= "2.7.0"} - "ocaml" {>= "4.03.0"} - "alcotest" {with-test & >= "0.8.1"} - "base-unix" {with-test} - "odoc" {with-doc & = "2.4.0"} -] -build: ["dune" "build" "-p" name "-j" jobs] -patches: ["arm64-musl-outline-atomics.patch"] -extra-files: [ - [ - "arm64-musl-outline-atomics.patch" - "sha256=c15c4c4d34c9b545197c5160e19c69a128cc186b65a54e0e9a779c2543528a4f" - ] -] -dev-repo: "git+https://github.com/aantron/luv.git" -url { - src: - "https://github.com/aantron/luv/releases/download/0.5.14/luv-0.5.14.tar.gz" - checksum: - "sha256=8e01b4a50c8876cdd98d8e245c0687c4dc4d883aed161ad9c5ace1fb1fdaae99" -} diff --git a/.github/opam-repository/repo b/.github/opam-repository/repo deleted file mode 100644 index 013b84db617..00000000000 --- a/.github/opam-repository/repo +++ /dev/null @@ -1 +0,0 @@ -opam-version: "2.0" diff --git a/changes/luv-libuv-1-53.internal.md b/changes/luv-libuv-1-53.internal.md new file mode 100644 index 00000000000..3cdf3f2b020 --- /dev/null +++ b/changes/luv-libuv-1-53.internal.md @@ -0,0 +1 @@ +- Build the OCaml rewatch against libuv 1.53.0 via the rescript-lang/luv fork. https://github.com/rescript-lang/rescript/pull/8883 diff --git a/dune-project b/dune-project index 77999e85a4d..dafd9675b9a 100644 --- a/dune-project +++ b/dune-project @@ -35,7 +35,7 @@ (cmdliner (= 2.1.1)) (luv - (= 0.5.14)) + (= 0.5.14+rescript.1)) (re (= 1.14.0)) (ounit2 diff --git a/rescript.opam b/rescript.opam index f09bd89a351..808a8041511 100644 --- a/rescript.opam +++ b/rescript.opam @@ -17,7 +17,7 @@ depends: [ "yojson" {= "3.0.0"} "spawn" {= "v0.17.0"} "cmdliner" {= "2.1.1"} - "luv" {= "0.5.14"} + "luv" {= "0.5.14+rescript.1"} "re" {= "1.14.0"} "ounit2" {with-test & = "2.2.7"} "odoc" {with-doc} @@ -39,3 +39,10 @@ build: [ "@doc" {with-doc} ] ] +pin-depends: [ + # libuv 1.53.0; https://github.com/rescript-lang/luv + [ + "luv.0.5.14+rescript.1" + "git+https://github.com/rescript-lang/luv.git#2094c025da82482a8b71118a87e609f82666a2f6" + ] +] diff --git a/rescript.opam.template b/rescript.opam.template new file mode 100644 index 00000000000..c94cdbc9087 --- /dev/null +++ b/rescript.opam.template @@ -0,0 +1,7 @@ +pin-depends: [ + # libuv 1.53.0; https://github.com/rescript-lang/luv + [ + "luv.0.5.14+rescript.1" + "git+https://github.com/rescript-lang/luv.git#2094c025da82482a8b71118a87e609f82666a2f6" + ] +] diff --git a/rewatch-ocaml/README.md b/rewatch-ocaml/README.md index af62cd8677c..d0d9b8f4daf 100644 --- a/rewatch-ocaml/README.md +++ b/rewatch-ocaml/README.md @@ -123,8 +123,8 @@ These are intentional: ends its descendants. - **Pipes:** each child's stdout and stderr are drained by reader threads, because Windows can't `select` on anonymous pipes. -- **Watching:** uses libuv through `luv`. `.github/opam-repository` holds a - patched luv package for static arm64 musl builds. +- **Watching:** uses libuv through `luv`. `rescript.opam.template` pins luv + to a commit of the rescript-lang/luv fork (libuv 1.53). The test suite compiles `platform_windows.ml` on every platform, so the Windows backend is always type-checked. Its process and Job Object paths only run on