about summary refs log tree commit diff
path: root/third_party/lisp/cl-unicode.nix
blob: 8b42e2eaec805adaed292f3679167ec846bc9041 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
{ depot, pkgs, ... }:

let
  inherit (pkgs) sbcl runCommand writeText;
  inherit (depot.nix.buildLisp) bundled;

  src = pkgs.fetchFromGitHub {
    owner = "edicl";
    repo = "cl-unicode";
    rev = "8073fc5634c9d4802888ac03abf11dfe383e16fa";
    sha256 = "0ykx2s9lqfl74p1px0ik3l2izd1fc9jd1b4ra68s5x34rvjy0hza";
  };

  cl-unicode-base = depot.nix.buildLisp.library {
    name = "cl-unicode-base";
    deps = with depot.third_party.lisp; [
      cl-ppcre
    ];

    srcs = map (f: src + ("/" + f)) [
      "packages.lisp"
      "specials.lisp"
      "util.lisp"
    ];
  };

  cl-unicode-build = depot.nix.buildLisp.program {
    name = "cl-unicode-build";
    deps = with depot.third_party.lisp; [
      cl-unicode-base
      flexi-streams
      (bundled "uiop")
    ];

    srcs = (map (f: src + ("/build/" + f)) [
      "util.lisp"
      "char-info.lisp"
      "read.lisp"
    ]) ++ [
      (runCommand "dump.lisp" {} ''
        substitute ${src}/build/dump.lisp $out \
          --replace ':defaults *this-file*' ":defaults (uiop:getcwd)"
      '')

      (writeText "export-create-source-files.lisp" ''
        (in-package :cl-unicode)
        (export 'create-source-files)
      '')
    ];

    main = "cl-unicode:create-source-files";
  };


  generated = runCommand "cl-unicode-generated" {} ''
    mkdir -p $out/build
    mkdir -p $out/test
    cd $out/build
    pwd
    ${cl-unicode-build}/bin/cl-unicode-build
  '';

in
depot.nix.buildLisp.library {
  name = "cl-unicode";
  deps = [cl-unicode-base];
  srcs = [
    "${src}/conditions.lisp"
    "${generated}/lists.lisp"
    "${generated}/hash-tables.lisp"
    "${src}/api.lisp"
    "${generated}/methods.lisp"
    "${src}/test-functions.lisp"
    "${src}/derived.lisp"
    "${src}/alias.lisp"
  ];
}