unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: David Elsing <david.elsing@posteo.net>
To: 66889@debbugs.gnu.org
Cc: David Elsing <david.elsing@posteo.net>
Subject: [bug#66889] [PATCH 1/2] gnu: Add pcg-c.
Date: Wed,  1 Nov 2023 22:57:14 +0000	[thread overview]
Message-ID: <1c639973fbed48a27da78c45d4332f3cae458738.1698878711.git.david.elsing@posteo.net> (raw)
In-Reply-To: <cover.1698878710.git.david.elsing@posteo.net>

* gnu/packages/c.scm (pcg-c): New variable.
---
 gnu/packages/c.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index ea58c68262..0c218b9656 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -20,6 +20,7 @@
 ;;; Copyright © 2022 Antero Mejr <antero@mailbox.org>
 ;;; Copyright © 2023 zamfofex <zamfofex@twdb.moe>
 ;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
+;;; Copyright © 2023 David Elsing <david.elsing@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1585,3 +1586,57 @@ (define-public ispc
 program instances execute in parallel on the hardware.")
     (home-page "https://github.com/ispc/ispc")
     (license license:bsd-3)))
+
+(define-public pcg-c
+  (let ((commit "83252d9c23df9c82ecb42210afed61a7b42402d7")
+        (revision "1"))
+    (package
+      (name "pcg-c")
+      (version (git-version "0.0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/imneme/pcg-c")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0768h0vw75a3smk39qsz1504v04a43s5w1ili1ijbixxv8gm42nf"))
+                (modules '((guix build utils)))
+                ;; Autogenerated files with some tests from test-high. If
+                ;; 128-bit integers are not supported, the build fails, but
+                ;; this is checked when building the tests.
+                (snippet #~(delete-file-recursively "sample"))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:test-target "test"
+        #:make-flags
+        #~(list
+           "CC=gcc"
+           (string-append "PREFIX=" #$output))
+        #:phases
+        #~(modify-phases %standard-phases
+            (delete 'configure)
+            (add-after 'unpack 'disable-sample
+              (lambda _
+                (substitute* "Makefile"
+                  ((".*cd sample.*") ""))))
+            (add-after 'unpack 'set-shared-library
+              (lambda _
+                (substitute* '("Makefile" "src/Makefile")
+                  (("\\.a") "\\.so")
+                  ((".*ar .*") "\t$(CC) $(CFLAGS) -o $@ $(LDFLAGS) -shared $^")
+                  ((".*ranlib.*") "")
+                  ((".*CFLAGS \\+=.*O3.*" orig)
+                   (string-append orig "CFLAGS += -fPIC\n")))))
+            (add-before 'install 'make-dirs
+              (lambda _
+                (mkdir-p (string-append #$output "/lib"))
+                (mkdir-p (string-append #$output "/include")))))))
+      (home-page "https://www.pcg-random.org")
+      (synopsis "C implementation of the PCG random generators")
+      (description "The Permuted Congruential Generator (PCG) extends the
+Linear Congruential Generator (LCG) with a permutation function to increase
+output randomness while retaining speed, simplicity, and conciseness.")
+      (license (list license:expat license:asl2.0))))) ; dual licensed
-- 
2.41.0





  reply	other threads:[~2023-11-01 22:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-01 22:53 [bug#66889] [PATCH 0/2] Unbundle igraph dependencies David Elsing
2023-11-01 22:57 ` David Elsing [this message]
2023-11-01 22:57 ` [bug#66889] [PATCH 2/2] gnu: igraph: Update to 0.10.7 David Elsing
2023-12-02 10:58 ` bug#66889: [PATCH 0/2] Unbundle igraph dependencies Ludovic Courtès

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=1c639973fbed48a27da78c45d4332f3cae458738.1698878711.git.david.elsing@posteo.net \
    --to=david.elsing@posteo.net \
    --cc=66889@debbugs.gnu.org \
    /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).