unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Christopher Baines <mail@cbaines.net>
To: Ryan Prior <rprior@protonmail.com>
Cc: 44978@debbugs.gnu.org
Subject: [bug#44978] [PATCH] gnu: packages: Add tiny-bignum.
Date: Tue, 08 Dec 2020 09:40:27 +0000	[thread overview]
Message-ID: <87o8j4iqk4.fsf@cbaines.net> (raw)
In-Reply-To: <20201201014454.18663-1-rprior@protonmail.com>

[-- Attachment #1: Type: text/plain, Size: 3806 bytes --]


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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 987 bytes --]

  parent reply	other threads:[~2020-12-08  9:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  1:44 [bug#44978] [PATCH] gnu: packages: Add tiny-bignum Ryan Prior via Guix-patches via
2020-12-01  4:10 ` [bug#44978] [PATCH] gnu: Add cjson Ryan Prior via Guix-patches via
2020-12-08  9:41   ` Christopher Baines
2020-12-01  4:15 ` [bug#44978] [PATCH 1/3] gnu: vlang: Update to 0.1.30 Ryan Prior via Guix-patches via
2020-12-01  4:15   ` [bug#44978] [PATCH 2/3] gnu: vlang: Use system tiny-bignum Ryan Prior via Guix-patches via
2020-12-01  4:15   ` [bug#44978] [PATCH 3/3] gnu: vlang: Use system cJSON Ryan Prior via Guix-patches via
2020-12-06  4:59 ` [bug#44978] Update vlang Ryan Prior via Guix-patches via
2020-12-08  9:40 ` Christopher Baines [this message]
2020-12-24  2:44 ` [bug#44978] Package v 0.1.30 in preparation for 0.2 Ryan Prior via Guix-patches via
2020-12-24 22:03   ` Leo Famulari
2021-01-01 19:47 ` [bug#44978] What remains to be done for bug#44978 Ryan Prior via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87o8j4iqk4.fsf@cbaines.net \
    --to=mail@cbaines.net \
    --cc=44978@debbugs.gnu.org \
    --cc=rprior@protonmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).