[Top][All Lists]

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

bug#32770: Packaging SLIME/SWANK as Common Lisp library

From: Andy Patterson
Subject: bug#32770: Packaging SLIME/SWANK as Common Lisp library
Date: Fri, 5 Oct 2018 00:56:52 -0400

Hi Pierre,

I've seen your later e-mail but I'd still like to answer some of your
questions here.

On Thu, 04 Oct 2018 10:37:08 +0200
Pierre Neidhardt <address@hidden> wrote:

> CC-ing Ludovic and Ricardo if they want to chime in.
> Thanks for the feedback, Andy, so invaluable as always.
> > I've been using a cffi consumer for a while now, and my approach for
> > that package was to update references to library and header files
> > with the full paths to their respective store items.  
> Cool!  Can you share this package?  Or provide an example?
> Can't wait to get this up and running!

Sure, I'll append it.

> > Adding to *foreign-library-directories* at compile time may allow a
> > package to compile, but I get the feeling that it may not have the
> > desired effect when you try to load the package later on.  
> Why?  In my experience it works for a compiled Next executable.

I assume that you created this executable by saving the lisp image?  If
that's the case, then it probably saved your
*foreign-library-directories* with the values you added to it.  What
I'm considering is consumers of the libraries which should still work
if you load them from a fresh lisp session with no configuration.

I haven't looked into it yet but I don't think loading the library
would work in that case.

> > I guess another approach we could take if replacement is undesirable
> > would be to modify the cffi package to honour some environment
> > variable for its default, and then add that variable to the search
> > path for cffi.  
> The cffi:*foreign-library-directories* approach got recommended to me
> on the CFFI mailing list.  I find it similar to what you want, a sort
> of environment variable (a search-path global variable).  I haven't
> looked into Nix.
> > I personally tend to favour replacement, but others could chime in
> > here as well since this problem isn't specific to lisp packaging.  
> Could this be automated?  What I like with
> cffi:*foreign-library-directories* is that we could automatically push
>     (string-append (assoc-ref inputs "foo") "/lib)
> to it so that packages only have to write something like
>     #:cffi-packages (list ,cl-sqlite ,cl-foo...)

Based on what you've written here, I guess that you're thinking of
adding to the *foreign-library-directories* for the consumers of
cffi-based packages.  I thought you meant to do it for those packages
themselves.  I think that might require some packages to propagate the
c libraries that they depend on.

In terms of automating things, it might be possible to do something
with *foreign-library-directories* in the asd files that we generate.

To be honest though, I think the fact that replacement can't be
automated is more of a bug in the libraries' build tooling.  What I'm
thinking of is something like a configure script to set the library
paths before building is done.  I think there are some examples of
guile projects which do just that.  It might be something that we could
discuss with the lisp and asdf community.


I think this package might include some dependencies that aren't
upstreamed yet but it should provide the gist of it.

(define sbcl-cl-freetype2
  (let ((revision "1")
        (commit "5e4c9ff898f84c888f7e4bfb3402ee35abbf8ad9"))
      (name "sbcl-cl-freetype2")
      (version (string-append "1.1-" revision "." (string-take commit
7))) (source
         (method git-fetch)
           (url "https://github.com/rpav/cl-freetype2.git";)
           (commit commit)))
"0xmpswm65g5qq85n9nl5blqij2hw4nd4nc143nxhc77w49nf613d")) (file-name
(string-append "cl-freetype2-next-" version "-checkout"))))
      (build-system asdf-build-system/sbcl)
       `(("freetype" ,freetype)
         ("sbcl-alexandria" ,sbcl-alexandria)
         ("sbcl-cffi" ,sbcl-cffi)
         ("sbcl-trivial-garbage" ,sbcl-trivial-garbage)))
       `(("tests:cl-fiveam" ,sbcl-fiveam)
         ("asdf:cl-cffi-grovel" ,sbcl-cffi-grovel)))
         (modify-phases %standard-phases
           (add-after 'unpack 'fix-paths
             (lambda* (#:key inputs #:allow-other-keys)
               (define freetype (assoc-ref inputs "freetype"))
               (substitute* "src/ffi/ft2-lib.lisp"
                 (("libfreetype" all) (string-append
                                       freetype "/lib/" all)))
               (substitute* "src/ffi/grovel/grovel-freetype2.lisp"
                 (("/usr/include") (string-append freetype
"/include")))))))) (home-page "https://github.com/rpav/cl-freetype2";)
      (synopsis "Common Lisp bindings for Freetype 2")
      (description "This is a general Freetype 2 wrapper for Common Lisp
using CFFI.  It's geared toward both using Freetype directly by
providing a simplified API, as well as providing access to the
underlying C structures and functions for use with other libraries
which may also use Freetype.")
      (license license:bsd-3))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]