summaryrefslogtreecommitdiff
path: root/sci-chemistry/psi
diff options
context:
space:
mode:
Diffstat (limited to 'sci-chemistry/psi')
-rw-r--r--sci-chemistry/psi/Manifest15
-rw-r--r--sci-chemistry/psi/files/3.4.0-destdir.patch41
-rw-r--r--sci-chemistry/psi/files/3.4.0-dont-build-libint.patch13
-rw-r--r--sci-chemistry/psi/files/3.4.0-fortify.patch58
-rw-r--r--sci-chemistry/psi/files/3.4.0-gcc-4.3.patch293
-rw-r--r--sci-chemistry/psi/files/3.4.0-ldflags.patch21
-rw-r--r--sci-chemistry/psi/files/3.4.0-man_paths.patch25
-rw-r--r--sci-chemistry/psi/files/3.4.0-parallel_fix.patch400
-rw-r--r--sci-chemistry/psi/files/psi-3.4.0-format-security.patch33
-rw-r--r--sci-chemistry/psi/files/psi-3.4.0-parallel-make.patch19
-rw-r--r--sci-chemistry/psi/files/use-external-libint.patch37
-rw-r--r--sci-chemistry/psi/metadata.xml11
-rw-r--r--sci-chemistry/psi/psi-3.4.0-r2.ebuild85
13 files changed, 1051 insertions, 0 deletions
diff --git a/sci-chemistry/psi/Manifest b/sci-chemistry/psi/Manifest
new file mode 100644
index 000000000000..e894cfc0d529
--- /dev/null
+++ b/sci-chemistry/psi/Manifest
@@ -0,0 +1,15 @@
+AUX 3.4.0-destdir.patch 1320 SHA256 17909af7b5dff643ef8ea134bf4468cd361457ba9192a1f9155a5870470af7a6 SHA512 cacd44ce2b5d0a1d7ccc2c2bb0429973b3d5d7cf145bc99ea5cbbbe693bef3bb624641761f93ba7f275f1d41fce0b14f15134167071fff4bce0542429d4d1098 WHIRLPOOL 3589a0e751d2ce2321b9495191be831d78997044bc15a07a38aecc29df08b40c0cbe4038593ede60872de3f45c441d765887b6395f546e4d9a4bd25fb378fdc0
+AUX 3.4.0-dont-build-libint.patch 432 SHA256 2bceacc5e924b033b2ef774df789cb5cd11278452da7ea2aad5d51d3b7a8d43c SHA512 db4dd3607c5fad353d9a692f38250c75f12330d6b9a10b2ea2d1ce265526310f7407c57f6846c063185f890089bcd325b13b04bf1d16742b019c0a86c766b05d WHIRLPOOL 170ec68dd4479b272e92ec38b0fb29050c30487b46cdd4537562ee099f63ba91018de9901259ca6a2bb92872c0bc738958602db8552f2c6234dbbe61865f622c
+AUX 3.4.0-fortify.patch 1889 SHA256 f901b42e64e6fdf1aed2d87bfc8efa503ab193d0464e9739be67c60daf249cd6 SHA512 b8433288aac07fe973bfcb24d17de94d2d40368c9bba4859b104c14bc2b38503307fa00145f88a00bb5185dfb1996df74786e990c132edd4f3cf4f228a03bdae WHIRLPOOL ad1eff61ef467c37a23ff986d1b3cc633c8213dc2242802c8ba49d682799c6a91bce4b64e1910fe935b68061b44ba9798488e6cab0b8fbb9707063fbd9eb3ba5
+AUX 3.4.0-gcc-4.3.patch 8000 SHA256 f0b354c3ce8c65956f4ace3ed19afd9ff9b6ab43b3cf21aa33a94c8af44989da SHA512 023a266d1b853e70b49f5e95f6ec78a4e13afc262dc95cef7b7dc580b0e11d68b36b78b0a1e8fa46b678bfd2f4a091800014393e1db812c6483d8c0e484d2ea5 WHIRLPOOL 42b92175b683a49b35e9b608a3b0feb9b31363fa73ee1116027f2972415d63f841eb0f7b72d5d69fe7844114c73e50a248d45b319370ccf7d6879d9c7d5eb9c0
+AUX 3.4.0-ldflags.patch 403 SHA256 edd2030d2d1f4f62d5297d7eab453fbe4d81d1b9ab8fe5f88b7ca8ca8ac70077 SHA512 208431df306d07562ba46a4f18327c8b8978452c250963c5a403e548817ea2709530675faf0b35929d0b2e6c214154a88e5e0e92066e2030c6988ec86681daf1 WHIRLPOOL f1ad2ef3984fef0d567ad443fbf53db718989c570cfc86201bb7f9563719be2f67b4a8419ce220ec8dbb04cd479d703ac80ba0ce242377d35bd943dedac4f65a
+AUX 3.4.0-man_paths.patch 603 SHA256 a8307a45d0af403e88299ea474f8af9cf26eafc3207cd991e53af1796ff8357b SHA512 d3b351b76f94f37cf7de34194b8a3fc92226e22cad5a25f9310721dddfa074ff62e6ce8aff856b59b040f0547efa5405647e664fd2e08248438592b3ca06b64d WHIRLPOOL 64a8c6262e60f57f2cad59c6fb51fc299bf888ff630652c72abfa754f5becf0806a3f0a4575186576a61e7c173b8721c4aac1149424e864fb400d380fe426b2e
+AUX 3.4.0-parallel_fix.patch 10682 SHA256 4853f395db93db2777fcda7427f4f75cc27ec03ac7ca5e238a56137c596f79c2 SHA512 44cbf4e159168ba9495f34031d409f2f22311f8c4899ca414fbcc789306aac2d8b0c165fdc0fb24907b1ddd69c79c4c2c980e2d9157a38aa94e7511914a7ff9d WHIRLPOOL 53f5ce9c1a775c284d0949ecda32897a0536ce73eb354a765cee58f8dc6d475a9240f7f6df8cd759f14f6f8597e894e1c7394d6384e4b3388f10df5dc9e4ab7c
+AUX psi-3.4.0-format-security.patch 1021 SHA256 5e39927ce8237a12fee5345f75dd9d2aa223749c48bad4d06d401bf65d38532d SHA512 f828866ae90711f244104c6443c750a148e9c848eedfe38d9a74fc2e5b56543ced7ae0beadbafa3fe338eddd391969e197104838afb5820b50f227ecbfa472de WHIRLPOOL fad11c794f467ef5cb03bd90d9f9f4720faa7ac0fa6f7fe158a34faa5bc6986adebd5da95c68f9afae06ba58c5bada6fc87e13442509e4d80d7dd65e32599979
+AUX psi-3.4.0-parallel-make.patch 445 SHA256 5c3592741513bacf70e1a642e59356e1e76a98239b615fc3299cc472a09d5634 SHA512 bf574c6c9c1e1ffc8747fb51896b8f9d8b29c4796b0a06529a58a2ab1ed5ee0a4270fe071eb86ca745bad2c760701c4d9eb7f269cd390f6d9cadf4065962e52e WHIRLPOOL cf1c8fd9b46d5aa0d1237ab5612efd465f7525b9f99a09ff277792034a38d1969b69cefb162e91d6ca22573b584911d428d26d062d4a9907bcd28e8abb0cc70f
+AUX use-external-libint.patch 1359 SHA256 41faa20ba804e98a81cb6809c789c643fd17458b6f6bc95dbe6311dd2fb16713 SHA512 8b4749b0c449dbc89067eec466d3d557da86e7f2d950cc0a94409e158a31a3fb8ceafefd090168acd97975ff3ccc7859e6f2df3c2cd57a3571b79f71aca6fff7 WHIRLPOOL ea034da3121075ae566b1e99de48c6c4f39aeff8bb4b9030e5cae4cc31e402da2861bbc194b4c9f1ce242b1e4c213971700c603699a29f405eb0c69ea9ff12b4
+DIST psi-3.4.0.tar.gz 7413072 SHA256 c87a7f63cb4e34bfd1a8b3731474eb417d9933338327143415a985bcedb619d4 SHA512 b13d2464502545cceec3a3b6048b505b918da26730c1614617b04ee6c1d637c9f799ef7fd92ad9554fa2db87617004aa810a6a81400a04df3c06787d51654ca6 WHIRLPOOL 9c0b9de2c9fbed298eaf958f0c135cadff16eac8754d4064dba0ac2275aabd36204bcad92f90236030bc62ef9917b967653ec608e40ad631e70a0ce1c16f2127
+EBUILD psi-3.4.0-r2.ebuild 1935 SHA256 c4b835d3f5fbf5b9e6326b3f7227e8a0eacc5457a190c78ccf5436eda9573086 SHA512 75c1615bb6510bfa0ef2a771a78a4d262dfac80ce5c597d69cba1c030e0a3db90902d3a9330ce9d2440918e2ee649fc44bca9c7453ff5099d592188d8142bfda WHIRLPOOL 3499d4fb4011475aa7e968217a01a5598094ffd75a96cc7b290af4b6f4f45c064d9b1d688892b5168d20d374571584563ce02a4b0f43bf1577c76f6c7f96c066
+MISC ChangeLog 3353 SHA256 4ab0e7198528e63ea6cab3697b2ad1ee1f4c4c9028160d913a9a6b7663772610 SHA512 1587184d1dbc4647df453e5b3f42a0b86c9bebfcb25e9b82407d9e831fecc3390a67664c23d625ecff9abeb9a3e63faad31310975ac384aa94dbc26b569cf72f WHIRLPOOL f31170f3ef210f55daf61215504224fdc5e7dd8c63f02616e745224f41fa4323ac3cae1ad160ebd6aeaf64a68b49c70fb7a85cebeda0ed2aaac3f6cd7fbc49b4
+MISC ChangeLog-2015 4266 SHA256 2edd997f887c0ee6ca527d01614844371deaef75c960c4b65ed73a502b691a77 SHA512 964d92590ca461950f2a2a3f47cd90068041420af03e8266b2f4238d763e9af33a02197dbd2df91a5bff7b88991d1391ffb377cada3bd7796be70efccec7ab35 WHIRLPOOL c78108a4048531b3ca22a73b189fb25470af719c9778c90c14bed1be28b5687a1ad0fc0faedc8e4433d427d44b7221830c6f306eb0e158b19f05c8178db4bb6d
+MISC metadata.xml 352 SHA256 ffcde8b1ae3a6c638299b892e9db2784cdebd6ecaf6baf589b0c4a2f159ffb36 SHA512 0ef2b193bcadef21bcad1e3fd3745b37f75bd65fe44645c667c99634d9047b28c82504002ed6967cf1cc2d5c8c43f5757ad08264613088ca36c7e94ac683b7e2 WHIRLPOOL 0b8e8609c669de5244adc767862fb184912b94bfc5d212a33a339fd246f51845165a008c9544078989f88723975bba399f72138683b88b11911bad339d0b84ac
diff --git a/sci-chemistry/psi/files/3.4.0-destdir.patch b/sci-chemistry/psi/files/3.4.0-destdir.patch
new file mode 100644
index 000000000000..45db9529aa4d
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-destdir.patch
@@ -0,0 +1,41 @@
+diff --git a/Makefile.in b/Makefile.in
+index aca5a16..2e49f0a 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -8,6 +8,7 @@ subdirs = lib include src
+
+ top_srcdir = @top_srcdir@
+ srcdir = @srcdir@
++datarootdir = @datarootdir@
+ VPATH = @srcdir@
+ top_objdir = .
+
+diff --git a/lib/ruby/Makefile.in b/lib/ruby/Makefile.in
+index b31ce7f..e099e1b 100644
+--- a/lib/ruby/Makefile.in
++++ b/lib/ruby/Makefile.in
+@@ -29,10 +29,10 @@ ccenergy.rb cclambda.rb chkpt.rb color.rb deriv2.rb frequ
+ cceom.rb ccsort.rb cints.rb cphf.rb detci.rb input.rb optking.rb psi3.rb testcases.rb
+
+ install: $(RUBYSRC)
+- $(MKDIRS) $(rubydatadir)
++ $(MKDIRS) $(DESTDIR)/$(rubydatadir)
+ for rbfile in $(RUBYSRC); \
+ do \
+- ($(INSTALL_DATA) $(srcdir)/$${rbfile} $(rubydatadir)) || exit 1; \
++ ($(INSTALL_DATA) $(srcdir)/$${rbfile} $(DESTDIR)/$(rubydatadir)) || exit 1; \
+ done
+
+ install_man:
+diff --git a/src/bin/Makefile.in b/src/bin/Makefile.in
+index e1abb46..4eddf8d 100644
+--- a/src/bin/Makefile.in
++++ b/src/bin/Makefile.in
+@@ -65,6 +65,7 @@ targetclean:
+
+ top_srcdir = @top_srcdir@
+ srcdir = @srcdir@
++datarootdir = @datarootdir@
+ top_objdir = ../..
+
+ $(top_srcdir)/configure: $(top_srcdir)/configure.ac $(top_srcdir)/aclocal.m4
diff --git a/sci-chemistry/psi/files/3.4.0-dont-build-libint.patch b/sci-chemistry/psi/files/3.4.0-dont-build-libint.patch
new file mode 100644
index 000000000000..0d65cee8a1a9
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-dont-build-libint.patch
@@ -0,0 +1,13 @@
+diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in
+index 42e025d..b098a36 100644
+--- a/src/lib/Makefile.in
++++ b/src/lib/Makefile.in
+@@ -2,7 +2,7 @@
+ .PHONY: default all install depend clean dclean targetclean
+
+ subdirs = libipv1 libciomr libchkpt libqt libpsio libiwl libdpd libutil \
+- liboptions libmoinfo libint libderiv libr12 libbasis libmints
++ liboptions libmoinfo libbasis libmints
+
+ all: default
+
diff --git a/sci-chemistry/psi/files/3.4.0-fortify.patch b/sci-chemistry/psi/files/3.4.0-fortify.patch
new file mode 100644
index 000000000000..5f098399ad3f
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-fortify.patch
@@ -0,0 +1,58 @@
+ src/bin/ccenergy/get_params.cc | 2 +-
+ src/bin/cclambda/get_params.cc | 2 +-
+ src/bin/ccresponse/get_params.cc | 2 +-
+ src/bin/ccsort/get_params.cc | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/src/bin/ccenergy/get_params.cc b/src/bin/ccenergy/get_params.cc
+index 53f4c83..a2fa932 100644
+--- a/src/bin/ccenergy/get_params.cc
++++ b/src/bin/ccenergy/get_params.cc
+@@ -193,7 +193,7 @@ void get_params()
+ }
+ }
+ else if(params.local) {
+- local.weakp = (char *) malloc(4 * sizeof(char));
++ local.weakp = (char *) malloc(5 * sizeof(char));
+ sprintf(local.weakp, "%s", "NONE");
+ }
+
+diff --git a/src/bin/cclambda/get_params.cc b/src/bin/cclambda/get_params.cc
+index 4a9d2c8..8a2ae17 100644
+--- a/src/bin/cclambda/get_params.cc
++++ b/src/bin/cclambda/get_params.cc
+@@ -150,7 +150,7 @@ void get_params(void)
+ }
+ }
+ else if(params.local) {
+- local.weakp = (char *) malloc(4 * sizeof(char));
++ local.weakp = (char *) malloc(5 * sizeof(char));
+ sprintf(local.weakp, "%s", "NONE");
+ }
+
+diff --git a/src/bin/ccresponse/get_params.cc b/src/bin/ccresponse/get_params.cc
+index a96db13..5c40aa0 100644
+--- a/src/bin/ccresponse/get_params.cc
++++ b/src/bin/ccresponse/get_params.cc
+@@ -207,7 +207,7 @@ void get_params()
+ }
+ }
+ else if(params.local) {
+- local.weakp = (char *) malloc(4 * sizeof(char));
++ local.weakp = (char *) malloc(5 * sizeof(char));
+ sprintf(local.weakp, "%s", "NONE");
+ }
+
+diff --git a/src/bin/ccsort/get_params.cc b/src/bin/ccsort/get_params.cc
+index ad7f0c3..6ee1993 100644
+--- a/src/bin/ccsort/get_params.cc
++++ b/src/bin/ccsort/get_params.cc
+@@ -120,7 +120,7 @@ void get_params()
+ }
+ }
+ else if(params.local) {
+- local.weakp = (char *) malloc(4 * sizeof(char));
++ local.weakp = (char *) malloc(5 * sizeof(char));
+ sprintf(local.weakp, "%s", "NONE");
+ }
+
diff --git a/sci-chemistry/psi/files/3.4.0-gcc-4.3.patch b/sci-chemistry/psi/files/3.4.0-gcc-4.3.patch
new file mode 100644
index 000000000000..8283e6d8d8ea
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-gcc-4.3.patch
@@ -0,0 +1,293 @@
+diff --git a/src/bin/mcscf/block_matrix.cc b/src/bin/mcscf/block_matrix.cc
+index fe1e131..3ad0bcd 100644
+--- a/src/bin/mcscf/block_matrix.cc
++++ b/src/bin/mcscf/block_matrix.cc
+@@ -1,6 +1,7 @@
+ #include "block_matrix.h"
+ #include "matrix_base.h"
+ #include "memory_manager.h"
++#include <cstdio>
+
+ extern FILE* outfile;
+
+diff --git a/src/bin/mcscf/block_vector.cc b/src/bin/mcscf/block_vector.cc
+index fb383c7..36f55d4 100644
+--- a/src/bin/mcscf/block_vector.cc
++++ b/src/bin/mcscf/block_vector.cc
+@@ -1,6 +1,7 @@
+ #include "block_vector.h"
+ #include "vector_base.h"
+ #include "memory_manager.h"
++#include <cstdio>
+
+ extern FILE* outfile;
+
+diff --git a/src/bin/mcscf/sblock_matrix.cc b/src/bin/mcscf/sblock_matrix.cc
+index 61aa7cc..4da4263 100644
+--- a/src/bin/mcscf/sblock_matrix.cc
++++ b/src/bin/mcscf/sblock_matrix.cc
+@@ -1,4 +1,5 @@
+ #include <cstdlib>
++#include <cstdio>
+ #include <psifiles.h>
+ #include "sblock_matrix.h"
+
+@@ -103,4 +104,4 @@ void SBlockMatrix::check(const char* cstr)
+ }
+ }
+
+-}}
+\ No newline at end of file
++}}
+diff --git a/src/bin/mcscf/sblock_vector.cc b/src/bin/mcscf/sblock_vector.cc
+index 63c3926..f24fc5b 100644
+--- a/src/bin/mcscf/sblock_vector.cc
++++ b/src/bin/mcscf/sblock_vector.cc
+@@ -1,4 +1,5 @@
+ #include <cstdlib>
++#include <cstdio>
+ #include <psifiles.h>
+
+ #include "sblock_vector.h"
+@@ -58,4 +59,4 @@ void SBlockVector::check(const char* cstr)
+ }
+ }
+
+-}}
+\ No newline at end of file
++}}
+diff --git a/src/bin/mcscf/scf.cc b/src/bin/mcscf/scf.cc
+index 77318fd..7d1e17f 100644
+--- a/src/bin/mcscf/scf.cc
++++ b/src/bin/mcscf/scf.cc
+@@ -5,6 +5,7 @@
+
+ #include <iostream>
+ #include <cmath>
++#include <cstdio>
+
+ extern FILE* outfile;
+
+diff --git a/src/bin/mcscf/scf_Feff.cc b/src/bin/mcscf/scf_Feff.cc
+index 584aa83..8a99c3b 100644
+--- a/src/bin/mcscf/scf_Feff.cc
++++ b/src/bin/mcscf/scf_Feff.cc
+@@ -1,4 +1,5 @@
+ #include <liboptions/liboptions.h>
++#include <cstdio>
+
+ #include "scf.h"
+
+diff --git a/src/bin/mcscf/scf_canonicalize_MO.cc b/src/bin/mcscf/scf_canonicalize_MO.cc
+index a2b3915..96bb6cc 100644
+--- a/src/bin/mcscf/scf_canonicalize_MO.cc
++++ b/src/bin/mcscf/scf_canonicalize_MO.cc
+@@ -1,6 +1,7 @@
+ #include "scf.h"
+
+ #include <liboptions/liboptions.h>
++#include <cstdio>
+
+ namespace psi{ namespace mcscf{
+
+diff --git a/src/bin/mcscf/scf_check_orthonormality.cc b/src/bin/mcscf/scf_check_orthonormality.cc
+index 63fbbbb..a13436c 100644
+--- a/src/bin/mcscf/scf_check_orthonormality.cc
++++ b/src/bin/mcscf/scf_check_orthonormality.cc
+@@ -1,5 +1,6 @@
+ #include <iostream>
+ #include <cmath>
++#include <cstdio>
+
+ #include "scf.h"
+
+diff --git a/src/bin/mcscf/scf_compute_energy.cc b/src/bin/mcscf/scf_compute_energy.cc
+index fe7ee6d..20194eb 100644
+--- a/src/bin/mcscf/scf_compute_energy.cc
++++ b/src/bin/mcscf/scf_compute_energy.cc
+@@ -1,4 +1,5 @@
+ #include <iostream>
++#include <cstdio>
+
+ #include "scf.h"
+
+diff --git a/src/bin/mcscf/scf_diis.cc b/src/bin/mcscf/scf_diis.cc
+index 9bcde15..261492a 100644
+--- a/src/bin/mcscf/scf_diis.cc
++++ b/src/bin/mcscf/scf_diis.cc
+@@ -1,4 +1,5 @@
+ #include <iostream>
++#include <cstdio>
+
+ #include <liboptions/liboptions.h>
+
+diff --git a/src/bin/mcscf/scf_iterate_scf_equations.cc b/src/bin/mcscf/scf_iterate_scf_equations.cc
+index 9e96360..3a3acc3 100644
+--- a/src/bin/mcscf/scf_iterate_scf_equations.cc
++++ b/src/bin/mcscf/scf_iterate_scf_equations.cc
+@@ -1,6 +1,7 @@
+ #include <cstdlib>
+ #include <iostream>
+ #include <cmath>
++#include <cstdio>
+
+ #include <liboptions/liboptions.h>
+
+diff --git a/src/bin/mcscf/scf_pairs.cc b/src/bin/mcscf/scf_pairs.cc
+index b0a8c9d..af5fc35 100644
+--- a/src/bin/mcscf/scf_pairs.cc
++++ b/src/bin/mcscf/scf_pairs.cc
+@@ -1,4 +1,5 @@
+ #include <iostream>
++#include <cstdio>
+
+ #include <libmoinfo/libmoinfo.h>
+
+diff --git a/src/bin/mcscf/scf_print_eigenvectors_and_MO.cc b/src/bin/mcscf/scf_print_eigenvectors_and_MO.cc
+index 3aac92a..e28e9e3 100644
+--- a/src/bin/mcscf/scf_print_eigenvectors_and_MO.cc
++++ b/src/bin/mcscf/scf_print_eigenvectors_and_MO.cc
+@@ -3,6 +3,7 @@
+ #include <string>
+ #include <utility>
+ #include <algorithm>
++#include <cstdio>
+
+ #include <libmoinfo/libmoinfo.h>
+
+diff --git a/src/bin/psimrcc/blas_algorithms.cc b/src/bin/psimrcc/blas_algorithms.cc
+index bb36025..0a5a3e2 100644
+--- a/src/bin/psimrcc/blas_algorithms.cc
++++ b/src/bin/psimrcc/blas_algorithms.cc
+@@ -1,5 +1,6 @@
+ #include <libmoinfo/libmoinfo.h>
+ #include <libutil/libutil.h>
++#include <cstdio>
+
+ #include "blas.h"
+ #include "memory_manager.h"
+diff --git a/src/bin/psimrcc/blas_compatibile.cc b/src/bin/psimrcc/blas_compatibile.cc
+index 8de6d73..7caf4f3 100644
+--- a/src/bin/psimrcc/blas_compatibile.cc
++++ b/src/bin/psimrcc/blas_compatibile.cc
+@@ -1,6 +1,7 @@
+ #include "blas.h"
+ #include <libutil/libutil.h>
+ #include <cstdlib>
++#include <cstdio>
+
+ extern FILE *infile, *outfile;
+
+diff --git a/src/bin/psimrcc/blas_parser.cc b/src/bin/psimrcc/blas_parser.cc
+index d211a24..78fe60a 100644
+--- a/src/bin/psimrcc/blas_parser.cc
++++ b/src/bin/psimrcc/blas_parser.cc
+@@ -3,6 +3,7 @@
+ #include "debugging.h"
+ #include <libutil/libutil.h>
+ #include <algorithm>
++#include <cstdio>
+
+ namespace psi{ namespace psimrcc{
+
+diff --git a/src/bin/psimrcc/blas_solve.cc b/src/bin/psimrcc/blas_solve.cc
+index b138a5b..f5dcdfc 100644
+--- a/src/bin/psimrcc/blas_solve.cc
++++ b/src/bin/psimrcc/blas_solve.cc
+@@ -1,6 +1,7 @@
+ #include "blas.h"
+ #include "debugging.h"
+ #include <libmoinfo/libmoinfo.h>
++#include <cstdio>
+
+ namespace psi{ namespace psimrcc{
+
+diff --git a/src/bin/psimrcc/index.cc b/src/bin/psimrcc/index.cc
+index 3465d88..68c2b77 100644
+--- a/src/bin/psimrcc/index.cc
++++ b/src/bin/psimrcc/index.cc
+@@ -5,6 +5,7 @@
+ ***************************************************************************/
+ #include <iostream>
+ #include <algorithm>
++#include <cstdio>
+
+ #include <libmoinfo/libmoinfo.h>
+
+diff --git a/src/bin/psimrcc/operation.cc b/src/bin/psimrcc/operation.cc
+index edbaed5..f4e881f 100644
+--- a/src/bin/psimrcc/operation.cc
++++ b/src/bin/psimrcc/operation.cc
+@@ -7,6 +7,7 @@
+ #include "debugging.h"
+ #include "blas.h"
+ #include <libutil/libutil.h>
++#include <cstdio>
+
+ namespace psi{ namespace psimrcc{
+
+diff --git a/src/bin/psimrcc/operation_compute.cc b/src/bin/psimrcc/operation_compute.cc
+index 7d2553c..72a1b39 100644
+--- a/src/bin/psimrcc/operation_compute.cc
++++ b/src/bin/psimrcc/operation_compute.cc
+@@ -11,6 +11,7 @@
+ #include "algebra_interface.h"
+ #include <libmoinfo/libmoinfo.h>
+ #include <cstdlib>
++#include <cstdio>
+
+ extern FILE *infile, *outfile;
+
+diff --git a/src/bin/psimrcc/sort_out_of_core.cc b/src/bin/psimrcc/sort_out_of_core.cc
+index 3f255c9..8fa31a3 100644
+--- a/src/bin/psimrcc/sort_out_of_core.cc
++++ b/src/bin/psimrcc/sort_out_of_core.cc
+@@ -8,6 +8,7 @@
+ #include "sort.h"
+ #include "matrix.h"
+ #include <libmoinfo/libmoinfo.h>
++#include <cstdio>
+
+ extern FILE* outfile;
+
+diff --git a/src/lib/libmoinfo/moinfo_model_space.cc b/src/lib/libmoinfo/moinfo_model_space.cc
+index 3bf2030..0a63cde 100644
+--- a/src/lib/libmoinfo/moinfo_model_space.cc
++++ b/src/lib/libmoinfo/moinfo_model_space.cc
+@@ -1,6 +1,7 @@
+ #include <iostream>
+ #include <cmath>
+ #include <cstdlib>
++#include <cstdio>
+
+ #include <psifiles.h>
+ #include <liboptions/liboptions.h>
+@@ -322,4 +323,4 @@ vector<string> MOInfo::get_matrix_names(std::string str)
+ return(names);
+ }
+
+-}
+\ No newline at end of file
++}
+diff --git a/src/lib/libmoinfo/moinfo_slaterdeterminant.cc b/src/lib/libmoinfo/moinfo_slaterdeterminant.cc
+index 8831cd5..a046679 100644
+--- a/src/lib/libmoinfo/moinfo_slaterdeterminant.cc
++++ b/src/lib/libmoinfo/moinfo_slaterdeterminant.cc
+@@ -1,4 +1,5 @@
+ #include <iostream>
++#include <cstdio>
+ #include "moinfo.h"
+
+ extern FILE *infile, *outfile;
+diff --git a/src/lib/libutil/stl_string.cc b/src/lib/libutil/stl_string.cc
+index 0ec247d..f719dcd 100644
+--- a/src/lib/libutil/stl_string.cc
++++ b/src/lib/libutil/stl_string.cc
+@@ -2,6 +2,7 @@
+ #include <cmath>
+ #include <iomanip>
+ #include <algorithm>
++#include <cstdio>
+
+ #include "libutil.h"
+
diff --git a/sci-chemistry/psi/files/3.4.0-ldflags.patch b/sci-chemistry/psi/files/3.4.0-ldflags.patch
new file mode 100644
index 000000000000..9d7f2767e8ec
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-ldflags.patch
@@ -0,0 +1,21 @@
+Respect LDFLAGS
+
+--- configure.ac
++++ configure.ac
+@@ -288,15 +288,13 @@
+ )
+ AC_SUBST(LDLIBS)
+
+-LDFLAGS=
+ LIBDIRS=
+ AC_ARG_WITH(libdirs,
+ [ --with-libdirs Specifies library directories (-Ldir1 -Ldir2).],
+ LIBDIRS=$withval
+-LDFLAGS=$withval
+ AC_MSG_RESULT([Using extra library directories: $withval])
+ )
+-AC_SUBST(LDFLAGS)
++AC_SUBST(LIBDIRS)
+
+ AC_CHECK_PROGS(PERL,perl,perl) AC_SUBST(PERL)
+
diff --git a/sci-chemistry/psi/files/3.4.0-man_paths.patch b/sci-chemistry/psi/files/3.4.0-man_paths.patch
new file mode 100644
index 000000000000..02cced160847
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-man_paths.patch
@@ -0,0 +1,25 @@
+Fix man paths
+
+http://bugs.gentoo.org/show_bug.cgi?id=326185
+
+--- src/bin/nonbonded/Makefile.in
++++ src/bin/nonbonded/Makefile.in
+@@ -19,5 +19,5 @@
+ endif
+
+ install_man:: nonbonded.1
+- $(MKDIRS) $(mandir)/man1
+- $(INSTALL_INCLUDE) $^ $(mandir)/man1
++ $(MKDIRS) $(DESTDIR)$(mandir)/man1
++ $(INSTALL_INCLUDE) $^ $(DESTDIR)$(mandir)/man1
+--- src/bin/intder/Makefile.in
++++ src/bin/intder/Makefile.in
+@@ -21,6 +21,6 @@
+ endif
+
+ install_man:: intder.1
+- $(MKDIRS) $(mandir)/man1
+- $(INSTALL_INCLUDE) $^ $(mandir)/man1
++ $(MKDIRS) $(DESTDIR)$(mandir)/man1
++ $(INSTALL_INCLUDE) $^ $(DESTDIR)$(mandir)/man1
+
diff --git a/sci-chemistry/psi/files/3.4.0-parallel_fix.patch b/sci-chemistry/psi/files/3.4.0-parallel_fix.patch
new file mode 100644
index 000000000000..65234fb40dcb
--- /dev/null
+++ b/sci-chemistry/psi/files/3.4.0-parallel_fix.patch
@@ -0,0 +1,400 @@
+--- Makefile.in
++++ Makefile.in
+@@ -17,62 +17,19 @@
+ INSTALL = @INSTALL@
+ INSTALL_PROGRAM = @INSTALL_PROGRAM@
+
+-all:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making in $${dir} && $(MAKE) all) || exit 1; \
+- done
+-
+-install: install_host
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making install in $${dir} && $(MAKE) install) || exit 1; \
+- done
+-
+-install_inc:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making install in $${dir} && $(MAKE) install_inc) || exit 1; \
+- done
+-
+-install_man:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making install in $${dir} && $(MAKE) install_man) || exit 1; \
+- done
+-
+-depend:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making depend in $${dir} && $(MAKE) depend) || exit 1; \
+- done
+-
+-clean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making clean in $${dir} && $(MAKE) clean) || exit 1; \
+- done
+-
+-dclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making dclean in $${dir} && $(MAKE) dclean) || exit 1; \
+- done
+-
+-targetclean:
+- for dir in $(subdirs) tests doc; \
+- do \
+- (cd $${dir} && echo Making clean in $${dir} && $(MAKE) targetclean) || exit 1; \
+- done
++all clean install install_inc install_man depend dclean targetclean:
++ for dir in $(subdirs); do \
++ $(MAKE) -C $$dir $@; \
++ done
+
+ tests:
+- (cd tests && echo Running test suite... && $(MAKE)) || exit 1;
++ $(MAKE) -C tests
+
+ testsclean:
+- (cd tests && echo Cleaning test suite... && $(MAKE) clean) || exit 1;
++ $(MAKE) -C tests clean
+
+ doc:
+- (cd doc && echo Building documentation... && $(MAKE)) || exit 1;
++ $(MAKE) -C doc
+
+ $(top_srcdir)/configure: $(top_srcdir)/configure.ac $(top_srcdir)/aclocal.m4
+ cd $(top_srcdir) && autoconf
+--- lib/Makefile.in
++++ lib/Makefile.in
+@@ -31,7 +31,7 @@
+ $(INSTALL_DATA) $(srcdir)/psi.dat $(DESTDIR)$(pkgdatadir)
+ for dir in $(subdirs); \
+ do \
+- (cd $${dir}; echo Making in $${dir}; $(MAKE) install) || exit 1; \
++ $(MAKE) -C $$dir install; \
+ done
+
+ install_man: macro.psi
+--- src/Makefile.in
++++ src/Makefile.in
+@@ -6,53 +6,10 @@
+
+ default: all
+
+-all:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making in $${dir} && $(MAKE) all) || exit 1; \
+- done
+-
+-install:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making install in $${dir} && $(MAKE) install) || exit 1; \
+- done
+-
+-install_inc:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making install in $${dir} && $(MAKE) install_inc) || exit 1; \
+- done
+-
+-install_man:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making install in $${dir} && $(MAKE) install_man) || exit 1; \
+- done
+-
+-depend:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making depend in $${dir} && $(MAKE) depend) || exit 1; \
+- done
+-
+-clean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making clean in $${dir} && $(MAKE) clean) || exit 1; \
+- done
+-
+-dclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making dclean in $${dir} && $(MAKE) dclean) || exit 1; \
+- done
+-
+-targetclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo Making clean in $${dir} && $(MAKE) targetclean) || exit 1; \
+- done
++all clean install depend dclean targetclean:
++ for dir in $(subdirs); do \
++ $(MAKE) -C $$dir $@; \
++ done
+
+ top_srcdir = @top_srcdir@
+ srcdir = @srcdir@
+--- src/lib/Makefile.in
++++ src/lib/Makefile.in
+@@ -4,56 +4,10 @@
+ subdirs = libipv1 libciomr libchkpt libqt libpsio libiwl libdpd libutil \
+ liboptions libmoinfo libbasis libmints
+
+-all: default
+-
+-default:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making in $${dir} ... && $(MAKE) default) || exit 1; \
+- done
+-
+-install:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install) || exit 1; \
+- done
+-
+-install_inc:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_inc) || exit 1; \
+- done
+-
+-install_man:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_man) || exit 1; \
+- done
+-
+-depend:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making depend in $${dir} ... && $(MAKE) depend) || exit 1; \
+- done
+-
+-clean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) clean) || exit 1; \
+- done
+-
+-dclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making dclean in $${dir} ... && $(MAKE) dclean) || exit 1; \
+- done
+-
+-targetclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) targetclean) || exit 1; \
+- done
+-
++all clean install install_inc install_man depend dclean targetclean:
++ for dir in $(subdirs); do \
++ $(MAKE) -C $$dir $@; \
++ done
+
+ #
+ # keep the configuration information and makefile up-to-date
+--- src/bin/Makefile.in
++++ src/bin/Makefile.in
+@@ -13,55 +13,10 @@
+ subdirs += psirb
+ endif
+
+-all: default
+-
+-default:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making in $${dir} ... && $(MAKE) default) || exit 1; \
+- done
+-
+-install:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install) || exit 1; \
+- done
+-
+-install_inc:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_inc) || exit 1; \
+- done
+-
+-install_man:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_man) || exit 1; \
+- done
+-
+-depend:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making depend in $${dir} ... && $(MAKE) depend) || exit 1; \
+- done
+-
+-clean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) clean) || exit 1; \
+- done
+-
+-dclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making dclean in $${dir} ... && $(MAKE) dclean) || exit 1; \
+- done
+-
+-targetclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) targetclean) || exit 1; \
+- done
++all install depend clean dclean targetclean:
++ for dir in $(subdirs); do \
++ $(MAKE) -C $$dir $@; \
++ done
+
+ top_srcdir = @top_srcdir@
+ srcdir = @srcdir@
+--- src/samples/Makefile.in
++++ src/samples/Makefile.in
+@@ -5,55 +5,10 @@
+
+ subdirs = mints
+
+-all: default
+-
+-default:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making in $${dir} ... && $(MAKE) default) || exit 1; \
+- done
+-
+-install:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install) || exit 1; \
+- done
+-
+-install_inc:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_inc) || exit 1; \
+- done
+-
+-install_man:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_man) || exit 1; \
+- done
+-
+-depend:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making depend in $${dir} ... && $(MAKE) depend) || exit 1; \
+- done
+-
+-clean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) clean) || exit 1; \
+- done
+-
+-dclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making dclean in $${dir} ... && $(MAKE) dclean) || exit 1; \
+- done
+-
+-targetclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) targetclean) || exit 1; \
+- done
++all install depend clean dclean targetclean:
++ for dir in $(subdirs); do \
++ $(MAKE) -C $$dir $@; \
++ done
+
+ top_srcdir = @top_srcdir@
+ srcdir = @srcdir@
+--- src/util/Makefile.in
++++ src/util/Makefile.in
+@@ -3,55 +3,10 @@
+
+ subdirs = tocprint psi2molden
+
+-all: default
+-
+-default:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making in $${dir} ... && $(MAKE) default) || exit 1; \
+- done
+-
+-install:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install) || exit 1; \
+- done
+-
+-install_inc:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_inc) || exit 1; \
+- done
+-
+-install_man:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making install in $${dir} ... && $(MAKE) install_man) || exit 1; \
+- done
+-
+-depend:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making depend in $${dir} ... && $(MAKE) depend) || exit 1; \
+- done
+-
+-clean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) clean) || exit 1; \
+- done
+-
+-dclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making dclean in $${dir} ... && $(MAKE) dclean) || exit 1; \
+- done
+-
+-targetclean:
+- for dir in $(subdirs); \
+- do \
+- (cd $${dir} && echo ... Making clean in $${dir} ... && $(MAKE) targetclean) || exit 1; \
+- done
++all install depend clean dclean targetclean:
++ for dir in $(subdirs); do \
++ $(MAKE) -C $$dir $@; \
++ done
+
+ top_srcdir = @top_srcdir@
+ srcdir = @srcdir@
+--- src/lib/libipv1/Makefile.in
++++ src/lib/libipv1/Makefile.in
+@@ -58,4 +58,4 @@
+ # in case DODEPEND is no
+ #
+
+-ip_read.o: y.tab.h
++ip_read.o: y.tab.c y.tab.h
diff --git a/sci-chemistry/psi/files/psi-3.4.0-format-security.patch b/sci-chemistry/psi/files/psi-3.4.0-format-security.patch
new file mode 100644
index 000000000000..10efa813ba3d
--- /dev/null
+++ b/sci-chemistry/psi/files/psi-3.4.0-format-security.patch
@@ -0,0 +1,33 @@
+ src/lib/libmints/matrix.cc | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/src/lib/libmints/matrix.cc b/src/lib/libmints/matrix.cc
+index 2ce5ede..2c7b5de 100644
+--- a/src/lib/libmints/matrix.cc
++++ b/src/lib/libmints/matrix.cc
+@@ -549,10 +549,9 @@ void Matrix::save(const char *filename, bool append, bool saveLowerTriangle, boo
+ } else {
+ out = fopen(filename, "w");
+ }
+-
+- fprintf(out, name_.c_str());
+- fprintf(out, "\n");
+-
++
++ fprintf(out, "%s\n", name_.c_str());
++
+ if (saveSubBlocks == false) {
+ // Convert the matrix to a full matrix
+ double **fullblock = to_block_matrix();
+@@ -1083,9 +1082,8 @@ void SimpleMatrix::save(const char *filename, bool append, bool saveLowerTriangl
+ } else {
+ out = fopen(filename, "w");
+ }
+-
+- fprintf(out, name_.c_str());
+- fprintf(out, "\n");
++
++ fprintf(out, "%s\n", name_.c_str());
+
+ if (saveLowerTriangle) {
+ // Count the number of non-zero element
diff --git a/sci-chemistry/psi/files/psi-3.4.0-parallel-make.patch b/sci-chemistry/psi/files/psi-3.4.0-parallel-make.patch
new file mode 100644
index 000000000000..2805cb195e24
--- /dev/null
+++ b/sci-chemistry/psi/files/psi-3.4.0-parallel-make.patch
@@ -0,0 +1,19 @@
+diff --git a/src/lib/libipv1/Makefile.in b/src/lib/libipv1/Makefile.in
+index eafe8e2..141bf3b 100644
+--- a/src/lib/libipv1/Makefile.in
++++ b/src/lib/libipv1/Makefile.in
+@@ -33,10 +33,12 @@ LIBOBJ = $(ALLCSRC:%.c=%.o) $(ALLCXXSRC:%.cc=%.o)
+
+ include ../MakeRules
+
+-y.tab.c y.tab.h: parse.y
++y.tab.h: y.tab.c
++
++y.tab.c: parse.y
+ $(YACC) -v -d $<
+
+-scan.c: scan.l
++scan.c: scan.l y.tab.h
+ $(LEX) -t $^ > scan.c
+
+ install_inc:: $(ALLINCLUDE)
diff --git a/sci-chemistry/psi/files/use-external-libint.patch b/sci-chemistry/psi/files/use-external-libint.patch
new file mode 100644
index 000000000000..1d9ce91e3111
--- /dev/null
+++ b/sci-chemistry/psi/files/use-external-libint.patch
@@ -0,0 +1,37 @@
+--- psi3.orig/src/bin/cints/Makefile.in 2003-11-14 08:15:19.000000000 -0800
++++ psi3/src/bin/cints/Makefile.in 2006-02-10 22:42:31.000000000 -0800
+@@ -51,25 +51,25 @@
+ # and form the list of the libraries. Remember that libderiv and libr12
+ # depend on libint, and hence need to come first for GNU ld to work.
+ #
+-INTLIBS := -lPSI_int
++INTLIBS := -lint
+ ifeq ($(findstring MP2R12,$(SUBDIRS)),MP2R12)
+- ifneq ($(findstring -lPSI_r12,$(INTLIBS)),-lPSI_r12)
+- INTLIBS := -lPSI_r12 $(INTLIBS)
++ ifneq ($(findstring -lr12,$(INTLIBS)),-lr12)
++ INTLIBS := -lr12 $(INTLIBS)
+ endif
+ endif
+ ifeq ($(findstring R12_Ints,$(SUBDIRS)),R12_Ints)
+- ifneq ($(findstring -lPSI_r12,$(INTLIBS)),-lPSI_r12)
+- INTLIBS := -lPSI_r12 $(INTLIBS)
++ ifneq ($(findstring -lr12,$(INTLIBS)),-lr12)
++ INTLIBS := -lr12 $(INTLIBS)
+ endif
+ endif
+ ifeq ($(findstring Default_Deriv1,$(SUBDIRS)),Default_Deriv1)
+- ifneq ($(findstring -lPSI_deriv,$(INTLIBS)),-lPSI_deriv)
+- INTLIBS := -lPSI_deriv $(INTLIBS)
++ ifneq ($(findstring -lderiv,$(INTLIBS)),-lderiv)
++ INTLIBS := -lderiv $(INTLIBS)
+ endif
+ endif
+ ifeq ($(findstring Default_Deriv2,$(SUBDIRS)),Default_Deriv2)
+- ifneq ($(findstring -lderiv,$(INTLIBS)),-lPSI_deriv)
+- INTLIBS := -lPSI_deriv $(INTLIBS)
++ ifneq ($(findstring -lderiv,$(INTLIBS)),-lderiv)
++ INTLIBS := -lderiv $(INTLIBS)
+ endif
+ endif
+
diff --git a/sci-chemistry/psi/metadata.xml b/sci-chemistry/psi/metadata.xml
new file mode 100644
index 000000000000..e18109f21fcd
--- /dev/null
+++ b/sci-chemistry/psi/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>sci-chemistry@gentoo.org</email>
+ <name>Gentoo Chemistry Project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="sourceforge">psicode</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/sci-chemistry/psi/psi-3.4.0-r2.ebuild b/sci-chemistry/psi/psi-3.4.0-r2.ebuild
new file mode 100644
index 000000000000..34dd75b6c1df
--- /dev/null
+++ b/sci-chemistry/psi/psi-3.4.0-r2.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=4
+
+inherit autotools-utils fortran-2 multilib toolchain-funcs
+
+DESCRIPTION="Suite for ab initio quantum chemistry computing various molecular properties"
+HOMEPAGE="http://www.psicode.org/"
+SRC_URI="mirror://sourceforge/psicode/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 x86"
+IUSE="static-libs test"
+
+RDEPEND="
+ !sci-visualization/extrema
+ virtual/blas
+ virtual/lapack
+ >=sci-libs/libint-1.1.4:1"
+DEPEND="${RDEPEND}
+ virtual/pkgconfig
+ dev-util/byacc
+ test? ( dev-lang/perl )"
+
+S="${WORKDIR}/${PN}${PV:0:1}"
+
+PATCHES=(
+ "${FILESDIR}"/${PV}-dont-build-libint.patch
+ "${FILESDIR}"/use-external-libint.patch
+ "${FILESDIR}"/${PV}-gcc-4.3.patch
+ "${FILESDIR}"/${PV}-destdir.patch
+ "${FILESDIR}"/${P}-parallel-make.patch
+ "${FILESDIR}"/${PV}-man_paths.patch
+ "${FILESDIR}"/${PV}-ldflags.patch
+ "${FILESDIR}"/${PV}-parallel_fix.patch
+ "${FILESDIR}"/${PV}-fortify.patch
+ "${FILESDIR}"/${P}-format-security.patch
+ )
+
+src_prepare() {
+ autotools-utils_src_prepare
+ # Broken test
+ sed \
+ -e 's:scf-mvd-opt ::g' \
+ -e 's:scf-mvd-opt-puream ::g' \
+ -i tests/Makefile.in || die
+
+ sed \
+ -e "/LIBPATTERNS/d" \
+ -i src/{bin,util,samples}/MakeVars.in || die
+ eautoreconf
+}
+
+src_configure() {
+ # This variable gets set sometimes to /usr/lib/src and breaks stuff
+ unset CLIBS
+
+ local myeconfargs=(
+ --with-opt="${CXXFLAGS}"
+ --datadir="${EPREFIX}"/usr/share/${PN}
+ --with-blas="$($(tc-getPKG_CONFIG) blas --libs)"
+ --with-lapack="$($(tc-getPKG_CONFIG) --libs lapack)"
+ )
+ autotools-utils_src_configure
+}
+
+src_compile() {
+ autotools-utils_src_compile \
+ SCRATCH="${WORKDIR}/libint" \
+ DODEPEND="no" \
+ YACC=byacc
+}
+
+src_test() {
+ emake EXECDIR="${S}"/bin TESTFLAGS="" -j1 tests
+}
+
+src_install() {
+ autotools-utils_src_install DODEPEND="no"
+ if ! use static-libs; then
+ rm -f "${ED}"/usr/$(get_libdir)/*.a || die
+ fi
+}