iucar / rpms / psi4

Forked from rpms/psi4 3 years ago
Clone
Blob Blame History Raw
# Run tests?
%bcond_with tests

# git snapshot
%global commit 6a655591f74cb10649d15f653fa2e66e168c073f
%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
Version:        4.0
Release:        0.16.%{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
# Fix compile
Patch2:         psi4-frag.patch

BuildRequires:  autoconf
BuildRequires:  automake

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

# 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}

%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.


%package doc
Summary:   User's and programmer's manuals for psi
Group:     Documentation
%if 0%{?fedora}>10 || 0%{?rhel} > 5
BuildArch: noarch
%endif

%description doc
This package contains the user's and programmer's manual for psi.

%prep
%setup -q -n psi4public-%{commit}
%patch0 -p1 -b .systemlibint
%patch1 -p1 -b .systemboost
%patch2 -p1 -b .frag

# Get rid of bundled boost
rm -rf boost/
# Get rid of bundled libint
rm -rf src/lib/{libint,libderiv}/
# Get rid of bundled madness
rm -rf madness/

%build
# Need to rerun autoconf because of removal of bundled libraries
autoconf

mkdir objdir-%{_target_platform}
cd objdir-%{_target_platform}
# Run configure
%dconfigure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran \
    --includedir=%{_includedir}/%{name} --with-opt="%{optflags}" --with-dot \
%if 0%{?fedora}>20
--with-blas='-L%{_libdir}/atlas -ltatlas' --with-lapack='-L%{_libdir}/atlas -ltatlas'
%else
--with-blas='-L%{_libdir}/atlas -lf77blas -latlas' --with-lapack='-L%{_libdir}/atlas -llapack -lcblas -latlas'
%endif
cd ..

# Build program
make -C objdir-%{_target_platform} %{?_smp_mflags}
# Build documentation
make -C objdir-%{_target_platform} doc

%install
make -C objdir-%{_target_platform} install DESTDIR=%{buildroot}

# Install libraries, too.
mkdir -p %{buildroot}%{_libdir}
install -p -m 644 objdir-%{_target_platform}/lib/*.a %{buildroot}%{_libdir}/

# .. and the documentation
make -C objdir-%{_target_platform} install-doc DESTDIR=%{buildroot}
# .. but move it back from the buildroot
mv %{buildroot}%{_docdir}/html htmldoc

%if %{with tests}
%check
# Full blown tests - take a long time to complete
#make -C objdir-%{_target_platform} tests
make -C objdir-%{_target_platform} quicktests
%endif

%files
%doc COPYING LICENSE
%{_bindir}/psi4

%files data
%doc COPYING LICENSE
%{_datadir}/psi/

%files devel
%doc COPYING LICENSE
%{_includedir}/psi4/
%{_libdir}/libPSI_*.a

%files doc
%doc COPYING LICENSE htmldoc/*

%changelog
* Wed Aug 19 2014 Susi Lehtola <jussilehtola@fedoraproject.org> - 4.0-0.16.6a655591
- Update to newer 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.