mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 01:06:58 +00:00
Python 3.12 includes a few breaking changes, such as the removal of the distutils module [1] and the deprecation of `setup.py install` in favour of pip install [2]. This patch updates the installation script for crit to reflect these changes by replacing the use of `setup.py install` with `pip install` and `distutils` with `setuptools`. In addition, a minimal pyproject.toml file has been added as it is required by the new version of pip [3]. It is worth noting that with this change we are switching from the egg packaging format to wheel [4] and add pip as a build dependency. [1] https://www.python.org/downloads/release/python-3120a2/ [2] https://github.com/pypa/setuptools/pull/2824 [3] https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/ [4] https://packaging.python.org/en/latest/discussions/wheel-vs-egg/ Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
76 lines
2.7 KiB
Makefile
76 lines
2.7 KiB
Makefile
CRIU_SO := libcriu.so
|
|
CRIU_A := libcriu.a
|
|
UAPI_HEADERS := lib/c/criu.h images/rpc.proto images/rpc.pb-c.h criu/include/version.h
|
|
|
|
all-y += lib-c lib-a lib-py
|
|
|
|
#
|
|
# C language bindings.
|
|
lib/c/Makefile: ;
|
|
lib/c/%: .FORCE
|
|
$(Q) $(MAKE) $(build)=lib/c $@
|
|
|
|
cflags-so += $(CFLAGS) -rdynamic -Wl,-soname,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
|
|
ldflags-so += -lprotobuf-c
|
|
|
|
lib/c/$(CRIU_SO): lib/c/built-in.o
|
|
$(call msg-link, $@)
|
|
$(Q) $(CC) -shared $(cflags-so) -o $@ $^ $(ldflags-so) $(LDFLAGS)
|
|
lib/c/$(CRIU_A): lib/c/built-in.o
|
|
$(call msg-link, $@)
|
|
$(Q) $(AR) rcs $@ $^
|
|
lib-c: lib/c/$(CRIU_SO)
|
|
lib-a: lib/c/$(CRIU_A)
|
|
.PHONY: lib-c lib-a
|
|
|
|
#
|
|
# Python bindings.
|
|
lib/py/Makefile: ;
|
|
lib/py/%: .FORCE
|
|
$(call msg-gen, $@)
|
|
$(Q) $(MAKE) $(build)=lib/py $@
|
|
lib-py:
|
|
$(Q) $(MAKE) $(build)=lib/py all
|
|
.PHONY: lib-py
|
|
|
|
clean-lib:
|
|
$(Q) $(MAKE) $(build)=lib/c clean
|
|
$(Q) $(MAKE) $(build)=lib/py clean
|
|
.PHONY: clean-lib
|
|
clean: clean-lib
|
|
cleanup-y += lib/c/$(CRIU_SO) lib/c/$(CRIU_A) lib/c/criu.pc
|
|
mrproper: clean
|
|
|
|
install: lib-c lib-a lib-py crit/crit lib/c/criu.pc.in
|
|
$(E) " INSTALL " lib
|
|
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)
|
|
$(Q) install -m 755 lib/c/$(CRIU_SO) $(DESTDIR)$(LIBDIR)/$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR)
|
|
$(Q) ln -fns $(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR)
|
|
$(Q) ln -fns $(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR) $(DESTDIR)$(LIBDIR)/$(CRIU_SO)
|
|
$(Q) install -m 755 lib/c/$(CRIU_A) $(DESTDIR)$(LIBDIR)/$(CRIU_A)
|
|
$(Q) mkdir -p $(DESTDIR)$(INCLUDEDIR)/criu/
|
|
$(Q) install -m 644 $(UAPI_HEADERS) $(DESTDIR)$(INCLUDEDIR)/criu/
|
|
$(E) " INSTALL " pkgconfig/criu.pc
|
|
$(Q) mkdir -p $(DESTDIR)$(LIBDIR)/pkgconfig
|
|
$(Q) sed -e 's,@version@,$(CRIU_VERSION),' -e 's,@libdir@,$(LIBDIR),' -e 's,@includedir@,$(dir $(INCLUDEDIR)/criu/),' lib/c/criu.pc.in > lib/c/criu.pc
|
|
$(Q) install -m 644 lib/c/criu.pc $(DESTDIR)$(LIBDIR)/pkgconfig
|
|
ifeq ($(PYTHON),python3)
|
|
$(E) " INSTALL " crit
|
|
$(Q) $(PYTHON) -m pip install --upgrade --force-reinstall --prefix=$(DESTDIR)$(PREFIX) ./crit
|
|
endif
|
|
.PHONY: install
|
|
|
|
uninstall:
|
|
$(E) " UNINSTALL" $(CRIU_SO)
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR))
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO))
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_A))
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/,$(CRIU_SO).$(CRIU_SO_VERSION_MAJOR).$(CRIU_SO_VERSION_MINOR))
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(INCLUDEDIR)/criu/,$(notdir $(UAPI_HEADERS)))
|
|
$(E) " UNINSTALL" pkgconfig/criu.pc
|
|
$(Q) $(RM) $(addprefix $(DESTDIR)$(LIBDIR)/pkgconfig/,criu.pc)
|
|
ifeq ($(PYTHON),python3)
|
|
$(E) " UNINSTALL" crit
|
|
$(Q) $(PYTHON) ./scripts/uninstall_module.py --prefix=$(DESTDIR)$(PREFIX) crit
|
|
endif
|
|
.PHONY: uninstall
|