diff options
author | P. J. McDermott <pjm@nac.net> | 2012-04-22 17:47:22 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-04-22 17:47:22 (EDT) |
commit | decf35633cbc818892873603b56239a46c8d8fe5 (patch) | |
tree | a41aabafe14c510d8de389c37813fe67d94cc508 | |
parent | cb074214309097382fdb064c09b9e7045512a979 (diff) |
Look up GNU architecture and set toolchain vars.
-rw-r--r-- | src/opkbuild.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh index efec272..4915787 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -185,6 +185,35 @@ ${OH_HOST_ARCH_DIST} EOF export OH_HOST_ARCH_CPU OH_HOST_ARCH_KERNEL OH_HOST_ARCH_LIBS +# Look up GNU architecture name and set toolchain environment variables. +if [ ! -f "@@DATADIR@@/opkhelper/archtab" ]; then + printf 'opkbuild: Error: architecture table not found.\n' >&2 + exit 1 +fi +export OH_HOST_ARCH_GNU="$(sed -n \ + "s/^${OH_HOST_ARCH_DIST}[ \\t][ \\t]*\\(.*\\)$/\\1/p" \ + "@@DATADIR@@/opkhelper/archtab")" +if [ -z "${OH_HOST_ARCH_GNU}" ]; then + printf 'opkbuild: Error: "%s" not found in architecture table.\n' \ + "${OH_HOST_ARCH_DIST}" >&2 + exit 1 +fi +# 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" +export CC="${OH_HOST_ARCH_GNU}-gcc" +export CPP="${OH_HOST_ARCH_GNU}-cpp" +export CXX="${OH_HOST_ARCH_GNU}-g++" +export LD="${OH_HOST_ARCH_GNU}-ld" +export NM="${OH_HOST_ARCH_GNU}-nm" +export OBJCOPY="${OH_HOST_ARCH_GNU}-objcopy" +export OBJDUMP="${OH_HOST_ARCH_GNU}-objdump" +export RANLIB="${OH_HOST_ARCH_GNU}-ranlib" +export READELF="${OH_HOST_ARCH_GNU}-readelf" +export SIZE="${OH_HOST_ARCH_GNU}-size" +export STRINGS="${OH_HOST_ARCH_GNU}-strings" +export STRIP="${OH_HOST_ARCH_GNU}-strip" + # Set build flags. if [ -f "@@DATADIR@@/opkhelper/buildflags/${OH_HOST_ARCH_CPU}" ]; then . @@DATADIR@@/opkhelper/buildflags/${OH_HOST_ARCH_CPU} |