File chmsee.spec of Package chmsee

#
# spec file for package chmsee (Version 1.0.6)
#
# Copyright (c) 2009 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:           chmsee
%if %suse_version < 1100
%define xulrunner_version 181
%define xulrunner_version2 1.8.1
%else
%if %suse_version > 1110
%define xulrunner_version 191
%define xulrunner_version2 1.9.1
%else
%define xulrunner_version 190
%define xulrunner_version2 1.9.0
%endif
%endif
Summary:        A Gtk+2 CHM document viewer
Version:        1.0.6
Release:        3
License:        GPL v2 or later
Group:          Productivity/Graphics/Viewers
Url:            http://code.google.com/p/chmsee/
Source:         %{name}-%{version}.tar.bz2
#PATCH-FIX-UPSTREAM chmsee-xul191.patch google issue #44 dimstar@opensuse.org -- Re-enable support for xulrunner 1.9.1
Patch0:         chmsee-xul191.patch
BuildRequires:  chmlib-devel
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  gtk2-devel
BuildRequires:  intltool
BuildRequires:  libgcrypt-devel
BuildRequires:  libglade2-devel
BuildRequires:  mozilla-xulrunner%{xulrunner_version}-devel
BuildRequires:  shared-mime-info
BuildRequires:  update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       mozilla-xulrunner%{xulrunner_version}
PreReq:         shared-mime-info

%description
It uses chmlib to extract files. It uses gecko to display pages. It
supports displaying multilingual pages due to gecko. It features
bookmarks and tabs. The tabs could be used to jump inside the chm file
conveniently. Its UI is clean and handy, also is well localized. It is
actively developed and maintained. The author of chmsee is Jungle Ji
and several other great people.

%prep
%setup -q
%patch0 -p1

%build
#rename no nb po/no.*
#sed "s/\(ALL_LINGUAS.*\) no /\1 nb /" configure.in > configure.in.tmp && \
#        mv configure.in.tmp configure.in
#autoreconf --force --install
CFLAGS="$RPM_OPT_FLAGS -Wall" \
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
make

%install
export GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL=1
make install DESTDIR=$RPM_BUILD_ROOT
unset GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL
DESTDIR=$RPM_BUILD_ROOT mime-info-to-mime
%find_lang %{name}
%if %suse_version <= 1100
# since xulrunner .pc files don't contain RPATH
install -p -m 755 -D $RPM_BUILD_ROOT%{_bindir}/%{name} $RPM_BUILD_ROOT%{_libdir}/%{name}/%{name}
cat > $RPM_BUILD_ROOT%{prefix}/bin/%{name} <<EOF
#!/bin/sh
LD_LIBRARY_PATH=%{_libdir}/xulrunner-%{xulrunner_version2} exec %{prefix}/%_lib/%{name}/%{name} "\$@"
EOF
%endif
%suse_update_desktop_file -r -N Chmsee -G "Compressed HTML Viewer" chmsee GNOME GTK Graphics Office Viewer

%clean
rm -rf %{buildroot}

%post
usr/bin/update-mime-database /usr/share/mime >/dev/null
/sbin/ldconfig

%postun
usr/bin/update-mime-database /usr/share/mime >/dev/null
/sbin/ldconfig

%files -f %{name}.lang
%defattr(-, root, root)
%doc README COPYING AUTHORS ChangeLog NEWS
%{_bindir}/chmsee
%if %suse_version <= 1100
%{_libdir}/chmsee
%endif
%{_datadir}/chmsee/
%{_datadir}/applications/*.desktop
%{_datadir}/mime-info
%{_datadir}/mime-info/chmsee.mime
%{_datadir}/mime-info/chmsee.keys
%{_datadir}/pixmaps/chmsee-icon.png
%{_datadir}/mime/packages/chmsee.xml

%changelog
openSUSE Build Service is sponsored by