about summary refs log tree commit diff
path: root/pkgs/applications/science/physics/xfitter
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2022-05-16 21:16:45 -0400
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2022-05-16 22:07:39 -0400
commit1c78ce70fa4811a0a6a074e0fdc2c7f18c7b36fd (patch)
treed9c6afd10e1744a62c81632e51aaf7974b46949e /pkgs/applications/science/physics/xfitter
parentf150888da6699b4f6215e9bd25d1074c4e756508 (diff)
xfitter: fix for gfortran10+
Diffstat (limited to 'pkgs/applications/science/physics/xfitter')
-rw-r--r--pkgs/applications/science/physics/xfitter/0001-src-GetChisquare.f-use-correct-types-in-calls-to-DSY.patch50
-rw-r--r--pkgs/applications/science/physics/xfitter/default.nix8
2 files changed, 54 insertions, 4 deletions
diff --git a/pkgs/applications/science/physics/xfitter/0001-src-GetChisquare.f-use-correct-types-in-calls-to-DSY.patch b/pkgs/applications/science/physics/xfitter/0001-src-GetChisquare.f-use-correct-types-in-calls-to-DSY.patch
new file mode 100644
index 0000000000000..dd43e17cc7a26
--- /dev/null
+++ b/pkgs/applications/science/physics/xfitter/0001-src-GetChisquare.f-use-correct-types-in-calls-to-DSY.patch
@@ -0,0 +1,50 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -54,21 +54,7 @@ endif()
+ endif()
+ 
+ #Use c preprocessor with fortran
+-
+-if(UNIX AND NOT APPLE)
+-  set(CMAKE_Fortran_FLAGS "-cpp -Wno-argument-mismatch")
+-endif()
+-
+-if(APPLE)
+-  set(CMAKE_Fortran_FLAGS "-cpp -fallow-argument-mismatch")
+-endif()
+-
+-
+-if (CMAKE_MAJOR_VERSION VERSION_GREATER_EQUAL "3")
+-if(CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL "10")
+-  set(CMAKE_Fortran_FLAGS "-cpp -fallow-argument-mismatch")
+-endif()
+-endif()
++set(CMAKE_Fortran_FLAGS "-cpp")
+ 
+ 
+ #For Fortran
+diff --git a/src/GetChisquare.f b/src/GetChisquare.f
+index b21413fe..28391bcb 100644
+--- a/src/GetChisquare.f
++++ b/src/GetChisquare.f
+@@ -2418,8 +2418,8 @@ C> @Brief Interface to lapack, to dynamically allocate work arrays
+       integer NCovar, NDimCovar
+       double precision Covar(NDimCovar,NDimCovar), EigenValues(NCovar)
+       integer IFail
+-      double precision Work
+-      integer IWork
++      double precision Work(1)
++      integer IWork(1)
+       Character*80 msg
+ C---------------------------------------------------------------
+ C Determine optimal size of the work array:
+@@ -2432,7 +2432,7 @@ C Determine optimal size of the work array:
+      $     int(work)+1, iwork
+       call HF_ERRLOG(14121701,msg)
+       call MyDSYEVD2(NCovar,Covar,NDimCovar, EigenValues,
+-     $     int(work)+1,iwork,ifail)
++     $     int(work(1))+1,iwork(1),ifail)
+ 
+       end
+ 
diff --git a/pkgs/applications/science/physics/xfitter/default.nix b/pkgs/applications/science/physics/xfitter/default.nix
index 2be6153878893..4e6f6626602f9 100644
--- a/pkgs/applications/science/physics/xfitter/default.nix
+++ b/pkgs/applications/science/physics/xfitter/default.nix
@@ -31,10 +31,10 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-ZHIQ5hOY+k0/wmpE0o4Po+RZ4MkVMk+bK1Rc6eqwwH0=";
   };
 
-  preConfigure = ''
-    substituteInPlace CMakeLists.txt \
-      --replace "-fallow-argument-mismatch" ""
-  '';
+  patches = [
+    # Avoid need for -fallow-argument-mismatch
+    ./0001-src-GetChisquare.f-use-correct-types-in-calls-to-DSY.patch
+  ];
 
   nativeBuildInputs = [ cmake gfortran pkg-config ];
   buildInputs =