gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / storage.scm
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 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages storage)
22 #:use-module (guix download)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (guix packages)
25 #:use-module (guix utils)
26 #:use-module (guix build-system cmake)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages admin)
29 #:use-module (gnu packages assembly)
30 #:use-module (gnu packages authentication)
31 #:use-module (gnu packages bdw-gc)
32 #:use-module (gnu packages boost)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages crypto)
35 #:use-module (gnu packages cryptsetup)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages databases)
38 #:use-module (gnu packages disk)
39 #:use-module (gnu packages gperf)
40 #:use-module (gnu packages jemalloc)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages lua)
43 #:use-module (gnu packages ncurses)
44 #:use-module (gnu packages networking)
45 #:use-module (gnu packages nss)
46 #:use-module (gnu packages openldap)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages sphinx)
51 #:use-module (gnu packages tls)
52 #:use-module (gnu packages web)
53 #:use-module (gnu packages xml))
54
55 (define-public ceph
56 (package
57 (name "ceph")
58 (version "14.2.16")
59 (source (origin
60 (method url-fetch)
61 (uri (string-append "https://download.ceph.com/tarballs/ceph-"
62 version ".tar.gz"))
63 (sha256
64 (base32
65 "0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh"))
66 (patches
67 (search-patches "ceph-disable-cpu-optimizations.patch"))
68 (modules '((guix build utils)))
69 (snippet
70 '(begin
71 (for-each delete-file-recursively
72 '(;; TODO: Unbundle these:
73 ;"src/isa-l"
74 ;"src/lua"
75 ;"src/xxHash"
76 ;"src/zstd"
77 ;"src/civetweb"
78 ;"src/seastar/fmt"
79 "src/test/downloads"
80 "src/c-ares"
81 "src/googletest"
82 "src/rapidjson"
83 "src/spdk"
84 "src/rocksdb"
85 "src/boost"))
86 #t))))
87 (build-system cmake-build-system)
88 (arguments
89 `(#:configure-flags
90 (let* ((out (assoc-ref %outputs "out"))
91 (lib (assoc-ref %outputs "lib"))
92 (libdir (string-append lib "/lib")))
93 (list (string-append "-DCMAKE_INSTALL_PREFIX=" out)
94 (string-append "-DCMAKE_INSTALL_LIBDIR=" libdir)
95 (string-append "-DCMAKE_INSTALL_INCLUDEDIR="
96 lib "/include")
97 ;; We need both libdir and libdir/ceph in RUNPATH.
98 (string-append "-DCMAKE_INSTALL_RPATH="
99 libdir ";" libdir "/ceph")
100 (string-append "-DCMAKE_INSTALL_SYSCONFDIR=" out "/etc")
101 (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share")
102 (string-append "-DCMAKE_INSTALL_MANDIR=" out "/share/man")
103 (string-append "-DCMAKE_INSTALL_DOCDIR=" out "/share/ceph/doc")
104 (string-append "-DCMAKE_INSTALL_LIBEXECDIR=" out "/libexec")
105 (string-append "-DKEYUTILS_INCLUDE_DIR="
106 (assoc-ref %build-inputs "keyutils") "/include")
107 (string-append "-DXFS_INCLUDE_DIR="
108 (assoc-ref %build-inputs "xfsprogs") "/include")
109 "-DCMAKE_INSTALL_LOCALSTATEDIR=/var"
110 "-DBUILD_SHARED_LIBS=ON"
111 "-DWITH_SYSTEM_ROCKSDB=ON"
112 "-DWITH_SYSTEM_BOOST=ON"
113 "-DWITH_PYTHON3=ON"
114 ;; TODO: Enable these when available in Guix.
115 "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv
116 "-DWITH_BABELTRACE=OFF"
117 "-DWITH_LTTNG=OFF"
118 "-DWITH_SPDK=OFF"
119 "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF"
120
121 ;; Use jemalloc instead of tcmalloc.
122 "-DALLOCATOR=jemalloc"
123
124 ;; Do not bother building the tests; we are not currently running
125 ;; them, and they do not build with system googletest as of 14.2.5.
126 "-DWITH_TESTS=OFF"))
127 ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See
128 ;; <https://bugs.gnu.org/29674> for details. Disable tests until
129 ;; resolved.
130 #:tests? #f
131 #:phases
132 (modify-phases %standard-phases
133 (add-after 'unpack 'patch-source
134 (lambda* (#:key outputs #:allow-other-keys)
135 (let ((out (assoc-ref outputs "out"))
136 (lib (assoc-ref outputs "lib")))
137
138 (substitute* "cmake/modules/Distutils.cmake"
139 ;; Prevent creation of Python eggs.
140 (("setup.py install")
141 "setup.py install --single-version-externally-managed --root=/"))
142
143 (substitute* (find-files "src/pybind" "^setup\\.py$")
144 ;; Here we inject an extra line to the `setup.py' of the
145 ;; Python C libraries so RUNPATH gets set up correctly.
146 (("^([[:blank:]]+)extra_compile_args=(.*)$" _ indent args)
147 (string-append indent "extra_compile_args=" args
148 indent "extra_link_args=['-Wl,-rpath="
149 lib "/lib'],\n")))
150
151 ;; Statically link libcrc32 because it does not get installed,
152 ;; yet several libraries end up referring to it.
153 (substitute* "src/common/CMakeLists.txt"
154 (("add_library\\(crc32")
155 "add_library(crc32 STATIC"))
156
157 (substitute* "udev/50-rbd.rules"
158 (("/usr/bin/ceph-rbdnamer")
159 (string-append out "/bin/ceph-rbdnamer")))
160 #t)))
161 (add-before 'install 'set-install-environment
162 (lambda* (#:key outputs #:allow-other-keys)
163 (let* ((out (assoc-ref outputs "out"))
164 (py3sitedir
165 (string-append out "/lib/python"
166 ,(version-major+minor
167 (package-version python))
168 "/site-packages")))
169 ;; The Python install scripts refuses to function if
170 ;; the install directory is not on PYTHONPATH.
171 (setenv "PYTHONPATH"
172 (string-append py3sitedir ":"
173 (getenv "PYTHONPATH")))
174 #t)))
175 (add-after 'install 'wrap-python-scripts
176 (lambda* (#:key inputs outputs #:allow-other-keys)
177 (let* ((out (assoc-ref outputs "out"))
178 (scripts '("ceph" "ceph-mgr" "ceph-volume"))
179 (prettytable (assoc-ref inputs "python-prettytable"))
180 (six (assoc-ref inputs "python-six"))
181 (sitedir (lambda (package)
182 (string-append package
183 "/lib/python"
184 ,(version-major+minor
185 (package-version python))
186 "/site-packages")))
187 (PYTHONPATH (string-append
188 (sitedir out) ":"
189 (sitedir six) ":"
190 (sitedir prettytable))))
191 (for-each (lambda (executable)
192 (wrap-program (string-append out "/bin/" executable)
193 `("PYTHONPATH" ":" prefix (,PYTHONPATH))))
194 scripts)
195 #t))))))
196 (outputs
197 '("out" "lib"))
198 (native-inputs
199 `(("gperf" ,gperf)
200 ("pkg-config" ,pkg-config)
201 ("python-cython" ,python-cython)
202 ("python-sphinx" ,python-sphinx)
203 ("yasm" ,yasm)))
204 (inputs
205 `(("boost" ,boost)
206 ("curl" ,curl)
207 ("cryptsetup" ,cryptsetup)
208 ("expat" ,expat)
209 ("fcgi" ,fcgi)
210 ("fuse" ,fuse)
211 ("jemalloc" ,jemalloc)
212 ("keyutils" ,keyutils)
213 ("leveldb" ,leveldb)
214 ("libaio" ,libaio)
215 ("libatomic-ops" ,libatomic-ops)
216 ("libcap-ng" ,libcap-ng)
217 ("libnl" ,libnl)
218 ("librdkafka" ,librdkafka)
219 ("lua" ,lua)
220 ("lz4" ,lz4)
221 ("oath-toolkit" ,oath-toolkit)
222 ("openldap" ,openldap)
223 ("openssl" ,openssl)
224 ("ncurses" ,ncurses)
225 ("nss" ,nss)
226 ("python-prettytable" ,python-prettytable) ;used by ceph_daemon.py
227 ("python-six" ,python-six) ;for ceph-mgr + plugins
228 ("python" ,python-wrapper)
229 ("rapidjson" ,rapidjson)
230 ("rdma-core" ,rdma-core)
231 ("rocksdb" ,rocksdb)
232 ("snappy" ,snappy)
233 ("udev" ,eudev)
234 ("util-linux" ,util-linux)
235 ("util-linux:lib" ,util-linux "lib")
236 ("xfsprogs" ,xfsprogs)
237 ("zlib" ,zlib)))
238 (home-page "https://ceph.com/")
239 (synopsis "Distributed object store and file system")
240 (description
241 "Ceph is a distributed storage system designed for reliability and
242 performance. It provides network-based block devices (RBD), a POSIX
243 compliant file system (CephFS), and offers compatibility with various
244 storage protocols (S3, NFS, and others) through the RADOS gateway.")
245 ;; The Ceph libraries are LGPL2.1 and most of the utilities fall under
246 ;; GPL2. The installed erasure code plugins are BSD-3 licensed and do
247 ;; not use the GPL code. The source archive includes a number of files
248 ;; carrying other licenses; consult COPYING for more information. Note
249 ;; that COPYING does not cover third-party bundled software.
250 (license (list license:lgpl2.1 license:gpl2 ;some files are 'or later'
251 license:cc-by-sa3.0 ;documentation
252 license:bsd-3 ;isa-l,jerasure,++
253 license:expat)))) ;civetweb,java bindings