guix-devel
[Top][All Lists]
Advanced

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

[PATCH 4/6] gnu: Add rocksdb.


From: Marius Bakke
Subject: [PATCH 4/6] gnu: Add rocksdb.
Date: Sun, 15 Jan 2017 21:33:36 +0100

* gnu/packages/databases.scm (rocksdb): New variable.
---
 gnu/packages/databases.scm | 86 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 4bbe55bab..610749d98 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -54,8 +54,10 @@
   #:use-module (gnu packages cyrus-sasl)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages parallel)
   #:use-module (gnu packages pcre)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages popt)
   #:use-module (gnu packages rdf)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages bison)
@@ -480,6 +482,90 @@ types are supported, as is encryption.")
     (license gpl3+)
     (home-page "http://www.gnu.org/software/recutils/";)))
 
+(define-public rocksdb
+  (package
+    (name "rocksdb")
+    (version "5.0.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/facebook/rocksdb";
+                                  "/archive/v" version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0kija4q6nbkjaj1x94q6qb73abgc5i49rakppxj3a368pg9nwz54"))
+              (modules '((guix build utils)))
+              (snippet
+               '(begin
+                  ;; TODO: unbundle gtest.
+                  (delete-file "build_tools/gnu_parallel")
+                  #t))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:make-flags (list "CC=gcc"
+                          ;; Make the resulting library position-independent 
so the
+                          ;; static version can be included in shared objects.
+                          "EXTRA_CXXFLAGS=-fPIC"
+                          (string-append "INSTALL_PATH="
+                                         (assoc-ref %outputs "out")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-source
+           (lambda _
+             (substitute* "Makefile"
+               (("build_tools/gnu_parallel") "parallel")
+               (("#!/bin/sh") (string-append "#!" (which "sh"))))
+             #t))
+         (delete 'configure)
+         (add-before 'check 'disable-failing-tests
+           (lambda _
+             (substitute* "Makefile"
+               ;; These tests reliably fail due to "Too many open files".
+               (("^[[:blank:]]+env_test[[:blank:]]+\\\\") "\\")
+               (("^[[:blank:]]+persistent_cache_test[[:blank:]]+\\\\") "\\"))
+             #t))
+         (add-after 'check 'build-release-libraries
+           ;; The 'check' target depends on the default target which
+           ;; is compiled with debug symbols. The 'install' target depends
+           ;; on custom release targets so we build them here for clarity.
+           ;; TODO: Add debug output.
+           (lambda* (#:key (make-flags '()) #:allow-other-keys)
+             ;; Prevent the build from adding machine-specific optimizations.
+             ;; This does not work if passed as a make flag...
+             (setenv "PORTABLE" "1")
+             (and (zero? (apply system* "make" "static_lib" make-flags))
+                  (zero? (apply system* "make" "shared_lib" make-flags)))))
+         (add-after 'install 'move-static-library
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (lib (string-append out "/lib"))
+                    (static (assoc-ref outputs "static"))
+                    (slib (string-append static "/lib")))
+               (mkdir-p slib)
+               (for-each (lambda (file)
+                           (install-file file slib)
+                           (delete-file file))
+                         (find-files lib "\\.l?a$"))
+               #t))))))
+    (outputs
+     '("out" "static"))
+    (native-inputs
+     `(("parallel" ,parallel)
+       ("perl" ,perl)
+       ("procps" ,procps)
+       ("python" ,python-2)))
+    (inputs
+     `(("bzip2" ,bzip2)
+       ("gflags" ,gflags)
+       ("snappy" ,snappy)
+       ("zlib" ,zlib)))
+    (home-page "http://rocksdb.org/";)
+    (synopsis "Persistent key-value store for fast storage")
+    (description
+     "RocksDB is an embeddable, persistent key-value storage library that is
+designed for flash and RAM storage.")
+    (license bsd-3)))
+
 (define-public sparql-query
   (package
     (name "sparql-query")
-- 
2.11.0




reply via email to

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