Unverified Commit 00c0a233 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #230114 from wegank/ligo-darwin

ligo: fix build on darwin
parents 09dbb079 b2963e31
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@
, mustache-go
, yaml2json
, tezos-rust-libs
, darwin
}:

ocamlPackages.buildDunePackage rec {
@@ -110,6 +111,8 @@ ocamlPackages.buildDunePackage rec {
    pure-splitmix
    zarith_stubs_js
    simple-diff
  ] ++ lib.optionals stdenv.isDarwin [
    darwin.apple_sdk.frameworks.Security
  ];

  preBuild = ''
+14 −0
Original line number Diff line number Diff line
diff --git a/hacl-star-raw/karamel/include/krml/internal/target.h b/hacl-star-raw/karamel/include/krml/internal/target.h
index 695873a..c0aed18 100644
--- a/hacl-star-raw/karamel/include/krml/internal/target.h
+++ b/hacl-star-raw/karamel/include/krml/internal/target.h
@@ -82,6 +82,9 @@
 #  endif
 #  if (defined(_MSC_VER) || (defined(__MINGW32__) && defined(__MINGW64_VERSION_MAJOR)))
 #    define KRML_ALIGNED_MALLOC(X, Y) _aligned_malloc(Y, X)
+#  elif defined(__APPLE__)
+#    include <mm_malloc.h>
+#    define KRML_ALIGNED_MALLOC(X, Y) _mm_malloc(Y, X)
 #  else
 #    define KRML_ALIGNED_MALLOC(X, Y) aligned_alloc(X, Y)
 #  endif
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,10 @@ stdenv.mkDerivation rec {
    stripRoot = false;
  };

  patches = [
    ./aligned-alloc.patch
  ];

  minimalOCamlVersion = "4.08";

  # strictoverflow is disabled because it breaks aarch64-darwin