File chemtool.spec of Package chemtool

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


%define         name0 cht
Name:           chemtool
Version:        1.6.14
Release:        0
Summary:        Program for Drawing 2D Organic Molecules
License:        GPL-2.0+
Group:          Productivity/Graphics/Other
Url:            http://ruby.chemie.uni-freiburg.de/~martin/chemtool/
Source:         %{name}-%{version}.tar.bz2
Source1:        %{name}.desktop
# PATCH-MISSING-TAG -- See http://en.opensuse.org/Packaging/Patches
Patch1:         %{name}-%{version}-mime.patch
# PATCH-MISSING-TAG -- See http://en.opensuse.org/Packaging/Patches
Patch2:         %{name}-%{version}-memmove.patch
Patch3:         %{name}-use_ac_tool_prefix_for_pkg-config.patch
BuildRequires:  gtk2-devel
BuildRequires:  shared-mime-info
BuildRequires:  update-desktop-files
# FIXME: use proper Requires(pre/post/preun/...)
PreReq:         shared-mime-info
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} > 1210
BuildRequires:  libXext-devel
%endif

%description
Chemtool is a program for drawing organic molecules easily and storing
them as an X bitmap, Xfig, or EPS file. It runs under the X Window
System using the GTK widget set.

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

%build
# to convince configure to install also gnome stuff
%configure \
    --with-gnomedir=%{_prefix} \
    --with-kdedir=%{_prefix} \
    --enable-undo \
    --disable-rpath \
    --enable-menu
make %{?_smp_mflags}

%install
# fix line endings
cd examples
tr -d '\r' < 14263232.mol > 14263232.mol.unix && mv -f 14263232.mol.unix 14263232.mol
tr -d '\r' < sample.sdf > sample.sdf.unix && mv -f sample.sdf.unix sample.sdf
cd -

make DESTDIR=%{buildroot} install

# desktop file
install -Dm 0644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
install -Dm 644 gnome/gnome-application-%{name}.png %{buildroot}%{_datadir}/pixmaps/gnome-application-%{name}.png
%suse_update_desktop_file %{name} Chemistry

# lang
%find_lang %{name}

%post
if [ -x usr/bin/update-mime-database ]; then
	usr/bin/update-mime-database %{_datadir}/mime >/dev/null
fi

%postun
if [ -x usr/bin/update-mime-database ]; then
	usr/bin/update-mime-database %{_datadir}/mime >/dev/null
fi

%files -f %{name}.lang
%defattr(-,root,root)
%doc NEWS README TODO ChangeLog
%doc %{_mandir}/man1/%{name}.1*
%doc %{_mandir}/man1/%{name0}.1*
%{_bindir}/*
%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/gnome-application-%{name}.png

%changelog
openSUSE Build Service is sponsored by