summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-04-22 17:06:43 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-04-22 17:06:43 (EDT)
commita3b45a082d7076a46ad5288c2d6728c289e6d479 (patch)
tree9a3d663af66a73bdfb3fac77e65e7cd778da6876 /src
parent062b1663aa690cb137c47043841ff3756d611b01 (diff)
Support new '-a' option and use GNU terms.
Diffstat (limited to 'src')
-rw-r--r--src/opkbuild.sh34
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.