Package gambit-bh: Specfile

Name: gambit-bh
Version: 20090817
Release: alt6
Summary: Module system abstraction for Gambit-C Scheme programming system
License: MIT
Group: Development/Scheme
URL: git://github.com/pereckerdal/blackhole.git

Packager: Paul Wolneykien <manowar@altlinux.ru>

BuildPreReq: gambit
Requires: gambit
Provides: %name(module) %name(lib)

Source: %name-%version.tar.gz

%description
Black Hole (BH) is a module system abstraction for Gambit-C Scheme
programming system providing recurring module file dependency compilation
and loading, including export of macros, for regular R5RS Scheme.

%prep
%setup -q

%build
sed -i -e "s|~~lib/modules|~~lib/blackhole|g" *.scm
install -d -m0755 %buildroot%{_libdir}/blackhole
install -m0644 *.scm %buildroot%{_libdir}/blackhole/
gsc build.scm
install -D -m0644 build.o1 %buildroot%{_libdir}/blackhole/build.o1

echo "Modules are installed into the ~~lib/blackhole directory." > README.ALT
echo "Startup file %{_libdir}/gambcext.scm is used to load BH." >> README.ALT
echo "Use gsc as usual and gsc -f to run without BH." >> README.ALT
echo "Use gsc -e '(prepend-module-dirs! "path1" "path2" ...)' to add" >> README.ALT
echo "more paths to be searched for module packages." >> README.ALT
echo "To use BH with gsi (load \"~~lib/blackhole/build\") explicitly." >> README.ALT

%post
cat - <<EOF >> %{_libdir}/gambcext.scm
;;; START %name-%version-%release
(if (with-exception-catcher
      (lambda (e) #f)
      (lambda () (and compile-file #t)))
    (load "~~lib/blackhole/build"))
;;; END %name-%version-%release
EOF
touch %{_libdir}/blackhole/build.o1

%postun
sed -i -n -e ":a /^;;; START %name-%version-%release/ bb" \
          -e "{p; n; ba}" \
          -e ":b /^;;; END %name-%version-%release/ {n; ba}" \
          -e "{n; bb}" \
    %{_libdir}/gambcext.scm

%files
%{_libdir}/blackhole
%doc LICENSE README README.ALT Black_Hole_Core.pdf

%changelog
* Wed Sep 09 2009 Paul Wolneykien <manowar@altlinux.ru> 20090817-alt6
- Includ %release markers in the gambcext.scm for proper package upgrade.

* Wed Sep 09 2009 Paul Wolneykien <manowar@altlinux.ru> 20090817-alt5
- Touch object files to prevent recompilation.

* Wed Sep 09 2009 Paul Wolneykien <manowar@altlinux.ru> 20090817-alt4
- Requires gambit.

* Tue Sep 08 2009 Paul Wolneykien <manowar@altlinux.ru> 20090817-alt3
- Add providings: %name(module) %name(lib).
- Suspend ns-table usage.

* Tue Sep 08 2009 Paul Wolneykien <manowar@altlinux.ru> 20090817-alt2
- Implement path list search for the package module resolver.
- Implement default module resolver.
- BH is loaded automatically on gsc start. Remove "bsc" wrapper.

* Mon Sep 07 2009 Paul Wolneykien <manowar@altlinux.ru> 20090817-alt1
- Initial release for ALTLinux.