%define guile_mver	1.8

Summary:      Platform independent library for scheme
Summary(ja):	プラットフォームに依存しない sheme ライブラリ
Name:         slib
Version:      3b1
Release:      1%{?_dist_release}
License:      SLIB
Group:        Development/Languages
BuildArch:    noarch
Source0:      http://swiss.csail.mit.edu/ftpdir/scm/slib-%{version}.zip
Patch1:       slib-3b1-guile.patch
URL:          http://swissnet.ai.mit.edu/~jaffer/SLIB.html
BuildRoot:    %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
PreReq:	      guile
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info

%description
"SLIB" is a portable library for the programming language Scheme.
It provides a platform independent framework for using "packages" of
Scheme procedures and syntax.  As distributed, SLIB contains useful
packages for all Scheme implementations.  Its catalog can be
transparently extended to accommodate packages specific to a site,
implementation, user, or directory.

%prep
%setup -q -n %{name}
%patch1 -p1 -b .guile
sed -r -i "s,/usr/(local/)?lib/slib,%{_datadir}/slib,g" *.init

%build

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/slib
cp *.scm *.init *.xyz *.txt *.dat *.ps ${RPM_BUILD_ROOT}%{_datadir}/slib
mkdir -p ${RPM_BUILD_ROOT}%{_infodir}
install -m644 slib.info ${RPM_BUILD_ROOT}%{_infodir}

# create sym link to work with guile
mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/guile/%{guile_mver}
pushd ${RPM_BUILD_ROOT}%{_datadir}/guile/%{guile_mver}
ln -s ../../slib ${RPM_BUILD_ROOT}%{_datadir}/guile/%{guile_mver}/slib
popd

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
/sbin/install-info %{_infodir}/slib.info.gz %{_infodir}/dir
:

# build guile catalog
/usr/bin/guile -c "((use-modules (ice-9 slib))(require 'new-catalog)(quit))"

%preun
if [ "$1" = 0 ]; then
    /sbin/install-info --delete %{_infodir}/slib.info.gz %{_infodir}/dir
fi
:

%files
%defattr(-,root,root)
%dir %{_datadir}/slib
%doc ANNOUNCE README COPYING FAQ ChangeLog
%{_datadir}/slib/*
%{_infodir}/slib.*
%{_datadir}/guile/%{guile_mver}/slib
%changelog
* Mon Jan 12 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 3b1-1
- initial build for Vine Linux based on fedora development
- create sym link to work with guile
- update guile catalog in %%post

* Thu Feb 14 2008 Miroslav Lichvar <mlichvar@redhat.com> 3b1-1
- update to 3b1

* Wed Jan 09 2008 Miroslav Lichvar <mlichvar@redhat.com> 3a5-1
- update to 3a5
- replace slib paths only in .init files

* Fri Jun 22 2007 Miroslav Lichvar <mlichvar@redhat.com> 3a4-2
- fix summary and buildroot (#226421)

* Tue Jan 23 2007 Miroslav Lichvar <mlichvar@redhat.com> 3a4-1
- update to 3a4
- make scriptlets safer (#223717)

* Wed Jul 12 2006 Miroslav Lichvar <mlichvar@redhat.com> 3a3-2
- fix requires for install-info
- drop slibcat, include *.dat and grapheps.ps files

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 3a3-1.1
- rebuild

* Tue May 09 2006 Miroslav Lichvar <mlichvar@redhat.com> 3a3-1
- update to slib3a3
- install info, remove html
- fix typo in description (#189650)

* Mon Feb 27 2006 Miroslav Lichvar <mlichvar@redhat.com> 3a1-6
- spec cleanup

* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt

* Thu Sep  8 2005 Jindrich Novy <jnovy@redhat.com> 3a1-5
- regenerate slibcat to remove all links to umb-scheme
  to make gnucash work with slib
- don't ship slib.spec from the upstream tarball
- replace bogus links to /usr/lib
- don't ship unneeded files in slib directory
- add slib html documentation

* Thu Sep 08 2005 Florian La Roche <laroche@redhat.com> 3a1-4
- no need to provide slib for this package

* Tue Sep  6 2005 Jindrich Novy <jnovy@redhat.com> 3a1-3
- use _datadir instead of /usr/local/lib and don't use
  /usr/local prefix (#167490)

* Wed Dec  8 2004 Jindrich Novy <jnovy@redhat.com> 3a1-2
- remove symlinks creation for guile, it's done by guile itself

* Wed Oct  6 2004 Jindrich Novy <jnovy@redhat.com> 3a1-1
- new package
- original spec file from R. J. Meier and Radey Shouman
