summary refs log tree commit diff
path: root/pkgs/development/compilers/ocaml
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/compilers/ocaml')
-rw-r--r--pkgs/development/compilers/ocaml/4.01.0.nix2
-rw-r--r--pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff20
2 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ocaml/4.01.0.nix b/pkgs/development/compilers/ocaml/4.01.0.nix
index ea3e8d49a4e3..d178285834ff 100644
--- a/pkgs/development/compilers/ocaml/4.01.0.nix
+++ b/pkgs/development/compilers/ocaml/4.01.0.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
     sha256 = "b1ca708994180236917ae79e17606da5bd334ca6acd6873a550027e1c0ec874a";
   };
 
+  patches = [ ./fix-clang-build-on-osx.diff ];
+
   prefixKey = "-prefix ";
   configureFlags = ["-no-tk"] ++ optionals useX11 [ "-x11lib" x11lib
                                                     "-x11include" x11inc ];
diff --git a/pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff b/pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff
new file mode 100644
index 000000000000..d7d9c863858f
--- /dev/null
+++ b/pkgs/development/compilers/ocaml/fix-clang-build-on-osx.diff
@@ -0,0 +1,20 @@
+diff --git a/configure b/configure
+index d45e88f..25d872b 100755
+--- a/configure
++++ b/configure
+@@ -322,7 +322,14 @@ case "$bytecc,$target" in
+     bytecccompopts="-fno-defer-pop $gcc_warnings -DSHRINKED_GNUC"
+     mathlib="";;
+   *,*-*-darwin*)
+-    bytecccompopts="-fno-defer-pop $gcc_warnings"
++    # On recent version of OSX, gcc is a symlink to clang
++    if $bytecc --version | grep -q clang; then
++        # -fno-defer-pop is not supported by clang, and make recent
++        # versions of clang to fail
++        bytecccompopts="$gcc_warnings"
++    else
++        bytecccompopts="-fno-defer-pop $gcc_warnings"
++    fi
+     mathlib=""
+     mkexe="$mkexe -Wl,-no_compact_unwind"
+     # Tell gcc that we can use 32-bit code addresses for threaded code