gentoo-ebuilds/app-containers/crun/crun-1.21.ebuild
Z. Liu e971f6c01e
app-containers/crun: fix building on musl
The reason is the same as in commit a4aa03f192,
which had been fixed upstream in https://github.com/containers/crun/pull/1887.
However, since we cannot provide a single patch for all the thress versions
in the tree, this is fixed by using sed to remove error.h from AC_CHECK_HEADERS
and append a new line with AC_CHECK_FUNC included.

Closes: https://bugs.gentoo.org/956287
Closes: https://bugs.gentoo.org/963641
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/44377
Closes: https://github.com/gentoo/gentoo/pull/44377
Signed-off-by: Sam James <sam@gentoo.org>
2025-12-04 01:21:51 +00:00

91 lines
2.1 KiB
Bash

# Copyright 2019-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..14} )
inherit autotools libtool python-any-r1
DESCRIPTION="Fast and low-memory footprint OCI Container Runtime fully written in C"
HOMEPAGE="https://github.com/containers/crun"
if [[ "${PV}" == *9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/containers/${PN}.git"
else
SRC_URI="https://github.com/containers/${PN}/releases/download/${PV}/${P}.tar.gz"
KEYWORDS="amd64 ~arm arm64 ~loong ppc64 ~riscv"
fi
LICENSE="GPL-2+ LGPL-2.1+"
SLOT="0"
IUSE="+bpf +caps criu +seccomp selinux systemd static-libs"
DEPEND="
dev-libs/yajl:=
sys-kernel/linux-headers
caps? ( sys-libs/libcap )
criu? ( >=sys-process/criu-3.15 )
seccomp? ( sys-libs/libseccomp )
systemd? ( sys-apps/systemd:= )
"
RDEPEND="
${DEPEND}
selinux? ( sec-policy/selinux-container )
"
BDEPEND="
${PYTHON_DEPS}
virtual/pkgconfig
"
src_prepare() {
default
elibtoolize
# https://github.com/containers/crun/pull/1887
sed -i -E '/AC_CHECK_HEADERS\(\[error.h/{
s/error\.h[[:space:]]*//g
a\
AC_CHECK_HEADER([error.h], [AC_CHECK_FUNC([error], AC_DEFINE([HAVE_ERROR_H], [1], [Define if error.h is usable]))])
}' configure.ac || die
eautoreconf
}
src_configure() {
local myeconfargs=(
--cache-file="${S}"/config.cache
$(use_enable bpf)
$(use_enable caps)
$(use_enable criu)
$(use_enable seccomp)
$(use_enable systemd)
--enable-shared
$(use_enable static-libs static)
)
econf "${myeconfargs[@]}"
}
src_test() {
emake check-TESTS -C ./libocispec
# The crun test suite is comprehensive to the extent that tests will fail
# within a sandbox environment, due to the nature of the privileges
# required to create linux "containers".
local supported_tests=(
"tests/tests_libcrun_utils"
"tests/tests_libcrun_errors"
"tests/tests_libcrun_intelrdt"
)
emake check-TESTS TESTS="${supported_tests[*]}" CFLAGS="${CFLAGS} -std=gnu17"
}
src_install() {
emake "DESTDIR=${D}" install-exec
doman crun.1
einstalldocs
find "${ED}" -name '*.la' -type f -delete || die
}