File xiphos.spec of Package xiphos

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


%if ( 0%{?suse_version} >= 1200 || 0%{?fedora} > 14 )
%define		gtk3 0
%endif

Name:           xiphos
Version:        4.0.4
Release:        0
Summary:        GNOME-based Bible research tool
License:        GPL-2.0
Group:          Productivity/Scientific/Other
Url:            http://xiphos.org/
Source0:        xiphos-%{version}.tar.gz
Source1:        %{name}.desktop

BuildRequires:  biblesync-devel >= 1.1.2
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gettext-devel
BuildRequires:  glibc-devel
BuildRequires:  intltool
%if %{undefined mdkversion}
BuildRequires:  libbonobo-devel
BuildRequires:  libgnomeui-devel
%endif
BuildRequires:  libgsf-devel
BuildRequires:  libidn-devel
BuildRequires:  libuuid-devel
BuildRequires:  pcre-devel
BuildRequires:  perl-XML-Parser
BuildRequires:  scrollkeeper
BuildRequires:  sword-devel > 1.6.2
%if ( %{undefined centos_version} && 0%{?suse_version} != 1110 )
BuildRequires:  pkgconfig(cairo)
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gtk+-2.0)
BuildRequires:  pkgconfig(libglade-2.0)
%endif

%if ( %{undefined fedora} && %{undefined centos_version} && %{undefined mdkversion} && 0%{?suse_version} != 1110 )

BuildRequires:  gnome-doc-utils-devel
BuildRequires:  libMagick++-devel
BuildRequires:  xorg-x11-libXdmcp-devel

  %if %{defined gtk3}
BuildRequires:  libwebkitgtk3-devel
  %else
BuildRequires:  libwebkitgtk-devel
  %endif
%endif
#
# CentOS
#
%if %{defined centos_version}
BuildRequires:  cairo-devel
BuildRequires:  dbus-glib-devel
BuildRequires:  glib2-devel
BuildRequires:  gnome-doc-utils
BuildRequires:  gtk2-devel
BuildRequires:  gtkhtml3-devel
BuildRequires:  libXdmcp-devel
BuildRequires:  libglade2-devel
BuildRequires:  perl-Compress-Zlib
BuildRequires:  sane-backends-libs
  %if 0%{?centos_version} >= 600
BuildRequires:  libcurl-devel
BuildRequires:  webkitgtk-devel
  %else
BuildRequires:  curl-devel
BuildRequires:  python26
BuildRequires:  sqlite
BuildRequires:  xulrunner-devel
%define		xulbuild 1
  %endif
%endif
#
# openSUSE
#
%if %{defined suse_version}
BuildRequires:  update-desktop-files
%if %{defined gtk3}
BuildRequires:  gtkhtml-devel
%else
BuildRequires:  gtkhtml2-devel
%endif
Requires:       sword
Recommends:     sword-bible
Recommends:     sword-commentary
%if 0%{?suse_version} <= 1130
BuildRequires:  gnome-spell2
%endif
%endif
#
# SLES
#
%if 0%{?suse_version} == 1110
BuildRequires:  gnome-doc-utils
BuildRequires:  mozilla-xulrunner190-devel
%define		xulbuild 1
%endif
#
# Fedora
#
%if %{defined fedora}
BuildRequires:  gnome-doc-utils
BuildRequires:  gtkhtml3-devel
BuildRequires:  libXdmcp-devel
BuildRequires:  sane-backends-libs
BuildRequires:  webkitgtk3-devel
%endif
#
# Mandriva
#
%if %{defined mdkversion}
BuildRequires:  gnome-doc-utils
BuildRequires:  libMagick-devel
BuildRequires:  libgnomeui2-devel
BuildRequires:  libxdmcp-devel
BuildRequires:  polkit-gnome
BuildRequires:  pkgconfig(libbonobo-2.0)
%endif

Provides:       sword-frontend
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Bible Study Software for the Linux community. Lookup and search Bible texts and
commentaries. Xiphos uses modules and libraries from the SWORD Project.
Display multiple translations in the interlinear window. Search for passages in
any translation by word, phrase, or regular expression. Install this package
if you want to browse the Bible translations and reference works distributed
by Crosswire Bible Society through the SWORD Project.

%prep
%setup -q -n xiphos-%{version}

%build
# SLES lacks the abillity to build help files for some reason
%if %{defined sles_version}
%define EXTRAOPTS --disable-help
%endif

rm -rf build
export CFLAGS="%{optflags}"
export CXXFLAGS="%{optflags}"
%if ( %{defined centos_version} && 0%{?centos_version} < 600 )
/usr/bin/python26 \
%endif
%if %{defined xulbuild}
./waf configure --prefix=%{_prefix} --backend=xulrunner --gtk=2 %{?EXTRAOPTS}
%else
  %if %{defined gtk3}
./waf configure --prefix=%{_prefix} --gtk=3 --enable-webkit-editor
  %else
./waf configure --prefix=%{_prefix} --gtk=2
  %endif
%endif
./waf build

%install
./waf install --destdir=%{buildroot}

install -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/%{name}.desktop
%if 0%{?suse_version}
%suse_update_desktop_file -n %{buildroot}%{_datadir}/applications/%{name}.desktop
%endif

%if ( %{undefined fedora} && %{undefined centos_version} )
mkdir -p %{buildroot}%_defaultdocdir/%{name}
mv %{buildroot}%{_datadir}/doc/%{name}/* %{buildroot}%_defaultdocdir/%{name}/
rmdir %{buildroot}%{_datadir}/doc/%{name}
%endif

rm %{buildroot}%_defaultdocdir/%{name}/INSTALL

install -Dm644 xiphos.1 %{buildroot}%{_mandir}/man1/xiphos.1

%find_lang %{name}

%if %{undefined fedora}
%fdupes -s %{buildroot}
%endif

%clean
rm -rf %{buildroot}

%post
%if 0%{?suse_version} > 1130
%icon_theme_cache_post
%endif

%postun
%if 0%{?suse_version} > 1130
%icon_theme_cache_postun
%endif

%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS ChangeLog COPYING README RELEASE-NOTES TODO TRANSLATION-HOWTO
%dir %{_datadir}/%{name}
%{_bindir}/xiphos*
%{_datadir}/xiphos/*
%{_datadir}/icons/hicolor/scalable/apps/*
%{_datadir}/applications/%{name}.desktop
%dir %{_datadir}/appdata
%{_datadir}/appdata/xiphos.appdata.xml
%{_mandir}/man1/*
%dir %{_datadir}/omf
%if ( %{defined centos_version} || %{defined fedora} )
%{_defaultdocdir}/%{name}/*
%{_datadir}/gnome/help/%{name}/*
%{_datadir}/omf/%{name}/*
%endif

%changelog
openSUSE Build Service is sponsored by