From 797fa0e2c78a08ae08f3e9119591b4fa6aa3708f Mon Sep 17 00:00:00 2001
From: Helmut Grohne <helmut@subdivi.de>
Date: Mon, 31 Jan 2022 09:18:28 -0500
Subject: [PATCH] Make cross-building work.

hddemux fails to cross build from source, because it hard codes build
architecture build tools. The attached patch makes the relevant tools
substitutable and hddemux cross buildable. Please consider applying it.

See https://bugs.debian.org/928996
---
 Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 610d25d..dff13ff 100644
--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,11 @@
 
 CFLAGS += -D_GNU_SOURCE -g -O3
 
-CFLAGS += $(shell pkg-config --cflags libuv)
-CFLAGS += $(shell pkg-config --cflags libsystemd)
-LDFLAGS += $(shell pkg-config --libs libuv)
-LDFLAGS += $(shell pkg-config --libs libsystemd)
+PKG_CONFIG ?= pkg-config
+CFLAGS += $(shell $(PKG_CONFIG) --cflags libuv)
+CFLAGS += $(shell $(PKG_CONFIG) --cflags libsystemd)
+LDFLAGS += $(shell $(PKG_CONFIG) --libs libuv)
+LDFLAGS += $(shell $(PKG_CONFIG) --libs libsystemd)
 
 all: hddemux hddemux.1
 
@@ -13,7 +14,7 @@ check: hddemux
 	PATH=.:$$PATH ./testsuite
 
 hddemux: hddemux.c
-	gcc $(CPPFLAGS) $(CFLAGS) $< -Wl,--as-needed $(LDFLAGS) -std=c11 -pedantic -Wall -Werror -o $@
+	$(CC) $(CPPFLAGS) $(CFLAGS) $< -Wl,--as-needed $(LDFLAGS) -std=c11 -pedantic -Wall -Werror -o $@
 
 hddemux.1: hddemux.1.md
 	pandoc -s -f markdown -t man -o $@ $<
-- 
GitLab