about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
authorEt7f3 <cadeaudeelie@gmail.com>2023-01-22 03:59:06 +0100
committerEt7f3 <cadeaudeelie@gmail.com>2023-01-22 15:35:48 +0100
commit637880a98ce604be0749a39ae5f3aa2cc00be101 (patch)
tree5ffc290cbd7792a42b2f173d9c00a3e7725cd73a /pkgs/applications/science
parentb75e83c055af9786ad75ebd2aa857ad083f08119 (diff)
ocamlPackages.megam: fix build with ocaml_5_0
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/misc/megam/default.nix10
-rw-r--r--pkgs/applications/science/misc/megam/ocaml-includes.patch2
2 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/applications/science/misc/megam/default.nix b/pkgs/applications/science/misc/megam/default.nix
index 044f9ae56d052..e71c232be8f01 100644
--- a/pkgs/applications/science/misc/megam/default.nix
+++ b/pkgs/applications/science/misc/megam/default.nix
@@ -12,6 +12,14 @@ stdenv.mkDerivation {
 
   patches = [ ./ocaml-includes.patch ./ocaml-3.12.patch ];
 
+  postPatch = ''
+    # Deprecated in ocaml 3.10 https://github.com/ocaml/ocaml/commit/f6190f3d0c49c5220d443ee8d03ca5072d68aa87
+    # Deprecated in ocaml 3.08 https://github.com/ocaml/ocaml/commit/0c7aecb88dc696f66f49f3bed54a037361a26b8d
+    substituteInPlace fastdot_c.c --replace copy_double caml_copy_double --replace Bigarray_val Caml_ba_array_val --replace caml_bigarray caml_ba_array
+    # They were already deprecated in 3.12 https://v2.ocaml.org/releases/3.12/htmlman/libref/Array.html
+    substituteInPlace abffs.ml main.ml --replace create_matrix make_matrix
+    substituteInPlace intHashtbl.ml --replace Array.create Array.make
+  '';
   strictDeps = true;
 
   nativeBuildInputs = [ makeWrapper ocaml ];
@@ -20,7 +28,7 @@ stdenv.mkDerivation {
 
   makeFlags = [
     "CAML_INCLUDES=${ocaml}/lib/ocaml/caml"
-    "WITHBIGARRAY=bigarray.cma"
+    ("WITHBIGARRAY=" + lib.optionalString (lib.versionOlder ocaml.version "4.08.0") "bigarray.cma")
   ];
 
   # see https://bugzilla.redhat.com/show_bug.cgi?id=435559
diff --git a/pkgs/applications/science/misc/megam/ocaml-includes.patch b/pkgs/applications/science/misc/megam/ocaml-includes.patch
index b3a56643448ca..d4f38949b4d31 100644
--- a/pkgs/applications/science/misc/megam/ocaml-includes.patch
+++ b/pkgs/applications/science/misc/megam/ocaml-includes.patch
@@ -15,7 +15,7 @@ diff -ru megam_0.92/Makefile megam_0.92-b/Makefile
  
  #WITHCLIBS =-I /usr/lib/ocaml/3.09.2/caml
 -WITHCLIBS =-I /usr/lib/ocaml/caml
-+WITHCLIBS =-I $(CAML_INCLUDES) 
++WITHCLIBS =-I $(CAML_INCLUDES) -I +unix -I +str
  
  ################ End of user's variables #####################