;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2013 Mark H Weaver ;;; Copyright © 2014 Eric Bavier ;;; Copyright © 2016, 2017 Alex Kost ;;; Copyright © 2016 Mathieu Lirzin ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages) #:use-module (guix packages) #:use-module (guix ui) #:use-module (guix utils) #:use-module (guix discovery) #:use-module (guix memoization) #:use-module ((guix build utils) #:select ((package-name->name+version . hyphen-separated-name->name+version) mkdir-p)) #:autoload (guix profiles) (packages->manifest) #:use-module (guix describe) #:use-module (guix deprecation) #:use-module (ice-9 vlist) #:use-module (ice-9 match) #:autoload (ice-9 binary-ports) (put-bytevector) #:autoload (system base compile) (compile) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) #:use-module (srfi srfi-39) #:export (search-patch search-patches search-auxiliary-file ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 John Darrington <jmd@gnu.org> ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com> ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2016, 2017 Nikita <nikita@n0.is> ;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca> ;;; Copyright © 2017, 2019, 2020 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2017-2019, 2022, 2023 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2017, 2019–2022 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net> ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com> ;;; Copyright © 2018, 2019, 2020 Pierre Neidhardt <mail@ambrevar.xyz> ;;; Copyright © 2018, 2019 Pierre Langlois <pierre.langlois@gmx.com> ;;; Copyright © 2019, 2020 Katherine Cox-Buday <cox.katherine.e@gmail.com> ;;; Copyright © 2019 Jesse Gildersleve <jessejohngildersleve@protonmail.com> ;;; Copyright © 2019-2024 Guillaume Le Vaillant <glv@posteo.net> ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com> ;;; Copyright © 2021, 2023 Sharlatan Hellseher <sharlatanus@gmail.com> ;;; Copyright © 2021 Paul A. Patience <paul@apatience.com> ;;; Copyright © 2021 Charles Jackson <charles.b.jackson@protonmail.com> ;;; Copyright © 2022 Joeke de Graaf <joeke@posteo.net> ;;; Copyright © 2021, 2022 jgart <jgart@dismail.de> ;;; Copyright © 2022 ( <paren@disroot.org> ;;; Copyright © 2023 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2023 Yovan Naumovski <yovan@gorski.stream> ;;; Copyright © 2023 Andrew Kravchuk <awkravchuk@gmail.com> ;;; Copyright © 2024 Andreas Enge <andreas@enge.fr> ;;; Copyright © 2024 bigbug <bigbookofbug@proton.me> ;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se> ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; This file only contains Common Lisp compilers and tooling. ;;; Common Lisp libraries go to lisp-xyz.scm. ;;; Common Lisp applications should go to the most appropriate file, ;;; e.g. StumpWM is in wm.scm. (define-module (gnu packages lisp) #:use-module (gnu packages) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix git-download) #:use-module (guix gexp) #:use-module (guix utils) #:use-module (guix build-system copy) #:use-module (guix build-system gnu) #:use-module (guix build-system haskell) #:use-module (guix build-system trivial) #:use-module (gnu packages admin) #:use-module (gnu packages algebra) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages bdw-gc) #:use-module (gnu packages boost) #:use-module (gnu packages check) #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages curl) #:use-module (gnu packages dbm) #:use-module (gnu packages elf) #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) #:use-module (gnu packages gettext) #:use-module (gnu packages ghostscript) #:use-module (gnu packages gl) #:use-module (gnu packages glib) #:use-module (gnu packages groff) #:use-module (gnu packages haskell-check) #:use-module (gnu packages haskell-web) #:use-module (gnu packages haskell-xyz) #:use-module (gnu packages libffcall) #:use-module (gnu packages libffi) #:use-module (gnu packages libsigsegv) #:use-module (gnu packages libunwind) #:use-module (gnu packages linux) #:use-module (gnu packages llvm) #:use-module (gnu packages m4) #:use-module (gnu packages maths) #:use-module (gnu packages multiprecision) #:use-module (gnu packages ncurses) #:use-module (gnu packages ninja) #:use-module (gnu packages notcurses) #:use-module (gnu packages onc-rpc) #:use-module (gnu packages perl) #:use-module (gnu packages pkg-config) #:use-module (gnu packages pretty-print) #:use-module (gnu packages readline) #:use-module (gnu packages sdl) #:use-module (gnu packages tcl) #:use-module (gnu packages tex) #:use-module (gnu packages texinfo) #:use-module (gnu packages text-editors) #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (gnu packages xorg) #:use-module (ice-9 match) #:use-module (srfi srfi-1)) (define-public buildapp (package (name "buildapp") (version "1.5.6") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/xach/buildapp") (commit (string-append "release-" version)))) (file-name (git-file-name name version)) (sha256 (base32 "020ipjfqa3l8skd97cj5kq837wgpj28ygfxnkv64cnjrlbnzh161")))) (build-system gnu-build-system) (native-inputs (list sbcl)) (arguments `(#:tests? #f #:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out"))) #:strip-binaries? #f #:phases (modify-phases %standard-phases (delete 'configure) (add-after 'unpack 'set-home (lambda _ (setenv "HOME" "/tmp") #t)) (add-before 'install 'create-target-directory (lambda* (#:key outputs #:allow-other-keys) (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))) (mkdir-p bin) #t)))))) (home-page "https://www.xach.com/lisp/buildapp/") (synopsis "Makes easy to build application executables with SBCL") (description "Buildapp is an application for SBCL or CCL that configures and saves an executable Common Lisp image. It is similar to cl-launch and hu.dwim.build.") (license license:bsd-2))) (define-public carp ;; Release 0.5.5 does not support GHC 9.2. (let ((commit "339722325ec607091f6035866ebedea2b69080fe") (revision "1")) (package (name "carp") (version (git-version "0.5.5" revision commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/carp-lang/Carp") (commit commit))) (file-name (git-file-name name version)) (sha256 (base32 "0w0j3imi4270dsmrh96spsc9xllsk5rrh817l80q1nyay9p53xwd")))) (build-system haskell-build-system) (arguments (list #:phases #~(modify-phases %standard-phases ;; Carp looks inside the sources checkout to know where to ;; find its core libraries and other files. ;; Carp emits C code and tries to compile it with an external ;; C compiler. On Linux it defaults to Clang. (add-after 'install 'wrap-programs (lambda* (#:key inputs #:allow-other-keys) (define (wrap-carp-program program) (wrap-program (string-append #$output "/bin/" program) `("CARP_DIR" prefix (#$(package-source this-package))) `("PATH" prefix ,(list (dirname (search-input-file inputs "bin/clang")) (dirname (search-input-file inputs "bin/ld")))) `("C_INCLUDE_PATH" prefix ,(list (dirname (search-input-directory inputs "include/linux")) (dirname (search-input-file inputs "include/stdlib.h")))))) (for-each wrap-carp-program (list "carp" "carp-header-parse"))))))) (inputs (list bash-minimal clang ghc-blaze-markup ghc-blaze-html ghc-split ghc-ansi-terminal ghc-cmark ghc-edit-distance ghc-hashable ghc-open-browser ghc-optparse-applicative)) (native-inputs (list ghc-hunit)) (home-page "https://carp-lang.org/") (synopsis "Statically typed Lisp without a garbage collector") (description "@code{carp} is a Lisp-like programming language that compiles to C. It features inferred static typing, macros, automatic memory management without a garbage collector, a REPL, and straightforward integration with code written in C.") (license license:asl2.0)))) (define-public ccl ;; Warning: according to upstream, CCL is not bootstrappable. ;; See https://github.com/Clozure/ccl/issues/222 from 2019-09-02: ;; ;; "As far as I know, there is no way to build CCL without an existing ;; running CCL image. It was bootstrapped back in 1986 or so as ;; Macintosh Common Lisp, by Gary Byers, I believe, who is no longer on ;; the planet to tell us the story. It SHOULD be possible to port the ;; CCL compiler to portable Common Lisp, so that ANY lisp could build ;; it, as is the case for SBCL, but I know of no attempt to do so." (package (name "ccl") ;; XXX When updating this package, check whether we can simply append ;; VERSION to the ccl-bootstrap URL again, instead of per architecture. (version "1.13") (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/Clozure/ccl/") (commit (string-append "v" version)))) (file-name (git-file-name "ccl" version)) (sha256 (base32 "12cb3gp43bhl7nyms3a4lix8j1s3arnp124d3ahc2lhlrjirs0mr")))) (build-system gnu-build-system) ;; CCL consists of a "lisp kernel" and "heap image", both of which are ;; shipped in precompiled form in source tarballs. The former is a C ;; program which we can rebuild from scratch, but the latter cannot be ;; generated without an already working copy of CCL, and is platform ;; dependent, so we need to fetch the correct tarball for the platform. (inputs `(("ccl-bootstrap" ,(origin (method url-fetch) (uri (string-append "https://github.com/Clozure/ccl/releases/download/v" (match (%current-system) ("armhf-linux" "1.13/linuxarm") ;; XXX: This source only works on x86, but provide it as a ;; catch-all to prevent errors when querying this package ;; on unsupported platforms. (_ "1.13/linuxx86")) ".tar.gz")) (sha256 (base32 (match (%current-system) ("armhf-linux" "1mlj7lgn4p9bw1ki7gk00sj89cjv0cjpdmpp65brhx9q3fvkk9xf") (_ "04ry8zwrcjjmzbxp43nkknchabk6i6mclrzg5biwfp1h64bcnzfx")))))))) (native-inputs (list cl-asdf m4)) (arguments `(#:tests? #f ;no 'check' target #:modules ((ice-9 match) (srfi srfi-26) (guix build utils) (guix build gnu-build-system)) #:phases (modify-phases %standard-phases (add-after 'unpack 'unpack-image (lambda* (#:key inputs #:allow-other-keys) (invoke "tar" "xzvf" (assoc-ref inputs "ccl-bootstrap")))) (add-after 'unpack 'replace-asdf ;; Use system ASDF instead of bundled one. (lambda* (#:key inputs #:allow-other-keys) (let* ((cl-asdf (assoc-ref inputs "cl-asdf")) (guix-asdf (string-append cl-asdf "/share/common-lisp/source/asdf/asdf.lisp")) (contrib-asdf "tools/asdf.lisp")) (delete-file contrib-asdf) (copy-file guix-asdf contrib-asdf)))) (delete 'configure) (add-before 'build 'pre-build ;; Enter the source directory for the current platform's lisp ;; kernel, and run 'make clean' to remove the precompiled one. (lambda* (#:key system #:allow-other-keys) (substitute* "lisp-kernel/m4macros.m4" (("/bin/pwd") (which "pwd"))) (chdir (string-append "lisp-kernel/" (match system ("i686-linux" "linuxx8632") ("x86_64-linux" "linuxx8664") ("armhf-linux" "linuxarm") (_ (string-append "unknown system: " system))))) (substitute* '("Makefile") (("/bin/rm") "rm")) (setenv "CC" "gcc") (invoke "make" "clean"))) ;; XXX Do we need to recompile the heap image as well for Guix? ;; For now just use the one we already got in the tarball. (replace 'install (lambda* (#:key outputs inputs system #:allow-other-keys) ;; The lisp kernel built by running 'make' in lisp-kernel/$system ;; is put back into the original directory, so go back. The heap ;; image is there as well. (chdir "../..") (let* ((out (assoc-ref outputs "out")) (libdir (string-append out "/lib/")) (bindir (string-append out "/bin/")) (wrapper (string-append bindir "ccl")) (bash (assoc-ref inputs "bash")) (kernel (match system ("i686-linux" "lx86cl") ("x86_64-linux" "lx86cl64") ("armhf-linux" "armcl") ;; Unlikely to work, but try it anyway... (_ system))) (heap (string-append kernel ".image"))) (install-file kernel libdir) (install-file heap libdir) (let ((dirs `("lib" "library" "examples" "tools" "objc-bridge" ,@(match system ("x86_64-linux" '("x86-headers64")) ("i686-linux" '("x86-headers")) (_ '()))))) (for-each copy-recursively dirs (map (cut string-append libdir <>) dirs))) (mkdir-p bindir) (with-output-to-file wrapper (lambda () (display (string-append "#!" bash "/bin/sh\n" "export CCL_DEFAULT_DIRECTORY=" libdir "\n" "exec -a \"$0\" " libdir kernel " \"$@\"\n")))) (chmod wrapper #o755)) #t))))) (native-search-paths (list (search-path-specification (variable "XDG_DATA_DIRS") (files '("share"))) (search-path-specification (variable "XDG_CONFIG_DIRS") (files '("etc"))))) (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux")) (home-page "https://ccl.clozure.com/") (synopsis "Common Lisp implementation") (description "Clozure CL (often called CCL for short) is a Common Lisp implementation featuring fast compilation speed, native threads, a precise, generational, compacting garbage collector, and a convenient foreign-function interface.") (license license:asl2.0))) (define-public clasp-cl (package (name "clasp-cl") (version "2.6.0") (source (origin (method url-fetch) (uri (string-append "https://github.com/clasp-developers/clasp/releases/download/" version "/clasp-" version ".tar.gz")) (sha256 (base32 "10jjhcid6qp64gx29iyy5rqqijwy8hrvx66f0xabdj8w3007ky39")))) (build-system gnu-build-system) (inputs (list boost clang-15 fmt `(,gcc "lib") gmp libelf libunwind llvm-15)) (native-inputs (list binutils-gold ninja pkg-config sbcl)) (arguments `(#:phases (modify-phases %standard-phases (delete 'check) (add-after 'unpack 'patch-koga (lambda* _ (call-with-port (open-file "src/koga/units.lisp" "a") (lambda (p) (display "(defmethod configure-unit (c (u (eql :git))))\n" p))))) (add-before 'configure 'set-configure-environment (lambda* _ (setenv "SOURCE_DATE_EPOCH" "1") (setenv "ASDF_OUTPUT_TRANSLATIONS" (string-append (getenv "PWD") ":" (getenv "PWD") "/__fasls")))) (replace 'configure (lambda* (#:key inputs outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")) (clang (assoc-ref inputs "clang")) (ld-flags (string-join (apply append (map (lambda (f) (list "-L" f "-rpath" f)) (string-split (getenv "LIBRARY_PATH") #\:))) ","))) (invoke "sbcl" "--script" "./koga" "--skip-sync" "--build-mode=bytecode-faso" (string-append &q