From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNNcx-0007xt-VI for guix-patches@gnu.org; Fri, 08 Dec 2017 13:44:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNNcw-0007gT-QU for guix-patches@gnu.org; Fri, 08 Dec 2017 13:44:04 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:44185) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eNNcw-0007gK-Ng for guix-patches@gnu.org; Fri, 08 Dec 2017 13:44:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eNNcw-0001g8-EW for guix-patches@gnu.org; Fri, 08 Dec 2017 13:44:02 -0500 Subject: [bug#29618] [PATCH] gnu: Add uthash. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eNNcE-0007wA-CW for guix-patches@gnu.org; Fri, 08 Dec 2017 13:43:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eNNcD-0007CL-4P for guix-patches@gnu.org; Fri, 08 Dec 2017 13:43:18 -0500 Received: from tobias.gr ([2001:470:cc92::1]:59254) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eNNcC-0007BT-Oo for guix-patches@gnu.org; Fri, 08 Dec 2017 13:43:17 -0500 Received: by tobias.gr (OpenSMTPD) with ESMTP id 937139cd for ; Fri, 8 Dec 2017 18:43:12 +0000 (UTC) Received: by submission.tobias.gr (OpenSMTPD) with ESMTPSA id f4a9a031 (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO) for ; Fri, 8 Dec 2017 18:43:11 +0000 (UTC) From: Tobias Geerinckx-Rice Date: Fri, 8 Dec 2017 19:45:40 +0100 Message-Id: <20171208184540.26410-1-me@tobias.gr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 29618@debbugs.gnu.org * gnu/packages/datastructures.scm (uthash): New public variable. --- gnu/packages/datastructures.scm | 54 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/gnu/packages/datastructures.scm b/gnu/packages/datastructures.scm index 36318ee04..7db2fc82a 100644 --- a/gnu/packages/datastructures.scm +++ b/gnu/packages/datastructures.scm @@ -116,3 +116,57 @@ with the number of cores. liburcu-cds provides efficient data structures based on RCU and lock-free algorithms. These structures include hash tables, queues, stacks, and doubly-linked lists.") (license license:lgpl2.1+))) + +(define-public uthash + (package + (name "uthash") + (version "2.0.2") + (source + (origin + (method url-fetch) + (file-name (string-append name "-" version ".tar.gz")) + (uri (string-append "https://github.com/troydhanson/uthash/archive/v" + version ".tar.gz")) + (sha256 + (base32 + "1la82gdlyl7m8ahdjirigwfh7zjgkc24cvydrqcri0vsvm8iv8rl")))) + (build-system gnu-build-system) + (native-inputs + `(("perl" ,perl))) + (arguments + `(#:make-flags (list "CC=gcc") + #:phases + (modify-phases %standard-phases + (delete 'configure) ; nothing to configure + (delete 'build) ; nothing to build + (replace 'check + (lambda* (#:key make-flags #:allow-other-keys) + (with-directory-excursion "tests" + (zero? (apply system* "make" + make-flags))))) + (replace 'install + ;; There is no top-level Makefile to do this for us. + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (doc (string-append out "/share/doc/" ,name)) + (include (string-append out "/include"))) + ;; Don't install HTML files: they are generated from these .txt + ;; files, could be stale, and updating them requires ‘asciidoc‘. + (for-each (λ (file) (install-file file doc)) + (append (list "LICENSE") + (find-files "doc" "\\.txt$"))) + (for-each (λ (file) (install-file file include)) + (find-files "src" "\\.h$")))))))) + (home-page "https://troydhanson.github.io/uthash/") + (synopsis + "Hash tables, lists, and other data structures implemented as C macros") + (description + "uthash implements a hash table and a few other basic data structures +as C preprocessor macros. It aims to be minimalistic and efficient: it's +around 1,000 lines of code which, being macros, inline automatically. + +Unlike function calls with fixed prototypes, macros operate on untyped +arguments. Thus, they are able to work with any type of structure or key. +Any C structure can be stored in a hash table by adding @code{UT_hash_handle} +to the structure and choosing one or more fields to act as the key.") + (license license:bsd-2))) -- 2.15.0