File libwpg.spec of Package libwpg

#
# spec file for package libwpg
#
# 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/
#

Name:           libwpg
# note: the main package is empty, it only sets a sane name for the source rpm
%if 0%{?suse_version} > 1020
%define build_doc	1
BuildRequires:  doxygen
%else
%define build_doc	0
%endif
BuildRequires:  gcc-c++
BuildRequires:  libwpd-devel >= 0.9.0
BuildRequires:  pkgconfig
Summary:        Library to read and parse graphics in WordPerfect Graphics format
License:        LGPL-2.1+
Group:          Productivity/Publishing/Word
Version:        0.2.1
Release:        0
Url:            http://libwpg.sourceforge.net/
Source:         libwpg-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Patch0:         libwpg-nodatetime.patch

%description
libwpg is a C++ library to read and parse graphics in WPG (WordPerfect
Graphics) format. It is cross-platform, at the moment it can be build
on Microsoft Windows and Linux.

%define libname libwpg-0_2-2

%package -n %libname
# remove the old non-versioned package (built in the bs for instance)
Obsoletes:      libwpg < %version
Summary:        Library to read and parse graphics in WordPerfect Graphics format
Group:          System/Libraries

%description -n %libname
libwpg is a C++ library to read and parse graphics in WPG (WordPerfect
Graphics) format.

%package devel
Summary:        Files for Developing with libwpg
Group:          Development/Libraries/C and C++
Provides:       libwpg-devel = %version-%release
Requires:       %libname = %version libwpd-devel

%description devel
libwpg is a C++ library to read and parse graphics in WPG (WordPerfect
Graphics) format. It is cross-platform, at the moment it can be build
on Microsoft Windows and Linux.

This package contains the libwpg development files.

%if %build_doc

%package devel-doc
Summary:        Documentation for the libwpg API
Group:          Documentation/HTML

%description devel-doc
This package contains documentation for the libwpg API.

%endif

%package tools
Summary:        Tools for converting WordPerfect Graphics files
Group:          Productivity/Publishing/Word

%description tools
Tools to work with graphics in WPG (WordPerfect Graphics) format.

%prep
%setup -q
%patch0

%build
export CXXFLAGS="%optflags -fvisibility-inlines-hidden"
%configure --disable-static --docdir=%_docdir/%name
make %{?_smp_mflags}

%install
make DESTDIR=$RPM_BUILD_ROOT install
rm $RPM_BUILD_ROOT%_libdir/*.la
# documentation
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}
cp -p AUTHORS COPYING ChangeLog $RPM_BUILD_ROOT%{_docdir}/%{name}

%post -n %libname -p /sbin/ldconfig

%postun -n %libname -p /sbin/ldconfig

%files -n %libname
%defattr(-,root,root)
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_libdir}/pkgconfig/libwpg*.pc
%{_includedir}/libwpg-*
%if %build_doc != 0

%files devel-doc
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}/html
%endif

%files tools
%defattr(-,root,root)
%{_bindir}/*
%doc %dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/[A-Z]*

%changelog