diff --git a/pkgs/development/libraries/physics/applgrid/bad_code.patch b/pkgs/development/libraries/physics/applgrid/bad_code.patch new file mode 100644 index 000000000000..c1c8f618fbb3 --- /dev/null +++ b/pkgs/development/libraries/physics/applgrid/bad_code.patch @@ -0,0 +1,39 @@ +diff --git a/appl_grid/appl_grid.h b/appl_grid/appl_grid.h +index 5059622..a0651c9 100644 +--- a/appl_grid/appl_grid.h ++++ b/appl_grid/appl_grid.h +@@ -56,7 +56,7 @@ public: + class exception : public std::exception { + public: + exception(const std::string& s) { std::cerr << what() << " " << s << std::endl; }; +- exception(std::ostream& s) { std::cerr << what() << " " << s << std::endl; }; ++ exception(std::ostream& s) { s << what() << " " << std::endl; }; + virtual const char* what() const throw() { return "appl::grid::exception"; } + }; + +diff --git a/appl_grid/appl_pdf.h b/appl_grid/appl_pdf.h +index c71fd84..2525527 100644 +--- a/appl_grid/appl_pdf.h ++++ b/appl_grid/appl_pdf.h +@@ -51,7 +51,7 @@ public: + class exception : public std::exception { + public: + exception(const std::string& s="") { std::cerr << what() << " " << s << std::endl; }; +- exception(std::ostream& s) { std::cerr << what() << " " << s << std::endl; }; ++ exception(std::ostream& s) { s << " " << std::endl; }; + const char* what() const throw() { return "appl::appl_pdf::exception "; } + }; + +diff --git a/src/appl_igrid.h b/src/appl_igrid.h +index d25288e..be354df 100644 +--- a/src/appl_igrid.h ++++ b/src/appl_igrid.h +@@ -52,7 +52,7 @@ private: + class exception { + public: + exception(const std::string& s) { std::cerr << s << std::endl; }; +- exception(std::ostream& s) { std::cerr << s << std::endl; }; ++ exception(std::ostream& s) { s << std::endl; }; + }; + + typedef double (igrid::*transform_t)(double) const; diff --git a/pkgs/development/libraries/physics/applgrid/default.nix b/pkgs/development/libraries/physics/applgrid/default.nix new file mode 100644 index 000000000000..1ad5dcb8b25b --- /dev/null +++ b/pkgs/development/libraries/physics/applgrid/default.nix @@ -0,0 +1,42 @@ +{ stdenv, fetchurl, gfortran, hoppet, lhapdf, root5 }: + +stdenv.mkDerivation rec { + name = "applgrid-${version}"; + version = "1.4.70"; + + src = fetchurl { + url = "https://www.hepforge.org/archive/applgrid/${name}.tgz"; + sha256 = "1yw9wrk3vjv84kd3j4s1scfhinirknwk6xq0hvj7x2srx3h93q9p"; + }; + + buildInputs = [ gfortran hoppet lhapdf root5 ]; + + patches = [ + ./bad_code.patch + ]; + + preConfigure = '' + substituteInPlace src/Makefile.in \ + --replace "-L\$(subst /libgfortran.a, ,\$(FRTLIB) )" "-L${gfortran.cc.lib}/lib" + '' + (if stdenv.isDarwin then '' + substituteInPlace src/Makefile.in \ + --replace "gfortran -print-file-name=libgfortran.a" "gfortran -print-file-name=libgfortran.dylib" + '' else ""); + + enableParallelBuilding = false; # broken + + # Install private headers required by APFELgrid + postInstall = '' + for header in src/*.h; do + install -Dm644 "$header" "$out"/include/appl_grid/"`basename $header`" + done + ''; + + meta = with stdenv.lib; { + description = "The APPLgrid project provides a fast and flexible way to reproduce the results of full NLO calculations with any input parton distribution set in only a few milliseconds rather than the weeks normally required to gain adequate statistics"; + license = licenses.gpl3; + homepage = http://applgrid.hepforge.org; + platforms = platforms.unix; + maintainers = with maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index ebaf793295cd..2ceb8527874e 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -21405,6 +21405,8 @@ with pkgs; ### SCIENCE / PHYSICS + applgrid = callPackage ../development/libraries/physics/applgrid { }; + hoppet = callPackage ../development/libraries/physics/hoppet { }; fastjet = callPackage ../development/libraries/physics/fastjet { };