summary refs log tree commit diff
path: root/pkgs/applications/science/physics/xfitter/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science/physics/xfitter/default.nix')
-rw-r--r--pkgs/applications/science/physics/xfitter/default.nix64
1 files changed, 34 insertions, 30 deletions
diff --git a/pkgs/applications/science/physics/xfitter/default.nix b/pkgs/applications/science/physics/xfitter/default.nix
index 51d6c9d68fe4b..2be6153878893 100644
--- a/pkgs/applications/science/physics/xfitter/default.nix
+++ b/pkgs/applications/science/physics/xfitter/default.nix
@@ -1,53 +1,57 @@
-{ lib, stdenv, fetchurl, apfel, apfelgrid, applgrid, blas, gfortran, lhapdf, lapack, libyaml, lynx
-, mela, root5, qcdnum, which, libtirpc
+{ lib
+, stdenv
+, fetchurl
+, apfel
+, apfelgrid
+, applgrid
+, blas
+, ceres-solver
+, cmake
+, gfortran
+, gsl
+, lapack
+, lhapdf
+, libtirpc
+, libyaml
+, libyamlcpp
+, pkg-config
+, qcdnum
+, root
+, zlib
 , memorymappingHook, memstreamHook
 }:
 
 stdenv.mkDerivation rec {
   pname = "xfitter";
-  version = "2.0.1";
+  version = "2.2.0";
 
   src = fetchurl {
     name = "${pname}-${version}.tgz";
     url = "https://www.xfitter.org/xFitter/xFitter/DownloadPage?action=AttachFile&do=get&target=${pname}-${version}.tgz";
-    sha256 = "0kmgc67nw5flp92yw5x6l2vsnhwsfi5z2a20404anisdgdjs8zc6";
+    sha256 = "sha256-ZHIQ5hOY+k0/wmpE0o4Po+RZ4MkVMk+bK1Rc6eqwwH0=";
   };
 
-  patches = [
-    ./undefined_behavior.patch
-  ];
+  preConfigure = ''
+    substituteInPlace CMakeLists.txt \
+      --replace "-fallow-argument-mismatch" ""
+  '';
 
-  preConfigure =
-  # Fix F77LD to workaround for a following build error:
-  #
-  #   gfortran: error: unrecognized command line option '-stdlib=libc++'
-  #
-    lib.optionalString stdenv.isDarwin ''
-      substituteInPlace src/Makefile.in \
-        --replace "F77LD = \$(F77)" "F77LD = \$(CXXLD)" \
-    '';
-
-  configureFlags = [
-    "--enable-apfel"
-    "--enable-apfelgrid"
-    "--enable-applgrid"
-    "--enable-mela"
-    "--enable-lhapdf"
-  ];
-
-  nativeBuildInputs = [ gfortran which ];
+  nativeBuildInputs = [ cmake gfortran pkg-config ];
   buildInputs =
-    [ apfel apfelgrid applgrid blas lhapdf libyaml lapack mela root5 qcdnum ]
+    [ apfel blas ceres-solver lhapdf lapack libyaml root qcdnum gsl libyamlcpp zlib ]
+    ++ lib.optionals ("5" == lib.versions.major root.version) [ apfelgrid applgrid ]
     ++ lib.optionals (stdenv.system == "x86_64-darwin") [ memorymappingHook memstreamHook ]
     ++ lib.optional (stdenv.hostPlatform.libc == "glibc") libtirpc
     ;
-  propagatedBuildInputs = [ lynx ];
-
-  enableParallelBuilding = true;
 
   NIX_CFLAGS_COMPILE = lib.optional (stdenv.hostPlatform.libc == "glibc") "-I${libtirpc.dev}/include/tirpc";
   NIX_LDFLAGS = lib.optional (stdenv.hostPlatform.libc == "glibc") "-ltirpc";
 
+  # workaround wrong library IDs
+  postInstall = lib.optionalString stdenv.isDarwin ''
+    ln -sv "$out/lib/xfitter/"* "$out/lib/"
+  '';
+
   meta = with lib; {
     description = "The xFitter project is an open source QCD fit framework ready to extract PDFs and assess the impact of new data";
     license     = licenses.gpl3;