# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 PYTHON_COMPAT=( python3_{10..11} ) LUA_COMPAT=( lua5-{3..4} ) inherit check-reqs bash-completion-r1 cmake flag-o-matic lua-single \ python-r1 udev readme.gentoo-r1 toolchain-funcs systemd tmpfiles XSIMD_HASH="aeec9c872c8b475dedd7781336710f2dd2666cb2" SRC_URI=" https://download.ceph.com/tarballs/${P}.tar.gz parquet? ( https://github.com/xtensor-stack/xsimd/archive/${XSIMD_HASH}.tar.gz -> ceph-xsimd-${PV}.tar.gz ) " KEYWORDS="amd64 ~arm64" DESCRIPTION="Ceph distributed filesystem" HOMEPAGE="https://ceph.com/" 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" 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 +parquet pmdk rabbitmq +radosgw rbd-rwl rbd-ssd rdma rgw-lua +ssl spdk +sqlite +system-boost systemd +tcmalloc test +uring xfs zbd zfs " IUSE+="$(printf "cpu_flags_x86_%s\n" ${CPU_FLAGS_X86[@]})" # =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" # hopefully this will not be necessary in the next release use parquet && export ARROW_XSIMD_URL="file:///${DISTDIR}/ceph-xsimd-${PV}.tar.gz" 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 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 cmake_build src/pybind/CMakeFiles/cython_modules } src_install() { python_foreach_impl python_install python_setup cmake_src_install python_optimize 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-r14" ${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}" DESTDIR="${ED}" cmake_build src/pybind/install python_optimize } pkg_postinst() { readme.gentoo_print_elog tmpfiles_process ${PN}.conf udev_reload } pkg_postrm() { udev_reload }