[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Question about packaging a Lisp image




On Wed 14 Jul 2021 01:10:36 PM EDT, Sébastien Villemot <sebastien@debian.org> wrote:
[Sorry, resending with proper quoting; my email client somehow messed things up]

Hi Douglas,

Le dimanche 11 juillet 2021 à 17:08 +0000, Torrance, Douglas a écrit :

I would like to package bergman [1], a Common Lisp program for computations in
noncommutative algebra.

Upstream's build script creates an executable by generating an image with
SAVEINITMEM.  However, in order for some of the features of bergman to work
properly, the source files must be present, and in the same location as they
were during build time, at runtime.  So generating the image while building the
binary package won't work, as then at runtime we'd be looking for some
non-existent directory from the buildd machines.  (Not to mention the
reproducibility issues from having these paths hardcoded in the image!)

One solution that I've come up with is to just have the Debian package install
the necessary source files, and then have the postinst script run the upstream
build script and generate the image right there on the user's system as part of
the installation process.

I'm very new to Common Lisp, so I'm not sure if this is the best strategy.  Is
there another method that would be recommended instead?

First, note that Common Lisp is a standard, which has different
implementations. In Debian, we have 5 of them, the most important ones
being SBCL, ECL and CLISP.¹

My understanding is that Bergman uses CLISP as its reference
implementation. This is a rather slow Common Lisp implementation, but
it is well-supported in Debian. SBCL is a much faster implementation,
but I don’t know if Bergman works with it (at the very least you would
have to modify the build system).

Applications programmed in Common Lisp typically ship the lisp image in
the binary package. See for example xindy², which also uses CLISP. See
also pgloader³, that uses SBCL (and relies on buildapp⁴ for creating
the executable from the lisp image).

So the ideal solution would still be to patch Bergman in a way that
allows it to work with sources under a standard location (typically
/usr/share/common-lisp/source/bergman/).

If that’s not possible, then you could do as you suggest: only ship the
sources in the binary package (under the location mentioned above), and
build the lisp image in the postinst script.

Note that most Common Lisp library packages only ship sources as well
(under /usr/share/common-lisp/source/), but they don’t provide any lisp
image. These libraries are supposed to be loaded from implementations,
typically via ASDF, into the running lisp image.

I hope this clarifies a bit. Don’t hesitate to ask for further advice,
since the Common Lisp way of doings things can be disturbing at first
sight. In particular, I suggest that you go through the introductory
wiki page linked below.

Best,

¹ For more details on Common Lisp and Debian, see https://wiki.debian.org/CommonLisp
² https://tracker.debian.org/pkg/xindy
³ https://tracker.debian.org/pkg/pgloaderhttps://tracker.debian.org/pkg/buildapp

Thank you so much for all of this information!  I'll do some more work and see if it's possible to patch things and ship the lisp image in the package, but it's good to hear that the postinst option would work as well.

Thanks again!
Doug

Attachment: signature.asc
Description: PGP signature


Reply to: