commit: 8d931c752ad908a68c4f358fc870af323d0eccfe Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sat Jun 21 09:41:08 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Jun 21 09:41:40 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8d931c75
sys-process/criu: add 4.1 Closes: https://bugs.gentoo.org/728148 Closes: https://bugs.gentoo.org/732264 Closes: https://bugs.gentoo.org/849533 Closes: https://bugs.gentoo.org/874525 Closes: https://bugs.gentoo.org/883301 Closes: https://bugs.gentoo.org/940477 Closes: https://bugs.gentoo.org/952753 Closes: https://bugs.gentoo.org/956788 Signed-off-by: Sam James <sam <AT> gentoo.org> sys-process/criu/Manifest | 1 + sys-process/criu/criu-4.1.ebuild | 210 ++++++++++++++++++++++++ sys-process/criu/files/criu-4.1-no-werror.patch | 164 ++++++++++++++++++ 3 files changed, 375 insertions(+) diff --git a/sys-process/criu/Manifest b/sys-process/criu/Manifest index 507b2f14200f..6b0bda7942fe 100644 --- a/sys-process/criu/Manifest +++ b/sys-process/criu/Manifest @@ -1 +1,2 @@ DIST criu-3.19.tar.gz 1379938 BLAKE2B c55c8e9cf7752ac1e6d7d99a3f87f98440f2054026bec2d5bed76ff5838e8e2dfa2a5fa9c8d17d60fc6da165260187d002ede6fa49f6902a0a6fe8461b12b479 SHA512 d243818cdac51580c952a80e9164786a67ce5e294c0faa6dc700f5e8da8e36495f0b64f5c27b345ede7d6697ed7a69fa4e9a85cef451f32e3ffeb78564884571 +DIST criu-4.1.tar.gz 1443243 BLAKE2B 6b5122016cddcebae6cf932c51a1c742b6a86023aa172d84cec2e85ce1773fae37f4b229a7ab3a868318a337fcd36a0560362898a84e8749ab6addcaedb8431b SHA512 769001a7e527c129fe73509fd0c7d3fc3b9b1080dc69929032cb84f60f95256f5d145ed4b7ea11f090a7f468f2bb2a0ecf56475eb292966cad26d643f0e46816 diff --git a/sys-process/criu/criu-4.1.ebuild b/sys-process/criu/criu-4.1.ebuild new file mode 100644 index 000000000000..457cdee63926 --- /dev/null +++ b/sys-process/criu/criu-4.1.ebuild @@ -0,0 +1,210 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..13} ) +DISTUTILS_USE_PEP517=setuptools +inherit fcaps flag-o-matic toolchain-funcs linux-info distutils-r1 + +DESCRIPTION="Utility to checkpoint/restore a process tree" +HOMEPAGE=" + https://criu.org/ + https://github.com/checkpoint-restore/ +" +SRC_URI="https://github.com/checkpoint-restore/${PN}/archive/v${PV}/${P}.tar.gz" + +LICENSE="GPL-2 LGPL-2.1" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 -riscv" +IUSE="bpf doc gnutls nftables selinux setproctitle static-libs test video_cards_amdgpu" + +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +COMMON_DEPEND=" + ${PYTHON_DEPS} + >=dev-libs/protobuf-c-1.4.0:= + dev-libs/libnl:3= + net-libs/libnet:1.1= + sys-libs/libcap:= + bpf? ( dev-libs/libbpf:= ) + gnutls? ( net-libs/gnutls:= ) + nftables? ( net-libs/gnutls:= ) + selinux? ( sys-libs/libselinux:= ) + setproctitle? ( dev-libs/libbsd:= ) + video_cards_amdgpu? ( x11-libs/libdrm[video_cards_amdgpu] ) +" +DEPEND=" + ${COMMON_DEPEND} +" +BDEPEND=" + doc? ( + app-text/asciidoc + app-text/xmlto + ) +" +RDEPEND=" + ${COMMON_DEPEND} + dev-python/protobuf[${PYTHON_USEDEP}] +" + +CONFIG_CHECK="~CHECKPOINT_RESTORE ~NAMESPACES ~PID_NS ~FHANDLE ~EVENTFD ~EPOLL ~INOTIFY_USER + ~UNIX_DIAG ~INET_DIAG ~INET_UDP_DIAG ~PACKET_DIAG ~NETLINK_DIAG ~TUN ~NETFILTER_XT_MARK" + +RESTRICT="!test? ( test )" + +PATCHES=( + "${FILESDIR}/2.2/criu-2.2-flags.patch" + "${FILESDIR}/2.3/criu-2.3-no-git.patch" + "${FILESDIR}/criu-3.12-automagic-libbsd.patch" + "${FILESDIR}/criu-4.1-no-werror.patch" +) + +FILECAPS=( + -m 0755 cap_checkpoint_restore usr/sbin/criu +) + +criu_arch() { + # criu infers the arch from $(uname -m). We never want this to happen. + case ${ARCH} in + amd64) echo "x86";; + arm64) echo "aarch64";; + loong) echo "loongarch64";; + ppc64*) echo "ppc64";; + *) echo "${ARCH}";; + esac +} + +pkg_setup() { + use amd64 && CONFIG_CHECK+=" ~IA32_EMULATION" + linux-info_pkg_setup +} + +src_prepare() { + distutils-r1_src_prepare + + if ! use doc; then + sed -i 's_\(install: \)install-man _\1_g' Makefile.install || die + fi +} + +criu_use() { + if ! use "${1}"; then + sed \ + -e "s:${2:-${1}}:no_${2:-lib${1}}:g" \ + -i Makefile.config || die + fi +} + +criu_python() { + local -x \ + CRIU_VERSION_MAJOR=$(ver_cut 1) \ + CRIU_VERSION_MINOR=$(ver_cut 2) \ + CRIU_VERSION_SUBLEVEL=$(ver_cut 3) + + "${@}" +} + +src_configure() { + # Gold linker generates invalid object file when used with criu's custom + # linker script. Use the bfd linker instead. See https://crbug.com/839665#c3 + tc-ld-force-bfd + + # The build system is quite sensitive to weird CFLAGS. It may + # show up with strange build errors (e.g. redefined enums) because + # of confused 'configure' (Makefile) tests. + strip-unsupported-flags + strip-flags + filter-flags '-Wa,*' '-W*' + filter-flags -Wl,--as-needed + + # CRIUs doesn't like LTO https://bugs.gentoo.org/910304 + filter-lto + + LDFLAGS="$(raw-ldflags)" + USERCFLAGS="${CFLAGS}" + + unset CFLAGS + + # Build system uses this variable as a trigger to append coverage flags + # we'd like to avoid it. https://bugs.gentoo.org/744244 + unset GCOV + + # we have to sed the Makefile.config to disable automagic deps + criu_use selinux + criu_use bpf + criu_use nftables + # TODO: CUDA plugin + criu_use video_cards_amdgpu libdrm + + emake_opts=( + SETPROCTITLE="$(usex setproctitle)" + NO_GNUTLS="$(usev !gnutls '1')" + ) + + python_setup + pushd crit >/dev/null || die + criu_python distutils-r1_src_configure + popd >/dev/null || die +} + +criu_emake() { + emake \ + AR="$(tc-getAR)" \ + ARCH="$(criu_arch)" \ + CC="$(tc-getCC)" \ + USERCFLAGS="${USERCFLAGS}" \ + FULL_PYTHON="${PYTHON%.*}" \ + HOSTCC="$(tc-getBUILD_CC)" \ + LD="$(tc-getLD)" \ + LIBDIR="${EPREFIX}/usr/$(get_libdir)" \ + LOGROTATEDIR="${EPREFIX}"/etc/logrotate.d \ + OBJCOPY="$(tc-getOBJCOPY)" \ + PKG_CONFIG="$(tc-getPKG_CONFIG)" \ + PREFIX="${EPREFIX}"/usr \ + PYTHON="${EPYTHON%.*}" \ + PYTHON_EXTERNALLY_MANAGED=1 \ + V=1 WERROR=0 DEBUG=0 \ + "${emake_opts[@]}" \ + "${@}" +} + +src_compile() { + local -a targets=( + all + $(usev video_cards_amdgpu 'amdgpu_plugin') + $(usev doc 'docs') + ) + criu_emake "${targets[@]}" + + pushd crit >/dev/null || die + criu_python distutils-r1_src_compile + popd >/dev/null || die +} + +src_test() { + criu_emake unittest +} + +python_install() { + local -x \ + CRIU_VERSION_MAJOR=$(ver_cut 1) \ + CRIU_VERSION_MINOR=$(ver_cut 2) \ + CRIU_VERSION_SUBLEVEL=$(ver_cut 3) + + distutils-r1_python_install +} + +src_install() { + criu_emake DESTDIR="${D}" install + + pushd crit >/dev/null || die + criu_python distutils-r1_src_install + popd >/dev/null || die + + dodoc CREDITS README.md + + if ! use static-libs; then + find "${D}" -name "*.a" -delete || die + fi +} diff --git a/sys-process/criu/files/criu-4.1-no-werror.patch b/sys-process/criu/files/criu-4.1-no-werror.patch new file mode 100644 index 000000000000..fc5cd6036b25 --- /dev/null +++ b/sys-process/criu/files/criu-4.1-no-werror.patch @@ -0,0 +1,164 @@ +--- a/Makefile.config ++++ b/Makefile.config +@@ -13,13 +13,13 @@ else + $(info $S Install libbsd-devel (RPM) / libbsd-dev (DEB) to fix.) + endif + +-ifeq ($(call pkg-config-check,libselinux),y) +- LIBS_FEATURES += -lselinux ++ifeq ($(call pkg-config-check,libno_libselinux),y) ++ LIBS_FEATURES += -lno_libselinux + FEATURE_DEFINES += -DCONFIG_HAS_SELINUX + endif + +-ifeq ($(call pkg-config-check,libbpf),y) +- LIBS_FEATURES += -lbpf ++ifeq ($(call pkg-config-check,libno_libbpf),y) ++ LIBS_FEATURES += -lno_libbpf + FEATURE_DEFINES += -DCONFIG_HAS_LIBBPF + export CONFIG_HAS_LIBBPF := y + endif +--- a/compel/test/fdspy/Makefile ++++ b/compel/test/fdspy/Makefile +@@ -1,5 +1,5 @@ + CC := gcc +-CFLAGS ?= -O2 -g -Wall -Werror ++CFLAGS ?= -O2 -g -Wall + + COMPEL := ../../../compel/compel-host + +--- a/compel/test/infect/Makefile ++++ b/compel/test/infect/Makefile +@@ -1,5 +1,5 @@ + CC := gcc +-CFLAGS ?= -O2 -g -Wall -Werror ++CFLAGS ?= -O2 -g -Wall + + COMPEL := ../../../compel/compel-host + +--- a/compel/test/rsys/Makefile ++++ b/compel/test/rsys/Makefile +@@ -1,5 +1,5 @@ + CC := gcc +-CFLAGS ?= -O2 -g -Wall -Werror ++CFLAGS ?= -O2 -g -Wall + + COMPEL := ../../../compel/compel-host + +--- a/compel/test/stack/Makefile ++++ b/compel/test/stack/Makefile +@@ -1,5 +1,5 @@ + CC := gcc +-CFLAGS ?= -O2 -g -Wall -Werror ++CFLAGS ?= -O2 -g -Wall + + COMPEL := ../../../compel/compel-host + +--- a/plugins/amdgpu/Makefile ++++ b/plugins/amdgpu/Makefile +@@ -15,7 +15,7 @@ DEPS_NOK := ; + __nmk_dir ?= ../../scripts/nmk/scripts/ + include $(__nmk_dir)msg.mk + +-PLUGIN_CFLAGS := -g -Wall -Werror -D _GNU_SOURCE -shared -nostartfiles -fPIC ++PLUGIN_CFLAGS := -g -Wall -D _GNU_SOURCE -shared -nostartfiles -fPIC + PLUGIN_LDFLAGS := -lpthread -lrt -ldrm -ldrm_amdgpu + + ifeq ($(CONFIG_AMDGPU),y) +--- a/plugins/cuda/Makefile ++++ b/plugins/cuda/Makefile +@@ -10,7 +10,7 @@ PLUGIN_INCLUDE += -iquote../../ + + COMPEL := ../../compel/compel-host + +-PLUGIN_CFLAGS := -g -Wall -Werror -shared -nostartfiles -fPIC ++PLUGIN_CFLAGS := -g -Wall -shared -nostartfiles -fPIC + + __nmk_dir ?= ../../scripts/nmk/scripts/ + include $(__nmk_dir)msg.mk +--- a/test/others/ext-links/Makefile ++++ b/test/others/ext-links/Makefile +@@ -1,4 +1,4 @@ + all: mvlink.so + + mvlink.so: mvlink.c +- gcc -g -Werror -Wall -shared -nostartfiles mvlink.c -o mvlink.so -iquote ../../../criu/include -fPIC ++ gcc -g -Wall -shared -nostartfiles mvlink.c -o mvlink.so -iquote ../../../criu/include -fPIC +--- a/test/others/libcriu/Makefile ++++ b/test/others/libcriu/Makefile +@@ -24,7 +24,7 @@ endef + $(foreach t, $(TESTS), $(eval $(call genb, $(t)))) + + %.o: %.c +- gcc -c $^ -iquote ../../../../criu/criu/include -I../../../../criu/lib/c/ -I../../../../criu/images/ -o $@ -Werror ++ gcc -c $^ -iquote ../../../../criu/criu/include -I../../../../criu/lib/c/ -I../../../../criu/images/ -o $@ + + clean: libcriu_clean + rm -rf $(TESTS) $(TESTS:%=%.o) lib.o +--- a/test/others/mounts/ext/Makefile ++++ b/test/others/mounts/ext/Makefile +@@ -1,7 +1,7 @@ + all: ext-mount.so ns_init + + ext-mount.so: ext-mount.c +- gcc -g -Werror -Wall -shared -nostartfiles ext-mount.c -o ext-mount.so -iquote ../../../include -fPIC ++ gcc -g -Wall -shared -nostartfiles ext-mount.c -o ext-mount.so -iquote ../../../include -fPIC + + ns_init: ns_init.o + gcc -static $< -o $@ +--- a/test/others/rpc/Makefile ++++ b/test/others/rpc/Makefile +@@ -1,7 +1,7 @@ + all: test-c rpc_pb2.py criu + .PHONY: all + +-CFLAGS += -g -Werror -Wall -I. ++CFLAGS += -g -Wall -I. + LDLIBS += -lprotobuf-c + + PYTHON ?= python3 +--- a/test/others/unix-callback/Makefile ++++ b/test/others/unix-callback/Makefile +@@ -7,16 +7,16 @@ unix.pb-c.c: unix.proto + protoc-c --proto_path=. --c_out=. unix.proto + + unix-lib.so: unix-lib.c unix.pb-c.c +- gcc -g -Werror -Wall -shared -nostartfiles unix-lib.c unix.pb-c.c -o unix-lib.so -iquote ../../../criu/include -fPIC ++ gcc -g -Wall -shared -nostartfiles unix-lib.c unix.pb-c.c -o unix-lib.so -iquote ../../../criu/include -fPIC + + syslog-lib.so: syslog-lib.c +- gcc -g -Werror -Wall -shared -nostartfiles syslog-lib.c -o syslog-lib.so -iquote ../../../criu/include -fPIC ++ gcc -g -Wall -shared -nostartfiles syslog-lib.c -o syslog-lib.so -iquote ../../../criu/include -fPIC + + unix-server: unix-server.c +- gcc -Werror -Wall -o unix-server unix-server.c ++ gcc -Wall -o unix-server unix-server.c + + unix-client: unix-client.c +- gcc -Werror -Wall -o unix-client unix-client.c ++ gcc -Wall -o unix-client unix-client.c + + clean: + rm -rf data unix-lib.so unix-server unix-client syslog-lib.so output pid unix.pb-c.* +--- a/test/plugins/Makefile ++++ b/test/plugins/Makefile +@@ -7,7 +7,7 @@ PLUGIN_INCLUDE := -iquote../../include + PLUGIN_INCLUDE += -iquote../../criu/include + PLUGIN_INCLUDE += -iquote../../criu/arch/$(ARCH)/include/ + PLUGIN_INCLUDE += -iquote../../ +-PLUGIN_CFLAGS := -g -Wall -Werror -shared -nostartfiles -fPIC ++PLUGIN_CFLAGS := -g -Wall -shared -nostartfiles -fPIC + + # Silent make rules. + Q := @ +--- a/test/zdtm/Makefile.inc ++++ b/test/zdtm/Makefile.inc +@@ -38,7 +38,7 @@ ifeq ($(origin CC), default) + CC := $(CROSS_COMPILE)$(HOSTCC) + endif + PKG_CONFIG ?= pkg-config +-CFLAGS += -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 ++CFLAGS += -g -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0 + CFLAGS += -Wdeclaration-after-statement -Wstrict-prototypes + CFLAGS += $(USERCFLAGS) $(ARCHCFLAGS) + CFLAGS += -D_GNU_SOURCE -D_LARGEFILE64_SOURCE
