gnu: Switch several packages to 'guile-build-system'.

* gnu/packages/guile.scm (guile-minikanren)[build-system]: Set to
GUILE-BUILD-SYSTEM.
[arguments]: Remove.
[inputs]: Rename to 'native-inputs'.
(guile-miniadapton): Likewise.
(guile-colorized): Likewise.
(guile-irregex): Likewise, but rewrite 'arguments' field with custom
phases.
(guile-gdbm-ffi): Likewise, and move patch to the 'origin' form.
(guile-simple-zmq): Likewise, and change 'propagated-inputs' to
'inputs'.
(jupyter-guile-kernel): Likewise.
This commit is contained in:
Ludovic Courtès 2018-07-18 15:42:11 +02:00
parent 2a3b1b3235
commit 977d866681
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 98 additions and 411 deletions

View File

@ -74,6 +74,7 @@
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix build-system guile)
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (guix utils) #:use-module (guix utils)
#:use-module (ice-9 match) #:use-module (ice-9 match)
@ -965,60 +966,8 @@ specification. These are the main features:
(sha256 (sha256
(base32 (base32
"0r50jlpzi940jlmxyy3ddqqwmj5r12gb4bcv0ssini9v8km13xz6")))) "0r50jlpzi940jlmxyy3ddqqwmj5r12gb4bcv0ssini9v8km13xz6"))))
(build-system trivial-build-system) (build-system guile-build-system)
(arguments (native-inputs
`(#:modules ((guix build utils))
#:builder
(begin
(use-modules (guix build utils)
(ice-9 match)
(ice-9 popen)
(ice-9 rdelim))
(let* ((out (assoc-ref %outputs "out"))
(guile (assoc-ref %build-inputs "guile"))
(effective (read-line
(open-pipe* OPEN_READ
(string-append guile "/bin/guile")
"-c" "(display (effective-version))")))
(module-dir (string-append out "/share/guile/site/"
effective))
(source (assoc-ref %build-inputs "source"))
(doc (string-append out "/share/doc/guile-minikanren"))
(scm-files '("minikanren.scm"
"minikanren/mkextraforms.scm"
"minikanren/mkprelude.scm"
"minikanren/mk.scm"))
(guild (string-append (assoc-ref %build-inputs "guile")
"/bin/guild")))
;; Make installation directories.
(mkdir-p (string-append module-dir "/minikanren"))
(mkdir-p doc)
;; Compile .scm files and install.
(chdir source)
(setenv "GUILE_AUTO_COMPILE" "0")
(for-each (lambda (file)
(let* ((dest-file (string-append module-dir "/"
file))
(go-file (match (string-split file #\.)
((base _)
(string-append module-dir "/"
base ".go")))))
;; Install source module.
(copy-file file dest-file)
;; Install compiled module.
(invoke guild "compile"
"-L" source
"-o" go-file
file)))
scm-files)
;; Also copy over the README.
(install-file "README.org" doc)
#t))))
(inputs
`(("guile" ,guile-2.2))) `(("guile" ,guile-2.2)))
(home-page "https://github.com/ijp/minikanren") (home-page "https://github.com/ijp/minikanren")
(synopsis "MiniKanren declarative logic system, packaged for Guile") (synopsis "MiniKanren declarative logic system, packaged for Guile")
@ -1055,46 +1004,8 @@ See http://minikanren.org/ for more on miniKanren generally.")
(sha256 (sha256
(base32 (base32
"09q51zkw2fypad5xixskfzw2cjhjgs5cswdp3i7cpp651rb3zndh")))) "09q51zkw2fypad5xixskfzw2cjhjgs5cswdp3i7cpp651rb3zndh"))))
(build-system gnu-build-system) (build-system guile-build-system)
(arguments (native-inputs
`(#:modules ((guix build utils)
(ice-9 popen)
(ice-9 rdelim)
(srfi srfi-1)
(guix build gnu-build-system))
#:tests? #f ; there is no test target
#:phases
(modify-phases %standard-phases
(delete 'configure)
(delete 'build)
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((cwd (getcwd))
(scm-files (find-files "." "\\.scm$"))
(effective (read-line
(open-pipe* OPEN_READ
"guile" "-c"
"(display (effective-version))")))
(module-dir (string-append (assoc-ref outputs "out")
"/share/guile/site/"
effective)))
;; Make installation directories.
(mkdir-p module-dir)
(setenv "GUILE_AUTO_COMPILE" "0")
;; Compile .scm files and install.
(every (lambda (file)
(let ((go-file (string-append module-dir "/"
(basename file ".scm") ".go")))
;; Install source module.
(install-file file module-dir)
;; Compile and install module.
(zero? (system* "guild" "compile" "-L" cwd
"-o" go-file file))))
scm-files)))))))
(inputs
`(("guile" ,guile-2.2))) `(("guile" ,guile-2.2)))
(home-page "https://github.com/fisherdj/miniAdapton") (home-page "https://github.com/fisherdj/miniAdapton")
(synopsis "Minimal implementation of incremental computation in Guile (synopsis "Minimal implementation of incremental computation in Guile
@ -1120,65 +1031,25 @@ understand, extend, and port to host languages other than Scheme.")
(sha256 (sha256
(base32 (base32
"1ia3m7dp3lcxa048q0gqbiwwsyvn99baw6xkhb4bhhzn4k7bwyqq")))) "1ia3m7dp3lcxa048q0gqbiwwsyvn99baw6xkhb4bhhzn4k7bwyqq"))))
(build-system gnu-build-system) (build-system guile-build-system)
(arguments (arguments
`(#:modules ((guix build utils) '(#:phases (modify-phases %standard-phases
(ice-9 match) (add-after 'unpack 'move-files-around
(ice-9 rdelim) (lambda _
(ice-9 popen) ;; Move the relevant source files to src/ and create the
(guix build gnu-build-system)) ;; rx/ directory to match the expected module hierarchy.
#:phases (mkdir-p "src/rx/source")
(modify-phases %standard-phases (rename-file "irregex-guile.scm"
(delete 'configure) "src/rx/irregex.scm")
(delete 'build) (rename-file "irregex.scm"
(delete 'check) "src/rx/source/irregex.scm")
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(effective (read-line
(open-pipe* OPEN_READ
"guile" "-c"
"(display (effective-version))")))
(module-dir (string-append out "/share/guile/site/"
effective))
(source (assoc-ref inputs "source"))
(doc (string-append out "/share/doc/guile-irregex/"))
(guild (string-append (assoc-ref %build-inputs "guile")
"/bin/guild")))
;; Make installation directories.
(mkdir-p (string-append module-dir "/rx/source"))
(mkdir-p doc)
;; Compile .scm files and install.
(setenv "GUILE_AUTO_COMPILE" "0")
(for-each (lambda (copy-info)
(match copy-info
((src-file dest-file-basis)
(let* ((dest-file (string-append
module-dir dest-file-basis
".scm"))
(go-file (string-append
module-dir dest-file-basis
".go")))
;; Install source module.
(copy-file src-file
dest-file)
;; Install compiled module.
(invoke guild "compile"
"-L" (getcwd)
"-o" go-file
src-file)))))
'(("irregex-guile.scm" "/rx/irregex")
("irregex.scm" "/rx/source/irregex")
;; Not really reachable via guile's packaging system, ;; Not really reachable via guile's packaging system,
;; but nice to have around ;; but nice to have around.
("irregex-utils.scm" "/rx/source/irregex-utils"))) (rename-file "irregex-utils.scm"
"src/rx/source/irregex-utils.scm")
;; Also copy over the README. #t)))
(install-file "irregex.html" doc) #:source-directory "src"))
#t)))))) (native-inputs
(inputs
`(("guile" ,guile-2.2))) `(("guile" ,guile-2.2)))
(home-page "http://synthcode.com/scheme/irregex") (home-page "http://synthcode.com/scheme/irregex")
(synopsis "S-expression based regular expressions") (synopsis "S-expression based regular expressions")
@ -1207,83 +1078,35 @@ inspired by the SCSH regular expression system.")
(url "https://github.com/ijp/guile-gdbm.git") (url "https://github.com/ijp/guile-gdbm.git")
(commit "fa1d5b6231d0e4d096687b378c025f2148c5f246"))) (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
(file-name (string-append name "-" version "-checkout")) (file-name (string-append name "-" version "-checkout"))
(patches (search-patches
"guile-gdbm-ffi-support-gdbm-1.14.patch"))
(sha256 (sha256
(base32 (base32
"1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj")))) "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
(build-system trivial-build-system) (build-system guile-build-system)
(inputs
`(("guile" ,guile-2.2)
;; patch-and-repack doesn't work for git checkouts,
;; so we must apply the patch manually.
("patch" ,patch)
("patch-file" ,(search-patch
"guile-gdbm-ffi-support-gdbm-1.14.patch"))))
(propagated-inputs
`(("gdbm" ,gdbm)))
(arguments (arguments
`(#:modules '(#:phases (modify-phases %standard-phases
((guix build utils)) (add-after 'unpack 'move-examples
#:builder (lambda* (#:key outputs #:allow-other-keys)
(begin ;; Move examples where they belong.
(use-modules (guix build utils) (let* ((out (assoc-ref outputs "out"))
(ice-9 rdelim) (doc (string-append out "/share/doc/"
(ice-9 popen)) (strip-store-file-name out)
"/examples")))
;; Avoid warnings we can safely ignore (copy-recursively "examples" doc)
(setenv "GUILE_AUTO_COMPILE" "0") (delete-file-recursively "examples")
#t)))
(let* ((out (assoc-ref %outputs "out")) (add-after 'unpack 'set-libgdbm-file-name
(effective-version (lambda* (#:key inputs #:allow-other-keys)
(read-line (substitute* "gdbm.scm"
(open-pipe* OPEN_READ
(string-append
(assoc-ref %build-inputs "guile")
"/bin/guile")
"-c" "(display (effective-version))")))
(module-dir (string-append out "/share/guile/site/"
effective-version))
(source (assoc-ref %build-inputs "source"))
(doc (string-append out "/share/doc"))
(guild (string-append (assoc-ref %build-inputs "guile")
"/bin/guild"))
(gdbm.scm-dest
(string-append module-dir "/gdbm.scm"))
(gdbm.go-dest
(string-append module-dir "/gdbm.go"))
(compile-file
(lambda (in-file out-file)
(invoke guild "compile" "-o" out-file in-file))))
;; Switch directory for compiling and installing
(chdir source)
;; Install the documentation.
(install-file "README.md" doc)
(copy-recursively "examples" (string-append doc "/examples"))
;; Make installation directories.
(mkdir-p module-dir)
;; copy the source
(copy-file "gdbm.scm" gdbm.scm-dest)
;; Patch the FFI
(substitute* gdbm.scm-dest
(("\\(dynamic-link \"libgdbm\"\\)") (("\\(dynamic-link \"libgdbm\"\\)")
(format #f "(dynamic-link \"~a/lib/libgdbm.so\")" (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
(assoc-ref %build-inputs "gdbm")))) (assoc-ref inputs "gdbm"))))
#t)))))
;; Apply the patch to add support for gdbm-1.14. (native-inputs
(let ((patch-command (string-append (assoc-ref %build-inputs "patch") `(("guile" ,guile-2.2)))
"/bin/patch")) (inputs
(patch-file (assoc-ref %build-inputs "patch-file"))) `(("gdbm" ,gdbm)))
(with-directory-excursion (dirname gdbm.scm-dest)
(format #t "applying '~a'...~%" patch-file)
(invoke patch-command "--force" "--input" patch-file)))
;; compile to the destination
(compile-file gdbm.scm-dest gdbm.go-dest)
#t))))
(home-page "https://github.com/ijp/guile-gdbm") (home-page "https://github.com/ijp/guile-gdbm")
(synopsis "Guile bindings to the GDBM library via Guile's FFI") (synopsis "Guile bindings to the GDBM library via Guile's FFI")
(description (description
@ -2142,32 +1965,8 @@ It has a nice, simple s-expression based syntax.")
(sha256 (sha256
(base32 (base32
"16xhc3an6aglnca8xl3mvgi8hsqzqn68vsl5ga4bz8bvbap5fn4p")))) "16xhc3an6aglnca8xl3mvgi8hsqzqn68vsl5ga4bz8bvbap5fn4p"))))
(build-system gnu-build-system) (build-system guile-build-system)
(arguments (native-inputs
`(#:modules ((system base compile)
,@%gnu-build-system-modules)
#:tests? #f ;No tests included
#:phases
(modify-phases %standard-phases
(delete 'configure) ;No configure script
(replace 'install
(lambda* (#:key outputs inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(module-dir (string-append out "/share/guile/site/2.2"))
(language-dir (string-append module-dir "/ice-9"))
(guild (string-append (assoc-ref inputs "guile")
"/bin/guild")))
;; The original 'make install' is too primitive.
;; copy the source
(install-file "ice-9/colorized.scm" language-dir)
;; compile to the destination
(compile-file "ice-9/colorized.scm"
#:output-file (string-append
language-dir "/colorized.go"))
#t))))))
(inputs
`(("guile" ,guile-2.2))) `(("guile" ,guile-2.2)))
(home-page "https://github.com/NalaGinrut/guile-colorized") (home-page "https://github.com/NalaGinrut/guile-colorized")
(synopsis "Colorized REPL for Guile") (synopsis "Colorized REPL for Guile")
@ -2191,72 +1990,20 @@ It has a nice, simple s-expression based syntax.")
(base32 (base32
"0nj2pd5bsmmgd3c54wh4sixfhmsv1arsq7yam2d7487h3n9q57r7")) "0nj2pd5bsmmgd3c54wh4sixfhmsv1arsq7yam2d7487h3n9q57r7"))
(file-name (git-file-name name version)))) (file-name (git-file-name name version))))
(build-system trivial-build-system) (build-system guile-build-system)
(arguments (arguments
`(#:modules ((guix build utils)) `(#:source-directory "src"
#:builder #:phases (modify-phases %standard-phases
(begin (add-after 'unpack 'set-libzmq-file-name
(use-modules (guix build utils) (lambda* (#:key inputs #:allow-other-keys)
(srfi srfi-26) (substitute* "src/simple-zmq.scm"
(ice-9 match)
(ice-9 popen)
(ice-9 rdelim))
(let* ((out (assoc-ref %outputs "out"))
(guile (assoc-ref %build-inputs "guile"))
(effective (read-line
(open-pipe* OPEN_READ
(string-append guile "/bin/guile")
"-c" "(display (effective-version))")))
(module-dir (string-append out "/share/guile/site/"
effective))
(go-dir (string-append out "/lib/guile/"
effective "/site-ccache/"))
(source (string-append (assoc-ref %build-inputs "source")
"/src"))
(scm-file "simple-zmq.scm")
(guild (string-append (assoc-ref %build-inputs "guile")
"/bin/guild"))
(zmq (assoc-ref %build-inputs "zeromq"))
(deps (list zmq))
(path (string-join
(map (cut string-append <>
"/lib/")
deps)
":")))
;; Make installation directories.
(mkdir-p module-dir)
(mkdir-p go-dir)
;; Compile .scm files and install.
(chdir source)
(setenv "GUILE_AUTO_COMPILE" "0")
(for-each (lambda (file)
(let* ((dest-file (string-append module-dir "/"
file))
(go-file (match (string-split file #\.)
((base _)
(string-append go-dir "/"
base ".go")))))
;; Install source module.
(copy-file file dest-file)
(substitute* dest-file
(("\\(dynamic-link \"libzmq\"\\)") (("\\(dynamic-link \"libzmq\"\\)")
(format #f "(dynamic-link \"~a/lib/libzmq.so\")" (format #f "(dynamic-link \"~a/lib/libzmq.so\")"
(assoc-ref %build-inputs "zeromq")))) (assoc-ref inputs "zeromq"))))
#t)))))
;; Install and compile module. (native-inputs
(unless (zero? (system* guild "compile"
"-L" source
"-o" go-file
dest-file))
(error (format #f "Failed to compile ~s to ~s!"
file go-file)))))
(list scm-file))
#t))))
(inputs
`(("guile" ,guile-2.2))) `(("guile" ,guile-2.2)))
(propagated-inputs (inputs
`(("zeromq" ,zeromq))) `(("zeromq" ,zeromq)))
(home-page "https://github.com/jerry40/guile-simple-zmq") (home-page "https://github.com/jerry40/guile-simple-zmq")
(synopsis "Guile wrapper over ZeroMQ library") (synopsis "Guile wrapper over ZeroMQ library")
@ -2280,106 +2027,46 @@ messaging library.")
(sha256 (sha256
(base32 (base32
"0y5jr0f0dyskvsawqbf6n0bpg8jirw4mhqbarf2a6p9lxhqha9s9")))) "0y5jr0f0dyskvsawqbf6n0bpg8jirw4mhqbarf2a6p9lxhqha9s9"))))
(build-system trivial-build-system) (build-system guile-build-system)
(arguments (arguments
`(#:modules ((guix build utils)) '(#:phases (modify-phases %standard-phases
#:builder (add-after 'unpack 'set-openssl-file-name
(begin (lambda* (#:key inputs #:allow-other-keys)
(use-modules (guix build utils) ;; Record the absolute file name of the 'openssl'
(srfi srfi-26) ;; command.
(ice-9 match) (substitute* "src/hmac.scm"
(ice-9 popen)
(ice-9 rdelim))
(let* ((out (assoc-ref %outputs "out"))
(guile (assoc-ref %build-inputs "guile"))
(effective (read-line
(open-pipe* OPEN_READ
(string-append guile "/bin/guile")
"-c" "(display (effective-version))")))
(module-dir (string-append out "/share/guile/site/"
effective))
(kernel-dir (string-append out "/share/jupyter/kernels/guile"))
(go-dir (string-append out "/lib/guile/"
effective
"/site-ccache"))
(source (string-append (assoc-ref %build-inputs "source")
"/src"))
(scm-files '("hmac.scm"
"tools.scm"
"guile-jupyter-kernel.scm"))
(kernel-file "kernel.json")
(guild (string-append (assoc-ref %build-inputs "guile")
"/bin/guild"))
(g-szmq (assoc-ref %build-inputs "guile-simple-zmq"))
(json (assoc-ref %build-inputs "guile-json"))
(deps (list g-szmq json))
(path (string-join
(map (cut string-append <>
"/share/guile/site/"
effective)
deps)
":"))
(gopath (string-join
(map (cut string-append <>
"/lib/guile/" effective
"/site-ccache/")
deps)
":")))
;; Make installation directories.
(mkdir-p module-dir)
(mkdir-p kernel-dir)
(mkdir-p go-dir)
;; Make a writable copy of SOURCE.
(copy-recursively source ".")
;; Record the absolute file name of the 'openssl' command.
(substitute* "hmac.scm"
(("openssl") (("openssl")
(string-append (assoc-ref %build-inputs "openssl") (string-append (assoc-ref inputs "openssl")
"/bin/openssl"))) "/bin/openssl")))
#t))
;; Compile .scm files and install. ;; XXX: The code uses 'include' to include its own source
(setenv "GUILE_AUTO_COMPILE" "0") ;; files, and "-L src" isn't enough in this case.
(setenv "GUILE_LOAD_PATH" path) (add-before 'build 'chdir
(setenv "GUILE_LOAD_COMPILED_PATH" gopath) (lambda _ (chdir "src") #t))
(add-after 'build 'chdir-back
(lambda _ (chdir "..") #t))
(for-each (lambda (file) (add-after 'install 'install-kernel
(let* ((dest-file (string-append module-dir "/" (lambda* (#:key inputs outputs #:allow-other-keys)
file)) (let* ((out (assoc-ref outputs "out"))
(go-file (match (string-split file #\.) (dir (string-append
((base _) out "/share/jupyter/kernels/guile")))
(string-append go-dir "/" ;; Install kernel.
base ".go"))))) (install-file "src/kernel.json" dir)
;; Install source module.
(copy-file file dest-file)
;; Install compiled module. ;; Fix hard-coded file name in the kernel.
(unless (zero? (system* guild "compile" (substitute* (string-append dir "/kernel.json")
"-L" source (("/home/.*/guile-jupyter-kernel.scm")
"-o" go-file (string-append out "/share/guile/site/"
file)) (target-guile-effective-version)
(error (format #f "Failed to compile ~s to ~s!" "/guile-jupyter-kernel.scm"))
file go-file)))))
scm-files)
;; Install kernel
(copy-file kernel-file (string-append kernel-dir "/"
kernel-file))
;; Fix hard-coded file name in the kernel
(substitute* (string-append kernel-dir "/"
kernel-file)
(("/home/jerry/.local/share/jupyter/kernels/guile/guile-jupyter-kernel.scm")
(string-append module-dir "/guile-jupyter-kernel.scm"))
(("\"guile\"") (("\"guile\"")
(string-append "\"" (assoc-ref %build-inputs "guile") (string-append "\"" (assoc-ref inputs "guile")
"/bin/guile\"")) "/bin/guile\""))
(("-s") (("-s")
(string-append "--no-auto-compile\", \"-s"))) (string-append "--no-auto-compile\", \"-s")))
#t))))))
#t))))
(inputs (inputs
`(("openssl" ,openssl) `(("openssl" ,openssl)
("guile" ,guile-2.2))) ("guile" ,guile-2.2)))