diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/opkbuild.sh | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh index 8658ed5..9397fb3 100644 --- a/src/opkbuild.sh +++ b/src/opkbuild.sh @@ -25,7 +25,9 @@ print_usage() { - printf 'Usage: %s [-r assume-uid0-cmd] [-p target-platform] [-d]\n' "${1}" + cat <<EOF +Usage: ${1} [-r assume-uid0-cmd] [-a host-architecture] [-p host-platform] [-d] +EOF } print_version() @@ -65,6 +67,10 @@ while true; do uid0_cmd=${2} shift 2 ;; + -a) + arch=${2} + shift 2 + ;; -p) platform=${2} shift 2 @@ -115,11 +121,11 @@ if [ "$(cat format)" != '1.0' ]; then exit 1 fi -# Attempt to detect the target platform. +# Attempt to detect the host platform. # If there no config files to copy, build platform-independent packages. if [ ! -f config ]; then platform='' -# If a target platform was not specified ... +# If a host platform was not specified ... elif [ -z "${platform}" ]; then platform=$(opkg print-architecture | \ sed -n 's/^arch \([^ -][^ -]*\) [0-9][0-9]*$/\1/p' | \ @@ -133,22 +139,24 @@ elif [ -z "${platform}" ]; then # explicit selection. elif [ $(echo "${platform}" | wc -l) -gt 1 ]; then printf 'opkbuild: Error: %s\n' \ - 'Multiple platforms found while detecting target' >&2 + 'Multiple platforms found while detecting host' >&2 exit 1 fi # ... and there are config files and one installable platform, build for it. fi -# Attempt to detect the target architecture tuple. -# NB: Currently cross-compiling is not supported. -arch=$(opkg print-architecture | sed -n \ - 's/^arch \([^ -][^ -]*-[^ -][^ -]*-[^ -][^ -]*\) [0-9][0-9]*$/\1/p') +# If a host architecture is not specified ... if [ -z "${arch}" ]; then - printf 'opkbuild: Error: No installable architecture found\n' >&2 - exit 1 -elif [ $(echo "${arch}" | wc -l) -gt 1 ]; then - printf 'opkbuild: Error: Multiple installable architectures found\n' >&2 - exit 1 + # Attempt to detect the host architecture tuple. + arch=$(opkg print-architecture | sed -n \ + 's/^arch \([^ -][^ -]*-[^ -][^ -]*-[^ -][^ -]*\) [0-9][0-9]*$/\1/p') + if [ -z "${arch}" ]; then + printf 'opkbuild: Error: No installable architecture found\n' >&2 + exit 1 + elif [ $(echo "${arch}" | wc -l) -gt 1 ]; then + printf 'opkbuild: Error: Multiple installable architectures found\n' >&2 + exit 1 + fi fi # Resolve status override file path. |