;;; Copyright © 2016 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2019 Brett Gilio <brettg@gnu.org>
+;;; Copyright © 2020 Brendan Tildesley <mail@brendan.scot>
+;;; Copyright © 2021 Philip McGrath <philip@philipmcgrath.com>
;;;
;;; This file is part of GNU Guix.
;;;
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix utils)
+ #:use-module (guix gexp)
#:use-module (guix build-system gnu)
#:use-module (gnu packages compression)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages ghostscript)
+ #:use-module (gnu packages linux)
#:use-module (gnu packages netpbm)
#:use-module (gnu packages tex)
#:use-module (gnu packages compression)
#:use-module (srfi srfi-1))
(define nanopass
- (let ((version "1.9"))
+ (let ((version "1.9.2"))
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/nanopass/nanopass-framework-scheme.git")
+ (url "https://github.com/nanopass/nanopass-framework-scheme")
(commit (string-append "v" version))))
- (sha256 (base32 "0lrngdna6w7v9vlp1a873hgwrwsz2p0pgkccswa4smzvdyhgfsri"))
+ (sha256 (base32 "16vjsik9rrzbabbhbxbaha51ppi3f9n8rk59pc6zdyffs0vziy4i"))
(file-name (git-file-name "nanopass" version)))))
(define stex
- (let ((version "1.2.1"))
+ ;; This commit includes a fix, which we would otherwise want to use as
+ ;; patch. Let's revert to tagged releases as soon as one becomes available.
+ (let* ((commit "54051494434a197772bf6ca5b4e6cf6be55f39a5")
+ (version "1.2.2")
+ (version (git-version version "1" commit)))
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/dybvig/stex.git")
- (commit (string-append "v" version))))
- (sha256 (base32 "1jiawhhqnsj42hzmlbq5xby3iarhf8vhiqs0kg1a0zg5jsn6cf8n"))
+ (url "https://github.com/dybvig/stex")
+ (commit commit)))
+ (sha256 (base32 "01jnvw8qw33gnpzwrakwhsr05h6b609lm180jnspcrb7lds2p23d"))
(file-name (git-file-name "stex" version)))))
(define-public chez-scheme
(package
(name "chez-scheme")
- (version "9.5")
+ (version "9.5.4")
(source
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/cisco/ChezScheme.git")
+ (url "https://github.com/cisco/ChezScheme")
(commit (string-append "v" version))))
(sha256
- (base32 "132fal5hwiq0bqzvfhjsqr4d11cfdh1670f6286ks29xxj1c04zq"))
+ (base32 "0prgn2z9l888j93ydxaf04ph424g0fi3a8w7f8m0b2r7fr1v7388"))
(file-name (git-file-name name version))
- (modules '((guix build utils)))
+ (patches
+ (search-patches
+ ;; backported from upstream: remove on next release
+ "chez-scheme-build-util-paths-backport.patch"))
(snippet
- ;; Fix compilation with glibc >= 2.26, which removed xlocale.h.
- '(begin
- (substitute* "c/expeditor.c"
- (("xlocale\\.h") "locale.h"))
- #t))))
+ ;; remove bundled libraries
+ (with-imported-modules '((guix build utils))
+ #~(begin
+ (use-modules (guix build utils))
+ (for-each (lambda (dir)
+ (when (directory-exists? dir)
+ (delete-file-recursively dir)))
+ '("stex"
+ "nanopass"
+ "lz4"
+ "zlib")))))))
(build-system gnu-build-system)
(inputs
- `(("ncurses" ,ncurses)
- ("libx11" ,libx11)
- ("xorg-rgb" ,xorg-rgb)
- ("nanopass" ,nanopass)
+ `(("libuuid" ,util-linux "lib")
("zlib" ,zlib)
("zlib:static" ,zlib "static")
- ("stex" ,stex)))
+ ("lz4" ,lz4)
+ ("lz4:static" ,lz4 "static")
+ ;; for expeditor:
+ ("ncurses" ,ncurses)
+ ;; for X11 clipboard support in expeditor:
+ ;; https://github.com/cisco/ChezScheme/issues/9#issuecomment-222057232
+ ("libx11" ,libx11)))
(native-inputs
- `(("texlive" ,(texlive-union (list texlive-latex-oberdiek
+ `(("nanopass" ,nanopass) ; source only
+ ;; for docs
+ ("stex" ,stex)
+ ("xorg-rgb" ,xorg-rgb)
+ ("texlive" ,(texlive-union (list texlive-latex-oberdiek
texlive-generic-epsf)))
("ghostscript" ,ghostscript)
("netpbm" ,netpbm)))
(files (list (string-append "lib/csv" version "-site"))))))
(outputs '("out" "doc"))
(arguments
- `(#:modules ((guix build gnu-build-system)
- (guix build utils)
- (ice-9 match))
+ `(#:modules
+ ((guix build gnu-build-system)
+ (guix build utils)
+ (ice-9 ftw)
+ (ice-9 match))
#:test-target "test"
#:configure-flags
- (list ,(match (or (%current-target-system) (%current-system))
- ("x86_64-linux" '(list "--machine=ta6le"))
- ("i686-linux" '(list "--machine=ti3le"))
- ;; Let autodetection have its attempt on other architectures.
- (_
- '())))
+ '("--threads") ;; TODO when we fix armhf, it doesn't support --threads
#:phases
(modify-phases %standard-phases
- (add-after 'unpack 'patch-processor-detection
- (lambda _ (substitute* "configure"
- (("uname -a") "uname -m"))
- #t))
- (add-after 'unpack 'patch-broken-documentation
- (lambda _
- ;; Work around an oversight in the 9.5 release tarball that causes
- ;; building the documentation to fail. This should be fixed in the
- ;; next one; see <https://github.com/cisco/ChezScheme/issues/209>.
- (substitute* "csug/copyright.stex"
- (("\\\\INSERTREVISIONMONTHSPACEYEAR" )
- "October 2017")) ; tarball release date
- #t))
- ;; Adapt the custom 'configure' script.
+ ;; put these where configure expects them to be
+ (add-after 'unpack 'unpack-nanopass+stex
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (for-each (lambda (dep)
+ (define src
+ (assoc-ref (or native-inputs inputs) dep))
+ (copy-recursively src dep
+ #:keep-mtime? #t))
+ '("nanopass" "stex"))
+ #t))
+ ;; NOTE: the custom Chez 'configure' script doesn't allow
+ ;; unrecognized flags, such as those automatically added
+ ;; by `gnu-build-system`.
(replace 'configure
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (nanopass (assoc-ref inputs "nanopass"))
- (stex (assoc-ref inputs "stex"))
- (zlib (assoc-ref inputs "zlib"))
- (zlib-static (assoc-ref inputs "zlib:static"))
- (unpack (assoc-ref %standard-phases 'unpack))
- (patch-source-shebangs
- (assoc-ref %standard-phases 'patch-source-shebangs)))
- (map (match-lambda
- ((src orig-name new-name)
- (with-directory-excursion "."
- (apply unpack (list #:source src))
- (apply patch-source-shebangs (list #:source src)))
- (delete-file-recursively new-name)
- (invoke "mv" orig-name new-name)))
- `((,nanopass "source" "nanopass")
- (,stex "source" "stex")))
- ;; The Makefile wants to download and compile "zlib". We patch
- ;; it to use the one from our 'zlib' package.
- (substitute* "configure"
- (("rmdir zlib .*$") "echo \"using system zlib\"\n"))
- (substitute* (find-files "./c" "Mf-[a-zA-Z0-9.]+")
- (("\\$\\{Kernel\\}: \\$\\{kernelobj\\} \\.\\./zlib/libz\\.a")
- "${Kernel}: ${kernelobj}")
- (("ld ([-a-zA-Z0-9_${} ]+) \\.\\./zlib/libz\\.a" all args)
- (string-append "ld " args " " zlib-static "/lib/libz.a"))
- (("\\(cd \\.\\./zlib; ([-a-zA-Z0-9=./ ]+))")
- (which "true")))
- (substitute* (find-files "mats" "Mf-.*")
- (("^[[:space:]]+(cc ) *") "\tgcc "))
- (substitute*
- (find-files "." (string-append
- "("
- "Mf-[a-zA-Z0-9.]+"
- "|Makefile[a-zA-Z0-9.]*"
- "|checkin"
- "|stex\\.stex"
- "|newrelease"
- "|workarea"
- ;;"|[a-zA-Z0-9.]+\\.ms" ; guile can't read
- ")"))
- (("/bin/rm") (which "rm"))
- (("/bin/ln") (which "ln"))
- (("/bin/cp") (which "cp")))
- (substitute* "makefiles/installsh"
- (("/bin/true") (which "true")))
- (substitute* "stex/Makefile"
- (("PREFIX=/usr") (string-append "PREFIX=" out)))
- (invoke "./configure" "--threads"
- (string-append "--installprefix=" out)))))
- ;; Installation of the documentation requires a running "chez".
- (add-after 'install 'install-doc
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((doc (string-append (assoc-ref outputs "doc")
- "/share/doc/" ,name "-" ,version)))
- (invoke "make" "docs")
- (with-directory-excursion "csug"
- (substitute* "Makefile"
- ;; The ‘installdir=’ can't be overruled on the command line.
- (("/tmp/csug9") doc)
- ;; $m is the ‘machine type’, e.g. ‘ta6le’ on x86_64, but is
- ;; set incorrectly for some reason, e.g. to ‘a6le’ on x86_64.
- ;; Avoid the whole mess by running the (machine-independent)
- ;; ‘installsh’ script at its original location.
- (("\\$m/installsh") "makefiles/installsh"))
- (invoke "make" "install")
- (install-file "csug.pdf" doc))
- (with-directory-excursion "release_notes"
- (install-file "release_notes.pdf" doc))
+ (lambda* (#:key inputs outputs
+ (configure-flags '())
+ #:allow-other-keys)
+ (let* ((zlib-static (assoc-ref inputs "zlib:static"))
+ (lz4-static (assoc-ref inputs "lz4:static"))
+ (out (assoc-ref outputs "out"))
+ ;; add flags which are always required:
+ (flags (cons*
+ (string-append "--installprefix=" out)
+ (string-append "ZLIB=" zlib-static "/lib/libz.a")
+ (string-append "LZ4=" lz4-static "/lib/liblz4.a")
+ ;; Guix will do compress man pages,
+ ;; and letting Chez try causes an error
+ "--nogzip-man-pages"
+ configure-flags)))
+ (format #t "configure flags: ~s~%" flags)
+ ;; Some makefiles (for tests) don't seem to propagate CC
+ ;; properly, so we take it out of their hands:
+ (setenv "CC" ,(cc-for-target))
+ (apply invoke
+ "./configure"
+ flags)
#t)))
- ;; The binary file name is called "scheme" as the one from MIT/GNU
+ ;; The binary file name is called "scheme" as is the one from MIT/GNU
;; Scheme. We add a symlink to use in case both are installed.
(add-after 'install 'install-symlink
(lambda* (#:key outputs #:allow-other-keys)
"/" name ".boot")))
(find-files lib "scheme.boot"))
#t)))
- (add-before 'reset-gzip-timestamps 'make-manpages-writable
- (lambda* (#:key outputs #:allow-other-keys)
- (map (lambda (file)
- (make-file-writable file))
- (find-files (string-append (assoc-ref outputs "out")
- "/share/man")
- ".*\\.gz$"))
- #t)))))
- ;; According to the documentation MIPS is not supported.
- ;; Cross-compiling for the Raspberry Pi is supported, but not native ARM.
+ ;; Building explicitly lets us avoid using substitute*
+ ;; to re-write makefiles.
+ (add-after 'install-symlink 'prepare-stex
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ ;; Eventually we want to install stex as a real
+ ;; package so it's reusable. For now:
+ (stex-output "/tmp")
+ (doc-dir (string-append stex-output
+ "/share/doc/"
+ stex+version)))
+ (with-directory-excursion "stex"
+ (invoke "make"
+ "install"
+ (string-append "LIB="
+ stex-output
+ "/lib/"
+ stex+version)
+ (string-append "Scheme="
+ (assoc-ref outputs "out")
+ "/bin/scheme"))
+ (for-each (lambda (pth)
+ (install-file pth doc-dir))
+ '("ReadMe" ; includes the license
+ "doc/stex.html"
+ "doc/stex.css"
+ "doc/stex.pdf"))
+ #t))))
+ ;; Building the documentation requires stex and a running scheme.
+ ;; FIXME: this is probably wrong for cross-compilation
+ (add-after 'prepare-stex 'install-doc
+ (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+ (let* ((chez+version (strip-store-file-name
+ (assoc-ref outputs "out")))
+ (stex+version
+ (strip-store-file-name
+ (assoc-ref (or native-inputs inputs) "stex")))
+ (scheme (string-append (assoc-ref outputs "out")
+ "/bin/scheme"))
+ ;; see note on stex-output in phase build-stex, above:
+ (stexlib (string-append "/tmp"
+ "/lib/"
+ stex+version))
+ (doc-dir (string-append (assoc-ref outputs "doc")
+ "/share/doc/"
+ chez+version)))
+ (define* (stex-make #:optional (suffix ""))
+ (invoke "make"
+ "install"
+ (string-append "Scheme=" scheme)
+ (string-append "STEXLIB=" stexlib)
+ (string-append "installdir=" doc-dir suffix)))
+ (with-directory-excursion "csug"
+ (stex-make "/csug"))
+ (with-directory-excursion "release_notes"
+ (stex-make "/release_notes"))
+ (with-directory-excursion doc-dir
+ (symlink "release_notes/release_notes.pdf"
+ "release_notes.pdf")
+ (symlink "csug/csug9_5.pdf"
+ "csug.pdf"))
+ #t))))))
+ ;; Chez Scheme does not have a MIPS backend.
+ ;; FIXME: Debian backports patches to get armhf working.
+ ;; We should too. It is the Chez machine type arm32le
+ ;; (no threaded version upstream yet, though there is in
+ ;; Racket's fork), more specifically (per the release notes) ARMv6.
(supported-systems (fold delete %supported-systems
'("mips64el-linux" "armhf-linux")))
- (home-page "http://www.scheme.com")
+ (home-page "https://cisco.github.io/ChezScheme/")
(synopsis "R6RS Scheme compiler and run-time")
(description
"Chez Scheme is a compiler and run-time system for the language of the
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/fedeinthemix/chez-srfi.git")
+ (url "https://github.com/fedeinthemix/chez-srfi")
(commit (string-append "v" version))))
(sha256
(base32 "1vgn984mj2q4w6r2q66h7qklp2hrh85wwh4k9yisga5fi0ps7myf"))
`(("chez-scheme" ,chez-scheme)))
(arguments
`(#:make-flags (let ((out (assoc-ref %outputs "out")))
- (list (string-append "PREFIX=" out)))
+ (list (string-append "PREFIX=" out)
+ "CHEZ=chez-scheme --libdirs ./"
+ (string-append "chezversion=" ,(package-version chez-scheme))))
#:test-target "test"
#:phases (modify-phases %standard-phases
(delete 'configure))))
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/arcfide/ChezWEB.git")
+ (url "https://github.com/arcfide/ChezWEB")
(commit commit)))
(file-name (git-file-name name version))
(sha256
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/arcfide/chez-sockets.git")
+ (url "https://github.com/arcfide/chez-sockets")
(commit commit)))
(file-name (git-file-name name version))
(sha256
;; files.
(define (chez-make-flags name version)
`(let ((out (assoc-ref %outputs "out")))
- (list (string-append "PREFIX=" out)
- (string-append "DOCDIR=" out "/share/doc/"
- ,name "-" ,version))))
+ (list
+ ;; Set 'chezversion' so that libraries are installed in
+ ;; 'lib/csvX.Y.Z-site' like Chez's 'native-search-paths' expects.
+ (string-append "chezversion=" ,(package-version chez-scheme))
+ (string-append "PREFIX=" out)
+ (string-append "DOCDIR=" out "/share/doc/"
+ ,name "-" ,version))))
(define-public chez-matchable
(package
(origin
(method git-fetch)
(uri (git-reference
- (url "https://github.com/fedeinthemix/chez-irregex.git")
+ (url "https://github.com/fedeinthemix/chez-irregex")
(commit (string-append "v" version))))
(sha256
(base32 "0jh6piylw545j81llay9wfivgpv6lcnwd81gm4w17lkasslir50q"))