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