guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#44978] [PATCH] gnu: packages: Add tiny-bignum.


From: Christopher Baines
Subject: [bug#44978] [PATCH] gnu: packages: Add tiny-bignum.
Date: Tue, 08 Dec 2020 09:40:27 +0000
User-agent: mu4e 1.4.13; emacs 27.1

Hey, I've pushed this to master as
ab58b2cc32068fc9e5f0a7c7ae112349943b7dfd with a few changes.


Ryan Prior via Guix-patches via <guix-patches@gnu.org> writes:

> * gnu/packages/maths.scm (tiny-bignum): New variable.

I removed packages: from the commit message, I think just gnu: Add
foo. is the convention.

> ---
>  gnu/packages/maths.scm | 46 ++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
> index d3f3539e26..a0dd9a761c 100644
> --- a/gnu/packages/maths.scm
> +++ b/gnu/packages/maths.scm
> @@ -4984,6 +4984,52 @@ be fed to @command{tcalc} through the command line.")
>    (home-page "https://sites.google.com/site/mohammedisam2000/tcalc";)
>    (license license:gpl3+)))
>  
> +(define-public tiny-bignum
> +  (let ((commit "1d7a1f9b8e77316187a6b3eae8e68d60a6f9a4d4"))
> +    (package
> +     (name "tiny-bignum")
> +     (version (git-version "0" "0" commit))
> +     (source
> +      (origin
> +        (method git-fetch)
> +        (uri (git-reference
> +              (url "https://github.com/kokke/tiny-bignum-c";)
> +              (commit commit)))
> +        (file-name (git-file-name "tiny-bignum" commit))
> +        (sha256
> +         (base32 "0vj71qlhlaa7d92bfar1kwqv6582dqrby8x3kdw0yzh82k2023g6"))))
> +     (build-system gnu-build-system)
> +     (arguments
> +      `(#:phases
> +        (modify-phases %standard-phases
> +          (delete 'configure)
> +          (replace 'check
> +            (lambda _
> +              (substitute* "scripts/test_rand.py"
> +                (("\t") "  ")
> +                (("\" % (\\w+)" _ symbol) (string-append "\" % int(" symbol 
> ")")))
> +              (invoke "make" "test")))

I split this phase, so 'check just does the testing, and I tweaked it to
use the tests? argument.

> +          (replace 'install
> +            (lambda* (#:key outputs #:allow-other-keys)
> +              (let ((share (string-append (assoc-ref outputs "out") 
> "/share"))
> +                    (doc (string-append (assoc-ref outputs "out") "/doc")))
> +                (mkdir-p share)
> +                (install-file "bn.c" share)
> +                (install-file "bn.h" share)
> +                (mkdir-p doc)
> +                (install-file "LICENSE" doc)
> +                (install-file "README.md" doc)))))))

The build output showed:

## WARNING: phase `install' returned `#<unspecified>'.  Return values other 
than #t
## are deprecated.  Please migrate this package so that its phase
## procedures report errors by raising an exception, and otherwise
## always return #t.

So I added #t at the end.

> +     (native-inputs
> +      `(("python" ,python-wrapper)))
> +     (home-page "https://github.com/kokke/tiny-bignum-c";)
> +     (synopsis "Small portable multiple-precision unsigned integer 
> arithmetic in C")
> +     (description
> +      "This library provides portable Arbitrary-precision unsigned integer
> +arithmetic in C, for calculating with large numbers.  Basic arithmetic (+, -,
> +*, /, %) and bitwise operations (&, |, ^. <<, >>) plus increments, decrements
> +and comparisons are supported.")
> +     (license license:unlicense))))
> +
>  (define-public sundials
>    (package
>      (name "sundials")

Final thing, I'm not sure the location of the bn.c and bn.h files in the
output are particularly conventional. I'd expect the .h file to be in
include I think, rather than share. Also, with a C library, I think
you'd expect to have a .so file in lib, and the .c file not to be
included. Looking ahead to where you're using this, I think I see why
you've done it this way, but it could mean that using this package is
harder in other packages.

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]