diff mbox series

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

Message ID 20201201014454.18663-1-rprior@protonmail.com
State Accepted
Headers show
Series [bug#44978] gnu: packages: Add tiny-bignum. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Ryan Prior Dec. 1, 2020, 1:44 a.m. UTC
* gnu/packages/maths.scm (tiny-bignum): New variable.
---
 gnu/packages/maths.scm | 46 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

Comments

Ryan Prior Dec. 6, 2020, 4:59 a.m. UTC | #1
Hi there! It would be good to get some feedback on this patch series, if you have any question or reservations!

Also, since it's related, some updates on vlang packaging efforts:

!
1) The next release will have support for multiple directores in the VMODULES environment variable, allowing us to use it as a search path similar to how we do GOPATH. This opens the door to a v-build-system and inclusion of packages for v libraries, which I'm researching how to contribute. This is the last v release where all the libraries have to be copied into a single directory.
2) The build system for compiling tools ahead-of-time has not been in good shape, but with some prodding from myself, it's improving. Hopefully by the next release we should have a fix for https://issues.guix.gnu.org/44978

Cheers,
Ryan
Christopher Baines Dec. 8, 2020, 9:40 a.m. UTC | #2
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.
Ryan Prior Dec. 24, 2020, 2:44 a.m. UTC | #3
Hi there! Bumping this again since vlang recently released 0.2, a major release has has a number of goodies I've asked for to help improve the quality of our package. I'm beginning the work to update our package to 0.2, and hopefully will also succeed at moving a few more of the vendored sources out into dedicated packages.

If I can get any feedback on this patch series it would be very appreciated!
Leo Famulari Dec. 24, 2020, 10:03 p.m. UTC | #4
On Thu, Dec 24, 2020 at 02:44:57AM +0000, Ryan Prior via Guix-patches via wrote:
> Hi there! Bumping this again since vlang recently released 0.2, a major release has has a number of goodies I've asked for to help improve the quality of our package. I'm beginning the work to update our package to 0.2, and hopefully will also succeed at moving a few more of the vendored sources out into dedicated packages.
> 
> If I can get any feedback on this patch series it would be very appreciated!

It looks like some parts of the patch series have been pushed. Can you
clarify what remains to be done? For example, attach your proposed
further work to a reply message.
Ryan Prior Jan. 1, 2021, 7:47 p.m. UTC | #5
Thanks Leo! I published a new patch series which obsoletes this one. See debbugs 45601.
diff mbox series

Patch

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")))
+          (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)))))))
+     (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")