From 18d7422d8787e3de08b7df1cb712d2613a70ba9b Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 26 Apr 2012 02:59:08 -0400 Subject: Support cross-building with kbuild. --- diff --git a/src/opkbuild.sh b/src/opkbuild.sh index bc32915..a167716 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -197,25 +197,44 @@ if [ ! -f "@@DATADIR@@/opkhelper/archtab" ]; then exit 1 fi -# Look up build GNU architecture name. -export OH_BUILD_ARCH_GNU="$(sed -n \ - "s/^${OH_BUILD_ARCH_DIST}[ \\t][ \\t]*\\(.*\\)$/\\1/p" \ +archtab_bre='[ \t][ \t]*\([^ \t][^ \t]*[ \t][ \t]*[^ \t][^ \t]*\)' + +# TODO: kbuild doesn't have standardized architecture names. For example, IA-32 +# is known as "x86" in Linux and "i386" in BusyBox. So we should support a +# comma-separated list of possible values and try to find one in src/arch once +# the software source code is copied into the work area. + +# TODO: Ideally, we should have a tool like debhelper's dh_auto_configure that +# detects the build system in use and configures the build automatically, +# including cross building options. + +# Look up build GNU and kbuild architecture names. +archtab_row_build="$(sed -n \ + "s/^${OH_BUILD_ARCH_DIST}${archtab_bre}\$/\\1/p" \ "@@DATADIR@@/opkhelper/archtab")" -if [ -z "${OH_BUILD_ARCH_GNU}" ]; then +if [ -z "${archtab_row_build}" ]; then printf 'opkbuild: Error: "%s" not found in architecture table.\n' \ "${OH_BUILD_ARCH_DIST}" >&2 exit 1 fi +read OH_BUILD_ARCH_GNU OH_BUILD_ARCH_KBUILD <&2 exit 1 fi +read OH_HOST_ARCH_GNU OH_HOST_ARCH_KBUILD <}" # Check build dependencies. -- cgit v0.9.1