guix-commits
[Top][All Lists]
Advanced

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

03/07: gnu: Add pcg-c.


From: guix-commits
Subject: 03/07: gnu: Add pcg-c.
Date: Sat, 2 Dec 2023 06:36:22 -0500 (EST)

civodul pushed a commit to branch master
in repository guix.

commit aa4959e602998e753f12a99ab38c4a8ab19e2171
Author: David Elsing <david.elsing@posteo.net>
AuthorDate: Wed Nov 1 22:57:14 2023 +0000

    gnu: Add pcg-c.
    
    * gnu/packages/c.scm (pcg-c): New variable.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 gnu/packages/c.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index da0d11e8f7..ac83336ba5 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.
 ;;;
@@ -1588,3 +1589,57 @@ serial program, though the execution model is actually 
that a number of
 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



reply via email to

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