From d97fa1a1419683d0722d9356f236577f7515494f Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 29 Jan 2012 20:03:55 -0500 Subject: Attempt to detect the target architecture tuple. --- diff --git a/src/opkbuild b/src/opkbuild index d41d5bd..d85a0ad 100644 --- a/src/opkbuild +++ b/src/opkbuild @@ -103,6 +103,15 @@ elif [ -z "${platform}" ]; then # ... and there are config files and one installable platform, build for it. fi +# Attempt to detect the target architecture tuple. +# NB: Currently cross-compiling is not supported. +arch=$(opkg print-architecture | grep -E '^arch [^ -]+(-[^ -]+){3} [0-9]+$') +if [ -z "${arch}" ]; then + printf 'opkbuild: Error: No installable architecture found\n' >&2 +elif [ $(echo "${arch}" | wc -l) -gt 1 ]; then + printf 'opkbuild: Error: Multiple installable architectures found\n' >&2 +fi + # Make work area. printf 'opkbuild: Making work area...\n' mkdir tmp @@ -115,6 +124,7 @@ version=$(oh_get_field Version) # Set environment variables for the build configuration. export OH_PLATFORM="${platform}" +export OH_ARCH="${arch}" export OH_SRCPKG="${srcpkg}" export OH_PKGVER="${version%'-'*}" export OH_PKGREV="${version#*'-'}" -- cgit v0.9.1