How to use quicklisp when CL program is invoked as a shell script?

前端 未结 2 1752
日久生厌
日久生厌 2021-02-04 06:21

I am currently have a small program in Common Lisp, which I want to run as a shell script. I am using the SBCL and perfectly fine with this so will prefer to stay on this platfo

2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-04 06:38

    Creating a dedicated version of core image is a good option. You may:

    1. load quicklisp and sb-ext:save-lisp-and-die in a new image. You write a shell/bat script named, say qlsbcl, like this:

      sbcl --core  "$@"
      
    2. grab clbuild2 at http://gitorious.org/clbuild2 and run clbuild lisp. You'll have to symlink clbuild to a binary directory in your path and tweak some scripts a bit if your quicklisp is not in the common place ~/quicklisp (https://gist.github.com/1485836) or if you use ASDF2 (https://gist.github.com/1621825). By doing so, clbuild create a new core with quicklisp, ASDF and anything you may add in conf.lisp. Now the shebang may look like this:

      #!/usr/bin/env sbcl --noinform --core /sbcl-base.core --script
      

    The advantage of clbuild is that you may easily create and manage core and quicklisp installation from shell for sbcl (by default) or any other modern CL like ccl64 implementation. Mixing the two techniques (script and clbuild) will solve your problem.

提交回复
热议问题