diff mbox series

[v2,2/5] builddeb: set CC on cross build to prefixed gcc

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

Commit Message

Bastian Germann May 25, 2021, 11:01 p.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 b317d26e2bbf..449e284a449c 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: