# Copyright 1999-2024 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 PYTHON_COMPAT=( python3_{10..11} ) LUA_COMPAT=( lua5-3 ) CMAKE_MAKEFILE_GENERATOR=emake inherit check-reqs bash-completion-r1 cmake python-r1 flag-o-matic \ lua-single udev readme.gentoo-r1 toolchain-funcs systemd tmpfiles DESCRIPTION="Ceph distributed filesystem" HOMEPAGE="https://ceph.com/" SRC_URI="https://download.ceph.com/tarballs/${P}.tar.gz" LICENSE="Apache-2.0 LGPL-2.1 CC-BY-SA-3.0 GPL-2 GPL-2+ LGPL-2+ LGPL-2.1 LGPL-3 GPL-3 BSD Boost-1.0 MIT public-domain" SLOT="0" KEYWORDS="~amd64 ~arm64 ~ppc64" CPU_FLAGS_X86=(avx2 avx512f pclmul sse{,2,3,4_1,4_2} ssse3) IUSE=" babeltrace +cephfs custom-cflags diskprediction dpdk fuse grafana jemalloc jaeger kafka kerberos ldap lttng +mgr numa pmdk rabbitmq +radosgw rbd-rwl rbd-ssd rdma rgw-lua selinux +ssl spdk +sqlite +system-boost systemd +tcmalloc test uring xfs zbd zfs " IUSE+="$(printf "cpu_flags_x86_%s\n" ${CPU_FLAGS_X86[@]})" DEPEND=" ${LUA_DEPS} ${PYTHON_DEPS} acct-group/ceph acct-user/ceph virtual/libudev:= app-arch/bzip2:= app-arch/lz4:= app-arch/snappy:= >=app-arch/snappy-1.1.9-r1 app-arch/zstd:= app-shells/bash:0 app-misc/jq:= dev-cpp/gflags:= =dev-util/google-perftools-2.6.1:= ) jaeger? ( dev-cpp/nlohmann_json:= ) kafka? ( dev-libs/librdkafka:= ) kerberos? ( virtual/krb5 ) ldap? ( net-nds/openldap:= ) lttng? ( dev-util/lttng-ust:= ) pmdk? ( dev-libs/pmdk:= ) rabbitmq? ( net-libs/rabbitmq-c:= ) radosgw? ( dev-libs/icu:= dev-libs/expat:= net-misc/curl:=[curl_ssl_openssl] ) rbd-rwl? ( dev-libs/pmdk:= ) rdma? ( sys-cluster/rdma-core:= ) spdk? ( dev-util/cunit ) sqlite? ( dev-db/sqlite:= ) system-boost? ( dev-libs/boost:=[context,python,${PYTHON_USEDEP},zlib] ) !system-boost? ( $(python_gen_impl_dep '' 3.{10..11}) ) uring? ( sys-libs/liburing:= ) xfs? ( sys-fs/xfsprogs:= ) zbd? ( sys-block/libzbd:= ) zfs? ( sys-fs/zfs:= ) " # =glibc-2.32 has_version '>=sys-libs/glibc-2.32' && mycmakeargs+=( -DWITH_REENTRANT_STRSIGNAL:BOOL=ON ) rm -f "${BUILD_DIR:-${S}}/CMakeCache.txt" \ || die "failed to remove cmake cache" cmake_src_configure # bug #630232 sed -i "s:\"${T//:\\:}/${EPYTHON}/bin/python\":\"${PYTHON}\":" \ "${BUILD_DIR:-${S}}"/include/acconfig.h \ || die "sed failed" } src_configure() { use custom-cflags || strip-flags ceph_src_configure } src_compile() { cmake_build VERBOSE=1 all # we have to do this here to prevent from building everything multiple times python_copy_sources python_foreach_impl python_compile } python_compile() { local CMAKE_USE_DIR="${S}" ceph_src_configure pushd "${BUILD_DIR}/src/pybind" >/dev/null || die cmake_build VERBOSE=1 clean cmake_build VERBOSE=1 all # python modules are only compiled with "make install" so we need to do this to # prevent doing a bunch of compilation in src_install DESTDIR="${T}" cmake_build VERBOSE=1 install popd >/dev/null || die } src_install() { python_foreach_impl python_install python_setup cmake_src_install find "${ED}" -name '*.la' -type f -delete || die exeinto /usr/$(get_libdir)/ceph newexe "${BUILD_DIR}/bin/init-ceph" init-ceph insinto /etc/logrotate.d/ newins "${FILESDIR}"/ceph.logrotate-r2 ${PN} keepdir /var/lib/${PN}{,/tmp} /var/log/ceph/stat /var/log/ceph/console fowners -R ceph:ceph /var/log/ceph newinitd "${FILESDIR}/rbdmap.initd-r1" rbdmap newinitd "${FILESDIR}/${PN}.initd-r13" ${PN} newconfd "${FILESDIR}/${PN}.confd-r5" ${PN} insinto /etc/sudoers.d doins sudoers.d/* insinto /etc/sysctl.d newins "${FILESDIR}"/sysctld 90-${PN}.conf use tcmalloc && newenvd "${FILESDIR}"/envd-tcmalloc 99${PN}-tcmalloc # units aren't installed by the build system unless systemd is enabled # so no point installing these with the USE flag disabled if use systemd; then systemd_install_serviced "${FILESDIR}/ceph-mds_at.service.conf" "ceph-mds@.service" systemd_install_serviced "${FILESDIR}/ceph-osd_at.service.conf" "ceph-osd@.service" fi udev_dorules udev/*.rules newtmpfiles "${FILESDIR}"/ceph-tmpfilesd ${PN}.conf readme.gentoo_create_doc # bug #630232 sed -i -r "s:${T//:/\\:}/${EPYTHON}:/usr:" "${ED}"/usr/bin/ceph{,-crash} \ || die "sed failed" python_fix_shebang "${ED}"/usr/{,s}bin/ # python_fix_shebang apparently is not idempotent local shebang_regex='(/usr/lib/python-exec/python[0-9]\.[0-9]/python)[0-9]\.[0-9]' grep -r -E -l --null "${shebang_regex}" "${ED}"/usr/{s,}bin/ \ | xargs --null --no-run-if-empty -- sed -i -r "s:${shebang_regex}:\1:" || die local -a rados_classes=( "${ED}/usr/$(get_libdir)/rados-classes"/* ) dostrip -x "${rados_classes[@]#${ED}}" } python_install() { local CMAKE_USE_DIR="${S}" pushd "${BUILD_DIR}/src/pybind" >/dev/null || die DESTDIR="${ED}" cmake_build VERBOSE=1 install popd >/dev/null || die python_scriptinto /usr/sbin python_doscript src/cephadm/cephadm python_optimize } pkg_postinst() { readme.gentoo_print_elog tmpfiles_process ${PN}.conf udev_reload } pkg_postrm() { udev_reload }