]> git.pld-linux.org Git - packages/sbcl.git/commitdiff
- added common-lisp-controller support from Fedora
authorJakub Bogusz <qboosh@pld-linux.org>
Mon, 10 Oct 2016 15:06:56 +0000 (17:06 +0200)
committerJakub Bogusz <qboosh@pld-linux.org>
Mon, 10 Oct 2016 15:06:56 +0000 (17:06 +0200)
sbcl-install-clc.lisp [new file with mode: 0644]
sbcl.rc [new file with mode: 0644]
sbcl.sh [new file with mode: 0644]
sbcl.spec

diff --git a/sbcl-install-clc.lisp b/sbcl-install-clc.lisp
new file mode 100644 (file)
index 0000000..c75c3dc
--- /dev/null
@@ -0,0 +1,37 @@
+;;; -*- Mode: LISP; Package: CL-USER -*-
+;;;
+;;; Copyright (C) Peter Van Eynde 2001 and Kevin Rosenberg 2002-2003
+;;;
+;;; License: LGPL v2
+;;;
+(in-package "COMMON-LISP-USER")
+
+(handler-case
+    (load "/usr/share/common-lisp/source/common-lisp-controller/common-lisp-controller.lisp")
+  (error (e)
+    (format t "~%Error during load of common-lisp-controller.lisp: ~A~%" e)
+    (sb-unix:unix-exit 1)))
+
+(handler-case
+    (common-lisp-controller:init-common-lisp-controller-v4 "sbcl")
+  (error (e)
+    (format t "~%Error running init-common-lisp-controller-v4: ~A~%" e)
+    (sb-unix:unix-exit 1)))
+
+(when (probe-file #p"/etc/lisp.config")
+  (load #p"/etc/lisp.config"))
+
+(setf (logical-pathname-translations "SYS")
+      '(("SYS:**;*.*.*"
+         #P"/usr/share/sbcl-source/**/*.*")))
+
+(set-dispatch-macro-character #\# #\!
+  (lambda (stream bang arg)
+    (declare (ignore bang arg))
+    (read-line stream)
+    (values)))
+
+(ignore-errors
+ (format t "~%Saving to sbcl-new.core...")
+ (sb-ext:gc :full t)
+ (sb-ext:save-lisp-and-die "sbcl-new.core"))
diff --git a/sbcl.rc b/sbcl.rc
new file mode 100644 (file)
index 0000000..299d5f5
--- /dev/null
+++ b/sbcl.rc
@@ -0,0 +1,7 @@
+;;; -*- Lisp -*-
+;;; this file gets installed as /etc/sbcl.rc and run on every
+;;; invocation of sbcl
+
+(if (probe-file "/etc/lisp-config.lisp")
+    (load "/etc/lisp-config.lisp")
+    (format t "~%;;; Hey: there is no /etc/lisp-config.lisp file, please create one."))
diff --git a/sbcl.sh b/sbcl.sh
new file mode 100644 (file)
index 0000000..3b92ebf
--- /dev/null
+++ b/sbcl.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+if [ ! -f /usr/share/common-lisp/source/common-lisp-controller/common-lisp-controller.lisp ] ; then
+  cat <<EOF
+OF
+$0: cannot find the common-lisp-controller source.
+EOF
+  exit 0
+fi
+
+build_error()
+{
+    echo "Build failure $1"
+    exit 1
+}
+
+if [ -f /etc/sbcl.rc ] ; then
+  RCFILE=/etc/sbcl.rc
+else
+  RCFILE=/dev/null
+fi
+
+case $1 in
+    install-clc)
+    echo $0 loading and dumping clc.
+    ( cd /usr/lib/sbcl
+         /usr/bin/sbcl \
+           --noinform --disable-ldb --disable-debugger \
+           --core /usr/lib/sbcl/sbcl-dist.core \
+          --sysinit ${RCFILE} --no-userinit \
+          --load "/usr/lib/sbcl/install-clc.lisp" # 2> /dev/null
+              (mv sbcl-new.core sbcl.core && touch sbcl.core --reference=sbcl-dist.core ) || (echo FAILED ; cp -a sbcl-dist.core sbcl.core ) )
+    ;;
+    remove-clc)
+    echo $0 removing clc-enabled image
+    cp -a /usr/lib/sbcl/sbcl-dist.core /usr/lib/sbcl/sbcl.core
+    ;;
+    rebuild)
+    echo $0 rebuilding...
+    shift
+    echo rebuilding $1
+    /usr/bin/sbcl \
+             --noinform --disable-ldb --disable-debugger \
+             --sysinit ${RCFILE} --no-userinit \
+             --eval \
+"(handler-case
+     (progn
+       (asdf:operate 'asdf:compile-op (quote $1))
+       (sb-unix:unix-exit 0))
+    (error (e)
+      (ignore-errors (format t \"~&Build error: ~A~%\" e))
+      (finish-output)
+      (sb-unix:unix-exit 1)))" || build_error
+    ;;
+     remove)
+    echo $0 removing packages...
+    shift
+    while [ ! -z "$1" ] ; do
+rm -rf "/var/cache/common-lisp-controller/*/sbcl/${1}"
+shift
+     done
+    ;;
+    *)
+    echo $0 unkown command $1
+    echo known commands: rebuild, remove, install-clc, and remove-clc
+    exit 1
+    ;;
+esac
+
+exit 0
index 8998a0984279e6f489f3ecdcf6d097d7cf254d29..d235e2b0a93054964dc644ef6f92d36248a5319d 100644 (file)
--- a/sbcl.spec
+++ b/sbcl.spec
@@ -3,6 +3,7 @@
 # Conditional build:
 %bcond_without doc             # build without documentation
 %bcond_with    clisp           # build using clisp instead of sbcl
+%bcond_without cl_controller   # common-lisp-controller support
 #
 # To build with an unpackaged Common Lisp implementation,
 # pass --define bootstrap_cl /path/to/lisp/binary to builder.
@@ -16,6 +17,9 @@ License:      MIT
 Group:         Development/Languages
 Source0:       http://download.sourceforge.net/sbcl/%{name}-%{version}-source.tar.bz2
 # Source0-md5: c8bd43e149109127651a6917976dda4a
+Source1:       sbcl.sh
+Source2:       sbcl.rc
+Source3:       sbcl-install-clc.lisp
 Source10:      http://download.sourceforge.net/sbcl/sbcl-1.2.7-x86-linux-binary.tar.bz2
 # Source10-md5:        f6a1b2137fbc74b4a8aaf338643f4ae2
 Source11:      http://download.sourceforge.net/sbcl/sbcl-1.3.10-x86-64-linux-binary.tar.bz2
@@ -34,10 +38,15 @@ Patch1:             %{name}-threads.patch
 Patch2:                %{name}-info.patch
 URL:           http://sbcl.sourceforge.net/
 %{?with_clisp:BuildRequires:   clisp}
+%{?with_cl_controller:BuildRequires:   common-lisp-controller}
 %if %{with doc}
 BuildRequires: tetex-dvips
 BuildRequires: texinfo-texi2dvi
 %endif
+%if %{with cl_controller}
+Requires(post,preun):  common-lisp-controller
+Requires:      common-lisp-controller
+%endif
 %if %{without clisp}
 %{!?bootstrap_cl:ExclusiveArch:        %{ix86} %{x8664}}
 # also: %{arm} aarch64 alpha mips mipsel ppc sparc
@@ -144,15 +153,33 @@ env -u SBCL_HOME INSTALL_ROOT=`pwd`/_install %{_buildshell} ./install.sh
 
 echo SBCL_HOME=%{_libdir}/%{name} > $RPM_BUILD_ROOT/etc/env.d/SBCL_HOME
 
+%if %{with cl_controller}
+install -d $RPM_BUILD_ROOT{/usr/lib/common-lisp/bin,%{_sysconfdir}}
+%{__sed} -e 's,/usr/lib/sbcl,%{_libdir}/%{name},g' %{SOURCE1} >$RPM_BUILD_ROOT/usr/lib/common-lisp/bin/sbcl.sh
+install -Dp %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sbcl.rc
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_libdir}/%{name}/install-clc.lisp
+%{__mv} $RPM_BUILD_ROOT%{_libdir}/%{name}/sbcl.core $RPM_BUILD_ROOT%{_libdir}/%{name}/sbcl-dist.core
+touch $RPM_BUILD_ROOT%{_libdir}/%{name}/sbcl.core
+%endif
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
 %env_update
+%if %{with common_lisp_controller}
+/usr/sbin/register-common-lisp-implementation sbcl >/dev/null 2>&1 ||:
+%endif
 
 %postun
 %env_update
 
+%if %{with common_lisp_controller}
+if [ $1 -eq 0 ]; then
+    /usr/sbin/unregister-common-lisp-implementation sbcl >/dev/null 2>&1 ||:
+endif
+%endif
+
 %if %{with doc}
 %post doc-info -p /sbin/postshell
 -/usr/sbin/fix-info-dir -c %{_infodir}
@@ -165,9 +192,19 @@ rm -rf $RPM_BUILD_ROOT
 %defattr(644,root,root,755)
 %doc _install/share/doc/sbcl/{BUGS,COPYING,CREDITS,NEWS}
 %attr (755,root,root) %{_bindir}/sbcl
-%{_libdir}/%{name}
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/contrib
 %{_mandir}/man1/sbcl.1*
 %config(noreplace,missingok) %verify(not md5 mtime size) /etc/env.d/SBCL_HOME
+%if %{with cl_controller}
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/sbcl.rc
+%attr(744,root,root) /usr/lib/common-lisp/bin/sbcl.sh
+%{_libdir}/%{name}/install-clc.lisp
+%{_libdir}/%{name}/sbcl-dist.core
+%ghost %{_libdir}/%{name}/sbcl.core
+%else
+%{_libdir}/%{name}/sbcl.core
+%endif
 
 %if %{with doc}
 %files doc-info
This page took 0.098887 seconds and 4 git commands to generate.