summary refs log tree commit diff
path: root/gnu/packages/c.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-10-13 15:15:59 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2020-10-13 22:26:41 -0400
commit9acf79b25861b75a92ea8c32eb926e465ba5b20a (patch)
tree585350ae4b8d41a439f9f9be2be04e9d9a0cbbba /gnu/packages/c.scm
parent7e15ded6474bf3096f01fcd830337d66cb682669 (diff)
downloadguix-9acf79b25861b75a92ea8c32eb926e465ba5b20a.tar.gz
gnu: Add libwuya.
* gnu/packages/c.scm (libwuya): New variable.
Diffstat (limited to 'gnu/packages/c.scm')
-rw-r--r--gnu/packages/c.scm59
1 files changed, 59 insertions, 0 deletions
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index c1ae98ddd3..493d99387c 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -40,6 +40,7 @@
   #:use-module (gnu packages perl)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages guile)
+  #:use-module (gnu packages lua)
   #:use-module (gnu packages multiprecision)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages python)
@@ -257,6 +258,64 @@ string formatting and autoresizing, option and config file parsing, type
 checking casts and more.")
     (license license:lgpl2.1+)))
 
+(define-public libwuya
+  ;; This commit is the one before "wuy_pool.h" was removed from libwuya,
+  ;; which libleak currently requires.
+  (let ((revision "1")
+        (commit "883502041044f4616cfbf75c8f2bb60059f704a9"))
+    (package
+      (name "libwuya")
+      (version (git-version "0.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/WuBingzheng/libwuya")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "1xrsqbgr13g2v0ag165ryp7xrwzv41xfygzk2a3445ca98c1qpdc"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f                    ;no test suite
+         #:phases (modify-phases %standard-phases
+                    (add-after 'unpack 'patch-lua-includes
+                      (lambda _
+                        (substitute* '("wuy_cflua.h" "wuy_cflua.c")
+                          (("<lua5\\.1/") "<"))
+                        #t))
+                    (add-after 'unpack 'add--fPIC-to-CFLAGS
+                      (lambda _
+                        (substitute* "Makefile"
+                          (("CFLAGS[^\n]*" all)
+                           (string-append all " -fPIC")))
+                        #t))
+                    (add-before 'build 'set-CC
+                      (lambda _
+                        (setenv "CC" "gcc")
+                        #t))
+                    (delete 'configure) ;no configure script
+                    (replace 'install
+                      (lambda* (#:key outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (include-dir (string-append out "/include"))
+                               (headers (find-files "." "\\.h$")))
+                          (for-each (lambda (h)
+                                      (install-file h include-dir))
+                                    headers)
+                          (install-file "libwuya.a" (string-append out "/lib"))
+                          #t))))))
+      (inputs `(("lua" ,lua)))
+      (home-page "https://github.com/WuBingzheng/libwuya/")
+      (synopsis "C library implementing various data structures")
+      (description "The @code{libwuya} library implements data structures such
+as dictionaries, skip lists, and memory pools.")
+      ;; There is no clear information as to what license this is distributed
+      ;; under, but it is included (bundled) with libleak from the same author
+      ;; under the GNU GPL v2 or later license, so use this here until it is
+      ;; clarified (see: https://github.com/WuBingzheng/libwuya/issues/2).
+      (license license:gpl2+))))
+
 (define-public packcc
   (package
     (name "packcc")