From decf35633cbc818892873603b56239a46c8d8fe5 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 22 Apr 2012 17:47:22 -0400 Subject: Look up GNU architecture and set toolchain vars. --- (limited to 'src') 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} -- cgit v0.9.1