From ceaf8699f8a08934481eed118555e5ce9f90faf4 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 12 May 2019 19:59:22 +0200 Subject: [PATCH] linux: Accept user-provided pkg-config command When cross-building, it's necessary to use versions of the various toolchain commands that have been built specifically to target the desired architecture, and that are named accordingly. In practice, the make invocation will look something like $ make CC=aarch64-linux-gnu-gcc \ PKG_CONFIG=aarch64-linux-gnu-pkg-config However, whereas $(CC) is a built-in make variable and so it behaves correctly out of the box, for $(PKG_CONFIG) we have to do some work ourselves. --- linux/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/linux/Makefile b/linux/Makefile index 6da00d3..35f3d26 100644 --- a/linux/Makefile +++ b/linux/Makefile @@ -6,6 +6,7 @@ DATAROOTDIR ?= $(PREFIX)/share MANDIR ?= $(DATAROOTDIR)/man DOCDIR ?= $(DATAROOTDIR)/doc/spectrwm XSESSIONSDIR ?= $(DATAROOTDIR)/xsessions +PKG_CONFIG ?= pkg-config BUILDVERSION = $(shell sh $(CURDIR)/../buildver.sh) LIBVERSION = $(shell . $(CURDIR)/../lib/shlib_version; echo $$major.$$minor) @@ -21,12 +22,12 @@ endif BIN_CFLAGS = -fPIE BIN_LDFLAGS = -fPIE -pie -BIN_CPPFLAGS = $(shell pkg-config --cflags x11 x11-xcb xcb-icccm xcb-keysyms xcb-randr xcb-util xcb-xinput xcb-xtest xcursor xft) -BIN_LDLIBS = $(shell pkg-config --libs x11 x11-xcb xcb-icccm xcb-keysyms xcb-randr xcb-util xcb-xinput xcb-xtest xcursor xft) +BIN_CPPFLAGS = $(shell $(PKG_CONFIG) --cflags x11 x11-xcb xcb-icccm xcb-keysyms xcb-randr xcb-util xcb-xinput xcb-xtest xcursor xft) +BIN_LDLIBS = $(shell $(PKG_CONFIG) --libs x11 x11-xcb xcb-icccm xcb-keysyms xcb-randr xcb-util xcb-xinput xcb-xtest xcursor xft) LIB_CFLAGS = -fPIC LIB_LDFLAGS = -fPIC -shared -LIB_CPPFLAGS = $(shell pkg-config --cflags x11) -LIB_LDLIBS = $(shell pkg-config --libs x11) -ldl +LIB_CPPFLAGS = $(shell $(PKG_CONFIG) --cflags x11) +LIB_LDLIBS = $(shell $(PKG_CONFIG) --libs x11) -ldl all: spectrwm libswmhack.so.$(LIBVERSION)