From cbf0dd3b3866d62169359f8882009c6f703f0c1a Mon Sep 17 00:00:00 2001 From: Anton Bachin Date: Fri, 9 Aug 2024 16:53:19 +0300 Subject: [PATCH] Build on OCaml 5 (river pin) (#2609) * Build on OCaml 5 The build was failing due to problems with a configuration script in ocamlnet, a transitive dependency of OCaml.org, through package river. For details on the problem in ocamlnet, see https://github.com/aantron/ocamlnet/commit/7ef255a0a994ef2721f3359077b36bcdd0428ee4 This commit pins ocamlnet to a fork with a workaround, until ocamlnet is fixed upstream and released. See https://gitlab.com/gerdstolpmann/lib-ocamlnet3/-/merge_requests/24 * Try with CI on 5.2.0 * Fix Dockerfile * Fix .devcontainer/Dockerfile * Update dune files .opam is generated from * Switch to upgraded River instead of ocamlnet --------- Co-authored-by: Cuihtlauac ALVARADO --- .devcontainer/Dockerfile | 2 +- .github/workflows/ci.yml | 2 +- Dockerfile | 2 +- Makefile | 2 +- dune-project | 4 +--- dune-workspace | 7 ++++++- ocamlorg.opam | 3 ++- ocamlorg.opam.template | 1 + 8 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 29b22437ea..8995edd338 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,4 +1,4 @@ -FROM ocaml/opam:debian-ocaml-4.14 +FROM ocaml/opam:debian-ocaml-5.2 # Branch freeze was opam-repo HEAD at the time of commit RUN cd ~/opam-repository && git checkout -b freeze c45f5bab71d3589f41f9603daca5acad14df0ab0 && opam update diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2c84a9b9f3..ac4421618f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - macos-latest - ubuntu-latest ocaml-compiler: - - "4.14" + - "5.2" steps: - name: Checkout Repo diff --git a/Dockerfile b/Dockerfile index cab943cfed..7bc00d0454 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ocaml/opam:alpine-3.20-ocaml-4.14 as build +FROM ocaml/opam:alpine-3.20-ocaml-5.2 as build # Install system dependencies RUN sudo apk update && sudo apk add --update libev-dev openssl-dev gmp-dev oniguruma-dev inotify-tools curl-dev autoconf diff --git a/Makefile b/Makefile index 2eb7b03630..ecd1297296 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ deps: create_switch ## Install development dependencies .PHONY: create_switch create_switch: ## Create switch and pinned opam repo - opam switch create . 4.14.2 --no-install --repos pin=git+https://github.com/ocaml/opam-repository#c45f5bab71d3589f41f9603daca5acad14df0ab0 + opam switch create . 5.2.0 --no-install --repos pin=git+https://github.com/ocaml/opam-repository#c45f5bab71d3589f41f9603daca5acad14df0ab0 .PHONY: switch switch: deps ## Create an opam switch and install development dependencies diff --git a/dune-project b/dune-project index a234df9a3f..530808fd14 100644 --- a/dune-project +++ b/dune-project @@ -31,9 +31,7 @@ "This repository contains the server that serves the official OCaml website at https://ocaml.org.") (depends (ocaml - (and - (>= 4.14.0) - (< 5.0.0))) + (>= 4.14.0)) dune cohttp cohttp-lwt-unix diff --git a/dune-workspace b/dune-workspace index 53b69a58ca..5adb477991 100644 --- a/dune-workspace +++ b/dune-workspace @@ -1,5 +1,10 @@ (lang dune 3.15) +(pin + (name river) + (url "git+https://github.com/aantron/river#476dc945a908a69548bddd267f143a3e5d9c8a1a") + (package (name river))) + (pin (name tailwindcss) (url "git+https://github.com/tmattio/opam-tailwindcss#3e60fc32bbcf82525999d83ad0f395e16107026b") @@ -11,4 +16,4 @@ (package (name olinkcheck))) (lock_dir - (pins tailwindcss olinkcheck)) + (pins river tailwindcss olinkcheck)) diff --git a/ocamlorg.opam b/ocamlorg.opam index 0c4c8105b5..40d3092094 100644 --- a/ocamlorg.opam +++ b/ocamlorg.opam @@ -18,7 +18,7 @@ homepage: "https://github.com/ocaml/ocaml.org" doc: "https://ocaml.github.io/ocaml.org/" bug-reports: "https://github.com/ocaml/ocaml.org/issues" depends: [ - "ocaml" {>= "4.14.0" & < "5.0.0"} + "ocaml" {>= "4.14.0"} "dune" {>= "3.15"} "cohttp" "cohttp-lwt-unix" @@ -70,6 +70,7 @@ build: [ ] dev-repo: "git+https://github.com/ocaml/ocaml.org.git" pin-depends: [ + ["river.dev" "git+https://github.com/aantron/river#476dc945a908a69548bddd267f143a3e5d9c8a1a"] ["tailwindcss.dev" "https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz"] ["olinkcheck.~dev" "git+https://github.com/tarides/olinkcheck"] ] diff --git a/ocamlorg.opam.template b/ocamlorg.opam.template index 7e96d5cc2f..b57ce018d1 100644 --- a/ocamlorg.opam.template +++ b/ocamlorg.opam.template @@ -1,4 +1,5 @@ pin-depends: [ + ["river.dev" "git+https://github.com/aantron/river#476dc945a908a69548bddd267f143a3e5d9c8a1a"] ["tailwindcss.dev" "https://github.com/tmattio/opam-tailwindcss/archive/3e60fc32bbcf82525999d83ad0f395e16107026b.tar.gz"] ["olinkcheck.~dev" "git+https://github.com/tarides/olinkcheck"] ]