summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-01-29 20:03:55 (EST)
committer P. J. McDermott <pjm@nac.net>2012-01-29 20:03:55 (EST)
commitd97fa1a1419683d0722d9356f236577f7515494f (patch)
treefe5744d1aab171891c81dd219d55b68ea97a2ffd
parente154d497346078ed2a7696124b274a87997b2b0b (diff)
Attempt to detect the target architecture tuple.
-rw-r--r--src/opkbuild10
1 files changed, 10 insertions, 0 deletions
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#*'-'}"