snix/third_party/lisp/closure-html/default.nix
sterni d42784eb48 chore(3p/lisp): port to new new lisp-modules set
Build //3p/lisp from pkgs proper, i.e. nixpkgs' nixos-unstable channel
instead of nixos-23.11 (yikes).

Basically, multiple package sets are attached to the different lisp
implementations now instead of having a “generic” lispPackages
set (which defaults to sbcl). We can just use that instead even though
it looks a bit weird having `srcOnly sbcl.pkgs.foo` everywhere when the
packages is not necessarily related to SBCL.

We could in theory create a source only package set by abusing how the
infrastructure works internally, but it's probably somewhat brittle:

  callPackage (pkgs.path + "/pkgs/development/lisp-modules/imported.nix") {
     build-asdf-system = { src, ... }: src;
  }

Since we do a pretty hefty jump in package versions, many packages have
to be adapted to internal changes and restructuring:

- bordeaux-threads
- cffi
- cl-colors2 (which has been deprecated, but is still required by other
  packages)
- cl-smtp
- cl-plus-ssl
- cl-prevalence
- hunchentoot (compiling the asd file no longer seemed to work)
- ironclad (fixes for SBCL compiler warnings caused a CCL compiler
  warning)
- nibbles (revert the only commit to sbcl-opt/x86-vm.lisp that's new
  compared to canon since it broke compilation for unknown reasons)

The following new packages had to be added as existing packages added
new dependencies:

- frugal-uuid, frugal-uuid/non-frugal
- trivial-clock

Change-Id: I8b94894df0357907cf2b27cf1e34a7e804b68e02
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13134
Autosubmit: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
2025-02-27 14:51:41 +00:00

69 lines
1.9 KiB
Nix

{ depot, pkgs, ... }:
let
src = pkgs.applyPatches {
name = "closure-html-source";
src = pkgs.sbcl.pkgs.closure-html.src;
patches = [
# delete unexported and unused double defun in sgml-dtd.lisp
# which reference undefined CL-USER:*HTML-DTD* (!) which
# unlike CLOSURE-HTML:*HTML-DTD* is not involved in the
# package's operation.
./no-double-defun.patch
# Patches html-parser.lisp to look for the distributed
# dtd files and catalog in this source derivations out
# path in the nix store instead of the same directory
# relatively to the (built) system.
./dtds-from-store.patch
];
postPatch = ''
# Inject file which defines CLOSURE-HTML:*HTML-DTD*
# early in the package's build since SBCL otherwise
# fails due to the undefined variable. Need to inject
# this via postPatch since using a nix file results
# in failure to look up the file's true name which
# is done for reasons, apparently.
cat > src/define-html-dtd.lisp << EOF
(in-package :closure-html)
(defvar *html-dtd*)
EOF
# Substitute reference to @out@ of this source
# directory in this patched file.
substituteAllInPlace src/parse/html-parser.lisp
'';
};
getSrcs = builtins.map (p: "${src}/${p}");
in
depot.nix.buildLisp.library {
name = "closure-html";
srcs = getSrcs [
"src/defpack.lisp"
"src/define-html-dtd.lisp"
"src/glisp/util.lisp"
"src/util/clex.lisp"
"src/util/lalr.lisp"
"src/net/mime.lisp"
"src/parse/pt.lisp"
"src/parse/sgml-dtd.lisp"
"src/parse/sgml-parse.lisp"
"src/parse/html-parser.lisp"
"src/parse/lhtml.lisp"
"src/parse/unparse.lisp"
"src/parse/documentation.lisp"
];
deps = [
depot.third_party.lisp.flexi-streams
depot.third_party.lisp.closure-common
];
brokenOn = [
"ecl" # see closure-common
];
}