File slib.spec of Package slib

#
# spec file for package slib (Version 3b3)
#
# Copyright (c) 2010 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/
#

# norootforbuild


Name:           slib
License:        PERMISSIVE-OSI-COMPLIANT
Group:          Development/Languages/Scheme
Provides:       scheme:/usr/lib/scheme/slib/umbscheme.init
PreReq:         %install_info_prereq
PreReq:         guile coreutils
AutoReqProv:    on
Version:        3b3
Release:        1
Summary:        Portable Scheme Library
Url:            http://swissnet.ai.mit.edu/~jaffer/SLIB.html
Source:         %{name}-%{version}.tar.bz2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
SLIB is a portable Scheme library providing compatibility and utility
functions for all standard Scheme implementations.



Authors:
--------
    William R. Campbell <bill@cs.umb.edu>

%prep
%setup -q -n slib

%build

%install
install -m 755 -d $RPM_BUILD_ROOT/usr/share/slib/
install -m 755 -d $RPM_BUILD_ROOT/%{_infodir}/
install -m 644 *.scm *.init $RPM_BUILD_ROOT/usr/share/slib/
install -m 644 slib.info* $RPM_BUILD_ROOT%{_infodir}/

%clean
rm -rf $RPM_BUILD_ROOT

%triggerin -- guile
# install guile library
# We need new guile for registration, see "Incompatible change in guile 1.8.2".
# During update must be slib-3a5 installed first (See Conflits: slib < 3a5 in guile.spec)
# because of %triggerin in slib, 3a1 for example, though.
if [ -d usr/share/guile/site ] ; then
  GUILE_VERSION=`guile -c "(display (version))" | sed "s:\.::g"`
  # guile is instaled
  if [ $GUILE_VERSION -ge 182 ]; then
    # we have guile >= 1.8.2
    if [ ! -e usr/share/guile/site/slib ] ; then
      # link slib library into guile
      ln -sf ../../slib usr/share/guile/site/slib
    fi
    usr/bin/guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)"
  fi
fi
exit 0

%triggerpostun -- guile
# Delete slib library files, only if guile was uninstalled.
if ! test -e usr/bin/guile ; then
    rm -f usr/share/guile/site/slib
    rm -f usr/share/guile/site/slibcat
    rmdir --ignore-fail-on-non-empty usr/share/guile/site
    rmdir --ignore-fail-on-non-empty usr/share/guile
fi
exit 0

%post
%install_info --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
# install guile library
# We need new guile for registration, see "Incompatible change in guile 1.8.2".
# During update must be slib-3a5 installed first (See Conflits: slib < 3a5 in guile.spec)
# because of %triggerin in slib, 3a1 for example, though.
if [ -d usr/share/guile/site ] ; then
  GUILE_VERSION=`guile -c "(display (version))" | sed "s:\.::g"`
  # guile is instaled
  if [ $GUILE_VERSION -ge 182 ]; then
  # we have guile >= 1.8.2
    if [ ! -e usr/share/guile/site/slib ] ; then
      # link slib library into guile
      ln -sf ../../slib usr/share/guile/site/slib
    fi
    usr/bin/guile -c "(use-modules (ice-9 slib)) (require 'new-catalog)"
  fi
fi

%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/%{name}.info.gz
# Delete guile library, only if slib or guile was uninstalled.
if ! test -d usr/share/slib -a -d usr/share/guile/site ; then
    rm -f usr/share/guile/site/slib
    rm -f usr/share/guile/site/slibcat
fi

%files
%defattr(-,root,root)
%doc ANNOUNCE COPYING ChangeLog FAQ README
%doc %{_infodir}/*
%{_datadir}/slib

%changelog