kbuild, deb-pkg: fix Architecture field when cross compiling
Attempt to guess the correct value of the Architecture control
field, based on the ARCH environment variable. Fallback to letting
deb-gencontrol use the host platform's architecture.
With this patch the following make command:
make ARCH=i386 deb-pkg
will output an i386 Debian package instead of an amd64 one,
when run on amd64 machine.
+ # Attempt to find correct debian architecture
+ local forcearch="" debarch=""
+ case "$ARCH" in
+ x86_64) debarch="amd64" ;;
+ i386|ia64) debarch="$ARCH" ;;
+ *)
+ case "$SUBARCH" in
+ arm) debarch=$(grep -q CONFIG_AEABI=y .config
+ && echo armel || echo arm) ;;
+ esac
+ ;;
+ 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" ..
}
--
1.7.2.3
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1288838560-6173-1-git-send-email-asbjorn@asbjorn.biz">http://lists.debian.org/1288838560-6173-1-git-send-email-asbjorn@asbjorn.biz
11-04-2010, 02:38 AM
Asbjørn Sloth Tønnesen
kbuild, deb-pkg: fix Architecture field when cross compiling
Hmm, didn't test the ARM part of that patch properly SUBARCH isn't
available to builddeb. Will reply to this mail with fixed patch.
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 4CD22ACF.1000407@asbjorn.it">http://lists.debian.org/4CD22ACF.1000407@asbjorn.it
11-04-2010, 02:44 AM
Asbjoern Sloth Toennesen
kbuild, deb-pkg: fix Architecture field when cross compiling
Attempt to guess the correct value of the Architecture control
field, based on the ARCH environment variable. Fallback to letting
deb-gencontrol use the host platform's architecture.
With this patch the following make command:
make ARCH=i386 deb-pkg
will output an i386 Debian package instead of an amd64 one,
when run on amd64 machine.
+ # 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" ..
}
--
1.7.2.3
--
To UNSUBSCRIBE, email to debian-kernel-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: 1288842244-6863-1-git-send-email-asbjorn@asbjorn.biz">http://lists.debian.org/1288842244-6863-1-git-send-email-asbjorn@asbjorn.biz