通常,这些系统工具应该允许这样做。您所需要的只是系统描述和 FASL 文件。然后系统工具应使用 FASL 文件进行加载。只需要确保它对某些源文件没有硬依赖。
这种方式软件已经在 Lisp 世界中交付了数十年(> 30 年)。这种方法没有错。如果某个特定工具(此处为 ASDF,但还有其他工具)存在问题,则应向作者投诉。
如果您对此有实际问题,您应该在 ASDF 邮件列表上讨论它或在此处发布问题。你有实际问题吗?
这不会直接帮助您,但它可能会为您提供一些系统工具通常如何工作的提示。
LispWorks 6 及其自己的 DEFSYSTEM 示例
我们在 FOO 目录中有三个文件:
RJMBA:foo joswig$ ls -l
-rw-r--r-- 1 joswig admin 13 22 Jul 20:42 a.lisp
-rw-r--r-- 1 joswig admin 14 22 Jul 20:42 b.lisp
-rw-r--r-- 1 joswig admin 331 22 Jul 20:41 system.lisp
system.lisp 包含以下系统描述:
(defvar *foo-directory*
(make-pathname :name nil
:type nil
:directory (pathname-directory *load-pathname*)
:defaults *load-pathname*))
(defsystem foo (:default-pathname *foo-directory*)
:members ("a" "b"))
上面*foo-directory*
根据加载文件的路径名设置路径名。因此我们可以设置一个真正的绝对路径名,但不必手动指定它。或者,我们可以使用相对路径名——这取决于一个人想要使用什么。我选择这个来展示如何自动设置绝对路径名。
现在我将此文件加载到 LispWorks 中,然后编译系统:
CL-USER 12 > (compile-system 'foo)
;;; Compiling file /Lisp/foo/a.lisp ...
;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 1
;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3
;;; Source level debugging is on
;;; Source file recording is on
;;; Cross referencing is on
; (TOP-LEVEL-FORM 0)
; (TOP-LEVEL-FORM 1)
;; Processing Cross Reference Information
;;; Compiling file /Lisp/foo/b.lisp ...
;;; Safety = 3, Speed = 1, Space = 1, Float = 1, Interruptible = 1
;;; Compilation speed = 1, Debug = 2, Fixnum safety = 3
;;; Source level debugging is on
;;; Source file recording is on
;;; Cross referencing is on
; (TOP-LEVEL-FORM 0)
; (TOP-LEVEL-FORM 1)
;; Processing Cross Reference Information
(FOO)
我们创建了两个 fasl 文件。
现在我将 system.lisp 文件和 fasl 文件复制到一个新目录中:
RJMBA:Lisp joswig$ mkdir bar
RJMBA:Lisp joswig$ cp foo/system.lisp bar/system.lisp
RJMBA:Lisp joswig$ cp foo/a.64xfasl bar/a.64xfasl
RJMBA:Lisp joswig$ cp foo/b.64xfasl bar/b.64xfasl
现在我将在b
目录中启动一个新的 LispWorks,加载 system.lisp 文件,然后加载系统:
RJMBA:Lisp joswig$ cd bar
RJMBA:bar joswig$ lispworks
LispWorks(R): The Common Lisp Programming Environment
Copyright (C) 1987-2009 LispWorks Ltd. All rights reserved.
Version 6.0.0
User joswig on RJMBA.local
...
CL-USER 1 > (load "system.lisp")
; Loading text file /Lisp/bar/system.lisp
;; Creating system "FOO"
#P"/Lisp/bar/system.lisp"
CL-USER 2 > (load-system 'foo)
; Loading fasl file /Lisp/bar/a.64xfasl
"a" ; whatever the file does
; Loading fasl file /Lisp/bar/b.64xfasl
"b" ; whatever the file does
(FOO)
完成并工作。
此外,这可以通过相对目录或所谓的逻辑路径名来完成。逻辑路径名具有从某个路径名到物理路径名的映射,因此可以使用独立于系统的路径名——独立于体系结构、操作系统和目录结构。这为特定部署方案提供了额外的独立性。