Next: , Previous: , Up: The Groveller   [Contents][Index]


13.3 ASDF Integration

An example software project might contain four files; an ASDF file, a package definition file, an implementation file, and a CFFI-Grovel specification file.

The ASDF file defines the system and its dependencies. Notice the use of eval-when to ensure CFFI-Grovel is present and the use of (cffi-grovel:grovel-file name &key cc-flags) instead of (:file name).

The example-software.asd file would look like that:

  ;;; CFFI-Grovel is needed for processing grovel-file components
  (defsystem "example-software"
    :defsystem-depends-on ("cffi-grovel")
    :depends-on ("cffi")
    :serial t
    :components
    ((:file "package")
     (:cffi-grovel-file "example-grovelling")
     (:cffi-wrapper-file "example-wrappers")
     (:file "example")))

The package.lisp file would contain one or several defpackage forms, to remove circular dependencies and make building the project easier. Note that you may or may not want to :use your internal package.

Implementor’s note: Note that it’s a not a good idea to :use when names may clash with, say, CL symbols. Or you could use uiop:define-package and its :mix option.

  (defpackage #:example-internal
    (:use)
    (:nicknames #:exampleint))
   
  (defpackage #:example-software
    (:export ...)
    (:use #:cl #:cffi #:exampleint))

The internal package is created by Lisp code output from the C program written by CFFI-Grovel; if your specification file is exampleint.lisp, the exampleint.cffi.lisp file will contain the CFFI definitions needed by the rest of your project. See Groveller Syntax.