Subject: Re: [PATCH 5/5] gnu: bqn: Update cbqn.

From: aecepoglu <[email-masked]>
Date: Sun, 31 Mar 2024 05:22:46 +0100

Can we get this reviewed please? The extra FFI capabilities it brings is critical in developing more libraries in BQN.

On Sat, 10 Feb 2024, at 11:28 PM, aecepoglu wrote:
> * gnu/packages/bqn.scm (cbqn): Update cbqn.
> Update version.
> Override 'generate-bytecode to rely on cbqn-bootstrap instead of dbqn.
>
> Change-Id: I1660d218960e7395f4c10983d840e3fa4b451d14
> ---
>  gnu/packages/bqn.scm | 37 ++++++++++++++++++++-----------------
>  1 file changed, 20 insertions(+), 17 deletions(-)
>
> diff --git a/gnu/packages/bqn.scm b/gnu/packages/bqn.scm
> index 6d3ec43a0f..66c70a8516 100644
> --- a/gnu/packages/bqn.scm
> +++ b/gnu/packages/bqn.scm
> @@ -209,9 +209,16 @@ (define-public cbqn
>                                      (list #:tests?)
>                                      (package-arguments cbqn-bootstrap))
>         ((#:make-flags flags #~(list))
> -        #~(cons* "shared-o3" "o3" #$flags))
> +        #~(append #$flags '("shared-o3" "o3")))
>         ((#:phases phases #~%standard-phases)
>          #~(modify-phases #$phases
> +            (replace 'generate-bytecode
> +                     (lambda* (#:key outputs #:allow-other-keys)
> +                       (let ((out (assoc-ref outputs "out")))
> +                         (mkdir-p (string-append "./build/bytecodeLocal/gen"))
> +                         (system (string-append #+cbqn-bootstrap
> +                                  "/bin/bqn ./build/genRuntime "
> +                                  #+bqn-sources " ./build/bytecodeLocal")))))
>              (replace 'check
>                (lambda* (#:key inputs tests? #:allow-other-keys)
>                  (when tests?
> @@ -219,25 +226,21 @@ (define-public cbqn
>                                           #+bqn-sources
>                                           "/test/this.bqn\""))
>                    (map (lambda (x)
> -                         (system (string-append "./BQN ./test/" x
> -                                                ".bqn")))
> +                         (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"))
> -                       (include (string-append (assoc-ref outputs "lib")
> -                                           "/include")))
> -                  (mkdir-p bin)
> -                  (rename-file "BQN" "bqn")
> -                  (install-file "bqn" bin)
> -                  (install-file "libcbqn.so" lib)
> -                  (install-file "include/bqnffi.h" include))))))))
> -    (native-inputs (list dbqn
> +            (add-after 'install 'install-lib-stuff
> +                     (lambda* (#:key outputs #:allow-other-keys)
> +                       (let* ((lib (string-append (assoc-ref outputs "lib")
> +                                                  "/lib"))
> +                              (include (string-append (assoc-ref outputs "lib")
> +                                                      "/include")))
> +                         (install-file "libcbqn.so" lib)
> +                         (install-file "include/bqnffi.h" include))))))))
> +    (native-inputs (list cbqn-bootstrap
> +                         singeli
>                           bqn-sources
>                           libffi))
> +    (inputs (list libffi))
>      (properties
>       `((tunable? . #t)))))
> -- 
> 2.43.0