Improving Common Lisp Infrastructure in FreeBSD Ports
Contact: Joe Mingrone <jrm@FreeBSD.org>
Common Lisp (CL) is a general-purpose, multi-paradigm programming language first conceived in the early 1980s. Although it predates many modern programming languages, it remains a viable option for many different projects. One contemporary example is Grammarly, a widely used grammar engine reportedly implemented in CL and capable of processing over a thousand sentences per second.
The FreeBSD ports tree has provided CL support for many years. The initial work was contributed by Henrik Motakef in 2003, and then enhanced and maintained by Jimmy Olgeni. The infrastructure facilitated building and installing CL libraries using ASDF so that multiple CL implementations could load compiled object code files (fasl) at run-time without conflicts.
However, many issues crept in over the years. Support dwindled to only one CL implementation, SBCL, and users encountered longstanding bugs such as conflicting ASDF versions and write errors when loading libraries outside the ports tree. Also, managing dependencies was cumbersome because most infrastructure code was included as part of the devel/cl-asdf port.
A long overdue update of the FreeBSD CL infrastructure was completed this quarter. The primary outcome is that users can, once again, easily and reliably work with CL on FreeBSD. For example, installing and loading the popular Alexandria library under SBCL requires only a few simple steps.
% pkg install cl-alexandria-sbcl
% sbcl
* (asdf:load-system :alexandria)Similar steps can be used to load libraries for the other two
newly supported implementations: CCL, and CLISP. Most users will likely
prefer to work with the fasl ports, although there is no obligation
to do so. Because ASDF is now configured to fall back to its
default caching mechanism of writing fasl to a cache under
${HOME}, users can also install CL source ports
without the associated fasl port or load CL sources from outside of
the ports tree.
Other highlights of the update include:
-
decoupling ASDF initialization from devel/cl-asdf by creating a dedicated port: devel/freebsd-cl-asdf-init
-
creating
USES=cl -
adding and updating various CL library ports for the three supported implementations
-
updating and modernizing lang/ccl and lang/clisp
For details, refer to these commit logs:
The tentative plan is to add support for ECL after an ASDF output translation issue is solved and to create ports for other CL libraries. Feedback, testing, and contributions are welcome.
Sponsor: The FreeBSD Foundation
Last modified on: January 18, 2025 by Joseph Mingrone
