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>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages storage)
21 #:use-module (guix download)
22 #:use-module ((guix licenses) #:prefix license:)
23 #:use-module (guix packages)
24 #:use-module (guix utils)
25 #:use-module (guix build-system cmake)
26 #:use-module (gnu packages)
27 #:use-module (gnu packages admin)
28 #:use-module (gnu packages assembly)
29 #:use-module (gnu packages authentication)
30 #:use-module (gnu packages bdw-gc)
31 #:use-module (gnu packages boost)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages crypto)
34 #:use-module (gnu packages cryptsetup)
35 #:use-module (gnu packages curl)
36 #:use-module (gnu packages databases)
37 #:use-module (gnu packages disk)
38 #:use-module (gnu packages gperf)
39 #:use-module (gnu packages jemalloc)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages lua)
42 #:use-module (gnu packages ncurses)
43 #:use-module (gnu packages nss)
44 #:use-module (gnu packages openldap)
45 #:use-module (gnu packages pkg-config)
46 #:use-module (gnu packages python)
47 #:use-module (gnu packages python-xyz)
48 #:use-module (gnu packages sphinx)
49 #:use-module (gnu packages tls)
50 #:use-module (gnu packages web)
51 #:use-module (gnu packages xml))
59 (uri (string-append "https://download.ceph.com/tarballs/ceph-"
63 "0zkh1a23v8g1fa5flqa2d53lv08ancab3li57gybpqpnja90k7il"))
65 (search-patches "ceph-disable-cpu-optimizations.patch"))
66 (modules '((guix build utils)))
69 (for-each delete-file-recursively
70 '(;; TODO: Unbundle these:
85 (build-system cmake-build-system)
88 (let* ((out (assoc-ref %outputs "out"))
89 (lib (assoc-ref %outputs "lib"))
90 (libdir (string-append lib "/lib")))
91 (list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
92 (string-append "-DCMAKE_INSTALL_LIBDIR=" libdir)
93 (string-append "-DCMAKE_INSTALL_INCLUDEDIR="
95 ;; We need both libdir and libdir/ceph in RUNPATH.
96 (string-append "-DCMAKE_INSTALL_RPATH="
97 libdir ";" libdir "/ceph")
98 (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")
99 (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share")
100 (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
101 (string-append "-DCMAKE_INSTALL_DOCDIR=" out "/share/ceph/doc")
102 (string-append "-DCMAKE_INSTALL_LIBEXECDIR=" out "/libexec")
103 (string-append "-DKEYUTILS_INCLUDE_DIR="
104 (assoc-ref %build-inputs "keyutils") "/include")
105 (string-append "-DXFS_INCLUDE_DIR="
106 (assoc-ref %build-inputs "xfsprogs") "/include")
107 "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
108 "-DBUILD_SHARED_LIBS=ON"
109 "-DWITH_SYSTEM_ROCKSDB=ON"
110 "-DWITH_SYSTEM_BOOST=ON"
112 ;; TODO: Enable these when available in Guix.
113 "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv
114 "-DWITH_BABELTRACE=OFF"
117 "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
119 ;; Use jemalloc instead of tcmalloc.
120 "-DALLOCATOR=jemalloc"
122 ;; Do not bother building the tests; we are not currently running
123 ;; them, and they do not build with system googletest as of 14.2.5.
125 ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
126 ;; <https://bugs.gnu.org/29674> for details. Disable tests until
130 (modify-phases %standard-phases
131 (add-after 'unpack 'patch-source
132 (lambda* (#:key outputs #:allow-other-keys)
133 (let ((out (assoc-ref outputs "out"))
134 (lib (assoc-ref outputs "lib")))
136 (substitute* "cmake/modules/Distutils.cmake"
137 ;; Prevent creation of Python eggs.
138 (("setup.py install")
139 "setup.py install --single-version-externally-managed --root=/"))
141 (substitute* (find-files "src/pybind" "^setup\\.py$")
142 ;; Here we inject an extra line to the `setup.py' of the
143 ;; Python C libraries so RUNPATH gets set up correctly.
144 (("^([[:blank:]]+)extra_compile_args=(.*)$" _ indent args)
145 (string-append indent "extra_compile_args=" args
146 indent "extra_link_args=['-Wl,-rpath="
149 ;; Statically link libcrc32 because it does not get installed,
150 ;; yet several libraries end up referring to it.
151 (substitute* "src/common/CMakeLists.txt"
152 (("add_library\\(crc32")
153 "add_library(crc32 STATIC"))
155 (substitute* "udev/50-rbd.rules"
156 (("/usr/bin/ceph-rbdnamer")
157 (string-append out "/bin/ceph-rbdnamer")))
159 (add-before 'install 'set-install-environment
160 (lambda* (#:key outputs #:allow-other-keys)
161 (let* ((out (assoc-ref outputs "out"))
163 (string-append out "/lib/python"
164 ,(version-major+minor
165 (package-version python))
167 ;; The Python install scripts refuses to function if
168 ;; the install directory is not on PYTHONPATH.
170 (string-append py3sitedir ":"
171 (getenv "PYTHONPATH")))
173 (add-after 'install 'wrap-python-scripts
174 (lambda* (#:key inputs outputs #:allow-other-keys)
175 (let* ((out (assoc-ref outputs "out"))
176 (scripts '("ceph" "ceph-mgr" "ceph-volume"))
177 (prettytable (assoc-ref inputs "python-prettytable"))
178 (six (assoc-ref inputs "python-six"))
179 (sitedir (lambda (package)
180 (string-append package
182 ,(version-major+minor
183 (package-version python))
185 (PYTHONPATH (string-append
188 (sitedir prettytable))))
189 (for-each (lambda (executable)
190 (wrap-program (string-append out "/bin/" executable)
191 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
198 ("pkg-config" ,pkg-config)
199 ("python-cython" ,python-cython)
200 ("python-sphinx" ,python-sphinx)
205 ("cryptsetup" ,cryptsetup)
209 ("jemalloc" ,jemalloc)
210 ("keyutils" ,keyutils)
213 ("libatomic-ops" ,libatomic-ops)
214 ("libcap-ng" ,libcap-ng)
218 ("oath-toolkit" ,oath-toolkit)
219 ("openldap" ,openldap)
223 ("python-prettytable" ,python-prettytable) ;used by ceph_daemon.py
224 ("python-six" ,python-six) ;for ceph-mgr + plugins
225 ("python" ,python-wrapper)
226 ("rapidjson" ,rapidjson)
227 ("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