From 5176e0a9942b4f1a7ebb32d516a284dedcf0d0b5 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 22 Apr 2012 19:30:13 -0400 Subject: Detect build platform like build architecture. --- diff --git a/src/opkbuild.sh b/src/opkbuild.sh index a184501..a525e4b 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -121,7 +121,7 @@ if [ "$(cat format)" != '1.0' ]; then exit 1 fi -# Attempt to detect the build architecture tuple. +# Attempt to detect the build architecture. build_arch=$(opkg print-architecture | sed -n \ 's/^arch \([^ -][^ -]*-[^ -][^ -]*-[^ -][^ -]*\) [0-9][0-9]*$/\1/p') if [ -z "${build_arch}" ]; then @@ -137,28 +137,24 @@ if [ -z "${host_arch}" ]; then host_arch="${build_arch}" fi -# Attempt to detect the host platform. +# Attempt to detect the build platform. +build_platform=$(opkg print-architecture | sed -n \ + 's/^arch \([^ -][^ -]*\) [0-9][0-9]*$/\1/p' | \ + grep -v 'all') +if [ -z "${build_platform}" ]; then + printf 'opkbuild: Error: No build platforms found\n' >&2 + exit 1 +elif [ $(echo "${build_platform}" | wc -l) -gt 1 ]; then + printf 'opkbuild: Error: Multiple build platforms found\n' >&2 + exit 1 +fi + # If there no config files to copy, build platform-independent packages. if [ ! -f config ]; then host_platform='' -# If a host platform was not specified ... +# If a host platform was not specified, natively configure. elif [ -z "${host_platform}" ]; then - host_platform=$(opkg print-architecture | \ - sed -n 's/^arch \([^ -][^ -]*\) [0-9][0-9]*$/\1/p' | \ - grep -v 'all') - # ... and there are config files and zero installable platforms, fail. - if [ -z "${host_platform}" ]; then - printf 'opkbuild: Error: %s\n' \ - 'Building platform-dependent package and no platforms detected' >&2 - exit 1 - # ... and there are config files and multiple installable platforms, request - # explicit selection. - elif [ $(echo "${host_platform}" | wc -l) -gt 1 ]; then - printf 'opkbuild: Error: %s\n' \ - 'Multiple platforms found while detecting host' >&2 - exit 1 - fi - # ... and there are config files and one installable platform, build for it. + host_platform="${build_platform}" fi # Resolve status override file path. @@ -185,6 +181,7 @@ IFS=- read OH_BUILD_ARCH_CPU OH_BUILD_ARCH_KERNEL OH_BUILD_ARCH_LIBS <