From 2e08324484aa4fcb8421900a2528ee751f905249 Mon Sep 17 00:00:00 2001 From: sterni Date: Mon, 2 Aug 2021 15:14:25 +0200 Subject: feat(3p/lisp/sclf): build using buildLisp Adding the default.nix is quite straightforward, however we have to make today's SBCL happy: due to package locking it no longer likes sclf using an sb-impl internal constant for some reason. This is however a good opportunity to clean up the stat-*-time code: It converted the times in an implementation specific way even though time.lisp does provide a generic way to convert between unix and universal time. Note that the updated ASDF file is untested, but should be a trivial enough change. Change-Id: If193bf830ac704cc53e0855d8e9fff2b5a5ef291 Reviewed-on: https://cl.tvl.fyi/c/depot/+/3268 Tested-by: BuildkiteCI Reviewed-by: grfn --- third_party/lisp/sclf/.skip-subtree | 1 + third_party/lisp/sclf/OWNERS | 3 +++ third_party/lisp/sclf/README | 8 ++++++-- third_party/lisp/sclf/default.nix | 28 ++++++++++++++++++++++++++++ third_party/lisp/sclf/directory.lisp | 11 +++-------- third_party/lisp/sclf/package.lisp | 2 ++ third_party/lisp/sclf/sclf.asd | 3 ++- 7 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 third_party/lisp/sclf/.skip-subtree create mode 100644 third_party/lisp/sclf/OWNERS create mode 100644 third_party/lisp/sclf/default.nix (limited to 'third_party') diff --git a/third_party/lisp/sclf/.skip-subtree b/third_party/lisp/sclf/.skip-subtree new file mode 100644 index 000000000000..5051f60d6b86 --- /dev/null +++ b/third_party/lisp/sclf/.skip-subtree @@ -0,0 +1 @@ +prevent readTree from creating entries for subdirs that don't contain an .nix files diff --git a/third_party/lisp/sclf/OWNERS b/third_party/lisp/sclf/OWNERS new file mode 100644 index 000000000000..f16dd105d761 --- /dev/null +++ b/third_party/lisp/sclf/OWNERS @@ -0,0 +1,3 @@ +inherited: true +owners: + - sterni diff --git a/third_party/lisp/sclf/README b/third_party/lisp/sclf/README index df51eee3683e..2a1c2c3c5c1c 100644 --- a/third_party/lisp/sclf/README +++ b/third_party/lisp/sclf/README @@ -1,2 +1,6 @@ -SCLF is a collection of disparate Common Lisp functions that are -common enough in my code but couldn't find a place anywhere else. +SCLF has originally been written by Walter C. Pelissero and vendored +into depot since it is a dependency of mime4cl. Upstream and depot version +may diverge. + +Upstream Website: http://wcp.sdf-eu.org/software/#sclf +Vendored Tarball: http://wcp.sdf-eu.org/software/sclf-20150207T213551.tbz diff --git a/third_party/lisp/sclf/default.nix b/third_party/lisp/sclf/default.nix new file mode 100644 index 000000000000..fb07f8f764e5 --- /dev/null +++ b/third_party/lisp/sclf/default.nix @@ -0,0 +1,28 @@ +# Copyright (C) 2021 by the TVL Authors +# SPDX-License-Identifier: LGPL-2.1-or-later +{ depot, pkgs, ... }: + +depot.nix.buildLisp.library { + name = "sclf"; + + deps = [ + (depot.nix.buildLisp.bundled "sb-posix") + ]; + + srcs = [ + ./package.lisp + ./sclf.lisp + ./sysproc.lisp + ./lazy.lisp + ./time.lisp + ./directory.lisp + ./serial.lisp + ./mp/sbcl.lisp + ]; + + # TODO(sterni): implement OS interaction for ECL and CCL + brokenOn = [ + "ecl" + "ccl" + ]; +} diff --git a/third_party/lisp/sclf/directory.lisp b/third_party/lisp/sclf/directory.lisp index 39479f66728e..4684a8e7056a 100644 --- a/third_party/lisp/sclf/directory.lisp +++ b/third_party/lisp/sclf/directory.lisp @@ -1,6 +1,7 @@ ;;; directory.lisp --- filesystem directory access ;;; Copyright (C) 2006, 2007, 2008, 2009, 2010 by Walter C. Pelissero +;;; Copyright (C) 2021 by the TVL Authors ;;; Author: Walter C. Pelissero ;;; Project: sclf @@ -348,18 +349,12 @@ are defined." (defun stat-modification-time (stat) "Return the modification time of the STAT structure as Lisp Universal Time, which is not the same as the Unix time." - #-(or cmu sbcl) (error "Don't know how to adjust Unix time to Lisp Universal Time.") - (+ #+cmu lisp::unix-to-universal-time - #+sbcl sb-impl::unix-to-universal-time - (stat-mtime stat))) + (unix->universal-time (stat-mtime stat))) (defun stat-creation-time (stat) "Return the creation time of the STAT structure as Lisp Universal Time, which is not the same as the Unix time." - #-(or cmu sbcl) (error "Don't know how to adjust Unix time to Lisp Universal Time.") - (+ #+cmu lisp::unix-to-universal-time - #+sbcl sb-impl::unix-to-universal-time - (stat-ctime stat))) + (unix->universal-time (stat-ctime stat))) (defun file-modification-time (file) "Return the modification time of FILE as Lisp Universal Time, which diff --git a/third_party/lisp/sclf/package.lisp b/third_party/lisp/sclf/package.lisp index 50c42e1a7d62..652194f93cad 100644 --- a/third_party/lisp/sclf/package.lisp +++ b/third_party/lisp/sclf/package.lisp @@ -1,6 +1,7 @@ ;;; package.lisp --- packages description ;;; Copyright (C) 2006, 2007, 2008, 2009, 2010 by Walter C. Pelissero +;;; Copyright (C) 2021 by the TVL Authors ;;; Author: Walter C. Pelissero ;;; Project: sclf @@ -179,6 +180,7 @@ #:stat-mode #:save-file-excursion #:stat-modification-time + #:stat-creation-time #:file-modification-time #:file-creation-time #:show diff --git a/third_party/lisp/sclf/sclf.asd b/third_party/lisp/sclf/sclf.asd index dea280401b1f..dfb56a8ded0e 100644 --- a/third_party/lisp/sclf/sclf.asd +++ b/third_party/lisp/sclf/sclf.asd @@ -1,6 +1,7 @@ ;;; sclf.asd --- system definition ;;; Copyright (C) 2005, 2006, 2008, 2009 by Walter C. Pelissero +;;; Copyright (C) 2021 by the TVL Authors ;;; Author: Walter C. Pelissero ;;; Project: SCLF @@ -44,8 +45,8 @@ uses, too small to fit anywhere else." (:file "sclf" :depends-on ("package")) (:file "sysproc" :depends-on ("package" "sclf")) (:file "lazy" :depends-on ("package" "sclf")) - (:file "directory" :depends-on ("package" "sclf")) (:file "time" :depends-on ("package" "sclf")) + (:file "directory" :depends-on ("package" "sclf" "time")) (:file "serial" :depends-on ("package" "sclf")) (:module "mp" :depends-on ("package" "sclf") -- cgit 1.4.1