From 302f12b8f63b7bc7c664d30eef83f563c356b407 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 1 Oct 2018 23:48:36 -0500 Subject: [PATCH] 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. --- Makefile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 97f21639..a2c13a33 100644 --- a/Makefile +++ b/Makefile @@ -285,7 +285,17 @@ bin_path=$(shell which $(1) 2> /dev/null) # set PKG_CONFIG_PATH or PKG_CONFIG to influence this, e.g. # PKG_CONFIG_PATH=/opt/cross/i386-mingw32msvc/lib/pkgconfig or # 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)),) CURL_CFLAGS ?= $(shell $(PKG_CONFIG) --silence-errors --cflags libcurl) @@ -1360,6 +1370,7 @@ targets: makedirs @echo " COMPILE_PLATFORM: $(COMPILE_PLATFORM)" @echo " COMPILE_ARCH: $(COMPILE_ARCH)" @echo " HAVE_VM_COMPILED: $(HAVE_VM_COMPILED)" + @echo " PKG_CONFIG: $(PKG_CONFIG)" @echo " CC: $(CC)" ifeq ($(PLATFORM),mingw32) @echo " WINDRES: $(WINDRES)"