From a9d14e345270b3a95b63ce4805c8f7771029ddc5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= <viric@viric.name>
Date: Thu, 24 Mar 2016 10:55:18 +0100
Subject: [PATCH] Setting gfortran to gcc5. octave was crashing.

Otherwise, using imread() in octave threw:

/nix/store/4fvwfzwg58d7167an550xm1k6m7px443-octave-4.0.0/lib/octave/4.0.0/oct/x86_64-unknown-linux-gnu/__magick_read__.oct: failed to load: /nix/store/w7xr6frwffrl135v7vpxdwmnx8l95j5m-gfortran-4.9.3/lib/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by /nix/store/qlxkin1arzwbcpiny6amn8747wp8ndg7-graphicsmagick-1.3.21/lib/libGraphicsMagick++.so.11)

(this is from 16.03, although I push this to staging)
---
 pkgs/top-level/all-packages.nix | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7e4beba0af8..a58827c8e61 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4232,7 +4232,7 @@ let
     isl = isl_0_14;
   }));
 
-  gfortran = if !stdenv.isDarwin then gfortran49
+  gfortran = if !stdenv.isDarwin then gfortran5
              else callPackage ../development/compilers/gcc/gfortran-darwin.nix {
     inherit (darwin) Libsystem;
   };
@@ -4253,6 +4253,14 @@ let
     profiledCompiler = false;
   });
 
+  gfortran5 = wrapCC (gcc5.cc.override {
+    name = "gfortran";
+    langFortran = true;
+    langCC = false;
+    langC = false;
+    profiledCompiler = false;
+  });
+
   gcj = gcj49;
   gcj49 = wrapCC (gcc49.cc.override {
     name = "gcj";