File chmsee.spec of Package chmsee

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


Name:           chmsee
Summary:        A Gtk+2 CHM document viewer
License:        GPL-2.0+
Group:          Productivity/Graphics/Viewers
Version:        2.0
Release:        0
Url:            http://code.google.com/p/chmsee/
Source0:        chmsee-%{version}.tar.gz
Source1:        Makefile
BuildRequires:  chmlib-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  shared-mime-info
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(libxul) >= 17.0
%define xulrunner_version %(rpm -q --queryformat '%{VERSION}' xulrunner-devel)
%define xulrunner_base %(pkg-config --variable=libdir libxul)
Requires:       xulrunner >= %{xulrunner_version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%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 #-n jungleji-chmsee-d5fb276
cp %{SOURCE1} src

%build
pushd src
CFLAGS="$RPM_OPT_FLAGS" \
CXXFLAGS="$RPM_OPT_FLAGS" \
make
popd

%install
# install xulrunner app
mkdir -p %{buildroot}/%{_libdir}/chmsee
cp -r chrome %{buildroot}/%{_libdir}/chmsee/
cp -r components %{buildroot}/%{_libdir}/chmsee/
cp -r defaults %{buildroot}/%{_libdir}/chmsee/
cp application.ini %{buildroot}/%{_libdir}/chmsee/
cp chrome.manifest %{buildroot}/%{_libdir}/chmsee/
cp %{xulrunner_base}/xulrunner-stub %{buildroot}%{_libdir}/chmsee/chmsee
ln -s %{xulrunner_base} %{buildroot}%{_libdir}/chmsee/xulrunner
mkdir -p %{buildroot}%{_bindir}
# because of bmo#690679 a link is not sufficient currently
#ln -s %{_libdir}/chmsee/chmsee %{buildroot}/%{_bindir}/chmsee
cat << EOF > %{buildroot}%{_bindir}/chmsee
#!/bin/sh
%{_libdir}/chmsee/chmsee
EOF
chmod 755 %{buildroot}%{_bindir}/chmsee
# Install desktop file
install -d %{buildroot}/%{_datadir}/applications
sed "s:^_::g" data/chmsee.desktop.in > %{buildroot}/%{_datadir}/applications/chmsee.desktop
%suse_update_desktop_file -r chmsee Office Viewer
# Install icons
install -D -m0644 data/chmsee-icon.png %{buildroot}/%{_datadir}/icons/hicolor/48x48/apps/chmsee-icon.png
for size in 16 32 48; do
  install -D -m0644 data/icons/hicolor/${size}x${size}/mimetypes/chm.png %{buildroot}/%{_datadir}/icons/hicolor/${size}x${size}/mimetypes/chm.png
done
install -D -m0644 data/icons/hicolor/scalable/mimetypes/chm.svg %{buildroot}/%{_datadir}/icons/hicolor/scalable/mimetypes/chm.svg
# Generate new mime data
install -D -m0644 data/chmsee.mime %{buildroot}/%{_datadir}/mime-info/chmsee.mime
install -D -m0644 data/chmsee.keys %{buildroot}/%{_datadir}/mime-info/chmsee.keys
DESTDIR=%{buildroot} mime-info-to-mime
# fdupes
%fdupes $RPM_BUILD_ROOT

%post
%if 0%{?suse_version} > 1130
%desktop_database_post
%icon_theme_cache_post
%mime_database_post
%else
usr/bin/update-mime-database /usr/share/mime >/dev/null || true
%endif

%postun
%if 0%{?suse_version} > 1130
%desktop_database_postun
%icon_theme_cache_postun
%mime_database_postun
%else
usr/bin/update-mime-database /usr/share/mime >/dev/null || true
%endif

%files
%defattr(-, root, root)
%doc COPYING AUTHORS NEWS README.md HACKING
%{_bindir}/chmsee
%{_libdir}/chmsee/
%{_datadir}/applications/*.desktop
%{_datadir}/icons/hicolor/*/apps/chmsee-icon.*
%{_datadir}/icons/hicolor/*/mimetypes/chm.*
%{_datadir}/mime/packages/chmsee.xml
%dir %{_datadir}/mime-info
%{_datadir}/mime-info/chmsee.mime
%{_datadir}/mime-info/chmsee.keys

%changelog
openSUSE Build Service is sponsored by