summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristopher Rodriguez <yewscion@gmail.com>2022-08-10 13:28:00 -0400
committerLudovic Courtès <ludo@gnu.org>2022-09-01 00:57:10 +0200
commitdc9a5257a9aeeb159ceb6cfad816c335586758be (patch)
treee528ff6ed68d446a9037681c854f5fe9502047e4
parent4e7c1130f79649af0e905a22d35de5473b451633 (diff)
downloadguix-dc9a5257a9aeeb159ceb6cfad816c335586758be.tar.gz
gnu: Add cbqn.
* gnu/packages/bqn.scm (cbqn): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--gnu/packages/bqn.scm47
1 files changed, 47 insertions, 0 deletions
diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
index 1462f2d964..c4e0f39efb 100644
--- a/gnu/packages/bqn.scm
+++ b/gnu/packages/bqn.scm
@@ -175,3 +175,50 @@ by APL.")
       (file-name (git-file-name "singeli-sources" commit))
       (sha256
        (base32 "1rr4l7ijzcg25n2igi1mzya6qllh5wsrf3m5i429rlgwv1fwvfji")))))
+
+(define-public cbqn
+  (package
+    (inherit cbqn-bootstrap)
+    (name "cbqn")
+    (outputs '("out" "lib"))
+    (arguments
+     (list #:make-flags '(list "shared-o3" "o3n-singeli")
+           #:phases #~(modify-phases %standard-phases
+                        (delete 'configure)
+                        (add-before 'build 'link-singeli
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (symlink #+singeli-sources "Singeli")))
+                        (add-before 'build 'generate-bytecode
+                          (lambda* (#:key inputs #:allow-other-keys)
+                            (system (string-append #+dbqn
+                                                   "/bin/dbqn ./genRuntime "
+                                                   #+bqn-sources))))
+                        (replace 'check
+                          (lambda* (#:key inputs tests? #:allow-other-keys)
+                            (when tests?
+                              (system (string-append "./BQN -M 1000 \""
+                                                     #+bqn-sources
+                                                     "/test/this.bqn\""))
+                              (map (lambda (x)
+                                     (system (string-append "./BQN ./test/" x
+                                                            ".bqn")))
+                                   '("cmp" "equal" "copy" "random"))
+                              (system "make -C test/ffi"))))
+                        (replace 'install
+                          (lambda* (#:key outputs #:allow-other-keys)
+                            (let* ((bin (string-append (assoc-ref outputs
+                                                                  "out")
+                                                       "/bin"))
+                                   (lib (string-append (assoc-ref outputs
+                                                                  "lib")
+                                                       "/lib")))
+                              (mkdir-p bin)
+                              (copy-recursively "BQN"
+                                                (string-append bin "/bqn"))
+                              (install-file "libcbqn.so" lib)))))))
+    (native-inputs (list dbqn
+                         bqn-sources
+                         singeli-sources
+                         libffi
+                         clang-toolchain
+                         linux-libre-headers))))