;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (gnu packages distributed-filesystems) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system gnu) #:use-module (gnu packages bdw-gc) #:use-module (gnu packages boost) #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages curl) #:use-module (gnu packages databases) #:use-module (gnu packages gnuzilla) #:use-module (gnu packages jemalloc) #:use-module (gnu packages linux) #:use-module (gnu packages openldap) #:use-module (gnu packages pkg-config) #:use-module (gnu packages python) #:use-module (gnu packages tls) #:use-module (gnu packages web) #:use-module (gnu packages xml)) (define-public ceph (package (name "ceph") (version "10.2.5") (source (origin (method url-fetch) (uri (string-append "https://download.ceph.com/tarballs/ceph-" version ".tar.gz")) (sha256 (base32 "1x6m69il34x4rjhybk5cpw4yiad4a193l9vgy57vidwfy5ql5pc2")) (modules '((guix build utils))) (snippet '(begin ;; Delete bundled software. (delete-file-recursively "src/test/downloads") ; python-cram (delete-file-recursively "src/rocksdb") ;; TODO: unbundle gtest, civetweb, DPDK, SPDK, xxHash. #t)))) (build-system gnu-build-system) (arguments `(#:configure-flags (list (string-append "--exec_prefix=" (assoc-ref %outputs "out")) (string-append "--libdir=" (assoc-ref %outputs "lib") "/lib") (string-append "--includedir=" (assoc-ref %outputs "lib") "/include") "--localstatedir=/var" "--sysconfdir=/etc" "--enable-static=no" ; TODO: separate output "--with-man-pages" (string-append "--with-systemd-unit-dir=" (assoc-ref %outputs "out") "/etc/systemd/system") "--without-libxfs" ; TODO: enable when xfsprogs is added. ;; Use jemalloc instead of tcmalloc. "--with-jemalloc") #:make-flags ;; Pass sysconfdir here too so that the sample configuration files ;; and directories are installed to the output instead of root level. (list (string-append "sysconfdir=" (assoc-ref %outputs "out") "/etc") (string-append "LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "lib") "/lib") ;; The python libraries depend on the ceph libraries, ;; so make sure they are in RUNPATH. (string-append "PYTHON_LDFLAGS=-Wl,-rpath=" (assoc-ref %outputs "lib") "/lib")) #:phases (modify-phases %standard-phases (add-after 'unpack 'patch-source (lambda* (#:key inputs outputs #:allow-other-keys) (substitute* "src/Makefile.in" ;; By default, the PYTHONPATH is set to "src/pybind". ;; Make sure our libraries are found too. (("export PYTHONPATH=") (string-append "export PYTHONPATH=" (getenv "PYTHONPATH") ":")) ;; Replace 'rocksdb/librocksdb.a' with the rocksdb store path. (("rocksdb/librocksdb\\.a") (string-append (assoc-ref inputs "rocksdb:static") "/lib/librocksdb.a")) ;; The above string is used both as a make target and a compile ;; flag. No-op the make target. (("^.*cd rocksdb &&.*$") "\ttrue\n")) (substitute* "src/test/run-cli-tests" ;; Use our python-cram instead of the (un)bundled one. (("CRAM_BIN=.*$") (string-append "CRAM_BIN=" (which "cram") "\n"))) (substitute* "src/Makefile.in" ;; Install python packages to default output. (("\\$\\$root \\$\\$options") (string-append "--root=/ --prefix=" (assoc-ref outputs "out")))) #t))) ;; XXX: Tests need more work. The bundled cram tarball (!) needs ;; patching to work on Guix, and the system version does not support ;; '--error-dir'. TODO: How to run other tests/targets? #:tests? #f ;; Tests uses lots of file descriptors and warns about using ;; -j without raising limits on large systems. #:parallel-tests? #f)) (outputs '("out" "lib")) (native-inputs `(("pkg-config" ,pkg-config) ("rocksdb" ,rocksdb) ; for headers ("python2-cram" ,python2-cram) ("python2-cython" ,python2-cython) ("python2-nose" ,python2-nose) ("python2-pip" ,python2-pip) ("python2-sphinx" ,python2-sphinx) ("python2-tox" ,python2-tox) ("python2-virtualenv" ,python2-virtualenv))) (inputs `(("boost" ,boost) ("curl" ,curl) ("expat" ,expat) ("fcgi" ,fcgi) ("fuse" ,fuse) ("jemalloc" ,jemalloc) ("keyutils" ,keyutils) ("leveldb" ,leveldb) ("libaio" ,libaio) ("libatomic-ops" ,libatomic-ops) ("lz4" ,lz4) ("openldap" ,openldap) ("openssl" ,openssl) ("nss" ,nss) ("python" ,python-2) ("rocksdb:static" ,rocksdb "static") ("snappy" ,snappy) ("udev" ,eudev) ("util-linux" ,util-linux) ("zlib" ,zlib))) (home-page "https://ceph.com") (synopsis "Distributed object store and file system") (description "Ceph is a distributed storage system designed for reliability and performance. It provides network-based block devices (RBD), a POSIX compliant filesystem (CephFS), and offers compatibility with various storage protocols (S3, NFS, and others) through the RADOS gateway.") ;; Ceph is licensed under LGPL2.1, but includes a number of components ;; covered by other licenses. Consult COPYING for full information. (license (list license:lgpl2.1 license:cc-by-sa3.0 ; documentation license:bsd-2 ; xxHash license:bsd-3 license:gpl3 license:gpl2 license:public-domain license:boost1.0 license:expat))))