1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
3 ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com>
4 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2021 Greg Hogan <code@greghogan.com>
7 ;;; This file is part of GNU Guix.
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22 (define-module (gnu packages storage)
23 #:use-module (guix download)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix utils)
27 #:use-module (guix build-system cmake)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages admin)
30 #:use-module (gnu packages assembly)
31 #:use-module (gnu packages authentication)
32 #:use-module (gnu packages bdw-gc)
33 #:use-module (gnu packages boost)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages crypto)
36 #:use-module (gnu packages cryptsetup)
37 #:use-module (gnu packages curl)
38 #:use-module (gnu packages databases)
39 #:use-module (gnu packages disk)
40 #:use-module (gnu packages gperf)
41 #:use-module (gnu packages jemalloc)
42 #:use-module (gnu packages icu4c)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages lua)
45 #:use-module (gnu packages ncurses)
46 #:use-module (gnu packages networking)
47 #:use-module (gnu packages nss)
48 #:use-module (gnu packages openldap)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages pretty-print)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-xyz)
53 #:use-module (gnu packages sphinx)
54 #:use-module (gnu packages sqlite)
55 #:use-module (gnu packages tls)
56 #:use-module (gnu packages web)
57 #:use-module (gnu packages xml))
65 (uri (string-append "https://download.ceph.com/tarballs/ceph-"
69 "0n7vpdcxji49bqaa5b7zxif1r80rrkbh0dfacbibvf20kzzbn2fz"))
72 "ceph-disable-cpu-optimizations.patch"
73 "ceph-boost-compat.patch"
74 "ceph-rocksdb-compat.patch"))
75 (modules '((guix build utils)))
77 '(for-each delete-file-recursively
78 '(;; TODO: Unbundle these:
91 (build-system cmake-build-system)
94 (let* ((out (assoc-ref %outputs "out"))
95 (lib (assoc-ref %outputs "lib"))
96 (libdir (string-append lib "/lib")))
97 (list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
98 (string-append "-DCMAKE_INSTALL_LIBDIR=" libdir)
99 (string-append "-DCMAKE_INSTALL_INCLUDEDIR="
101 ;; We need both libdir and libdir/ceph in RUNPATH.
102 (string-append "-DCMAKE_INSTALL_RPATH="
103 libdir ";" libdir "/ceph")
104 (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")
105 (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share")
106 (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
107 (string-append "-DCMAKE_INSTALL_DOCDIR=" out "/share/ceph/doc")
108 (string-append "-DCMAKE_INSTALL_LIBEXECDIR=" out "/libexec")
109 (string-append "-DKEYUTILS_INCLUDE_DIR="
110 (assoc-ref %build-inputs "keyutils") "/include")
111 (string-append "-DXFS_INCLUDE_DIR="
112 (assoc-ref %build-inputs "xfsprogs") "/include")
113 "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
114 "-DBUILD_SHARED_LIBS=ON"
115 "-DWITH_SYSTEM_ROCKSDB=ON"
116 "-DWITH_SYSTEM_BOOST=ON"
118 ;; TODO: Enable these when available in Guix.
119 "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv
120 "-DWITH_BABELTRACE=OFF"
123 "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
125 ;; Use jemalloc instead of tcmalloc.
126 "-DALLOCATOR=jemalloc"
128 ;; Don't install systemd unit files.
131 ;; Do not bother building the tests; we are not currently running
132 ;; them, and they do not build with system googletest as of 14.2.5.
134 ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
135 ;; <https://bugs.gnu.org/29674> for details. Disable tests until
139 (modify-phases %standard-phases
140 (add-after 'unpack 'patch-source
141 (lambda* (#:key outputs #:allow-other-keys)
142 (let ((out (assoc-ref outputs "out"))
143 (lib (assoc-ref outputs "lib")))
145 (substitute* "cmake/modules/Distutils.cmake"
146 ;; Prevent creation of Python eggs.
147 (("setup.py install")
148 "setup.py install --single-version-externally-managed --root=/")
149 ;; Inject the -rpath linker argument when linking
150 ;; Python C libraries so RUNPATH gets set up correctly.
151 (("LDFLAGS=(.*)\n" _ flags)
152 (string-append "LDFLAGS=\\\"" flags
153 " -Wl,-rpath=" lib "/lib\\\"\n")))
155 ;; Statically link libcrc32 because it does not get installed,
156 ;; yet several libraries end up referring to it.
157 (substitute* "src/common/CMakeLists.txt"
158 (("add_library\\(crc32")
159 "add_library(crc32 STATIC"))
161 (substitute* "udev/50-rbd.rules"
162 (("/usr/bin/ceph-rbdnamer")
163 (string-append out "/bin/ceph-rbdnamer"))))))
164 (add-before 'install 'set-install-environment
165 (lambda* (#:key outputs #:allow-other-keys)
166 (let* ((out (assoc-ref outputs "out"))
168 (string-append out "/lib/python"
169 ,(version-major+minor
170 (package-version python))
172 ;; The Python install scripts refuses to function if
173 ;; the install directory is not on PYTHONPATH.
174 (setenv "PYTHONPATH" py3sitedir))))
175 (add-after 'install 'wrap-python-scripts
176 (lambda* (#:key inputs outputs #:allow-other-keys)
177 (let* ((out (assoc-ref outputs "out"))
178 (scripts '("bin/ceph" "bin/cephfs-top" "sbin/ceph-volume"))
179 (dependencies (map (lambda (input)
180 (assoc-ref inputs input))
181 '("python-prettytable" "python-pyyaml")))
182 (sitedir (lambda (package)
183 (string-append package
185 ,(version-major+minor
186 (package-version python))
188 (PYTHONPATH (string-join (map sitedir (cons out dependencies))
190 (for-each (lambda (executable)
191 (wrap-program (string-append out "/" executable)
192 `("GUIX_PYTHONPATH" ":" prefix (,PYTHONPATH))))
197 (list gperf pkg-config python-cython python-sphinx yasm))
201 ("cryptsetup" ,cryptsetup)
207 ("jemalloc" ,jemalloc)
208 ("keyutils" ,keyutils)
211 ("libatomic-ops" ,libatomic-ops)
212 ("libcap-ng" ,libcap-ng)
214 ("librdkafka" ,librdkafka)
217 ("oath-toolkit" ,oath-toolkit)
218 ("openldap" ,openldap)
222 ("python-prettytable" ,python-prettytable) ;used by ceph_daemon.py
223 ("python-pyyaml" ,python-pyyaml) ;from python-common/setup.py
225 ("rapidjson" ,rapidjson)
226 ("rdma-core" ,rdma-core)
231 ("util-linux" ,util-linux)
232 ("util-linux:lib" ,util-linux "lib")
233 ("xfsprogs" ,xfsprogs)
235 (home-page "https://ceph.com/")
236 (synopsis "Distributed object store and file system")
238 "Ceph is a distributed storage system designed for reliability and
239 performance. It provides network-based block devices (RBD), a POSIX
240 compliant file system (CephFS), and offers compatibility with various
241 storage protocols (S3, NFS, and others) through the RADOS gateway.")
242 ;; The Ceph libraries are LGPL2.1 and most of the utilities fall under
243 ;; GPL2. The installed erasure code plugins are BSD-3 licensed and do
244 ;; not use the GPL code. The source archive includes a number of files
245 ;; carrying other licenses; consult COPYING for more information. Note
246 ;; that COPYING does not cover third-party bundled software.
247 (license (list license:lgpl2.1 license:gpl2 ;some files are 'or later'
248 license:cc-by-sa3.0 ;documentation
249 license:bsd-3 ;isa-l,jerasure,++
250 license:expat)))) ;civetweb,java bindings