fae7684
# Qt6 builds for testing
fae7684
%bcond_with qt6
fae7684
366eac0
Name:           avogadro2-libs
8c01900
Version:        1.98.1
Cristian Le ca35f0c
Release:        %autorelease
366eac0
Summary:        Avogadro2 libraries
366eac0
366eac0
# BSD is main license
12e61e0
# BSD is the license of avogenerators scripts
f007721
License: BSD and MIT
f007721
URL:     http://avogadro.openmolecules.net/
eb569a8
Source0: https://github.com/OpenChemistry/avogadrolibs/archive/%{version}/avogadrolibs-%{version}.tar.gz
8c01900
Source1: https://github.com/OpenChemistry/avogenerators/archive/1.98.0/avogenerators-1.98.0.tar.gz
366eac0
b915768
# External sources for data files
8c01900
Source2: https://github.com/OpenChemistry/molecules/archive/refs/tags/1.98.0/molecules-1.98.0.tar.gz
8c01900
Source3: https://github.com/OpenChemistry/crystals/archive/refs/tags/1.98.0/crystals-1.98.0.tar.gz
b915768
366eac0
# Set installation path of Python files
c243b87
Patch0: %{name}-set_pythonpath.patch
b752697
Patch1: %{name}-1.94.0-do_not_download_external_files.patch
Cristian Le f5aea83
Patch2: %{name}-1.98.1-use_upstream_cmake_config.patch
366eac0
81d9643
BuildRequires:  boost-devel
81d9643
BuildRequires:  python%{python3_pkgversion}-devel
eb569a8
%if 0%{?rhel}
12e61e0
BuildRequires:  epel-rpm-macros
eb569a8
%endif
12e61e0
BuildRequires:  cmake3
eb569a8
BuildRequires:  chrpath
0194457
BuildRequires:  gcc
0194457
BuildRequires:  gcc-c++
c243b87
BuildRequires:  make
366eac0
BuildRequires:  pkgconfig(eigen3)
366eac0
BuildRequires:  pkgconfig(glew)
fae7684
BuildRequires:  pkgconfig(openbabel-3)
366eac0
BuildRequires:  mesa-libGLU-devel
366eac0
BuildRequires:  hdf5-devel
12e61e0
BuildRequires:  mmtf-cpp-devel, jsoncpp-devel
b915768
BuildRequires:  spglib-devel
fae7684
%if %{with qt6}
fae7684
BuildRequires:  qt6-qtbase-devel
fae7684
BuildRequires:  qt6-qttools-devel
fae7684
BuildRequires:  qt6-qtsvg-devel
fae7684
%else
fae7684
BuildRequires:  qt5-qtbase-devel
fae7684
BuildRequires:  qt5-qttools-devel
fae7684
BuildRequires:  qt5-qtsvg-devel
fae7684
%endif
f28d746
%if 0%{?fedora}
37f2134
BuildRequires:  libarchive-devel >= 3.4.0
f28d746
%endif
37f2134
Provides: %{name}-static = 0:%{version}-%{release}
81d9643
%{?python_provide:%python_provide python%{python3_pkgversion}-%{name}}
366eac0
366eac0
%description
366eac0
Avogadro libraries provide 3D rendering, visualization, analysis
366eac0
and data processing useful in computational chemistry, molecular modeling,
366eac0
bioinformatics, materials science, and related areas.
366eac0
366eac0
%package  devel
366eac0
Summary:  Development files of %{name}
fae7684
%if %{with qt6}
fae7684
Requires: qt6-qtbase-devel%{?_isa}
fae7684
%else
8bb496e
Requires: qt5-qtbase-devel%{?_isa}
fae7684
%endif
8bb496e
Requires: glew-devel%{?_isa}
8bb496e
Requires: libGL-devel%{?_isa}
8bb496e
Requires: mesa-libGLU-devel%{?_isa}
8bb496e
Requires: spglib-devel%{?_isa}
366eac0
Requires: %{name}%{?_isa} = %{version}-%{release}
366eac0
eb569a8
Provides: libgwavi-static
eb569a8
366eac0
%description devel
366eac0
This package contains libraries and header files for developing
366eac0
applications that use %{name}.
366eac0
366eac0
%package doc
366eac0
Summary: HTML documentation of %{name}
366eac0
BuildArch: noarch
eb569a8
BuildRequires: doxygen, graphviz
7ddd2e0
BuildRequires: make
366eac0
%description doc
366eac0
HTML documentation of %{name}.
366eac0
366eac0
%prep
eb569a8
%autosetup -a 1 -N -n avogadrolibs-%{version}
b752697
8c01900
tar -xf %{SOURCE2} && mv molecules-1.98.0 molecules
8c01900
tar -xf %{SOURCE3} && mv crystals-1.98.0 crystals
f230621
b915768
# Rename LICENSE file
b915768
mv molecules/LICENSE molecules/LICENSE-molecules
b752697
502c0b6
%patch -P 0 -p0 -b .backup
502c0b6
%patch -P 1 -p0 -b .backup
Cristian Le f5aea83
%patch -P 2 -p1 -b .backup
eb569a8
eb569a8
# Make avogadro generators source code available for CMake
8c01900
mv avogenerators-1.98.0 avogadrogenerators
eb569a8
mv avogadrogenerators/README.md avogadrogenerators/README-avogenerators.md
eb569a8
sed -e 's|../avogadrogenerators|avogadrogenerators|g' -i avogadro/qtplugins/quantuminput/CMakeLists.txt
eb569a8
#
eb569a8
eb569a8
mv thirdparty/libgwavi/README.md thirdparty/libgwavi/README-libgwavi.md
366eac0
366eac0
%build
20b0b31
mkdir -p build
3770bc6
export CXXFLAGS="%{optflags} -DH5_USE_110_API"
b752697
# RHBZ #1996330
b752697
%ifarch %{power64}
b752697
export CXXFLAGS="%{optflags} -DEIGEN_ALTIVEC_DISABLE_MMA"
b752697
%endif
20b0b31
%cmake3 -B build -DCMAKE_BUILD_TYPE:STRING=Release \
0c7c2f9
 -DINSTALL_INCLUDE_DIR:PATH=include/avogadro2 -DINSTALL_LIBRARY_DIR:PATH=%{_lib} \
8bb496e
 -Wno-dev \
366eac0
 -DENABLE_GLSL:BOOL=ON \
366eac0
 -DENABLE_PYTHON:BOOL=ON  \
81d9643
 -DPYTHON_EXECUTABLE:FILEPATH=%{__python3} \
81d9643
 -DPYTHON_VERSION:STRING=%{python3_version} \
81d9643
%if 0%{?fedora}
81d9643
 -DUSE_BOOST_PYTHON:BOOL=ON \
f28d746
 -DUSE_LIBARCHIVE:BOOL=ON \
81d9643
%else
81d9643
 -DUSE_BOOST_PYTHON:BOOL=OFF \
f28d746
 -DUSE_LIBARCHIVE:BOOL=OFF \
81d9643
%endif
366eac0
 -DENABLE_RPATH:BOOL=OFF \
366eac0
 -DENABLE_TESTING:BOOL=OFF \
12e61e0
 -DUSE_MMTF:BOOL=ON \
12e61e0
 -DUSE_QT:BOOL=ON \
366eac0
 -DUSE_MOLEQUEUE:BOOL=ON \
366eac0
 -DUSE_VTK:BOOL=OFF \
366eac0
 -DUSE_HDF5:BOOL=ON \
12e61e0
 -DUSE_SPGLIB:BOOL=ON \
366eac0
 -DBUILD_GPL_PLUGINS:BOOL=ON \
366eac0
 -DBUILD_STATIC_PLUGINS:BOOL=ON \
f007721
 -DBUILD_DOCUMENTATION:BOOL=ON \
f28d746
 -DUSE_LIBMSYM:BOOL=OFF
f28d746
20b0b31
%make_build -C build
366eac0
20b0b31
pushd build/docs
366eac0
doxygen
366eac0
popd
366eac0
366eac0
%install
20b0b31
%make_install -C build
366eac0
0c9b9df
# Move scale.py* files into %%{python3_sitearch}/avogadro2
12e61e0
cp -a %{buildroot}%{_libdir}/avogadro2/scripts %{buildroot}%{python3_sitearch}/avogadro2/
b26eb9a
%{__python3} %{_rpmconfigdir}/redhat/pathfix.py -pn -i "%{__python3}" %{buildroot}%{python3_sitearch}/avogadro2/scripts/*/*.py
12e61e0
ln -sf %{python3_sitearch}/avogadro2/scripts %{buildroot}%{_libdir}/avogadro2/scripts
366eac0
366eac0
chrpath -d %{buildroot}%{_libdir}/lib*.so
366eac0
rm -rf %{buildroot}%{_datadir}/doc
366eac0
366eac0
%files
eb569a8
%doc README.md thirdparty/libgwavi/README-libgwavi.md avogadrogenerators/README-avogenerators.md
b752697
%license LICENSE molecules/LICENSE-molecules
b915768
%{_libdir}/libAvogadro*.so.1
b915768
%{_libdir}/libAvogadro*.so.%{version}
eb569a8
%dir %{_libdir}/avogadro2
b915768
%{_libdir}/avogadro2/scripts/
b915768
%{_libdir}/avogadro2/libgwavi.a
b915768
%{_libdir}/avogadro2/staticplugins/
366eac0
%{python3_sitearch}/avogadro2/
b915768
%{_datadir}/avogadro2/
366eac0
366eac0
%files devel
366eac0
%{_includedir}/avogadro2/
b915768
%{_libdir}/libAvogadro*.so
366eac0
%{_libdir}/cmake/avogadrolibs/
366eac0
366eac0
%files doc
20b0b31
%doc README.md build/docs/html
f007721
%license LICENSE
366eac0
366eac0
%changelog
Cristian Le ca35f0c
%autochangelog