summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-05-24 19:01:50 -0500
committerThomas Tuegel <ttuegel@gmail.com>2015-05-24 19:01:50 -0500
commitd8dab38fda0e48b31edc6fdd88ebfb1ad08c5105 (patch)
tree0b16b5e528a55abb88ac18b93798cafa16f9e506 /pkgs/development
parent5722d7c5b593c8cabf0cf2783161ad5ef8d89e07 (diff)
parente802740b69375fc628e446ffd7c3f746c59312d0 (diff)
downloadnixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.tar
nixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.tar.gz
nixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.tar.bz2
nixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.tar.lz
nixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.tar.xz
nixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.tar.zst
nixpkgs-d8dab38fda0e48b31edc6fdd88ebfb1ad08c5105.zip
Merge pull request #7899 from thinkpad20/openblas_on_osx
added flags/switches necessary to get openblas to compile on osx
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/gcc/gfortran-darwin.nix26
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix13
2 files changed, 35 insertions, 4 deletions
diff --git a/pkgs/development/compilers/gcc/gfortran-darwin.nix b/pkgs/development/compilers/gcc/gfortran-darwin.nix
new file mode 100644
index 00000000000..954b236ff6f
--- /dev/null
+++ b/pkgs/development/compilers/gcc/gfortran-darwin.nix
@@ -0,0 +1,26 @@
+# This is a derivation specific to OS X (Darwin). It may work on other
+# systems as well but has not been tested.
+{gmp, mpfr, libmpc, fetchurl, stdenv}:
+
+stdenv.mkDerivation rec {
+  name = "gfortran-${version}";
+  version = "5.1.0";
+  buildInputs = [gmp mpfr libmpc];
+  src = fetchurl {
+    url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
+    sha256 = "1bd5vj4px3s8nlakbgrh38ynxq4s654m6nxz7lrj03mvkkwgvnmp";
+  };
+  configureFlags = ''
+    --enable-languages=fortran --enable-checking=release --disable-bootstrap
+    --with-gmp=${gmp}
+    --with-mpfr=${mpfr}
+    --with-mpc=${libmpc}
+  '';
+  makeFlags = ["CC=clang"];
+  meta = with stdenv.lib; {
+    description = "GNU Fortran compiler, part of the GNU Compiler Collection.";
+    homepage    = "https://gcc.gnu.org/fortran/";
+    license     = licenses.gpl3Plus;
+    platforms   = platforms.darwin;
+  };
+}
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index e779957a6fb..67d95f97e07 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gfortran, perl, liblapack, config }:
+{ stdenv, fetchurl, gfortran, perl, liblapack, config, coreutils }:
 
 with stdenv.lib;
 
@@ -7,6 +7,7 @@ let local = config.openblas.preferLocalBuild or false;
       {
         i686-linux = "32";
         x86_64-linux = "64";
+        x86_64-darwin = "64";
       }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}");
     genericFlags =
       [
@@ -29,14 +30,18 @@ stdenv.mkDerivation rec {
 
   preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz";
 
-  nativeBuildInputs = [gfortran perl];
+  nativeBuildInputs = optionals stdenv.isDarwin [coreutils] ++ [gfortran perl];
 
   makeFlags =
     (if local then localFlags else genericFlags)
     ++
+    optionals stdenv.isDarwin ["MACOSX_DEPLOYMENT_TARGET=10.9"]
+    ++
     [
       "FC=gfortran"
-      "CC=gcc"
+      # Note that clang is available through the stdenv on OSX and
+      # thus is not an explicit dependency.
+      "CC=${if stdenv.isDarwin then "clang" else "gcc"}"
       ''PREFIX="''$(out)"''
       "INTERFACE64=1"
     ];
@@ -45,7 +50,7 @@ stdenv.mkDerivation rec {
     description = "Basic Linear Algebra Subprograms";
     license = licenses.bsd3;
     homepage = "https://github.com/xianyi/OpenBLAS";
-    platforms = with platforms; linux;
+    platforms = with platforms; unix;
     maintainers = with maintainers; [ ttuegel ];
   };
 }