File slib.spec of Package slib

#
# spec file for package slib
#
# Copyright (c) 2013 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:           slib
Provides:       scheme:/usr/lib/scheme/slib/umbscheme.init
PreReq:         %install_info_prereq
PreReq:         guile1 coreutils
Version:        3b4
Release:        0
Summary:        Portable Scheme Library
License:        SUSE-SLIB
Group:          Development/Languages/Scheme
Url:            http://swissnet.ai.mit.edu/~jaffer/SLIB.html
Source:         http://groups.csail.mit.edu/mac/ftpdir/scm/slib-%{version}.zip
# this is not upstreamable (bnc#754532):
Patch0:         remove-resene-colors.diff
BuildRequires:  unzip
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
%patch0 -p1

%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 -- guile1
# 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=`guile1 -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/guile1 -c "(use-modules (ice-9 slib)) (require 'new-catalog)"
  fi
fi
exit 0

%triggerpostun -- guile1
# Delete slib library files, only if guile1 was uninstalled.
if ! test -e usr/bin/guile1 ; 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 -o -e usr/bin/guile1 ] ; then
  GUILE_VERSION=`guile1 -c "(display (version))" | sed "s:\.::g"`
  # guile is instaled
  if [ $GUILE_VERSION -ge 182 ]; then
  # we have guile >= 1.8.2
    if [ ! -d usr/share/guile/site ] ; then
      # This is in orderd to fixup eventually removed guile/site folders
      # which could have happened due to bnc#780827.
      mkdir usr/share/guile/site
    fi
    if [ ! -e usr/share/guile/site/slib ] ; then
      # link slib library into guile
      ln -sf ../../slib usr/share/guile/site/slib
    fi
    usr/bin/guile1 -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
openSUSE Build Service is sponsored by