File sword.spec of Package sword

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


%define         libver 1_6_2
%define		libinstver 1.6.2

Name:           sword
Version:        1.6.2+svn2679
Release:        0
Summary:        Framework for manipulating Bible texts
License:        GPL-2.0
Group:          Development/Libraries/C and C++
Url:            http://www.crosswire.org/sword
Source0:        %{name}-%{version}.tar.bz2
Patch1:         sword-1.6.1-fix_compiler_warnings.patch
Patch2:         sword-1.6.1-curl.patch
Patch3:         sword-gcc47.patch
Requires:       libsword-%{libver} = %version
BuildRequires:  curl-devel
BuildRequires:  gcc-c++
BuildRequires:  icu
BuildRequires:  libicu-devel
BuildRequires:  pkgconfig
BuildRequires:  zlib-devel
#
# openSUSE
#
%if 0%{?suse_version}
BuildRequires:  clucene-core-devel
Recommends:     sword-bible
Recommends:     sword-commentary
Recommends:     sword-frontend
%endif
#
# Fedora
#
%if 0%{?fedora_version}
BuildRequires:  clucene-core-devel
%endif
#
# Mandriva
#
%if 0%{?mandriva_version}
%ifarch x86_64
BuildRequires:  lib64clucene-devel
%else
BuildRequires:  libclucene-devel
%endif
%endif
#
# CentOS
#
%if ( %{defined centos_version} && 0%{?centos_version} < 600 )
BuildRequires:  sqlite
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
The SWORD Project is an effort to create an ever expanding software package for
research and study of God and His Word.

The SWORD Bible Framework allows easy manipulation of Bible texts, commentaries,
lexicons, dictionaries, etc.  Many frontends are build using this framework.
An installed module set may be shared between any frontend using the framework.

%package -n libsword-%{libver}
Summary:        Shared library for sword
Group:          Development/Libraries/Other
Provides:       libsword = %{version}
Provides:       libsword%{libver}

%description -n libsword-%{libver}
This package contains the shared library for applications using sword.

%package devel
Summary:        Include files and static libraries for developing sword applications
Group:          Development/Libraries/Other
%if 0%{?centos_version} < 600
Requires:       curl-devel
%else
Requires:       libcurl-devel
%endif
Requires:       sword = %{version}

%description devel
Include files and static libraries for developing sword applications. This package
is required to compile Sword frontends, too.

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

%build

%if 0%{?mandriva_version}
autoreconf
%endif

%configure --disable-static \
           --with-icu \
           --enable-tests \
           --enable-examples
make %{?_smp_mflags}

%check
cd tests/testsuite
# could not run all tests, as verseparsing-utf8 tries to
# use already installed locales and not the currently
# build ones :-(
# && ./runall.sh
TESTSUITE=$(for i in *.good; do basename $i .good; done)
for i in $TESTSUITE; do
	case $i in
		verseparsing*)
			continue
		;;
		*)
			echo -n "$i: "
			./runtest.sh $i -q
		    if [ $? -ne 0 ]; then
		        echo FAILED
		        echo ""
		        echo To see problems, try running:
		        echo ./runtest.sh $i
		        echo ""
		        exit 1
		    else
		        echo PASSED.
		    fi
		;;
	esac
done

%install
%makeinstall install_config
rm %{buildroot}/%{_libdir}/*.la
pushd %{buildroot}/%{_bindir}
strip *
strip %{buildroot}/%{_libdir}/libsword*.so
popd

%post -n libsword-%{libver} -p /sbin/ldconfig

%postun -n libsword-%{libver} -p /sbin/ldconfig

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog LICENSE NEWS README doc
%config(noreplace) %{_sysconfdir}/sword.conf
%{_bindir}/*
%dir %{_datadir}/sword
%dir %{_datadir}/sword/locales.d
%dir %{_datadir}/sword/mods.d
%{_libdir}/sword/
%{_datadir}/sword/locales.d/*
%{_datadir}/sword/mods.d/globals.conf

%files -n libsword-%{libver}
%defattr(-,root,root)
%doc LICENSE
%{_libdir}/libsword-%{libinstver}.so

%files devel
%defattr(-,root,root)
%doc CODINGSTYLE
%{_includedir}/*
%{_libdir}/pkgconfig/sword.pc
%{_libdir}/*.so
%exclude %{_libdir}/libsword-%{libinstver}.so

%changelog
openSUSE Build Service is sponsored by