From da8bc7635e746ba313801632c9001df9161d3605 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Fri, 24 Jul 2020 13:36:40 -0400 Subject: feat(3p/lisp): Add postmodern Change-Id: If6ffd9a2344dc98e95312ddcce14ba5c2519d004 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1420 Tested-by: BuildkiteCI Reviewed-by: tazjin --- third_party/lisp/cl-unicode.nix | 77 ++++++++++++++++++++++++++++++++++ third_party/lisp/global-vars.nix | 14 +++++++ third_party/lisp/postmodern.nix | 91 ++++++++++++++++++++++++++++++++++++++++ third_party/lisp/uax-15.nix | 46 ++++++++++++++++++++ 4 files changed, 228 insertions(+) create mode 100644 third_party/lisp/cl-unicode.nix create mode 100644 third_party/lisp/global-vars.nix create mode 100644 third_party/lisp/postmodern.nix create mode 100644 third_party/lisp/uax-15.nix (limited to 'third_party/lisp') diff --git a/third_party/lisp/cl-unicode.nix b/third_party/lisp/cl-unicode.nix new file mode 100644 index 000000000000..8b42e2eaec80 --- /dev/null +++ b/third_party/lisp/cl-unicode.nix @@ -0,0 +1,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" + ]; +} diff --git a/third_party/lisp/global-vars.nix b/third_party/lisp/global-vars.nix new file mode 100644 index 000000000000..2b4078f588cd --- /dev/null +++ b/third_party/lisp/global-vars.nix @@ -0,0 +1,14 @@ +{ depot, pkgs, ... }: + +let + src = pkgs.fetchFromGitHub { + owner = "lmj"; + repo = "global-vars"; + rev = "c749f32c9b606a1457daa47d59630708ac0c266e"; + sha256 = "06m3xc8l3pgsapl8fvsi9wf6y46zs75cp9zn7zh6dc65v4s5wz3d"; + }; + +in depot.nix.buildLisp.library { + name = "global-vars"; + srcs = [ "${src}/global-vars.lisp" ] ; +} diff --git a/third_party/lisp/postmodern.nix b/third_party/lisp/postmodern.nix new file mode 100644 index 000000000000..cc133eeb8939 --- /dev/null +++ b/third_party/lisp/postmodern.nix @@ -0,0 +1,91 @@ +{ depot, pkgs, ... }: + +let + inherit (depot.nix.buildLisp) bundled; + + src = pkgs.fetchFromGitHub { + owner = "marijnh"; + repo = "Postmodern"; + rev = "v1.32"; + sha256 = "0prwmpixcqpzqd67v77cs4zgbs73a10m6hs7q0rpv0z1qm7mqfcb"; + }; + + cl-postgres = depot.nix.buildLisp.library { + name = "cl-postgres"; + deps = with pkgs.lisp; [ + md5 + split-sequence + ironclad + cl-base64 + uax-15 + usocket + (bundled "sb-bsd-sockets") + ]; + + srcs = map (f: src + ("/cl-postgres/" + f)) [ + "package.lisp" + "features.lisp" + "errors.lisp" + "sql-string.lisp" + "trivial-utf-8.lisp" + "strings-utf-8.lisp" + "communicate.lisp" + "messages.lisp" + "oid.lisp" + "ieee-floats.lisp" + "interpret.lisp" + "saslprep.lisp" + "scram.lisp" + "protocol.lisp" + "public.lisp" + "bulk-copy.lisp" + ]; + }; + + s-sql = depot.nix.buildLisp.library { + name = "s-sql"; + deps = with pkgs.lisp; [ + cl-postgres + alexandria + ]; + + srcs = map (f: src + ("/s-sql/" + f)) [ + "package.lisp" + "s-sql.lisp" + ]; + }; + + postmodern = depot.nix.buildLisp.library { + name = "postmodern"; + + deps = with pkgs.lisp; [ + alexandria + cl-postgres + s-sql + global-vars + split-sequence + cl-unicode + closer-mop + bordeaux-threads + ]; + + srcs = [ + "${src}/postmodern.asd" + ] ++ (map (f: src + ("/postmodern/" + f)) [ + "package.lisp" + "connect.lisp" + "query.lisp" + "prepare.lisp" + "roles.lisp" + "util.lisp" + "transaction.lisp" + "namespace.lisp" + "execute-file.lisp" + "table.lisp" + "deftable.lisp" + ]); + }; + +in postmodern // { + inherit s-sql cl-postgres; +} diff --git a/third_party/lisp/uax-15.nix b/third_party/lisp/uax-15.nix new file mode 100644 index 000000000000..664be63f06b3 --- /dev/null +++ b/third_party/lisp/uax-15.nix @@ -0,0 +1,46 @@ +{ depot, pkgs, ... }: + +let + inherit (pkgs) runCommand; + inherit (depot.nix.buildLisp) bundled; + + src = pkgs.fetchFromGitHub { + owner = "sabracrolleton"; + repo = "uax-15"; + rev = "a62fc7253663fac6467fc6b6bb69a73a0e8dfaa0"; + sha256 = "028kc3yfi29qjxs2nyr7dbrr2rcrr8lwpvbxvrq3g8bcwamc4jz4"; + }; + + # src = ../../../uax-15; + +in depot.nix.buildLisp.library { + name = "uax-15"; + + deps = with pkgs.lisp; [ + split-sequence + cl-ppcre + (bundled "uiop") + (bundled "asdf") + ]; + + srcs = [ + "${src}/uax-15.asd" + "${src}/src/package.lisp" + "${src}/src/utilities.lisp" + "${src}/src/trivial-utf-16.lisp" + (runCommand "precomputed-tables.lisp" {} '' + substitute ${src}/src/precomputed-tables.lisp precomputed-tables.lisp \ + --replace "(asdf:system-source-directory (asdf:find-system 'uax-15 nil))" \ + '"${src}/"' + + sed -i precomputed-tables.lisp \ + -e '17i(defvar *canonical-decomp-map*)' \ + -e '17i(defvar *compatible-decomp-map*)' \ + -e '17i(defvar *canonical-combining-class*)' + + cp precomputed-tables.lisp $out + '') + "${src}/src/normalize-backend.lisp" + "${src}/src/uax-15.lisp" + ]; +} -- cgit 1.4.1