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> |
dcfe44cb MB |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
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. | |
11 | ;;; | |
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. | |
16 | ;;; | |
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/>. | |
19 | ||
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) | |
1badc850 | 29 | #:use-module (gnu packages authentication) |
dcfe44cb MB |
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) | |
5b0b520e | 38 | #:use-module (gnu packages gperf) |
dcfe44cb MB |
39 | #:use-module (gnu packages jemalloc) |
40 | #:use-module (gnu packages linux) | |
41 | #:use-module (gnu packages lua) | |
be23ce2c | 42 | #:use-module (gnu packages ncurses) |
aff0cce9 | 43 | #:use-module (gnu packages nss) |
dcfe44cb | 44 | #:use-module (gnu packages openldap) |
dcfe44cb MB |
45 | #:use-module (gnu packages pkg-config) |
46 | #:use-module (gnu packages python) | |
44d10b1f | 47 | #:use-module (gnu packages python-xyz) |
9d0c291e | 48 | #:use-module (gnu packages sphinx) |
dcfe44cb MB |
49 | #:use-module (gnu packages tls) |
50 | #:use-module (gnu packages web) | |
51 | #:use-module (gnu packages xml)) | |
52 | ||
53 | (define-public ceph | |
54 | (package | |
55 | (name "ceph") | |
bd0a9062 | 56 | (version "14.2.9") |
dcfe44cb MB |
57 | (source (origin |
58 | (method url-fetch) | |
59 | (uri (string-append "https://download.ceph.com/tarballs/ceph-" | |
60 | version ".tar.gz")) | |
61 | (sha256 | |
62 | (base32 | |
bd0a9062 | 63 | "0zkh1a23v8g1fa5flqa2d53lv08ancab3li57gybpqpnja90k7il")) |
dcfe44cb | 64 | (patches |
c2d7e800 | 65 | (search-patches "ceph-disable-cpu-optimizations.patch")) |
dcfe44cb MB |
66 | (modules '((guix build utils))) |
67 | (snippet | |
68 | '(begin | |
69 | (for-each delete-file-recursively | |
70 | '(;; TODO: Unbundle these: | |
71 | ;"src/isa-l" | |
72 | ;"src/lua" | |
dcfe44cb MB |
73 | ;"src/xxHash" |
74 | ;"src/zstd" | |
75 | ;"src/civetweb" | |
be23ce2c | 76 | "src/seastar/fmt" |
dcfe44cb | 77 | "src/test/downloads" |
be23ce2c MB |
78 | "src/c-ares" |
79 | "src/googletest" | |
1badc850 | 80 | "src/rapidjson" |
dcfe44cb MB |
81 | "src/spdk" |
82 | "src/rocksdb" | |
83 | "src/boost")) | |
84 | #t)))) | |
85 | (build-system cmake-build-system) | |
86 | (arguments | |
87 | `(#:configure-flags | |
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) | |
02a4efb2 MB |
93 | (string-append "-DCMAKE_INSTALL_INCLUDEDIR=" |
94 | lib "/include") | |
dcfe44cb MB |
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") | |
be23ce2c | 99 | (string-append "-DCMAKE_INSTALL_DATADIR=" lib "/share") |
dcfe44cb MB |
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") | |
67b1d9a1 MB |
105 | (string-append "-DXFS_INCLUDE_DIR=" |
106 | (assoc-ref %build-inputs "xfsprogs") "/include") | |
dcfe44cb | 107 | "-DCMAKE_INSTALL_LOCALSTATEDIR=/var" |
7f080fb9 | 108 | "-DBUILD_SHARED_LIBS=ON" |
dcfe44cb MB |
109 | "-DWITH_SYSTEM_ROCKSDB=ON" |
110 | "-DWITH_SYSTEM_BOOST=ON" | |
111 | "-DWITH_PYTHON3=ON" | |
112 | ;; TODO: Enable these when available in Guix. | |
1badc850 | 113 | "-DWITH_MGR_DASHBOARD_FRONTEND=OFF" ;requires node + nodeenv |
5b0b520e | 114 | "-DWITH_BABELTRACE=OFF" |
dcfe44cb | 115 | "-DWITH_LTTNG=OFF" |
1badc850 | 116 | "-DWITH_SPDK=OFF" |
be23ce2c MB |
117 | "-DWITH_RADOSGW_AMQP_ENDPOINT=OFF" |
118 | ||
dcfe44cb | 119 | ;; Use jemalloc instead of tcmalloc. |
be23ce2c MB |
120 | "-DALLOCATOR=jemalloc" |
121 | ||
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. | |
124 | "-DWITH_TESTS=OFF")) | |
5bf306f9 RH |
125 | ;; FIXME: Some of the tests leak Btrfs subvolumes on Btrfs. See |
126 | ;; <https://bugs.gnu.org/29674> for details. Disable tests until | |
127 | ;; resolved. | |
128 | #:tests? #f | |
dcfe44cb MB |
129 | #:phases |
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"))) | |
135 | ||
dcfe44cb MB |
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=/")) | |
140 | ||
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=" | |
147 | lib "/lib'],\n"))) | |
148 | ||
be23ce2c MB |
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")) | |
dcfe44cb | 154 | |
dcfe44cb MB |
155 | (substitute* "udev/50-rbd.rules" |
156 | (("/usr/bin/ceph-rbdnamer") | |
157 | (string-append out "/bin/ceph-rbdnamer"))) | |
dcfe44cb | 158 | #t))) |
dcfe44cb MB |
159 | (add-before 'install 'set-install-environment |
160 | (lambda* (#:key outputs #:allow-other-keys) | |
161 | (let* ((out (assoc-ref outputs "out")) | |
dcfe44cb MB |
162 | (py3sitedir |
163 | (string-append out "/lib/python" | |
164 | ,(version-major+minor | |
165 | (package-version python)) | |
166 | "/site-packages"))) | |
167 | ;; The Python install scripts refuses to function if | |
168 | ;; the install directory is not on PYTHONPATH. | |
169 | (setenv "PYTHONPATH" | |
be23ce2c | 170 | (string-append py3sitedir ":" |
dcfe44cb MB |
171 | (getenv "PYTHONPATH"))) |
172 | #t))) | |
173 | (add-after 'install 'wrap-python-scripts | |
5b0b520e | 174 | (lambda* (#:key inputs outputs #:allow-other-keys) |
dcfe44cb | 175 | (let* ((out (assoc-ref outputs "out")) |
be23ce2c MB |
176 | (scripts '("ceph" "ceph-mgr" "ceph-volume")) |
177 | (prettytable (assoc-ref inputs "python-prettytable")) | |
178 | (six (assoc-ref inputs "python-six")) | |
5b0b520e MB |
179 | (sitedir (lambda (package) |
180 | (string-append package | |
be23ce2c MB |
181 | "/lib/python" |
182 | ,(version-major+minor | |
183 | (package-version python)) | |
184 | "/site-packages"))) | |
5b0b520e MB |
185 | (PYTHONPATH (string-append |
186 | (sitedir out) ":" | |
1badc850 | 187 | (sitedir six) ":" |
5b0b520e | 188 | (sitedir prettytable)))) |
dcfe44cb | 189 | (for-each (lambda (executable) |
1badc850 | 190 | (wrap-program (string-append out "/bin/" executable) |
dcfe44cb | 191 | `("PYTHONPATH" ":" prefix (,PYTHONPATH)))) |
1badc850 | 192 | scripts) |
dcfe44cb MB |
193 | #t)))))) |
194 | (outputs | |
195 | '("out" "lib")) | |
196 | (native-inputs | |
63d4ef52 | 197 | `(("gperf" ,gperf) |
5b0b520e | 198 | ("pkg-config" ,pkg-config) |
dcfe44cb MB |
199 | ("python-cython" ,python-cython) |
200 | ("python-sphinx" ,python-sphinx) | |
be23ce2c | 201 | ("yasm" ,yasm))) |
dcfe44cb | 202 | (inputs |
4cb9b726 | 203 | `(("boost" ,boost) |
dcfe44cb MB |
204 | ("curl" ,curl) |
205 | ("cryptsetup" ,cryptsetup) | |
206 | ("expat" ,expat) | |
207 | ("fcgi" ,fcgi) | |
208 | ("fuse" ,fuse) | |
dcfe44cb MB |
209 | ("jemalloc" ,jemalloc) |
210 | ("keyutils" ,keyutils) | |
211 | ("leveldb" ,leveldb) | |
212 | ("libaio" ,libaio) | |
213 | ("libatomic-ops" ,libatomic-ops) | |
be23ce2c MB |
214 | ("libcap-ng" ,libcap-ng) |
215 | ("libnl" ,libnl) | |
dcfe44cb MB |
216 | ("lua" ,lua) |
217 | ("lz4" ,lz4) | |
1badc850 | 218 | ("oath-toolkit" ,oath-toolkit) |
dcfe44cb MB |
219 | ("openldap" ,openldap) |
220 | ("openssl" ,openssl) | |
be23ce2c | 221 | ("ncurses" ,ncurses) |
dcfe44cb | 222 | ("nss" ,nss) |
be23ce2c MB |
223 | ("python-prettytable" ,python-prettytable) ;used by ceph_daemon.py |
224 | ("python-six" ,python-six) ;for ceph-mgr + plugins | |
225 | ("python" ,python-wrapper) | |
1badc850 | 226 | ("rapidjson" ,rapidjson) |
be23ce2c | 227 | ("rdma-core" ,rdma-core) |
dcfe44cb MB |
228 | ("rocksdb" ,rocksdb) |
229 | ("snappy" ,snappy) | |
230 | ("udev" ,eudev) | |
231 | ("util-linux" ,util-linux) | |
bb93042c | 232 | ("util-linux:lib" ,util-linux "lib") |
67b1d9a1 | 233 | ("xfsprogs" ,xfsprogs) |
dcfe44cb MB |
234 | ("zlib" ,zlib))) |
235 | (home-page "https://ceph.com/") | |
236 | (synopsis "Distributed object store and file system") | |
237 | (description | |
238 | "Ceph is a distributed storage system designed for reliability and | |
239 | performance. It provides network-based block devices (RBD), a POSIX | |
162a1374 | 240 | compliant file system (CephFS), and offers compatibility with various |
dcfe44cb MB |
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 |