From f3b2183bff9f8e1d3dfc13abd55593649eebf652 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Thu, 19 Oct 2006 03:17:58 +0000 Subject: [PATCH] r11233: convert from sb-executable to save-lisp-and-die --- INSTALL | 11 +++++++---- Makefile | 8 ++++---- debian/changelog | 8 ++++++++ debian/control | 6 +++--- debian/rules | 11 ++++++----- kmrcl-excerpt.lisp | 14 +++++++------- loader.lisp | 24 ------------------------ vcs-tree | 3 +++ vcs-tree.asd | 44 ++++++++++++++++++-------------------------- 9 files changed, 56 insertions(+), 73 deletions(-) delete mode 100644 loader.lisp create mode 100755 vcs-tree diff --git a/INSTALL b/INSTALL index 153a2f1..05e902a 100644 --- a/INSTALL +++ b/INSTALL @@ -1,8 +1,11 @@ -This program requires the SBCL Common Lisp system (http://www.sbcl.org) -to compile and run. Because of its use of a new feature in the -sb-executable module, vcs-tree requires SBCL version 0.8.3.55 or greater. +This program requires the SBCL Common Lisp system +(http://www.sbcl.org) to compile. Because of its use of a new feature +of SBCL, "(save-lisp-and-die :executable t)", vcs-tree requires SBCL +version 0.9.4 or greater to compile Once you have SBCL installed on your system, you can give the command make -which will create the executable file "vcs-tree". You can then copy +which will create the executable file "_vcs-tree". You can then copy that file to any directory in your path, such as /usr/local/bin/ +Additionally, the small shell wrapper "vcs-tree" can be used and copied to +a directory of binaries along with _vcs-tree. diff --git a/Makefile b/Makefile index eb0629e..7e02ade 100644 --- a/Makefile +++ b/Makefile @@ -11,11 +11,11 @@ pkg :=vcs-tree -sources :=$(pkg).asd main.lisp loader.lisp package.lisp kmrcl-excerpt.lisp +sources :=$(pkg).asd $(wildcard *.lisp) -$(pkg): $(sources) +_$(pkg): $(sources) $(MAKE) clean - /usr/bin/sbcl --userinit /dev/null --eval "(require 'asdf)" --load "$(pkg).asd" --eval "(asdf:operate 'asdf:load-op '$(pkg))" --eval "(sb-ext:quit :unix-status 0)" + /usr/bin/sbcl --userinit /dev/null --eval "(require 'asdf)" --load vcs-tree.asd --eval "(asdf:operate 'asdf::load-op 'vcs-tree)" --eval "(vcs-tree-system:save-executable \"_vcs-tree\")" --eval "(sb-ext:quit :unix-status 0)" clean: - rm -f *.fasl $(pkg) + rm -f *.fasl _$(pkg) diff --git a/debian/changelog b/debian/changelog index 40c4202..172fdfd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +vcs-tree (0.3.0-1) unstable; urgency=low + + * Change from using fasl loading to using SBCL's new + (save-lisp-and-die :executable t) feature so that binaries don't + depend upon particular versions of SBCL fasls. + + -- Kevin M. Rosenberg Wed, 18 Oct 2006 19:19:13 -0600 + vcs-tree (0.2.2-4) unstable; urgency=low * Change architecture to any diff --git a/debian/control b/debian/control index e439a31..3d45dbd 100644 --- a/debian/control +++ b/debian/control @@ -2,12 +2,12 @@ Source: vcs-tree Section: devel Priority: optional Maintainer: Kevin M. Rosenberg -Build-Depends: debhelper (>> 4.0.0), sbcl (>= 0.8.3) -Standards-Version: 3.6.1.1 +Build-Depends: debhelper (>> 4.0.0), sbcl (>= 0.9.4) +Standards-Version: 3.7.1.1 Package: vcs-tree Architecture: any -Depends: ${shlibs:Depends}, sbcl (>= 0.8.3) +Depends: ${shlibs:Depends} Description: Version Control System Tree Walker vcs-tree walks through a directory tree and performs actions on CVS or Subversion directories. vcs-tree works differently than just using diff --git a/debian/rules b/debian/rules index f9f80d2..c97a2f6 100755 --- a/debian/rules +++ b/debian/rules @@ -7,7 +7,6 @@ debpkg := vcs-tree bin-dir := usr/bin doc-dir := usr/share/doc/$(debpkg) - configure: configure-stamp configure-stamp: dh_testdir @@ -20,7 +19,7 @@ build: build-stamp build-stamp: configure-stamp dh_testdir # Add here commands to compile the package. - $(MAKE) ${pkg} + $(MAKE) _${pkg} touch build-stamp clean: @@ -38,7 +37,8 @@ install: build dh_clean -k # Add here commands to install the package into debian/xlunit. dh_installdirs $(bin-dir) - dh_install ${pkg} $(bin-dir) + dh_install $(pkg) $(bin-dir) + dh_install _$(pkg) $(bin-dir) # Build architecture-independent files here. binary-indep: build install @@ -58,11 +58,12 @@ binary-arch: build install # dh_installmime # dh_installinit # dh_installcron - dh_installman ${pkg}.1 + dh_installman $(pkg).1 # dh_installinfo # dh_undocumented dh_installchangelogs - dh_strip + # don't strip sbcl binary or will remove vcs-tree code + dh_strip -X_$(pkg) dh_compress dh_fixperms # dh_makeshlibs diff --git a/kmrcl-excerpt.lisp b/kmrcl-excerpt.lisp index b3a225a..9a74e8c 100644 --- a/kmrcl-excerpt.lisp +++ b/kmrcl-excerpt.lisp @@ -16,8 +16,8 @@ "Opens a reads a file. Returns the contents as a list of strings" (let ((lines '())) (with-open-file (in file :direction :input) - (let ((eof (gensym))) - (do ((line (read-line in nil eof) + (let ((eof (gensym))) + (do ((line (read-line in nil eof) (read-line in nil eof))) ((eq line eof)) (push line lines))) @@ -80,7 +80,7 @@ new-dir) :name nil :type nil :version nil :defaults path) path)))) - + (defun probe-directory (filename) (let ((path (canonicalize-directory-name filename))) @@ -153,15 +153,15 @@ (defun shell-command-output (cmd &key directory whole) #+allegro (excl.osi:command-output cmd :directory directory :whole whole) #+sbcl - (let* ((out (make-array '(0) :element-type 'base-char :fill-pointer 0 + (let* ((out (make-array '(0) :element-type 'character :fill-pointer 0 :adjustable t)) - (err (make-array '(0) :element-type 'base-char :fill-pointer 0 + (err (make-array '(0) :element-type 'character :fill-pointer 0 :adjustable t)) - (status + (status (sb-impl::process-exit-code (with-output-to-string (out-stream out) (with-output-to-string (err-stream err) - (sb-ext:run-program + (sb-ext:run-program "/bin/sh" (list "-c" cmd) :input nil :output out-stream :error err-stream)))))) diff --git a/loader.lisp b/loader.lisp deleted file mode 100644 index 7c1833b..0000000 --- a/loader.lisp +++ /dev/null @@ -1,24 +0,0 @@ -;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Package: cl-user -*- -;;;; ************************************************************************* -;;;; FILE IDENTIFICATION -;;;; -;;;; Name: loader.lisp -;;;; Purpose: loads any required modules, contains RUN function -;;;; Programmer: Kevin M. Rosenberg -;;;; Date Started: Sep 2003 -;;;; -;;;; $Id$ -;;;; ************************************************************************* - -(in-package :cl-user) - -;;; Nothing to load since the executable contains all of the required -;;; fasls - - -(defun run () - (handler-case - (funcall #'vcs-tree::main (list* "vcs-tree" (cdr *posix-argv*))) - (error (c) - (format *error-output* "vcs-tree failed due to error:~% ~A~%" c) - (sb-ext:quit :unix-status 1)))) diff --git a/vcs-tree b/vcs-tree new file mode 100755 index 0000000..c576923 --- /dev/null +++ b/vcs-tree @@ -0,0 +1,3 @@ +#!/bin/sh + +_vcs-tree --noinform $* diff --git a/vcs-tree.asd b/vcs-tree.asd index 9022540..f192bf7 100644 --- a/vcs-tree.asd +++ b/vcs-tree.asd @@ -11,38 +11,30 @@ ;;;; ************************************************************************* (in-package cl-user) -(defpackage vcs-tree-system (:use #:cl #:asdf)) +(defpackage vcs-tree-system + (:use #:cl #:asdf) + (:export save-executable)) (in-package vcs-tree-system) -(require 'sb-executable) - -;;; From asdf-install.asd -(defclass exe-file (cl-source-file) ()) -(defmethod perform :after ((o compile-op) (c exe-file)) - (sb-executable:make-executable - (make-pathname :name "vcs-tree" - :type nil - :defaults (component-pathname c)) - (mapcar - #'(lambda (n) - (make-pathname :name n :type "fasl" - :defaults (car (output-files o c)))) - '("package" "kmrcl-excerpt" "getopt-excerpt" "main" "loader")) - :initial-function "RUN")) - -(defmethod perform ((o load-op) (c exe-file)) nil) +(defun save-executable (&optional (fname "_vcs-tree")) + (setq cl:*print-pretty* nil) + (sb-ext:save-lisp-and-die + fname + :executable t + :toplevel (lambda () + (handler-case + (funcall (intern (symbol-name '#:main) + (find-package (symbol-name '#:vcs-tree))) + (list* "vcs-tree" (cdr sb-ext:*posix-argv*))) + (error (c) + (format *error-output* "vcs-tree failed due to error:~% ~A~%" c) + (sb-ext:quit :unix-status 1))) + (sb-ext:quit :unix-status 0)))) (defsystem vcs-tree - :version "0.1" + :version "0.3" :components ((:file "package") - (:exe-file "loader" :depends-on ("main")) (:file "kmrcl-excerpt" :depends-on ("package")) (:file "getopt-excerpt" :depends-on ("package")) (:file "main" :depends-on ("kmrcl-excerpt" "getopt-excerpt")))) - -(defmethod perform :after ((o load-op) (c (eql (find-system :vcs-tree)))) - (provide 'vcs-tree)) - -(defmethod perform ((o test-op) (c (eql (find-system :vcs-tree)))) - t) -- 2.34.1