Blob Blame History Raw
%global commit da6ebb9f0e39c73ca861001e390d13e6ed3e6cb5
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global commitdate 20180612

Name:           avogadro2-libs
Version:        1.91.0
Release:        0.3.%{commitdate}git%{shortcommit}%{?dist}
Summary:        Avogadro2 libraries

# BSD is main license
# MIT is the license of jsoncpp.a
License: BSD and MIT
URL:     http://avogadro.openmolecules.net/
Source0: https://github.com/OpenChemistry/avogadrolibs/archive/%{commit}.zip#/avogadrolibs-%{commit}.zip

# Fix reported path
Patch1: %{name}-fix_AvogadroLibsConfig.patch

# Set installation path of jsoncpp.a file
Patch2: %{name}-set_jsoncpp_path.patch

# Set installation path of Python files
Patch3: %{name}-set_pythonpath.patch

BuildRequires:  boost-devel
BuildRequires:  python%{python3_pkgversion}-devel
%if 0%{?fedora}
BuildRequires:  boost-python3-devel
%endif
BuildRequires:  cmake, chrpath
BuildRequires:  gcc-c++, doxygen
BuildRequires:  pkgconfig(eigen3)
BuildRequires:  pkgconfig(glew)
BuildRequires:  pkgconfig(openbabel-2.0)
BuildRequires:  mesa-libGLU-devel
BuildRequires:  hdf5-devel
BuildRequires:  spglib-devel, molequeue-devel
BuildRequires:  qt5-qtbase-devel, qt5-qttools-devel
BuildRequires:  libarchive-devel

Provides: %{name}-static = %{version}-%{release}
Provides: jsoncpp-static
%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}

%description
Avogadro libraries provide 3D rendering, visualization, analysis
and data processing useful in computational chemistry, molecular modeling,
bioinformatics, materials science, and related areas.

%package  devel
Summary:  Development files of %{name}
Requires: qt5-qtbase-devel%{?_isa}
Requires: glew-devel%{?_isa}
Requires: libGL-devel%{?_isa}
Requires: mesa-libGLU-devel%{?_isa}
Requires: spglib-devel%{?_isa}
Requires: %{name}%{?_isa} = %{version}-%{release}

%description devel
This package contains libraries and header files for developing
applications that use %{name}.

%package doc
Summary: HTML documentation of %{name}
BuildArch: noarch
%description doc
HTML documentation of %{name}.

%prep
%autosetup -n avogadrolibs-%{commit} -p0

%build
mkdir build && pushd build
export LDFLAGS="%{__global_ldflags} -Wl,--as-needed"
%cmake -DCMAKE_BUILD_TYPE:STRING=Release \
 -DINSTALL_INCLUDE_DIR:PATH=include/avogadro2 -DINSTALL_LIBRARY_DIR:PATH=%{_lib} \
 -Wno-dev \
 -DENABLE_GLSL:BOOL=ON \
 -DENABLE_PYTHON:BOOL=ON  \
 -DPYTHON_EXECUTABLE:FILEPATH=%{__python3} \
 -DPYTHON_VERSION:STRING=%{python3_version} \
%if 0%{?fedora}
 -DUSE_BOOST_PYTHON:BOOL=ON \
%else
 -DUSE_BOOST_PYTHON:BOOL=OFF \
%endif
 -DENABLE_RPATH:BOOL=OFF \
 -DENABLE_TESTING:BOOL=OFF \
 -DUSE_MOLEQUEUE:BOOL=ON \
 -DUSE_VTK:BOOL=OFF \
 -DUSE_HDF5:BOOL=ON \
 -DSPGLIB_LIBRARY:FILEPATH=%{_libdir}/libsymspg.so \
 -DBUILD_GPL_PLUGINS:BOOL=ON \
 -DBUILD_STATIC_PLUGINS:BOOL=ON \
 -DBUILD_DOCUMENTATION:BOOL=ON \
 -DUSE_LIBMSYM:BOOL=OFF ..

%make_build

pushd docs
doxygen
popd

%install
%make_install -C build

sed -i -e '1i#!%{__python3}' %{buildroot}%{python3_sitearch}/avogadro2/scripts/inputGenerators/*.py
sed -i -e '1i#!%{__python3}' %{buildroot}%{python3_sitearch}/avogadro2/scripts/formatScripts/*.py

# Move scale.py* files into %%{python3_sitearch}/avogadro2
cp -a %{buildroot}%{_libdir}/avogadro2/scripts/workflows %{buildroot}%{python3_sitearch}/avogadro2/scripts/
sed -i -e '1i#!%{__python3}' %{buildroot}%{python3_sitearch}/avogadro2/scripts/workflows/scale.py

rm -rf %{buildroot}%{_libdir}/avogadro2/scripts/workflows
ln -sf %{python3_sitearch}/avogadro2/scripts/workflows %{buildroot}%{_libdir}/avogadro2/scripts/workflows

chrpath -d %{buildroot}%{_libdir}/lib*.so
rm -rf %{buildroot}%{_datadir}/doc

%check
pushd build
#ctest -VV

%ldconfig_scriptlets

%files
%doc README.md
%license LICENSE
%{_libdir}/lib*.so.*
%{_libdir}/avogadro2/
%{python3_sitearch}/avogadro2/

%files devel
%{_includedir}/avogadro2/
%{_libdir}/lib*.so
%{_libdir}/cmake/avogadrolibs/

%files doc
%doc README.md build/docs/html
%license LICENSE

%changelog
* Thu Aug 23 2018 Nicolas Chauvet <kwizart@gmail.com> - 1.91.0-0.3.20180612gitda6ebb9
- Rebuilt for glew-2.1.0

* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.91.0-0.2.20180612gitda6ebb9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Jun 22 2018 Antonio Trande <sagitter@fedoraproject.org> - 1.91.0-0.1.20180612gitda6ebb9
- Update to commit #da6ebb9 (1.91.0 pre-release)

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.90.0-16
- Rebuilt for Python 3.7

* Tue Feb 13 2018 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-15
- Add explicit dependencies to -devel sub-package (bz#1544510)

* Tue Feb 13 2018 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-14
- Fix AvogadroLibsConfig.cmake relative paths (bz#1544510)

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.90.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Wed Jan 31 2018 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-12
- Rebuild for moloqueue-0.9.0
- Use %%ldconfig_scriptlets

* Thu Dec 14 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-11
- Rebuild for spglib-1.10.2

* Sun Aug 06 2017 Björn Esser <besser82@fedoraproject.org> - 1.90.0-10
- Rebuilt for AutoReq cmake-filesystem

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.90.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.90.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Thu Jun 22 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-7
- Modified for epel builds

* Mon May 15 2017 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.90.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild

* Mon Mar 13 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-5
- Add ld scriptlets

* Sun Mar 12 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-4
- Set python3 installation directory

* Sun Mar 12 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-3
- Move jsoncpp.a into the private lib directory

* Sat Mar 11 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-2
- Use default paths

* Sat Mar 11 2017 Antonio Trande <sagitter@fedoraproject.org> - 1.90.0-1
- Initial package