Don't use host pkg-config when cross-compiling

Fix cross-compiling using mingw-w64 on Ubuntu 18.04.

pkg-config --cflags libcurl is now pulling in a Linux include directory
which breaks compiling.
This commit is contained in:
Zack Middleton 2018-10-01 23:48:36 -05:00
parent 0cf10d2b77
commit 302f12b8f6
1 changed files with 12 additions and 1 deletions

View File

@ -285,7 +285,17 @@ bin_path=$(shell which $(1) 2> /dev/null)
# set PKG_CONFIG_PATH or PKG_CONFIG to influence this, e.g. # set PKG_CONFIG_PATH or PKG_CONFIG to influence this, e.g.
# PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig or # PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig or
# PKG_CONFIG=arm-linux-gnueabihf-pkg-config # PKG_CONFIG=arm-linux-gnueabihf-pkg-config
PKG_CONFIG ?= pkg-config ifeq ($(CROSS_COMPILING),0)
PKG_CONFIG ?= pkg-config
else
ifneq ($(PKG_CONFIG_PATH),)
PKG_CONFIG ?= pkg-config
else
# Don't use host pkg-config when cross-compiling.
# (unknown-pkg-config is meant to be a non-existant command.)
PKG_CONFIG ?= unknown-pkg-config
endif
endif
ifneq ($(call bin_path, $(PKG_CONFIG)),) ifneq ($(call bin_path, $(PKG_CONFIG)),)
CURL_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags libcurl) CURL_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags libcurl)
@ -1360,6 +1370,7 @@ targets: makedirs
@echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)" @echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)"
@echo " COMPILE_ARCH: $(COMPILE_ARCH)" @echo " COMPILE_ARCH: $(COMPILE_ARCH)"
@echo " HAVE_VM_COMPILED: $(HAVE_VM_COMPILED)" @echo " HAVE_VM_COMPILED: $(HAVE_VM_COMPILED)"
@echo " PKG_CONFIG: $(PKG_CONFIG)"
@echo " CC: $(CC)" @echo " CC: $(CC)"
ifeq ($(PLATFORM),mingw32) ifeq ($(PLATFORM),mingw32)
@echo " WINDRES: $(WINDRES)" @echo " WINDRES: $(WINDRES)"