diff mbox

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

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

Commit Message

Asbjørn Sloth Tønnesen Nov. 1, 2010, 11:31 p.m. UTC
None
diff mbox

Patch

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 49b74e1..e5b7b9b 100644
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -25,8 +25,20 @@  create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Check for cross compilation
+	local forcearch=""
+	env | grep -q CROSS_COMPILE
+	if [ $? -eq 0 ] ; then
+		local debarch=""
+		case "$ARCH" in
+			x86_64) debarch="amd64" ;;
+			*) debarch="$ARCH" ;;
+		esac
+		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" ..
 }