diff mbox series

[2/6] builddeb: set CC on cross build to prefixed gcc

Message ID 20210411101422.7092-3-bage@linutronix.de (mailing list archive)
State New
Headers show
Series builddeb: make deb building more flexible | expand

Commit Message

bage@linutronix.de April 11, 2021, 10:14 a.m. UTC
From: Bastian Germann <bage@linutronix.de>

Building the generated package with CC unset will fail for cross
compilation. Detect that and set CC to a sane default prefixed by
dpkg-architecture's DEB_HOST_GNU_TYPE variable.

Signed-off-by: Bastian Germann <bage@linutronix.de>
---
 scripts/package/mkdebian | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 3d2d4b033e44..2fa149796791 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -223,6 +223,14 @@  fi
 cat <<EOF > debian/rules
 #!$(command -v $MAKE) -f
 
+include /usr/share/dpkg/architecture.mk
+
+ifneq (\$(DEB_BUILD_GNU_TYPE),\$(DEB_HOST_GNU_TYPE))
+ifeq (\$(origin CC),default)
+CC := \$(DEB_HOST_GNU_TYPE)-gcc
+endif
+endif
+
 srctree ?= .
 
 build-indep: