On Sun, May 26, 2019 at 03:03:13PM +0200, Helmut Grohne wrote:
> On Sun, May 26, 2019 at 10:00:46AM +0200, Andrea Bolognani wrote:
> > Can you please provide instructions I can use to reproduce the build
> > failure? The way you tackled it looks sensible enough, but I'd like
> > to play around a bit myself :)
> 
> sbuildĀ¹: Pass --host=somearch.
> pbuilder: Pass --host-arch somearch
> dpkg-buildpackage: DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --build=any 
> --host-arch somearch --profiles cross,nocheck

Hi Helmut,

it's been an embarrassingly long time, I know :(

Anyway, I'm updating the spectrwm package and wanted to make sure
cross-building works fine once the new version hits the archive.
I have already both reproduced the issue you reported, and verified
that your changes address it.

I am still polishing debian/rules, for which I've landed on a slighly
different solution than you had, but in the meantime I would like to
submit the linux/Makefile changes for consideration upstream, as they
are in no way Debian-specific.

I have written a commit message and prepared a git-compatible patch,
which you can find attached. Of course I've retained full authorship.
Are you okay with me submitting it upstream?

Thank you for your patches, and your patience :)

-- 
Andrea Bolognani <e...@kiyuko.org>
Resistance is futile, you will be garbage collected.
From a6fdbde54a42c190218066ac28de11b3c7995cae Mon Sep 17 00:00:00 2001
From: Helmut Grohne <hel...@subdivi.de>
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 4016c2b..105f0f0 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)
 
-- 
2.25.1

Attachment: signature.asc
Description: PGP signature

Reply via email to