summaryrefslogtreecommitdiffstats
path: root/src/opkbuild.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-04-22 18:36:33 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-04-22 18:41:22 (EDT)
commit4259f9d8e8ae928c05dc2435bf5d3e73cc7d0463 (patch)
treeb24b441cdb236a1f025a351f90d3aaf4773ac5d7 /src/opkbuild.sh
parent5b00ea717798eabe4bd0324a38d456629321017a (diff)
Look up build GNU architecture name.
Diffstat (limited to 'src/opkbuild.sh')
-rw-r--r--src/opkbuild.sh14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 8d6e14a..6881546 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -200,7 +200,17 @@ if [ ! -f "@@DATADIR@@/opkhelper/archtab" ]; then
exit 1
fi
-# Look up GNU architecture name and set toolchain environment variables.
+# Look up build GNU architecture name.
+export OH_BUILD_ARCH_GNU="$(sed -n \
+ "s/^${OH_BUILD_ARCH_DIST}[ \\t][ \\t]*\\(.*\\)$/\\1/p" \
+ "@@DATADIR@@/opkhelper/archtab")"
+if [ -z "${OH_BUILD_ARCH_GNU}" ]; then
+ printf 'opkbuild: Error: "%s" not found in architecture table.\n' \
+ "${OH_BUILD_ARCH_DIST}" >&2
+ exit 1
+fi
+
+# Look up host GNU architecture name.
export OH_HOST_ARCH_GNU="$(sed -n \
"s/^${OH_HOST_ARCH_DIST}[ \\t][ \\t]*\\(.*\\)$/\\1/p" \
"@@DATADIR@@/opkhelper/archtab")"
@@ -209,6 +219,8 @@ if [ -z "${OH_HOST_ARCH_GNU}" ]; then
"${OH_HOST_ARCH_DIST}" >&2
exit 1
fi
+
+# Set toolchain environment variables.
# NB: This is written for GNU Binutils and GCC and won't work for, e.g., LLVM.
export AR="${OH_HOST_ARCH_GNU}-ar"
export AS="${OH_HOST_ARCH_GNU}-as"