%define name libcorelinux
%define version @CORELINUX_VERSION@
%define prefix %{_prefix}
%define lib_name libcl++
%define release 1


Name: %{name}
Summary: OOA and OOD for Linux
Version: %{version}
Release: 1
Epoch: 1
Source: http://dowload.sourceforge.net/corelinux/libcorelinux-%{version}.tar.gz
URL: http://corelinux.sourceforge.net
Group: System Environment/Libraries
Packager: Christophe Prud'homme <prudhomm@users.sourceforge.net>
License: LGPL
BuildRoot: /var/tmp/%{name}-buildroot

%description
OOA and OOD for Linux dynamic libraries.

This package provides the shared libraries for corelinux
so that you can run any corelinux based code on the machine.

OOA: Object Oriented Analysis
OOD: Object Oriented Design
check http://corelinux.sourceforge.net

%package dev
Group: Development/Libraries
Summary: Header files, static library and manual pages for libcorelinux
Requires: libcorelinux = %{version}

%description dev
OOA and OOD for Linux development kit. 

This package provides the include files, the manpages
and the static library for development with corelinux.

OOA: Object Oriented Analysis
OOD: Object Oriented Design
check http://corelinux.sourceforge.net

%package doc
Group: Development/Libraries
Summary: Reference manual for libcorelinux
Requires: libcorelinux = %{version}

%description doc
OOA and OOD for Linux: reference manual.

This package provides the full reference manual in 
HTML, PS and PDF format.

HTML: /usr/doc/%{name}-doc-%{version}/html/index.html
  PS: /usr/doc/%{name}-doc-%{version}/corelinux-ref.ps.gz
 PDF: /usr/doc/%{name}-doc-%{version}/corelinux-ref.pdf.gz

OOA: Object Oriented Analysis
OOD: Object Oriented Design
check http://corelinux.sourceforge.net

%package examples
Group: Development/Libraries
Summary: Examples for libcorelinux
Requires: libcorelinux = %{version}

%description examples
OOA and OOD for Linux: examples. 

This package provides examples for corelinux.

OOA: Object Oriented Analysis
OOD: Object Oriented Design
check http://corelinux.sourceforge.net


%prep
%setup -q
./autorun.sh

%build
./configure
make -j 2

# create the reference manual
(rm -rf doc/html  doc/man && cd doc && doxygen corelinux.cfg)
#(cd doc/latex && for i in *.eps; do epstopdf $i; done)
#(mkdir doc/ps)
#(mkdir doc/pdf)
#(cd doc/latex && make pdf && mv refman.pdf ../pdf/corelinux-ref.pdf && mv refman.ps ../ps/corelinux-ref.ps)
#(gzip doc/ps/corelinux-ref.ps)
#(gzip doc/pdf/corelinux-ref.pdf)

# the manual pages
(mkdir -p $RPM_BUILD_ROOT%{prefix}/man/man3)
(cp -r doc/man/* $RPM_BUILD_ROOT%{prefix}/man/man3)

# the examples
(mkdir -p examples)
(find src/testdrivers -name "*.[ch]*[pp]*" | xargs -ifilename cp filename examples)
(perl debian/genmake.pl examples)
(for i in examples/*; do gzip $i; done)

%install

# install all the stuff
(cd corelinux && make install prefix=$RPM_BUILD_ROOT%{prefix}  includedir=$RPM_BUILD_ROOT%{prefix}/include/corelinux)
(cd src/classlibs && make install prefix=$RPM_BUILD_ROOT%{prefix}  includedir=$RPM_BUILD_ROOT%{prefix}/include/corelinux)
(/bin/sh admin/mkinstalldirs $RPM_BUILD_ROOT%{prefix}/man/man3 )
(cd doc/man/man3 && cp *.3 $RPM_BUILD_ROOT%{prefix}/man/man3/)

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
# remove BuildRoot
rm -rf $RPM_BUILD_ROOT
# we are in /usr/src/redhat/BUID/%{name}-%{version} and we want to delete it
cd .. && rm -rf %{name}-%{version}

%files
%defattr(-,root,root)
%doc AUTHORS COPYING COPYING.LIB README NEWS ChangeLog  README.emacs debian/README.Redhat
%attr(755,root,root) %{_libdir}/%{lib_name}.so*

%files dev
%defattr(-,root,root)
%{_includedir}/corelinux/*
%{_libdir}/%{lib_name}.a
%{_libdir}/%{lib_name}.la
%{_mandir}/man3/*.3.gz
%doc debian/README.Redhat

%files doc
%defattr(-,root,root)
#%doc doc/html doc/ps doc/pdf
%doc doc/html 
%doc debian/README.Redhat

%files examples
%defattr(-,root,root)
%doc examples debian/README.examples debian/README.Redhat
 
%changelog
* Fri Jan 12 2001 Christophe Prud'homme <prudhomm@mit.edu> @CORELINUX_VERSION@-1
- removed ps and pdf generation for the reference manual

* Thu Jul  27 2000  Christophe Prud'homme <prudhomm@users.sourceforge.net>
- initial
