summary refs log tree commit diff
path: root/pkgs/development/compilers/ocaml/generic.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/ocaml/generic.nix')
-rw-r--r--pkgs/development/compilers/ocaml/generic.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/pkgs/development/compilers/ocaml/generic.nix b/pkgs/development/compilers/ocaml/generic.nix
index 1b6a3b56e62..ec52e56c1fa 100644
--- a/pkgs/development/compilers/ocaml/generic.nix
+++ b/pkgs/development/compilers/ocaml/generic.nix
@@ -64,9 +64,15 @@ stdenv.mkDerivation (args // {
     "-target ${stdenv.targetPlatform.config}"
   ];
   dontAddStaticConfigureFlags = lib.versionOlder version "4.08";
-  configurePlatforms = lib.optionals (lib.versionAtLeast version "4.08") [ "host" "target" ];
+
+  # on aarch64-darwin using --host and --target causes the build to invoke
+  # `aarch64-apple-darwin-clang` while using assembler. However, such binary
+  # does not exist. So, disable these configure flags on `aarch64-darwin`.
+  # See #144785 for details.
+  configurePlatforms = lib.optionals (lib.versionAtLeast version "4.08" && !(stdenv.isDarwin && stdenv.isAarch64)) [ "host" "target" ];
   # x86_64-unknown-linux-musl-ld: -r and -pie may not be used together
-  hardeningDisable = lib.optional (lib.versionAtLeast version "4.09" && stdenv.hostPlatform.isMusl) "pie";
+  hardeningDisable = lib.optional (lib.versionAtLeast version "4.09" && stdenv.hostPlatform.isMusl) "pie"
+    ++ lib.optionals (args ? hardeningDisable) args.hardeningDisable;
 
   buildFlags = [ "world" ] ++ optionals useNativeCompilers [ "bootstrap" "world.opt" ];
   buildInputs = optional (!lib.versionAtLeast version "4.07") ncurses