File avogadro.spec of Package avogadro-qt4

#
# spec file for package avogadro
#
# Copyright (c) 2016 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/
#


Name:           avogadro-qt4
Version:        1.2.0
Release:        0
Summary:        A Molecular design tool
License:        GPL-2.0
Group:          Productivity/Scientific/Chemistry
Url:            http://avogadro.cc
Source0:        http://sourceforge.net/projects/avogadro/files/avogadro/%{version}/avogadro-%{version}.tar.gz
Source1:        avogadro.png
Source2:        baselibs.conf
# PATCH-FIX-UPSTREAM avogadro-1.1.0-avopkg-fix-echo.patch ledest@gmail.com
Patch1:         avogadro-1.1.0-avopkg-fix-echo.patch
Patch2:         avogadro-boost.patch
Patch3:         avogadro-opanbabel.patch
# PATCH-FIX-OPENSUSE don't use signbit() on non-float kkaempf@suse.de
Patch4:         0004-don-t-use-signbit-on-non-float.patch
# PATCH-FIX-OPENSUSE link with libm kkaempf@suse.de
Patch5:         0005-Link-with-libm.patch
# PATCH-FIX-UPSTREAM avogadro-port-to-eigen3.patch badshah400@gmail.com -- Cherry pick commits from upstream to get avogadro building with eigen3
Patch7:         avogadro-port-to-eigen3.patch

%if 0%{?suse_version} >= 1500
BuildRequires:  libboost_python-devel
%else
BuildRequires:  boost-devel
%endif
BuildRequires:  cmake
BuildRequires:  docbook-utils
BuildRequires:  fdupes
BuildRequires:  gcc-c++
%if 0%{?suse_version} > 1500
# fails to build with latest glew, use an older one until it can be fixed
BuildRequires:  glew2_1-devel
%else
BuildRequires:  glew-devel
%endif
BuildRequires:  libopenbabel-devel >= 2.3.1
BuildRequires:  libqt4-devel >= 4.5.1
BuildRequires:  python-devel
BuildRequires:  python-numpy-devel
BuildRequires:  python-qt4-devel
BuildRequires:  python-sip-devel
BuildRequires:  pkgconfig(eigen3)
BuildRequires:  pkgconfig(glu)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(zlib)
Requires:       libavogadro1 = %{version}
Requires:       openbabel
Requires:       python-numpy
Requires:       python-sip
Provides:       avogadro = %{version}
Obsoletes:      avogadro < 1.90

%description
Avogadro is an advanced molecular editor designed
for cross-platform use in computational chemistry,
molecular modeling, bioinformatics, materials science,
and related areas. It offers flexible rendering and
a powerful plugin architecture.

%package -n libavogadro1
Summary:        A Molecular design tool
Group:          Development/Libraries/C and C++
Provides:       libavogadro = %{version}-%{release}

%description -n libavogadro1
This package contains the shared libraries for Avogadro.

Avogadro is an advanced molecular editor designed
for cross-platform use in computational chemistry,
molecular modeling, bioinformatics, materials science,
and related areas. It offers flexible rendering and
a powerful plugin architecture.

%package devel
Summary:        Development files for Avogadro
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}

%description devel
This package contains files to develop applications using
Avogadros libraries.

%package -n python-avogadro
Summary:        A python wrapper to avogadro
Group:          Development/Languages/Python
Requires:       python-numpy
Requires:       python-sip

%description -n python-avogadro
This package contains the python wrapper to Avogadro.

Avogadro is an advanced molecular editor designed
for cross-platform use in computational chemistry,
molecular modeling, bioinformatics, materials science,
and related areas. It offers flexible rendering and
a powerful plugin architecture.

%prep
%autosetup -p1 -n avogadro-%{version}

%build
%cmake \
	-DBoost_NO_BOOST_CMAKE=ON \
	-DINSTALL_LIB_DIR=%{_libdir} \
	-DINSTALL_CMAKE_DIR=%{_libdir}/cmake/libmsym \
	-DENABLE_GLSL=ON \
	-DENABLE_UPDATE_CHECKER=OFF \
	-DENABLE_ZMATRIX_TOOL=ON \
	-DENABLE_PYTHON=ON \
	-DPYTHON_EXECUTABLE=%{_bindir}/python2 \
	-DCMAKE_BUILD_TYPE=RelWithDebInfo 

%cmake_build

%install
%cmake_install

mkdir -p %{buildroot}/%{_datadir}/qt4/mkspecs/
mv %{buildroot}%{_prefix}/features %{buildroot}/%{_datadir}/qt4/mkspecs/
# Create the system menu entry
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/avogadro.desktop << EOF
[Desktop Entry]
Name=Avogadro
Comment=%{summary}
GenericName=Avogadro
Exec=avogadro
Icon=avogadro
Terminal=0
Categories=KDE;Education;Chemistry;
Type=Application
X-SuSE-translate=false
EOF

# icon
install -D -m644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/avogadro.png
%fdupes %{buildroot}%{_datadir}/libavogadro/shaders/
%fdupes %{buildroot}%{_datadir}/avogadro/

%post -n libavogadro1 -p /sbin/ldconfig

%postun -n libavogadro1 -p /sbin/ldconfig

%files
%doc AUTHORS README
%license COPYING
%{_mandir}/man1/avogadro.1.gz
%{_mandir}/man1/avopkg.1.gz
%{_bindir}/avogadro
%{_bindir}/avopkg
%{_bindir}/qube
%dir %{_datadir}/libavogadro
%{_datadir}/libavogadro/shaders/
%{_datadir}/avogadro
%{_datadir}/pixmaps/*.png
%{_datadir}/applications/avogadro.desktop
#plugins not libraries
%{_libdir}/libmsym.so
%dir %{_libdir}/avogadro
%dir %{_libdir}/avogadro/1_2
%dir %{_libdir}/avogadro/1_2/colors
%dir %{_libdir}/avogadro/1_2/engines
%dir %{_libdir}/avogadro/1_2/extensions
%dir %{_libdir}/avogadro/1_2/tools
%{_libdir}/avogadro/1_2/*/*.so
%dir %{_datadir}/libavogadro/engineScripts
%dir %{_datadir}/libavogadro/extensionScripts
%{_datadir}/libavogadro/engineScripts/wireframe.py
%{_datadir}/libavogadro/extensionScripts/example.py

%files devel
%dir %{_includedir}/avogadro
%{_includedir}/avogadro/*.h
%dir %{_includedir}/libmsym
%{_includedir}/libmsym/*.h
%dir %{_libdir}/cmake/libmsym
%{_libdir}/cmake/libmsym/*.cmake
%dir %{_libdir}/avogadro/1_2/cmake
%{_libdir}/libavogadro.so
%{_libdir}/libavogadro_OpenQube.so
%{_libdir}/avogadro/1_2/cmake/*
%{_libdir}/avogadro/1_2/*.cmake
%{_libdir}/avogadro/*.cmake
%{_libdir}/pkgconfig/*.pc
%{_datadir}/qt4/mkspecs/features/avogadro.prf

%files -n libavogadro1
%{_libdir}/*.so.*

%files -n python-avogadro
# installed with python support
%{python2_sitearch}/Avogadro.so

%changelog
openSUSE Build Service is sponsored by