diff mbox

kbuild, deb-pkg: fix Architecture field when cross compiling

Message ID 1288842244-6863-1-git-send-email-asbjorn@asbjorn.biz (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Asbjørn Sloth Tønnesen Nov. 4, 2010, 3:44 a.m. UTC
None
diff mbox

Patch

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 5f1e2fc..43b8826 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,23 @@  create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Attempt to find the correct Debian architecture
+	local forcearch="" debarch=""
+	case "$ARCH" in
+	i386|ia64)
+		debarch="$ARCH" ;;
+	x86_64)
+		debarch="amd64" ;;
+	*)
+		grep -q CONFIG_ARM=y .config &&
+			debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el)
+	esac
+	if [ -n "$debarch" ] ; then
+		forcearch="-DArchitecture=$debarch"
+	fi
+
 	# Create the package
-	dpkg-gencontrol -isp -p$pname -P"$pdir"
+	dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir"
 	dpkg --build "$pdir" ..
 }