2018-02-06 15:06:46 +01:00
|
|
|
{ stdenv, ensureNewerSourcesHook, cmake, pkgconfig
|
|
|
|
, which, git
|
|
|
|
, boost, python2Packages
|
|
|
|
, libxml2, zlib
|
2018-07-17 22:11:16 +02:00
|
|
|
, openldap, lttng-ust
|
2018-02-06 15:06:46 +01:00
|
|
|
, babeltrace, gperf
|
|
|
|
, cunit, snappy
|
2018-03-21 21:53:02 +01:00
|
|
|
, rocksdb, makeWrapper
|
2015-04-21 23:57:48 +02:00
|
|
|
|
|
|
|
# Optional Dependencies
|
2018-02-06 15:06:46 +01:00
|
|
|
, yasm ? null, fcgi ? null, expat ? null
|
2018-07-21 02:44:44 +02:00
|
|
|
, curl ? null, fuse ? null
|
2015-04-21 23:57:48 +02:00
|
|
|
, libedit ? null, libatomic_ops ? null, kinetic-cpp-client ? null
|
2018-02-06 15:06:46 +01:00
|
|
|
, libs3 ? null
|
2015-04-21 23:57:48 +02:00
|
|
|
|
|
|
|
# Mallocs
|
|
|
|
, jemalloc ? null, gperftools ? null
|
|
|
|
|
|
|
|
# Crypto Dependencies
|
|
|
|
, cryptopp ? null
|
|
|
|
, nss ? null, nspr ? null
|
|
|
|
|
|
|
|
# Linux Only Dependencies
|
|
|
|
, linuxHeaders, libuuid, udev, keyutils, libaio ? null, libxfs ? null
|
2015-04-20 20:42:55 +02:00
|
|
|
, zfs ? null
|
|
|
|
|
|
|
|
# Version specific arguments
|
2018-07-21 02:44:44 +02:00
|
|
|
, version, src ? [], buildInputs ? []
|
2015-04-20 20:42:55 +02:00
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
2015-04-21 23:57:48 +02:00
|
|
|
# We must have one crypto library
|
|
|
|
assert cryptopp != null || (nss != null && nspr != null);
|
|
|
|
|
2015-06-25 03:25:53 +02:00
|
|
|
with stdenv;
|
2015-04-20 20:42:55 +02:00
|
|
|
with stdenv.lib;
|
|
|
|
let
|
2015-06-01 21:29:47 +02:00
|
|
|
|
2015-06-25 03:25:53 +02:00
|
|
|
shouldUsePkg = pkg_: let pkg = (builtins.tryEval pkg_).value;
|
2018-08-29 00:20:54 +02:00
|
|
|
in if lib.any (lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms
|
|
|
|
then pkg else null;
|
2015-06-25 03:25:53 +02:00
|
|
|
|
|
|
|
optYasm = shouldUsePkg yasm;
|
|
|
|
optFcgi = shouldUsePkg fcgi;
|
|
|
|
optExpat = shouldUsePkg expat;
|
|
|
|
optCurl = shouldUsePkg curl;
|
|
|
|
optFuse = shouldUsePkg fuse;
|
|
|
|
optLibedit = shouldUsePkg libedit;
|
|
|
|
optLibatomic_ops = shouldUsePkg libatomic_ops;
|
|
|
|
optKinetic-cpp-client = shouldUsePkg kinetic-cpp-client;
|
2015-08-02 03:05:40 +02:00
|
|
|
optLibs3 = if versionAtLeast version "10.0.0" then null else shouldUsePkg libs3;
|
2015-06-25 03:25:53 +02:00
|
|
|
|
|
|
|
optJemalloc = shouldUsePkg jemalloc;
|
|
|
|
optGperftools = shouldUsePkg gperftools;
|
|
|
|
|
|
|
|
optCryptopp = shouldUsePkg cryptopp;
|
|
|
|
optNss = shouldUsePkg nss;
|
|
|
|
optNspr = shouldUsePkg nspr;
|
|
|
|
|
|
|
|
optLibaio = shouldUsePkg libaio;
|
|
|
|
optLibxfs = shouldUsePkg libxfs;
|
|
|
|
optZfs = shouldUsePkg zfs;
|
|
|
|
|
|
|
|
hasRadosgw = optFcgi != null && optExpat != null && optCurl != null && optLibedit != null;
|
2015-04-21 23:57:48 +02:00
|
|
|
|
2015-04-22 21:34:34 +02:00
|
|
|
|
|
|
|
# TODO: Reenable when kinetic support is fixed
|
2015-06-25 03:25:53 +02:00
|
|
|
#hasKinetic = versionAtLeast version "9.0.0" && optKinetic-cpp-client != null;
|
|
|
|
hasKinetic = false;
|
2015-04-22 21:34:34 +02:00
|
|
|
|
2015-04-21 23:57:48 +02:00
|
|
|
# Malloc implementation (can be jemalloc, tcmalloc or null)
|
2015-06-25 03:25:53 +02:00
|
|
|
malloc = if optJemalloc != null then optJemalloc else optGperftools;
|
2015-04-21 23:57:48 +02:00
|
|
|
|
|
|
|
# We prefer nss over cryptopp
|
2015-06-25 03:25:53 +02:00
|
|
|
cryptoStr = if optNss != null && optNspr != null then "nss" else
|
|
|
|
if optCryptopp != null then "cryptopp" else "none";
|
2015-04-21 23:57:48 +02:00
|
|
|
cryptoLibsMap = {
|
2015-06-25 03:25:53 +02:00
|
|
|
nss = [ optNss optNspr ];
|
|
|
|
cryptopp = [ optCryptopp ];
|
2015-04-21 23:57:48 +02:00
|
|
|
none = [ ];
|
|
|
|
};
|
|
|
|
|
2018-07-17 22:11:16 +02:00
|
|
|
ceph-python-env = python2Packages.python.withPackages (ps: [
|
2018-02-24 18:56:25 +01:00
|
|
|
ps.sphinx
|
|
|
|
ps.flask
|
2018-07-17 22:11:16 +02:00
|
|
|
ps.cython
|
2018-02-24 18:56:25 +01:00
|
|
|
ps.setuptools
|
|
|
|
ps.pip
|
|
|
|
# Libraries needed by the python tools
|
|
|
|
ps.Mako
|
|
|
|
ps.pecan
|
|
|
|
ps.prettytable
|
|
|
|
ps.webob
|
2018-03-21 21:53:02 +01:00
|
|
|
ps.cherrypy
|
2018-07-21 02:44:44 +02:00
|
|
|
]);
|
2018-02-06 15:06:46 +01:00
|
|
|
|
2015-04-20 20:42:55 +02:00
|
|
|
in
|
2015-04-20 21:01:40 +02:00
|
|
|
stdenv.mkDerivation {
|
2015-04-20 20:42:55 +02:00
|
|
|
name="ceph-${version}";
|
|
|
|
|
|
|
|
inherit src;
|
|
|
|
|
2018-07-17 22:11:16 +02:00
|
|
|
patches = [
|
2018-07-21 02:44:44 +02:00
|
|
|
# ./ceph-patch-cmake-path.patch
|
2018-07-17 22:11:16 +02:00
|
|
|
./0001-kv-RocksDBStore-API-break-additional.patch
|
2018-02-24 18:56:25 +01:00
|
|
|
] ++ optionals stdenv.isLinux [
|
|
|
|
./0002-fix-absolute-include-path.patch
|
2015-04-20 20:42:55 +02:00
|
|
|
];
|
|
|
|
|
2016-03-03 17:55:17 +01:00
|
|
|
nativeBuildInputs = [
|
2018-02-06 15:06:46 +01:00
|
|
|
cmake
|
2018-03-21 21:53:02 +01:00
|
|
|
pkgconfig which git python2Packages.wrapPython makeWrapper
|
2016-03-03 17:55:17 +01:00
|
|
|
(ensureNewerSourcesHook { year = "1980"; })
|
2018-02-06 15:06:46 +01:00
|
|
|
];
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2015-04-22 21:34:34 +02:00
|
|
|
buildInputs = buildInputs ++ cryptoLibsMap.${cryptoStr} ++ [
|
2018-07-17 22:11:16 +02:00
|
|
|
boost ceph-python-env libxml2 optYasm optLibatomic_ops optLibs3
|
|
|
|
malloc zlib openldap lttng-ust babeltrace gperf cunit
|
2018-02-06 15:06:46 +01:00
|
|
|
snappy rocksdb
|
2016-08-30 17:34:45 +02:00
|
|
|
] ++ optionals stdenv.isLinux [
|
2015-06-25 03:25:53 +02:00
|
|
|
linuxHeaders libuuid udev keyutils optLibaio optLibxfs optZfs
|
2016-08-30 17:34:45 +02:00
|
|
|
] ++ optionals hasRadosgw [
|
2015-06-25 03:25:53 +02:00
|
|
|
optFcgi optExpat optCurl optFuse optLibedit
|
2016-08-30 17:34:45 +02:00
|
|
|
] ++ optionals hasKinetic [
|
2015-06-25 03:25:53 +02:00
|
|
|
optKinetic-cpp-client
|
2015-04-20 20:42:55 +02:00
|
|
|
];
|
2018-02-24 18:56:25 +01:00
|
|
|
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2018-02-06 15:06:46 +01:00
|
|
|
preConfigure =''
|
|
|
|
# rip off submodule that interfer with system libs
|
|
|
|
rm -rf src/boost
|
|
|
|
rm -rf src/rocksdb
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2018-02-06 15:06:46 +01:00
|
|
|
# require LD_LIBRARY_PATH for cython to find internal dep
|
|
|
|
export LD_LIBRARY_PATH="$PWD/build/lib:$LD_LIBRARY_PATH"
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2018-02-06 15:06:46 +01:00
|
|
|
# requires setuptools due to embedded in-cmake setup.py usage
|
|
|
|
export PYTHONPATH="${python2Packages.setuptools}/lib/python2.7/site-packages/:$PYTHONPATH"
|
2015-04-21 23:57:48 +02:00
|
|
|
'';
|
|
|
|
|
2018-07-17 22:11:16 +02:00
|
|
|
cmakeFlags = [
|
2018-02-06 15:06:46 +01:00
|
|
|
"-DENABLE_GIT_VERSION=OFF"
|
|
|
|
"-DWITH_SYSTEM_BOOST=ON"
|
|
|
|
"-DWITH_SYSTEM_ROCKSDB=ON"
|
|
|
|
"-DWITH_LEVELDB=OFF"
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2018-02-06 15:06:46 +01:00
|
|
|
# enforce shared lib
|
|
|
|
"-DBUILD_SHARED_LIBS=ON"
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2018-02-06 15:06:46 +01:00
|
|
|
# disable cephfs, cmake build broken for now
|
|
|
|
"-DWITH_CEPHFS=OFF"
|
|
|
|
"-DWITH_LIBCEPHFS=OFF"
|
2015-04-21 23:57:48 +02:00
|
|
|
];
|
2015-04-20 20:42:55 +02:00
|
|
|
|
2018-02-24 18:56:25 +01:00
|
|
|
postFixup = ''
|
|
|
|
wrapPythonPrograms
|
2018-03-22 21:08:28 +01:00
|
|
|
wrapProgram $out/bin/ceph-mgr --set PYTHONPATH $out/${python2Packages.python.sitePackages}
|
2018-02-24 18:56:25 +01:00
|
|
|
'';
|
|
|
|
|
2015-04-20 20:42:55 +02:00
|
|
|
enableParallelBuilding = true;
|
2018-07-17 22:11:16 +02:00
|
|
|
|
2018-02-06 15:06:46 +01:00
|
|
|
outputs = [ "dev" "lib" "out" "doc" ];
|
2015-04-20 20:42:55 +02:00
|
|
|
|
|
|
|
meta = {
|
2018-03-25 07:04:25 +02:00
|
|
|
homepage = https://ceph.com/;
|
2015-04-20 20:42:55 +02:00
|
|
|
description = "Distributed storage system";
|
|
|
|
license = licenses.lgpl21;
|
2019-01-26 11:01:09 +01:00
|
|
|
maintainers = with maintainers; [ adev ak ];
|
2015-11-17 21:29:29 +01:00
|
|
|
platforms = platforms.unix;
|
2015-04-20 20:42:55 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru.version = version;
|
|
|
|
}
|