X-Git-Url: https://git.hcoop.net/jackhill/guix/guix.git/blobdiff_plain/4bdf4182fe080c3409f6ef9b410146b67cfa2595..0609713120011956093876901652beda6fc1af45:/gnu/packages/chez.scm diff --git a/gnu/packages/chez.scm b/gnu/packages/chez.scm index d08363a8dc..1cd2cde71b 100644 --- a/gnu/packages/chez.scm +++ b/gnu/packages/chez.scm @@ -3,6 +3,8 @@ ;;; Copyright © 2016 Efraim Flashner ;;; Copyright © 2017, 2019 Tobias Geerinckx-Rice ;;; Copyright © 2019 Brett Gilio +;;; Copyright © 2020 Brendan Tildesley +;;; Copyright © 2021 Philip McGrath ;;; ;;; This file is part of GNU Guix. ;;; @@ -28,6 +30,7 @@ #: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) @@ -42,50 +45,76 @@ #: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.2") + (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 "1hagrqdp649n2g0wq2a9gfnz7mjcjakkw7ziplbj3db412bb7kx5")) - (file-name (git-file-name name version)))) + (base32 "0prgn2z9l888j93ydxaf04ph424g0fi3a8w7f8m0b2r7fr1v7388")) + (file-name (git-file-name name version)) + (patches + (search-patches + ;; backported from upstream: remove on next release + "chez-scheme-build-util-paths-backport.patch")) + (snippet + ;; 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) - ("libuuid" ,util-linux "lib") - ("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))) @@ -95,98 +124,54 @@ (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)) - ;; 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 configure step wants to CURL all submodules as it - ;; detects a checkout without submodules. Disable curling, - ;; and manually patch the needed modules for compilation. - (substitute* "configure" - (("! -f '") "-d '")) ; working around CURL. - (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) @@ -201,16 +186,75 @@ "/" 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 "https://cisco.github.io/ChezScheme/") @@ -230,7 +274,7 @@ and 32-bit PowerPC architectures.") (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")) @@ -240,7 +284,9 @@ and 32-bit PowerPC architectures.") `(("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)))) @@ -261,7 +307,7 @@ and 32-bit PowerPC architectures.") (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 @@ -326,7 +372,7 @@ programming in Scheme.") (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 @@ -414,9 +460,13 @@ Chez Scheme.") ;; 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 @@ -456,7 +506,7 @@ Chez Scheme.") (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"))