File xmakemol.spec of Package xmakemol

#
# spec file for package xmakemol
#
# Copyright (c) 2013 ithod.
#
# 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.

Name:           xmakemol
Version:        5.16
Release:        0
License:        GPL-2.0
Summary:        Viewing and manipulating atomic systems
Url:            http://www.nongnu.org/xmakemol/
Group:          Productivity/Scientific/Chemistry
Source0:        http://savannah.nongnu.org/download/%{name}/%{name}-%{version}.tar.gz
Requires:       libGLw1
BuildRequires:  libX11-devel
BuildRequires:  libXt-devel
BuildRequires:  libXext-devel
BuildRequires:  libXi-devel
BuildRequires:  libXpm-devel
BuildRequires:  motif-devel
BuildRequires:  libGLw-devel
BuildRequires:  freeglut-devel
BuildRequires:  cpp < 10
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Patch0:         h-bond-factor.patch
Patch1:         xmakemol-cmdline.patch
Patch2:         xmakemol-zoom.patch
%define name_ani xmake_anim.pl

%description
XMakemol is a mouse-based program, written using the LessTif widget set, for viewing and manipulating atomic and other chemical systems. It reads XYZ input and renders atoms, bonds and hydrogen bonds. 

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1

%build
# opengl version
./configure --without-glu --prefix=%{buildroot}/usr
# add man for script
sed -i 's/man_MANS = .*/man_MANS = %{name}.1 %{name_ani}.1/g' Makefile
# hardcoded path must not contain buildroot
sed -i 's/ELEM_FILE = .*/ELEM_FILE = \/usr\/share\/%{name}\/elements/g' Makefile
make all
mv xmakemol{,-gl}
make distclean
# non opengl version
./configure --without-glu --without-gl --without-opengl --prefix=%{buildroot}/usr
# add man for script
sed -i 's/man_MANS = .*/man_MANS = %{name}.1 %{name_ani}.1/g' Makefile
# hardcoded path must not contain buildroot
sed -i 's/ELEM_FILE = .*/ELEM_FILE = \/usr\/share\/%{name}\/elements/g' Makefile
make all

%install
make install
install -m 755 xmakemol-gl %{buildroot}%{_bindir}/xmakemol-gl
# man
make install-man
# .desktop
mkdir -p %{buildroot}%{_datadir}/applications
cat > %{buildroot}%{_datadir}/applications/%{name}.desktop << EOF
[Desktop Entry]
Name=XMakemol
Comment=View atomic systems
GenericName=XMakemol
Exec=xmakemol
Terminal=false
Categories=Education;Science;Chemistry;Physics;
Type=Application
EOF
cat > %{buildroot}%{_datadir}/applications/%{name}-gl.desktop << EOF
[Desktop Entry]
Name=XMakemol
Comment=View atomic systems (using OpenGL)
GenericName=XMakemol
Exec=xmakemol-gl
Terminal=false
Categories=Education;Science;Chemistry;Physics;
Type=Application
EOF

%post
# nothing

%files
%defattr(-,root,root)
%doc AUTHORS COPYING README
%{_mandir}/man1/%{name}.1.gz
%{_mandir}/man1/%{name_ani}.1.gz
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}-gl.desktop
%{_datadir}/%{name}/elements
%{_datadir}/%{name}
%{_bindir}/%{name}
%{_bindir}/%{name}-gl
%{_bindir}/%{name_ani}

%changelog

openSUSE Build Service is sponsored by