File scheme48.spec of Package scheme48

#------------------------------------------------------------------------------
#   a spec file for scheme48
#------------------------------------------------------------------------------

Name:       scheme48
Version:    1.8
Release:    1
Summary:    Scheme 48 is an implementation of R5RS Scheme
Group:      Development/Languages/Scheme
License:    BSD or BSD style
URL:        http://s48.org/
Source:     http://s48.org/%{version}/%{name}-%{version}.tar.bz2
Patch0:     scheme48-destdir.patch
Patch1:     scheme48-implicit-fortify-decl.patch
Patch2:     scheme48-no-return-in-nonvoid-function.patch
Patch3:     scheme48-asneeded.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-build

BuildRequires: emacs-nox
Requires:   %{name}-vm = %{version}

#------------------------------------------------------------------------------
#   Description
#------------------------------------------------------------------------------
%description
Scheme 48 is an implementation of the Scheme programming language as described
in the Revised5 Report on the Algorithmic Language Scheme. It is based on a
compiler and interpreter for a virtual Scheme machine. Scheme 48 tries to be
faithful to the Revised5 Scheme Report, providing neither more nor less in
the initial user environment.

%package vm
Summary:	Virtual Machine for Scheme48
Group:		System/Libraries

%description vm
Core files of Scheme48 without development environment.

%package devel
Summary:	Virtual Machine for Scheme48
Group:		Development/Languages/Scheme
Requires:       %name = %version

%description devel
A devel files for %{name} and %{name}-prescheme. This includes a header files,
libprescheme.a and %{name}-config.

%package doc
Summary:	Documentation for Scheme48
Group:		Development/Languages/Scheme

%description doc
Documentation for Scheme48 VM and interpreter

%package prescheme
Summary:	PreScheme compiler
Group:		Development/Languages/Scheme
Requires:	%name = %version

%description prescheme
Pre-Scheme is a low-level dialect of Scheme, designed for systems programming
with higher-level abstractions. For example, the Scheme48 virtual machine is
written in Pre-Scheme. Pre-Scheme is a particularly interesting alternative to
C for many systems programming tasks, because not only does it operate at about
the same level as C, but it also may be run in a regular high-level Scheme
development with no changes to the source, without resorting to low-level stack
munging with tools such as gdb. Pre-Scheme also supports two extremely
important high-level abstractions of Scheme: macros and higher-order, anonymous
functions. Richard Kelsey's Pre-Scheme compiler, based on his PhD research on
transformational compilation, compiles Pre-Scheme to efficient C, applying
numerous intermediate source transformations in the process.

%package -n emacs-scheme48
Summary:	CMUScheme48 emacs mode
Group:		Productivity/Editors/Emacs
Requires:	%name = %version, emacs-common

%description -n emacs-scheme48
Scheme process in a buffer.  Adapted from cmuscheme.el

#------------------------------------------------------------------------------
#   install scripts
#------------------------------------------------------------------------------
%prep
%setup -q
%patch0
%patch1
%patch2
%patch3

%build
%{configure}
make %{?jobs:-j%jobs} LD=gcc

pushd ps-compiler
../go -h 20000000 -a batch << EOF
,config ,load ../scheme/prescheme/interface.scm
,config ,load ../scheme/prescheme/package-defs.scm
,exec ,load load-ps-compiler.scm
,in prescheme-compiler prescheme-compiler
,user (define prescheme-compiler ##)
,dump ../ps-compiler.image "(Pre-Scheme)"
,exit
EOF
popd
ar cru libprescheme.a c/unix/misc.o c/unix/fd-io.o c/unix/io.o
ranlib libprescheme.a
emacs -q -no-site-file -batch -eval "(byte-compile-file \"emacs/cmuscheme48.el\")"

%install
make DESTDIR=%{buildroot} mandir=%{_mandir}/man1 install

cat > %{buildroot}/%{_bindir}/prescheme << EOF
#!/bin/sh

LIB=%{_libdir}/%{name}-%{version}
exec \$LIB/scheme48vm -i \$LIB/ps-compiler.image -h 20000000 "\$@"
EOF
chmod a+x %{buildroot}/%{_bindir}/prescheme

install -m644 ps-compiler.image %{buildroot}/%{_libdir}/%{name}-%{version}/ps-compiler.image
install -m644 c/{prescheme,io}.h %{buildroot}/%{_includedir}/
install -m644 libprescheme.a %{buildroot}/%{_libdir}/libprescheme.a
mkdir -p %{buildroot}/%{_datadir}/emacs/site-lisp
install -m644 emacs/cmuscheme48.el* %buildroot/%{_datadir}/emacs/site-lisp
ln -sf ../../%{_libdir}/%{name}-%{version}/%{name}vm $RPM_BUILD_ROOT/%{_bindir}/%{name}vm

%clean
rm -rf $RPM_BUILD_ROOT

#------------------------------------------------------------------------------
#   Files listing.
#------------------------------------------------------------------------------
%files
%defattr(-,root,root,0755)
%{_bindir}/*
%exclude %{_bindir}/%{name}-config
%exclude %{_bindir}/%{name}vm
%{_libdir}/%{name}-%{version}
%exclude %{_libdir}/%{name}-%{version}/%{name}vm
%{_datadir}/%{name}-%{version}
%{_mandir}/man1/%{name}.1.gz

%files vm
%defattr(-,root,root,0755)
%{_bindir}/%{name}vm
%{_libdir}/%{name}-%{version}/%{name}vm

%files doc
%defattr(-,root,root,0755)
%doc doc/*.txt doc/html/ doc/*.pdf doc/*.ps

%files devel
%defattr(-,root,root,0755)
%{_includedir}/*.h
%{_includedir}/%{name}-external.exp
%{_includedir}/%{name}.def
%{_includedir}/%{name}.exp
%{_bindir}/%{name}-config
%{_libdir}/libprescheme.a

%files prescheme
%defattr(-,root,root,0755)
%{_bindir}/prescheme
%{_libdir}/%{name}-%{version}/ps-compiler.image

%files -n emacs-scheme48
%defattr(-,root,root,0755)
%dir %{_datadir}/emacs/site-lisp
%{_datadir}/emacs/site-lisp/*

#------------------------------------------------------------------------------
#   Change Log
#------------------------------------------------------------------------------
%changelog
openSUSE Build Service is sponsored by