%define name    @PACKAGE@
%define version @VERSION@
%define release 1

Summary:   Raptor RDF Parser Toolkit for Redland
Name:      %{name}
Version:   %{version}
Release:   %{release}
Prefix:    %{_prefix}
Copyright: LGPL/MPL
Group:     Development/Libraries
Source:    http://www.redland.opensource.ac.uk/dist/source/%{name}-%{version}.tar.gz
URL:       http://www.redland.opensource.ac.uk/raptor/
BuildRoot: /tmp/%{name}-%{version}
BuildRequires: libxml2 libxml2-devel curl curl-devel
Packager:  Dave Beckett <Dave.Beckett@bristol.ac.uk>
Docdir: %{_docdir}

%description

Raptor is the RDF Parser Toolkit for Redland that provides
a set of standalone RDF parsers, generating triples from RDF/XML
or N-Triples.

%package devel
Summary: Libraries, includes etc to develop with Raptor RDF parser library
Group: Development/Libraries
Requires: raptor = %{version}
Requires: libxml2-devel

%description devel
Libraries, includes etc to develop with Raptor RDF parser library.
It provides a set of standalone RDF parsers, generating triples from
RDF/XML or N-Triples.

%prep
%setup -q

%build
# Needed for snapshot releases.
if [ ! -f configure ]; then
%ifarch alpha
  CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --host=alpha-redhat-linux --prefix=%prefix --sysconfdir="/etc" --mandir=%{_mandir} --libdir=%{_libdir}
%else
  CFLAGS="$RPM_OPT_FLAGS" ./autogen.sh --prefix=%prefix --sysconfdir="/etc" --mandir=%{_mandir} --libdir=%{_libdir}
%endif
else
%ifarch alpha
  CFLAGS="$RPM_OPT_FLAGS" ./configure --host=alpha-redhat-linux --prefix=%prefix --sysconfdir="/etc" --mandir=%{_mandir} --libdir=%{_libdir}
%else
  CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%prefix --sysconfdir="/etc" --mandir=%{_mandir} --libdir=%{_libdir}
%endif
fi

if [ "$SMP" != "" ]; then
  (make "MAKE=make -k -j $SMP"; exit 0)
else
  make
fi

%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

install -d $RPM_BUILD_ROOT%{_mandir}/man1
install -d $RPM_BUILD_ROOT%{_mandir}/man3

make prefix=$RPM_BUILD_ROOT%{prefix} libdir=$RPM_BUILD_ROOT%{_libdir} mandir=$RPM_BUILD_ROOT%{_mandir} install

%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-, root, root)

%doc AUTHORS COPYING COPYING.LIB ChangeLog LICENSE.txt NEWS README
%doc MPL.html
%doc %{_mandir}/man1/rapper.1*
%doc %{_mandir}/man3/libraptor.3*

%{_libdir}/lib*.so.*
%{prefix}/bin/rapper


%files devel
%defattr(-, root, root)

%doc AUTHORS COPYING COPYING.LIB ChangeLog LICENSE.txt NEWS README
%doc MPL.html
%doc INSTALL.html
%doc %{_mandir}/man1/raptor-config.1*

%{_libdir}/lib*.so
%{_libdir}/*a
%{_libdir}/pkgconfig/raptor.pc
%{prefix}/include/*
%{prefix}/bin/raptor-config


%changelog
* Thu Apr 17 2003 Dave Beckett <Dave.Beckett@bristol.ac.uk>

- Added pkgconfig raptor.pc, raptor-config
- Requires curl

* Mon Jan 13 2003 Dave Beckett <Dave.Beckett@bristol.ac.uk>

- rdfdump now rapper

* Fri Dec 20 2002 Dave Beckett <Dave.Beckett@bristol.ac.uk>

- Updated to have two RPMs for raptor and raptor-devel.  Depend on
  libxml2 as XML parser.
