File avogadro.spec of Package avogadro

#
# spec file for package avogadro (Version 1.0.1)
#
# Copyright (c) 2010 SUSE LINUX Products 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/
#

# norootforbuild


Name:           avogadro
Version:        1.0.1
Release:        1
License:        GPLv2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       libavogadro1 = %{version}
Requires:       python-numpy python-sip
Requires:       openbabel
BuildRequires:  docbook-utils glew-devel xorg-x11-devel
BuildRequires:  boost-devel python-numpy-devel python-sip-devel
BuildRequires:  gcc-c++ libopenbabel-devel >= 2.2.3 python-qt4-devel
BuildRequires:  cmake libeigen2-devel libqt4-devel >= 4.5.1 python-devel
BuildRequires:  fdupes xorg-x11-libX11-devel xorg-x11-libXext-devel
Group:          Productivity/Editors/Other
Summary:        Avogadro is a Molecular design tool
Url:            http://avogadro.sourceforge.net/wiki/Main_Page
Source0:        http://mesh.dl.sourceforge.net/sourceforge/avogadro/%{name}-%{version}.tar.bz2
Source1:        %name.png
# PATCH-FIX-OPENSUSE avogadro-1.0.1-fix_plugin_dir.patch toddrme2178@gmail.com - fix a bug with duplicating part of a path in cmake
Patch0:         %{name}-1.0.1-fix_plugin_dir.patch
# PATCH-FIX-UPSTREAM avogadro-1.0.1-find_python_27.patch toddrme2178@gmail.com - fix detection of python 2.7
Patch1:         %{name}-1.0.1-find_python_27.patch
# PATCH-FIX-UPSTREAM avogadro-1.0.1-fix_sip.patch toddrme2178@gmail.com - fix use of API call removed in recent python-sip
Patch2:         %{name}-1.0.1-fix_sip.patch
%{py_requires}

%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
License:        GPLv2
Summary:        Avogadro is a Molecular design tool
Group:          Development/Libraries/C and C++
Provides:       libavogadro

%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
License:        GPLv2
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.

%prep
%setup -q

%patch0
%patch1
%patch2

%build
mkdir build
export SUSE_ASNEEDED=0
cd build
cmake 	-DCMAKE_INSTALL_PREFIX=%{_prefix} \
      	-DLIB_INSTALL_DIR=%{_libdir} \
%ifarch x86_64
        -DLIB_SUFFIX=64 \
%endif
	-DENABLE_GLSL=ON \
        -DENABLE_RPATH=OFF \
	-DENABLE_UPDATE_CHECKER=OFF \
        ..

%{__make} %{?jobs:-j %jobs}

%install
cd build
%makeinstall

# Create the system menu entry
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%name.desktop << EOF
[Desktop Entry]
Name=Avogadro
Comment=%{summary}
GenericName=Avogadro
Exec=%name
Icon=%name
Terminal=0
Categories=KDE;Education;Chemistry;
Type=Application
X-SuSE-translate=false
EOF
# icon
install -D -m644 %SOURCE1 $RPM_BUILD_ROOT/%{_datadir}/pixmaps/%name.png

%fdupes -s %{buildroot}

%post -n libavogadro1 -p /sbin/ldconfig

%postun -n libavogadro1 -p /sbin/ldconfig

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING
%doc %{_mandir}/man1/avogadro.1.gz
%doc %{_mandir}/man1/avopkg.1.gz
%{_bindir}/avogadro
%{_bindir}/avopkg
%dir %{_datadir}/libavogadro
%dir %{_datadir}/libavogadro/shaders
%{_datadir}/libavogadro/shaders/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/pixmaps/*.png
%{_datadir}/applications/%name.desktop
#plugins not libraries
%dir %{_libdir}/avogadro
%dir %{_libdir}/avogadro/1_0
%dir %{_libdir}/avogadro/1_0/colors
%dir %{_libdir}/avogadro/1_0/engines
%dir %{_libdir}/avogadro/1_0/extensions
%dir %{_libdir}/avogadro/1_0/tools
%{_libdir}/avogadro/1_0/*/*.so
# installed with python support
%{python_sitelib}/Avogadro.so
#%{py_sitedir}/Avogadro.py
%dir %{_datadir}/libavogadro/engineScripts
%dir %{_datadir}/libavogadro/extensionScripts
%{_datadir}/libavogadro/engineScripts/wireframe.py
%{_datadir}/libavogadro/extensionScripts/example.py

%files devel
%defattr(-,root,root,-)
%dir %{_includedir}/avogadro
%{_includedir}/avogadro/*.h
%dir %{_libdir}/avogadro/1_0/cmake
%{_libdir}/libavogadro.so
%{_libdir}/avogadro/1_0/cmake/*
%{_libdir}/avogadro/1_0/*.cmake
%{_libdir}/avogadro/*.cmake
%{_datadir}/qt4/mkspecs/features/avogadro.prf

%files -n libavogadro1
%defattr(-,root,root,-)
%{_libdir}/*.so.*

%changelog
openSUSE Build Service is sponsored by