Commit | Line | Data |
---|---|---|
dcfe44cb | 1 | ;;; GNU Guix --- Functional package management for GNU |
be23ce2c | 2 | ;;; Copyright © 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com> |
5bf306f9 | 3 | ;;; Copyright © 2017 Rutger Helling <rhelling@mykolab.com> |
a583d01a | 4 | ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr> |
dcfe44cb MB |
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) | |
1badc850 | 30 | #:use-module (gnu packages authentication) |
dcfe44cb MB |
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) | |
5b0b520e | 39 | #:use-module (gnu packages gperf) |
dcfe44cb MB |
40 | #:use-module (gnu packages jemalloc) |
41 | #:use-module (gnu packages linux) | |
42 | #:use-module (gnu packages lua) | |
be23ce2c | 43 | #:use-module (gnu packages ncurses) |
a583d01a | 44 | #:use-module (gnu packages networking) |
aff0cce9 | 45 | #:use-module (gnu packages nss) |
dcfe44cb | 46 | #:use-module (gnu packages openldap) |
dcfe44cb MB |
47 | #:use-module (gnu packages pkg-config) |
48 | #:use-module (gnu packages python) | |
44d10b1f | 49 | #:use-module (gnu packages python-xyz) |
9d0c291e | 50 | #:use-module (gnu packages sphinx) |
dcfe44cb MB |
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") | |
56734df9 | 58 | (version "14.2.16") |
dcfe44cb MB |
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 | |
56734df9 | 65 | "0lmdri415hqczc9565s5m5568pnj97ipqxgnw6085kps0flwq5zh")) |
dcfe44cb | 66 | (patches |
c2d7e800 | 67 | (search-patches "ceph-disable-cpu-optimizations.patch")) |
dcfe44cb MB |
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" | |
dcfe44cb MB |
75 | ;"src/xxHash" |
76 | ;"src/zstd" | |
77 | ;"src/civetweb" | |
a583d01a | 78 | ;"src/seastar/fmt" |
dcfe44cb | 79 | "src/test/downloads" |
be23ce2c MB |
80 | "src/c-ares" |
81 | "src/googletest" | |
1badc850 | 82 | "src/rapidjson" |
dcfe44cb MB |
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) | |
02a4efb2 MB |
95 | (string-append "-DCMAKE_INSTALL_INCLUDEDIR=" |
96 | lib "/include") | |
dcfe44cb MB |
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") | |
be23ce2c | 101 | (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share") |
dcfe44cb MB |
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") | |
67b1d9a1 MB |
107 | (string-append "-DXFS_INCLUDE_DIR=" |
108 | (assoc-ref %build-inputs "xfsprogs") "/include") | |
dcfe44cb | 109 | "-DCMAKE_INSTALL_LOCALSTATEDIR=/var" |
7f080fb9 | 110 | "-DBUILD_SHARED_LIBS=ON" |
dcfe44cb MB |
111 | "-DWITH_SYSTEM_ROCKSDB=ON" |
112 | "-DWITH_SYSTEM_BOOST=ON" | |
113 | "-DWITH_PYTHON3=ON" | |
114 | ;; TODO: Enable these when available in Guix. | |
1badc850 | 115 | "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv |
5b0b520e | 116 | "-DWITH_BABELTRACE=OFF" |
dcfe44cb | 117 | "-DWITH_LTTNG=OFF" |
1badc850 | 118 | "-DWITH_SPDK=OFF" |
be23ce2c MB |
119 | "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF" |
120 | ||
dcfe44cb | 121 | ;; Use jemalloc instead of tcmalloc. |
be23ce2c MB |
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")) | |
5bf306f9 RH |
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 | |
dcfe44cb MB |
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 | ||
dcfe44cb MB |
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 | ||
be23ce2c MB |
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")) | |
dcfe44cb | 156 | |
dcfe44cb MB |
157 | (substitute* "udev/50-rbd.rules" |
158 | (("/usr/bin/ceph-rbdnamer") | |
159 | (string-append out "/bin/ceph-rbdnamer"))) | |
dcfe44cb | 160 | #t))) |
dcfe44cb MB |
161 | (add-before 'install 'set-install-environment |
162 | (lambda* (#:key outputs #:allow-other-keys) | |
163 | (let* ((out (assoc-ref outputs "out")) | |
dcfe44cb MB |
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" | |
be23ce2c | 172 | (string-append py3sitedir ":" |
dcfe44cb MB |
173 | (getenv "PYTHONPATH"))) |
174 | #t))) | |
175 | (add-after 'install 'wrap-python-scripts | |
5b0b520e | 176 | (lambda* (#:key inputs outputs #:allow-other-keys) |
dcfe44cb | 177 | (let* ((out (assoc-ref outputs "out")) |
be23ce2c MB |
178 | (scripts '("ceph" "ceph-mgr" "ceph-volume")) |
179 | (prettytable (assoc-ref inputs "python-prettytable")) | |
180 | (six (assoc-ref inputs "python-six")) | |
5b0b520e MB |
181 | (sitedir (lambda (package) |
182 | (string-append package | |
be23ce2c MB |
183 | "/lib/python" |
184 | ,(version-major+minor | |
185 | (package-version python)) | |
186 | "/site-packages"))) | |
5b0b520e MB |
187 | (PYTHONPATH (string-append |
188 | (sitedir out) ":" | |
1badc850 | 189 | (sitedir six) ":" |
5b0b520e | 190 | (sitedir prettytable)))) |
dcfe44cb | 191 | (for-each (lambda (executable) |
1badc850 | 192 | (wrap-program (string-append out "/bin/" executable) |
dcfe44cb | 193 | `("PYTHONPATH" ":" prefix (,PYTHONPATH)))) |
1badc850 | 194 | scripts) |
dcfe44cb MB |
195 | #t)))))) |
196 | (outputs | |
197 | '("out" "lib")) | |
198 | (native-inputs | |
63d4ef52 | 199 | `(("gperf" ,gperf) |
5b0b520e | 200 | ("pkg-config" ,pkg-config) |
dcfe44cb MB |
201 | ("python-cython" ,python-cython) |
202 | ("python-sphinx" ,python-sphinx) | |
be23ce2c | 203 | ("yasm" ,yasm))) |
dcfe44cb | 204 | (inputs |
4cb9b726 | 205 | `(("boost" ,boost) |
dcfe44cb MB |
206 | ("curl" ,curl) |
207 | ("cryptsetup" ,cryptsetup) | |
208 | ("expat" ,expat) | |
209 | ("fcgi" ,fcgi) | |
210 | ("fuse" ,fuse) | |
dcfe44cb MB |
211 | ("jemalloc" ,jemalloc) |
212 | ("keyutils" ,keyutils) | |
213 | ("leveldb" ,leveldb) | |
214 | ("libaio" ,libaio) | |
215 | ("libatomic-ops" ,libatomic-ops) | |
be23ce2c MB |
216 | ("libcap-ng" ,libcap-ng) |
217 | ("libnl" ,libnl) | |
a583d01a | 218 | ("librdkafka" ,librdkafka) |
dcfe44cb MB |
219 | ("lua" ,lua) |
220 | ("lz4" ,lz4) | |
1badc850 | 221 | ("oath-toolkit" ,oath-toolkit) |
dcfe44cb MB |
222 | ("openldap" ,openldap) |
223 | ("openssl" ,openssl) | |
be23ce2c | 224 | ("ncurses" ,ncurses) |
dcfe44cb | 225 | ("nss" ,nss) |
be23ce2c MB |
226 | ("python-prettytable" ,python-prettytable) ;used by ceph_daemon.py |
227 | ("python-six" ,python-six) ;for ceph-mgr + plugins | |
228 | ("python" ,python-wrapper) | |
1badc850 | 229 | ("rapidjson" ,rapidjson) |
be23ce2c | 230 | ("rdma-core" ,rdma-core) |
dcfe44cb MB |
231 | ("rocksdb" ,rocksdb) |
232 | ("snappy" ,snappy) | |
233 | ("udev" ,eudev) | |
234 | ("util-linux" ,util-linux) | |
bb93042c | 235 | ("util-linux:lib" ,util-linux "lib") |
67b1d9a1 | 236 | ("xfsprogs" ,xfsprogs) |
dcfe44cb MB |
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 | |
162a1374 | 243 | compliant file system (CephFS), and offers compatibility with various |
dcfe44cb MB |
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 |