r11233: convert from sb-executable to save-lisp-and-die
authorKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 19 Oct 2006 03:17:58 +0000 (03:17 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Thu, 19 Oct 2006 03:17:58 +0000 (03:17 +0000)
INSTALL
Makefile
debian/changelog
debian/control
debian/rules
kmrcl-excerpt.lisp
loader.lisp [deleted file]
vcs-tree [new file with mode: 0755]
vcs-tree.asd

diff --git a/INSTALL b/INSTALL
index 153a2f1c0261bb37106602b50b0b4189883d954c..05e902ad829fd1411e5ee15c91e6547550a43489 100644 (file)
--- 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.
index eb0629eee52a0a93bfc8ba20f4d058f754dd34b4..7e02ade5cf2f6796ca372bf1f4ed92f12c25aab1 100644 (file)
--- a/Makefile
+++ b/Makefile
 
 
 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)
index 40c42026219518609afd9b47610f9839e61124b4..172fdfdd01a643390f4ed479531df555401fd314 100644 (file)
@@ -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 <kmr@debian.org>  Wed, 18 Oct 2006 19:19:13 -0600
+
 vcs-tree (0.2.2-4) unstable; urgency=low
 
   * Change architecture to any
index e439a31be60212b241524bcf96e0c19cfdd4df68..3d45dbd7037e85d95cc0d24ce456ff9f75ecda10 100644 (file)
@@ -2,12 +2,12 @@ Source: vcs-tree
 Section: devel
 Priority: optional
 Maintainer: Kevin M. Rosenberg <kmr@debian.org>
-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
index f9f80d2e639764ff35f25b80651e7daaebb1969e..c97a2f6213bba5cf52f5b69432d567cae7697852 100755 (executable)
@@ -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
index b3a225a3f3330223571940d867f3addcf9717be1..9a74e8cda31f8417a67cd539a01eff4c28c4622c 100644 (file)
@@ -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)))
 (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 (file)
index 7c1833b..0000000
+++ /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 (executable)
index 0000000..c576923
--- /dev/null
+++ b/vcs-tree
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+_vcs-tree --noinform $*
index 9022540226043ef2cf6276ef7e1492aa0469260f..f192bf7dc12c03e46da41c64874284fd24fdc8f1 100644 (file)
 ;;;; *************************************************************************
 
 (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)