File avogadrolibs.spec of Package avogadrolibs
#
# spec file for package avogadrolibs
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%if 0%{suse_version} >= 1550
%bcond_without spglib
%bcond_without python
%bcond_without libmsym
%bcond_without mmtf
%bcond_without molequeue
%else
%bcond_with spglib
%bcond_with python
%bcond_with libmsym
%bcond_with mmtf
%bcond_with molequeue
%endif
%define sonum 1
%define libname libAvogadro%{sonum}
Name: avogadrolibs
Version: 1.93.0
Release: 0
Summary: Avogadro libraries for computational chemistry
License: BSD-3-Clause
Url: https://avogadro.cc/
Source0: https://github.com/OpenChemistry/avogadrolibs/archive/%{version}.tar.gz
# PATCH-FIX-OPENSUSE -- https://github.com/OpenChemistry/avogadrolibs/issues/436
Patch0: fix_libgwavi_linking.patch
BuildRequires: cmake >= 3.3
BuildRequires: eigen3-devel
BuildRequires: gcc-c++
BuildRequires: hdf5-devel
BuildRequires: libqt5-linguist-devel
%if %{with python}
BuildRequires: python3-devel
BuildRequires: python3-pybind11-devel
%endif
%if %{with spglib}
BuildRequires: spglib-devel
%endif
%if %{with libmsym}
BuildRequires: msym-devel
%endif
%if %{with mmtf}
BuildRequires: mmtf-cpp-devel
%endif
%if %{with molequeue}
BuildRequires: molequeue-devel
%endif
BuildRequires: cmake(Qt5Concurrent)
BuildRequires: cmake(Qt5Network)
BuildRequires: cmake(Qt5Widgets)
BuildRequires: pkgconfig(gl)
BuildRequires: pkgconfig(glew)
%if 0%{?suse_version} <= 1500
BuildRequires: pkgconfig(glu)
%endif
BuildRequires: pkgconfig(libarchive)
BuildRequires: pkgconfig(zlib)
%description
Avogadro libraries provide 3D rendering, visualization, analysis
and data processing useful in computational chemistry, molecular
modeling, bioinformatics, materials science, and related areas.
%package -n %{libname}
Summary: Avogadro libraries for computational chemistry
%description -n %{libname}
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: Header files for Avogadro libraries
Requires: %{libname}
%description devel
Header files for Avogadro libraries.
%prep
%setup -q
%patch0 -p1
%build
%cmake \
-DINSTALL_DOC_DIR:PATH=%{_defaultdocdir} \
-DENABLE_TRANSLATIONS:BOOL=ON \
-DUSE_HDF5:BOOL=ON \
-DUSE_PYTHON:BOOL=%{?with_python:ON}%{!?with_python:OFF} \
-DUSE_QT:BOOL=ON \
-DUSE_LIBMSYM:BOOL=%{?with_libmsym:ON}%{!?with_libmsym:OFF} \
-DUSE_SPGLIB:BOOL=%{?with_spglib:ON}%{!?with_spglib:OFF} \
-DUSE_MMTF:BOOL=%{?with_mmtf:ON}%{!?with_mmtf:OFF} \
-DUSE_MOLEQUEUE:BOOL=%{?with_molequeue:ON}%{!?with_molequeue:OFF} \
-DBUILD_STATIC_PLUGINS:BOOL=OFF \
%{nil}
%cmake_build
%install
%cmake_install
rm %{buildroot}%{_libdir}/liblibgwavi.a
rm %{buildroot}%{_defaultdocdir}/avogadrolibs/LICENSE
%if %{with python}
# Fixup install location
mkdir -p %{buildroot}%{python3_sitearch}
mv %{buildroot}%{_libdir}/avogadro %{buildroot}%{python3_sitearch}/avogadro
%endif
sed -i -e '1 s@^@#!/usr/bin/python3\n@' %{buildroot}%{_libdir}/avogadro2/scripts/commands/scale.py
%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%files -n %{libname}
%license LICENSE
%dir %{_defaultdocdir}/avogadrolibs
%doc %{_defaultdocdir}/avogadrolibs/*.md
%{_libdir}/libAvogadro*.so.1*
%dir %{_libdir}/avogadro2
%{_libdir}/avogadro2/{plugins,scripts}
%if %{with python}
%{python3_sitearch}/avogadro
%endif
%files devel
%{_includedir}/avogadro/
%{_libdir}/libAvogadro*.so
%{_libdir}/cmake/*
%changelog