2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00

build: respect $PKG_CONFIG settings

The build needs to respect $PKG_CONFIG env var like other standard
build systems and the the upstream pkg-config project itself.  This
allows the package builder to point it to the right tool when doing
a cross-compile build.  Otherwise the host pkg-config tool is used
which won't have access to the packages in the cross sysroot.

Signed-off-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Mike Frysinger 2021-06-16 15:43:04 -04:00 committed by Andrei Vagin
parent 81a68ad3b2
commit 2967bed64e
7 changed files with 10 additions and 8 deletions

View File

@ -30,7 +30,7 @@ else
endif
ifeq ($(call pkg-config-check,libnftables),y)
LIB_NFTABLES := $(shell pkg-config --libs libnftables)
LIB_NFTABLES := $(shell $(PKG_CONFIG) --libs libnftables)
ifeq ($(call try-cc,$(FEATURE_TEST_NFTABLES_LIB_API_0),$(LIB_NFTABLES)),true)
LIBS_FEATURES += $(LIB_NFTABLES)
FEATURE_DEFINES += -DCONFIG_HAS_NFTABLES_LIB_API_0

View File

@ -27,7 +27,7 @@ CFLAGS += -iquote include
CFLAGS += -iquote images
CFLAGS += -iquote $(ARCH_DIR)/include
CFLAGS += -iquote .
CFLAGS += $(shell pkg-config --cflags libnl-3.0)
CFLAGS += $(shell $(PKG_CONFIG) --cflags libnl-3.0)
CFLAGS += $(CONFIG-DEFINES)
ifeq ($(GMON),1)

View File

@ -17,6 +17,7 @@ AR := $(CROSS_COMPILE)ar
STRIP := $(CROSS_COMPILE)strip
OBJCOPY := $(CROSS_COMPILE)objcopy
OBJDUMP := $(CROSS_COMPILE)objdump
PKG_CONFIG ?= pkg-config
NM := $(CROSS_COMPILE)nm
MAKE := make
MKDIR := mkdir -p

View File

@ -16,7 +16,7 @@ try-asm = $(call try-compile,assembler-with-cpp,$(1),$(2),$(3))
# pkg-config-check
# Usage: ifeq ($(call pkg-config-check, library),y)
pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
#
# Remove duplicates.

View File

@ -37,6 +37,7 @@ HOSTCC ?= gcc
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 += -Wdeclaration-after-statement -Wstrict-prototypes
CFLAGS += $(USERCFLAGS)
@ -55,7 +56,7 @@ RM := rm -f --one-file-system
ifeq ($(COMPAT_TEST),y)
# Firstly look for 32-bit libs and then in standard path.
PKG_CONFIG_PATH := $(shell pkg-config --variable pc_path pkg-config)
PKG_CONFIG_PATH := $(shell $(PKG_CONFIG) --variable pc_path pkg-config)
PKG_CONFIG_PATH := /usr/lib32/pkgconfig:$(PKG_CONFIG_PATH)
ifeq ($(ARCH),x86)
export CFLAGS += -m32
@ -66,11 +67,11 @@ endif
endif
define pkg-libs
$(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --libs $(1))
$(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(PKG_CONFIG) --libs $(1))
endef
define pkg-cflags
$(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --cflags $(1))
$(shell PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" $(PKG_CONFIG) --cflags $(1))
endef
%.d: %.c

View File

@ -6,7 +6,7 @@ LIB := libzdtmtst.a
LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c
pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
ifeq ($(call pkg-config-check,libbpf),y)
LIBSRC += bpfmap_zdtm.c
endif

View File

@ -241,7 +241,7 @@ TST_NOFILE := \
sigtrap01 \
# jobctl00 \
pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
pkg-config-check = $(shell sh -c '$(PKG_CONFIG) $(1) && echo y')
ifeq ($(call pkg-config-check,libbpf),y)
TST_NOFILE += \
bpf_hash \