about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libint
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-09-08 17:57:14 +0000
committerAlyssa Ross <hi@alyssa.is>2021-09-13 11:31:47 +0000
commitee7984efa14902a2ddd820c937457667a4f40c6a (patch)
treec9c1d046733cefe5e21fdd8a52104175d47b2443 /nixpkgs/pkgs/development/libraries/libint
parentffc9d4ba381da62fd08b361bacd1e71e2a3d934d (diff)
parentb3c692172e5b5241b028a98e1977f9fb12eeaf42 (diff)
downloadnixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.gz
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.bz2
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.lz
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.xz
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.tar.zst
nixlib-ee7984efa14902a2ddd820c937457667a4f40c6a.zip
Merge commit 'b3c692172e5b5241b028a98e1977f9fb12eeaf42'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libint')
-rw-r--r--nixpkgs/pkgs/development/libraries/libint/default.nix156
1 files changed, 91 insertions, 65 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libint/default.nix b/nixpkgs/pkgs/development/libraries/libint/default.nix
index 330fe8eac26b..64b83166ae99 100644
--- a/nixpkgs/pkgs/development/libraries/libint/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libint/default.nix
@@ -1,76 +1,102 @@
 { lib, stdenv, fetchFromGitHub, autoconf, automake, libtool
-, python3, perl, gmpxx, mpfr, boost, eigen, gfortran
-, enableFMA ? false
+, python3, perl, gmpxx, mpfr, boost, eigen, gfortran, cmake
+, enableFMA ? stdenv.hostPlatform.fmaSupport
+, enableFortran ? true
 }:
 
-stdenv.mkDerivation rec {
-  pname = "libint2";
+let
+  pname = "libint";
   version = "2.6.0";
 
-  src = fetchFromGitHub {
-    owner = "evaleev";
-    repo = "libint";
-    rev = "v${version}";
-    sha256 = "0pbc2j928jyffhdp4x5bkw68mqmx610qqhnb223vdzr0n2yj5y19";
-  };
-
-  patches = [
-    ./fix-paths.patch
-  ];
-
-  nativeBuildInputs = [
-    autoconf
-    automake
-    libtool
-    gfortran
-    mpfr
-    python3
-    perl
-    gmpxx
-  ];
-
-  buildInputs = [ boost ];
-
-  enableParallelBuilding = true;
-
-  doCheck = true;
-
-  configureFlags = [
-    "--enable-eri=2"
-    "--enable-eri3=2"
-    "--enable-eri2=2"
-    "--with-eri-max-am=7,5,4"
-    "--with-eri-opt-am=3"
-    "--with-eri3-max-am=7"
-    "--with-eri2-max-am=7"
-    "--with-g12-max-am=5"
-    "--with-g12-opt-am=3"
-    "--with-g12dkh-max-am=5"
-    "--with-g12dkh-opt-am=3"
-    "--enable-contracted-ints"
-    "--enable-shared"
-   ] ++ lib.optional enableFMA "--enable-fma";
-
-  preConfigure = ''
-    ./autogen.sh
-  '';
-
-  postBuild = ''
-    # build the fortran interface file
-    cd export/fortran
-    make libint_f.o ENABLE_FORTRAN=yes
-    cd ../..
-  '';
-
-  postInstall = ''
-    cp export/fortran/libint_f.mod $out/include/
-  '';
-
   meta = with lib; {
     description = "Library for the evaluation of molecular integrals of many-body operators over Gaussian functions";
     homepage = "https://github.com/evaleev/libint";
     license = with licenses; [ lgpl3Only gpl3Only ];
-    maintainers = [ maintainers.markuskowa ];
+    maintainers = with maintainers; [ markuskowa sheepforce ];
     platforms = [ "x86_64-linux" ];
   };
-}
+
+  codeGen = stdenv.mkDerivation {
+    inherit pname version;
+
+    src = fetchFromGitHub {
+      owner = "evaleev";
+      repo = pname;
+      rev = "v${version}";
+      sha256 = "0pbc2j928jyffhdp4x5bkw68mqmx610qqhnb223vdzr0n2yj5y19";
+    };
+
+    patches = [ ./fix-paths.patch ];
+
+    nativeBuildInputs = [
+      autoconf
+      automake
+      libtool
+      mpfr
+      python3
+      perl
+      gmpxx
+    ] ++ lib.optional enableFortran gfortran;
+
+    buildInputs = [ boost eigen ];
+
+    preConfigure = "./autogen.sh";
+
+    configureFlags = [
+      "--enable-eri=2"
+      "--enable-eri3=2"
+      "--enable-eri2=2"
+      "--with-eri-max-am=7,5,4"
+      "--with-eri-opt-am=3"
+      "--with-eri3-max-am=7"
+      "--with-eri2-max-am=7"
+      "--with-g12-max-am=5"
+      "--with-g12-opt-am=3"
+      "--with-g12dkh-max-am=5"
+      "--with-g12dkh-opt-am=3"
+      "--enable-contracted-ints"
+      "--enable-shared"
+    ] ++ lib.optional enableFMA "--enable-fma"
+      ++ lib.optional enableFortran "--enable-fortran";
+
+    makeFlags = [ "export" ];
+
+    installPhase = ''
+      mkdir -p $out
+      cp ${pname}-${version}.tgz $out/.
+    '';
+
+    enableParallelBuilding = true;
+
+    inherit meta;
+  };
+
+  codeComp = stdenv.mkDerivation {
+    inherit pname version;
+
+    src = "${codeGen}/${pname}-${version}.tgz";
+
+    nativeBuildInputs = [
+      python3
+      cmake
+    ] ++ lib.optional enableFortran gfortran;
+
+    buildInputs = [ boost eigen ];
+
+    # Default is just "double", but SSE2 is available on all x86_64 CPUs.
+    # AVX support is advertised, but does not work in 2.6 (possibly in 2.7).
+    # Fortran interface is incompatible with changing the LIBINT2_REALTYPE.
+    cmakeFlags = [
+      (if enableFortran
+        then "-DENABLE_FORTRAN=ON"
+        else "-DLIBINT2_REALTYPE=libint2::simd::VectorSSEDouble"
+      )
+    ];
+
+    # Can only build in the source-tree. A lot of preprocessing magic fails otherwise.
+    dontUseCmakeBuildDir = true;
+
+    inherit meta;
+  };
+
+in codeComp