# Run tests?
%bcond_without tests
# git snapshot
%global commit 1881450f30d3bd2ac91dbc4fc6a4eaa5c9f03ae5
%global shortcommit %(c=%{commit}; echo ${c:0:7})
# Define a macro for calling ../configure instead of ./configure
%global dconfigure %(printf %%s '%configure' | sed 's!\./configure!../configure!g')
Name: psi4
Epoch: 1
Version: 0.3
Release: 1.%{shortcommit}git%{?dist}
Summary: An ab initio quantum chemistry package
Group: Applications/Engineering
License: GPLv2+ and MIT
URL: http://www.psicode.org/
#Source0: http://downloads.sourceforge.net/psicode/psi-%{version}.tar.bz
Source0: https://github.com/psi4/psi4public/archive/%{commit}/psi4public-%{commit}.tar.gz
# Use system libint
Patch0: psi4-systemlibint.patch
# Force system boost
Patch1: psi4-systemboost.patch
# Use custom version instead of getting it from git
Patch2: psi4-gitversion.patch
# Install headers into psi4 specific directory
Patch3: psi4-includeinst.patch
BuildRequires: cmake
BuildRequires: atlas-devel
BuildRequires: bison-devel
BuildRequires: boost-devel >= 1.46
BuildRequires: byacc
BuildRequires: flex
BuildRequires: gcc-gfortran
BuildRequires: libint-devel >= 1.1.5-3
BuildRequires: perl-devel
BuildRequires: python2-devel >= 2.6
BuildRequires: numpy
BuildRequires: gsl-devel
BuildRequires: hdf5-devel
BuildRequires: zlib-devel
# For the documentation
BuildRequires: python-sphinx >= 1.1
BuildRequires: tex(latex)
BuildRequires: tex-preview
BuildRequires: dvipng
BuildRequires: graphviz
%if %{with tests}
# Needed for running tests
BuildRequires: perl(Env)
%endif
Requires: %{name}-data = %{version}-%{release}
Requires: numpy
# Libint can break the api between releases
Requires: libint(api)%{?_isa} = %{_libint_apiversion}
# Don't have documentation in the cmake version yet..
Obsoletes: psi4-doc < 1:0.3-1
%description
PSI4 is an open-source suite of ab initio quantum chemistry programs
designed for efficient, high-accuracy simulations of a variety of
molecular properties. We can routinely perform computations with more
than 2500 basis functions running serially or in parallel.
%package data
Summary: Data files necessary for operation of PSI4
Group: Documentation
BuildArch: noarch
%description data
This package contains necessary data files for PSI4, e.g., basis sets
and the quadrature grids.
%package devel
Summary: Static libraries and development headers for psi
Group: Development/Libraries
Provides: %{name}-static = %{version}-%{release}
%description devel
This package contains static libraries and development headers for psi.
%prep
%setup -q -n psi4public-%{commit}
%patch0 -p1 -b .systemlibint
%patch1 -p1 -b .systemboost
%patch2 -p1 -b .gitversion
%patch3 -p1 -b .includeinst
# Get rid of bundled boost
rm -rf boost/
# Get rid of bundled libint
rm -rf src/lib/{libint,libderiv}/
# Generate git version header
cat > src/bin/psi4/gitversion.h <<EOF
#ifdef GIT_VERSION
#undef GIT_VERSION
#endif
#ifdef PSI_VERSION
#undef PSI_VERSION
#endif
#define PSI_VERSION "%{version}"
EOF
%build
export F77=gfortran
export FC=gfortran
mkdir objdir-%{_target_platform}
cd objdir-%{_target_platform}
%cmake .. \
-DENABLE_DKH=ON -DPCMSOLVER=ON -DENABLE_OMP=ON -DENABLE_MPI=OFF \
-DEXPLICIT_BLAS_LIB='%{_libdir}/atlas/libtatlas.so' -DENABLE_AUTO_BLAS=OFF \
-DEXPLICIT_LAPACK_LIB='%{_libdir}/atlas/libtatlas.so' -DENABLE_AUTO_LAPACK=OFF \
-DCMAKE_Fortran_COMPILER=gfortran -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ \
-DCUSTOM_C_FLAGS='%{optflags} -DNDEBUG' -DCUSTOM_CXX_FLAGS='%{optflags} -std=c++11 -DNDEBUG' \
-DCUSTOM_Fortran_FLAGS='-I%{_libdir}/gfortran/modules %{optflags} -DNDEBUG' \
-DCMAKE_BUILD_TYPE=Release
# Build program
make %{?_smp_mflags}
%install
make -C objdir-%{_target_platform} install DESTDIR=%{buildroot}
# Install libraries, too.
mkdir -p %{buildroot}%{_libdir}/psi4
install -p -m 644 objdir-%{_target_platform}/lib/*.a %{buildroot}%{_libdir}/psi4/
%if %{with tests}
%check
# Run quick tests
cd objdir-%{_target_platform}/tests
ctest -L quicktests
%endif
%files
%doc COPYING LICENSE
%{_bindir}/psi4
%files data
%doc COPYING LICENSE
%{_datadir}/psi/
%files devel
%doc COPYING LICENSE
%{_includedir}/psi4/
%{_libdir}/psi4/
%changelog
* Sun Sep 06 2015 Susi Lehtola <jussilehtola@fedoraproject.org> - 1:0.3-1.1881450fgit
- Update to newest release, switched to using github release tags.
* Wed Jul 29 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-0.21.c7deee9git.1
- Rebuilt for https://fedoraproject.org/wiki/Changes/F23Boost159
* Wed Jul 22 2015 David Tardon <dtardon@redhat.com> - 4.0-0.20.c7deee9git.1
- rebuild for Boost 1.58
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-0.19.c7deee9git.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 4.0-0.18.c7deee9git.1
- Rebuilt for GCC 5 C++11 ABI change
* Tue Jan 27 2015 Petr Machata <pmachata@redhat.com> - 4.0-0.17.c7deee9git.1
- Rebuild for boost 1.57.0
* Thu Sep 11 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.16.c7deee99.1
- Forgot to tag buildroot override in previous build.
* Wed Sep 10 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.16.c7deee99
- Update to newest snapshot.
- Requires libint(api).
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-0.15.0c7ea92git.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Jul 02 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.14.0c7ea92git.1
- Rebuild due to rebuilt libint.
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 4.0-0.14.0c7ea92git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Fri May 23 2014 Petr Machata <pmachata@redhat.com> - 4.0-0.13.0c7ea92git
- Rebuild for boost 1.55.0
* Tue May 13 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.12.0c7ea928git
- Add BR: perl(Env) for tests.
* Tue May 13 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.11.0c7ea928git
- Update to newest git snapshot.
- Remove BR: ruby-devel.
* Mon Mar 10 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.10.b5
- Rebuild against updated libint.
* Sat Jan 04 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.9.b5
- Drop %%?_isa from virtual provide of -static package (BZ #951582).
* Fri Dec 27 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.8.b5
- Versioned libint build dependency.
* Tue Dec 24 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.7.b5
- Added LICENSE and COPYING to -data as well.
- Versioned libint dependency.
* Sat Dec 21 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.6.b5
- Get rid of bundled madness.
* Thu Dec 19 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.5.b5
- Added BR and R on numpy.
- Use ATLAS after all.
* Fri Aug 16 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.4.b5
- Use openblas on supported architectures.
- Update to beta5.
* Thu May 02 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.3.b4
- Added BR on graphviz and enabled dot in configure for documentation.
* Tue Apr 30 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.2.b4
- Review fixes.
* Thu Apr 11 2013 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.1.b4
- First release.