summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"