Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/criu/, sys-process/criu/files/
Date: Wed, 16 Jun 2021 20:10:23
Message-Id: 1623874147.d79e10b274201dad47a013ed29a1420877a37ba7.vapier@gentoo
1 commit: d79e10b274201dad47a013ed29a1420877a37ba7
2 Author: Mike Frysinger <vapier <AT> chromium <DOT> org>
3 AuthorDate: Wed Jun 16 19:50:43 2021 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 16 20:09:07 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d79e10b2
7
8 sys-process/criu: fix $PKG_CONFIG usage
9
10 Needed to properly cross-compile.
11
12 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
13
14 sys-process/criu/criu-3.15.ebuild | 2 +
15 sys-process/criu/files/criu-3.15-pkg-config.patch | 141 ++++++++++++++++++++++
16 2 files changed, 143 insertions(+)
17
18 diff --git a/sys-process/criu/criu-3.15.ebuild b/sys-process/criu/criu-3.15.ebuild
19 index b9e42cf4fa5..065124a7e5d 100644
20 --- a/sys-process/criu/criu-3.15.ebuild
21 +++ b/sys-process/criu/criu-3.15.ebuild
22 @@ -45,6 +45,7 @@ PATCHES=(
23 "${FILESDIR}"/2.2/${PN}-2.2-flags.patch
24 "${FILESDIR}"/2.3/${PN}-2.3-no-git.patch
25 "${FILESDIR}"/${PN}-3.12-automagic-libbsd.patch
26 + "${FILESDIR}"/${PN}-3.15-pkg-config.patch
27 )
28
29 criu_arch() {
30 @@ -93,6 +94,7 @@ src_compile() {
31 CC="$(tc-getCC)" \
32 LD="$(tc-getLD)" \
33 AR="$(tc-getAR)" \
34 + PKG_CONFIG="$(tc-getPKG_CONFIG)" \
35 PYTHON="${EPYTHON%.?}" \
36 FULL_PYTHON="${PYTHON%.?}" \
37 OBJCOPY="$(tc-getOBJCOPY)" \
38
39 diff --git a/sys-process/criu/files/criu-3.15-pkg-config.patch b/sys-process/criu/files/criu-3.15-pkg-config.patch
40 new file mode 100644
41 index 00000000000..69d83bfc399
42 --- /dev/null
43 +++ b/sys-process/criu/files/criu-3.15-pkg-config.patch
44 @@ -0,0 +1,141 @@
45 +https://github.com/checkpoint-restore/criu/pull/1517
46 +
47 +From d72536d9a821f9ff64f5dd62c9f8a282e3e5ec85 Mon Sep 17 00:00:00 2001
48 +From: Mike Frysinger <vapier@××××××××.org>
49 +Date: Wed, 16 Jun 2021 15:43:04 -0400
50 +Subject: [PATCH] build: respect $PKG_CONFIG settings
51 +
52 +The build needs to respect $PKG_CONFIG env var like other standard
53 +build systems and the the upstream pkg-config project itself. This
54 +allows the package builder to point it to the right tool when doing
55 +a cross-compile build. Otherwise the host pkg-config tool is used
56 +which won't have access to the packages in the cross sysroot.
57 +
58 +Signed-off-by: Mike Frysinger <vapier@××××××××.org>
59 +---
60 + Makefile.config | 2 +-
61 + criu/Makefile | 2 +-
62 + scripts/nmk/scripts/tools.mk | 1 +
63 + scripts/nmk/scripts/utils.mk | 2 +-
64 + test/zdtm/Makefile.inc | 8 +++++---
65 + test/zdtm/lib/Makefile | 2 +-
66 + test/zdtm/static/Makefile | 2 +-
67 + 7 files changed, 11 insertions(+), 8 deletions(-)
68 +
69 +diff --git a/Makefile.config b/Makefile.config
70 +index 3d99e680be7f..6e3e1b062256 100644
71 +--- a/Makefile.config
72 ++++ b/Makefile.config
73 +@@ -30,7 +30,7 @@ else
74 + endif
75 +
76 + ifeq ($(call pkg-config-check,libnftables),y)
77 +- LIB_NFTABLES := $(shell pkg-config --libs libnftables)
78 ++ LIB_NFTABLES := $(shell $(PKG_CONFIG) --libs libnftables)
79 + ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(LIB_NFTABLES)),true)
80 + LIBS_FEATURES += $(LIB_NFTABLES)
81 + FEATURE_DEFINES += -DCONFIG_HAS_NFTABLES_LIB_API_0
82 +diff --git a/criu/Makefile b/criu/Makefile
83 +index ceb49ce09925..11d454c81026 100644
84 +--- a/criu/Makefile
85 ++++ b/criu/Makefile
86 +@@ -27,7 +27,7 @@ CFLAGS += -iquote include
87 + CFLAGS += -iquote images
88 + CFLAGS += -iquote $(ARCH_DIR)/include
89 + CFLAGS += -iquote .
90 +-CFLAGS += $(shell pkg-config --cflags libnl-3.0)
91 ++CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-3.0)
92 + CFLAGS += $(CONFIG-DEFINES)
93 +
94 + ifeq ($(GMON),1)
95 +diff --git a/scripts/nmk/scripts/tools.mk b/scripts/nmk/scripts/tools.mk
96 +index c5794401c734..1681d4e9092b 100644
97 +--- a/scripts/nmk/scripts/tools.mk
98 ++++ b/scripts/nmk/scripts/tools.mk
99 +@@ -17,6 +17,7 @@ AR := $(CROSS_COMPILE)ar
100 + STRIP := $(CROSS_COMPILE)strip
101 + OBJCOPY := $(CROSS_COMPILE)objcopy
102 + OBJDUMP := $(CROSS_COMPILE)objdump
103 ++PKG_CONFIG ?= pkg-config
104 + NM := $(CROSS_COMPILE)nm
105 + MAKE := make
106 + MKDIR := mkdir -p
107 +diff --git a/scripts/nmk/scripts/utils.mk b/scripts/nmk/scripts/utils.mk
108 +index b9790615ca7f..f93fdf911cef 100644
109 +--- a/scripts/nmk/scripts/utils.mk
110 ++++ b/scripts/nmk/scripts/utils.mk
111 +@@ -16,7 +16,7 @@ try-asm = $(call try-compile,assembler-with-cpp,$(1),$(2),$(3))
112 +
113 + # pkg-config-check
114 + # Usage: ifeq ($(call pkg-config-check, library),y)
115 +-pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
116 ++pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
117 +
118 + #
119 + # Remove duplicates.
120 +diff --git a/test/zdtm/Makefile.inc b/test/zdtm/Makefile.inc
121 +index 43763321f956..e4af9c51e9e4 100644
122 +--- a/test/zdtm/Makefile.inc
123 ++++ b/test/zdtm/Makefile.inc
124 +@@ -37,6 +37,7 @@ HOSTCC ?= gcc
125 + ifeq ($(origin CC), default)
126 + CC := $(CROSS_COMPILE)$(HOSTCC)
127 + endif
128 ++PKG_CONFIG ?= pkg-config
129 + CFLAGS += -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
130 + CFLAGS += -Wdeclaration-after-statement -Wstrict-prototypes
131 + CFLAGS += $(USERCFLAGS)
132 +@@ -54,8 +55,9 @@ endif
133 + RM := rm -f --one-file-system
134 +
135 + ifeq ($(COMPAT_TEST),y)
136 ++$(error bad juju)
137 + # Firstly look for 32-bit libs and then in standard path.
138 +- PKG_CONFIG_PATH := $(shell pkg-config --variable pc_path pkg-config)
139 ++ PKG_CONFIG_PATH := $(shell $(PKG_CONFIG) --variable pc_path pkg-config)
140 + PKG_CONFIG_PATH := /usr/lib32/pkgconfig:$(PKG_CONFIG_PATH)
141 + ifeq ($(ARCH),x86)
142 + export CFLAGS += -m32
143 +@@ -66,11 +68,11 @@ endif
144 + endif
145 +
146 + define pkg-libs
147 +- $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs $(1))
148 ++ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(PKG_CONFIG) --libs $(1))
149 + endef
150 +
151 + define pkg-cflags
152 +- $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --cflags $(1))
153 ++ $(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(PKG_CONFIG) --cflags $(1))
154 + endef
155 +
156 + %.d: %.c
157 +diff --git a/test/zdtm/lib/Makefile b/test/zdtm/lib/Makefile
158 +index 05fe64e91703..5ecf8bccf27b 100644
159 +--- a/test/zdtm/lib/Makefile
160 ++++ b/test/zdtm/lib/Makefile
161 +@@ -6,7 +6,7 @@ LIB := libzdtmtst.a
162 +
163 + LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c
164 +
165 +-pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
166 ++pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
167 + ifeq ($(call pkg-config-check,libbpf),y)
168 + LIBSRC += bpfmap_zdtm.c
169 + endif
170 +diff --git a/test/zdtm/static/Makefile b/test/zdtm/static/Makefile
171 +index e60fe6dc2d66..c5f3c98be3ed 100644
172 +--- a/test/zdtm/static/Makefile
173 ++++ b/test/zdtm/static/Makefile
174 +@@ -241,7 +241,7 @@ TST_NOFILE := \
175 + sigtrap01 \
176 + # jobctl00 \
177 +
178 +-pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
179 ++pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
180 + ifeq ($(call pkg-config-check,libbpf),y)
181 + TST_NOFILE += \
182 + bpf_hash \
183 +--
184 +2.31.1
185 +