Description: Make pkg-config substitutable
 Taken from Helmut's e-mail:
 .
 superkb fails to cross build from source, because the upstream build
 system hard codes build architecture build tools (gcc and pkg-config).
 The attached patch makes pkg-config substitutable, but it doesn't make
 superkb cross buildable due to its use of help2man [*]. Please consider
 applying the attached patch anyway and close this bug when doing so even
 though superkb will continue to fail cross building.
 .
 [*] A later patch fixes this too.

Author: Helmut Grohne <helmut@subdivi.de>
Bug-Debian: https://bugs.debian.org/929005
Forwarded: https://gitlab.com/alvarezp2000/superkb/-/commit/c93312d60484a40469a02da543ea0eda2e44a3db
Reviewed-By: Octavio Alvarez <alvarezp@alvarezp.com>
Last-Update: 2020-09-05

--- superkb-0.23.orig/Makefile
+++ superkb-0.23/Makefile
@@ -3,54 +3,56 @@
 CONFIGURATION=configuration
 -include $(CONFIGURATION)
 
+PKG_CONFIG ?= pkg-config
+
 #Module information:
 #puticon/puticon-gdkpixbuf
 obj-$(PUTICON_GDKPIXBUF) += puticon/puticon-gdkpixbuf.o
 syms-$(PUTICON_GDKPIXBUF) += -DWITH_GDKPIXBUF
-ldlibs-$(PUTICON_GDKPIXBUF) += $(shell pkg-config gdk-pixbuf-xlib-2.0 --libs)
-cflags-$(PUTICON_GDKPIXBUF) += $(shell pkg-config gdk-pixbuf-xlib-2.0 --cflags)
+ldlibs-$(PUTICON_GDKPIXBUF) += $(shell $(PKG_CONFIG) gdk-pixbuf-xlib-2.0 --libs)
+cflags-$(PUTICON_GDKPIXBUF) += $(shell $(PKG_CONFIG) gdk-pixbuf-xlib-2.0 --cflags)
 
 #puticon/puticon-imlib2 (which I prefer)
 obj-$(PUTICON_IMLIB2) += puticon/puticon-imlib2.o
 syms-$(PUTICON_IMLIB2) += -DWITH_IMLIB2
-ldlibs-$(PUTICON_IMLIB2) += $(shell pkg-config imlib2 --libs)
-cflags-$(PUTICON_IMLIB2) += $(shell pkg-config imlib2 --cflags)
+ldlibs-$(PUTICON_IMLIB2) += $(shell $(PKG_CONFIG) imlib2 --libs)
+cflags-$(PUTICON_IMLIB2) += $(shell $(PKG_CONFIG) imlib2 --cflags)
 
 #drawkblibs/drawkblibs-xlib
 obj-$(DRAWKBLIBS_XLIB) += drawkblibs/drawkblibs-xlib.o
 syms-$(DRAWKBLIBS_XLIB) += -DWITH_DRAWKBLIBS_XLIB
-ldlibs-$(DRAWKBLIBS_XLIB) += $(shell pkg-config x11 --libs)
-cflags-$(DRAWKBLIBS_XLIB) += $(shell pkg-config x11 --cflags)
+ldlibs-$(DRAWKBLIBS_XLIB) += $(shell $(PKG_CONFIG) x11 --libs)
+cflags-$(DRAWKBLIBS_XLIB) += $(shell $(PKG_CONFIG) x11 --cflags)
 
 #drawkblibs/drawkblibs-cairo
 obj-$(DRAWKBLIBS_CAIRO) += drawkblibs/drawkblibs-cairo.o
 syms-$(DRAWKBLIBS_CAIRO) += -DWITH_DRAWKBLIBS_CAIRO
-ldlibs-$(DRAWKBLIBS_CAIRO) += $(shell pkg-config x11 renderproto xrender cairo cairo-xlib pangocairo --libs)
-cflags-$(DRAWKBLIBS_CAIRO) += $(shell pkg-config x11 renderproto xrender cairo cairo-xlib pangocairo --cflags) -DPANGO_ENABLE_BACKEND
+ldlibs-$(DRAWKBLIBS_CAIRO) += $(shell $(PKG_CONFIG) x11 renderproto xrender cairo cairo-xlib pangocairo --libs)
+cflags-$(DRAWKBLIBS_CAIRO) += $(shell $(PKG_CONFIG) x11 renderproto xrender cairo cairo-xlib pangocairo --cflags) -DPANGO_ENABLE_BACKEND
 
-cflags-y += $(shell pkg-config xft --cflags)
-ldlibs-y += $(shell pkg-config xft --libs)
+cflags-y += $(shell $(PKG_CONFIG) xft --cflags)
+ldlibs-y += $(shell $(PKG_CONFIG) xft --libs)
 
 #Choose whether Xinerama will be emulated or real.
 ifeq ($(XINERAMA_SUPPORT),n)
 	obj-y += screeninfo-xlib.o
 else
 	obj-y += screeninfo-xinerama.o
-	ldlibs-y += $(shell pkg-config xinerama --libs)
-	cflags-y += $(shell pkg-config xinerama --cflags)
+	ldlibs-y += $(shell $(PKG_CONFIG) xinerama --libs)
+	cflags-y += $(shell $(PKG_CONFIG) xinerama --cflags)
 endif
 
 version_extrainfo = $(shell ./extendedversioninfo.bash)
 
 #Conditional -pedantic-errors because of pango 1.32.3, 1.32.4 and 1.32.5.
 PEDANTIC_ERRORS := -pedantic-errors
-ifeq ($(shell pkg-config --modversion pango),1.32.3)
+ifeq ($(shell $(PKG_CONFIG) --modversion pango),1.32.3)
        PEDANTIC_ERRORS :=
 endif
-ifeq ($(shell pkg-config --modversion pango),1.32.4)
+ifeq ($(shell $(PKG_CONFIG) --modversion pango),1.32.4)
        PEDANTIC_ERRORS :=
 endif
-ifeq ($(shell pkg-config --modversion pango),1.32.5)
+ifeq ($(shell $(PKG_CONFIG) --modversion pango),1.32.5)
        PEDANTIC_ERRORS :=
 endif
 
@@ -111,17 +113,17 @@ $(APP): $(OBJS)
 	}
 
 configuration:
-	-pkg-config xinerama --exists > /dev/null \
+	-$(PKG_CONFIG) xinerama --exists > /dev/null \
 		&& (echo "XINERAMA_SUPPORT=y" >> configuration) \
 		|| (echo "XINERAMA_SUPPORT=n" >> configuration)
-	-pkg-config gdk-pixbuf-xlib-2.0 --exists > /dev/null \
+	-$(PKG_CONFIG) gdk-pixbuf-xlib-2.0 --exists > /dev/null \
 		&& (echo "PUTICON_GDKPIXBUF=$(MODTYPE)" >> configuration) \
 		|| (echo "PUTICON_GDKPIXBUF=n" >> configuration)
-	-pkg-config imlib2 --exists > /dev/null \
+	-$(PKG_CONFIG) imlib2 --exists > /dev/null \
 		&& (echo "PUTICON_IMLIB2=$(MODTYPE)" >> configuration) \
 		|| (echo "PUTICON_IMLIB2=n" >> configuration)
 	-echo "DRAWKBLIBS_XLIB=$(MODTYPE)" >> configuration
-	-pkg-config x11 renderproto xrender cairo cairo-xlib pangocairo --exists > /dev/null \
+	-$(PKG_CONFIG) x11 renderproto xrender cairo cairo-xlib pangocairo --exists > /dev/null \
 		&& (echo "DRAWKBLIBS_CAIRO=$(MODTYPE)" >> configuration) \
 		|| (echo "DRAWKBLIBS_CAIRO=n" >> configuration)
 
--- superkb-0.23.orig/approve-config
+++ superkb-0.23/approve-config
@@ -1,5 +1,7 @@
 #!/bin/bash
 
+: "${PKG_CONFIG:=pkg-config}"
+
 # Poor man's distro detection.
 DISTRO=unknown
 grep -q 'Debian' /etc/issue && DISTRO=debian
@@ -32,7 +34,7 @@ if echo "$DRAWKBLIBS_XLIB $PUTICON_IMLIB
 fi
 
 if [ "$DRAWKBLIBS_XLIB" = "y" -o "$DRAWKBLIBS_XLIB" = "m" ]; then
-	if pkg-config xft renderproto xrender --exists > /dev/null; then
+	if "${PKG_CONFIG}" xft renderproto xrender --exists > /dev/null; then
 		true
 	else
 
