summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-04-22 18:29:57 (EDT)
committer P. J. McDermott <pjm@nac.net>2012-04-22 18:29:57 (EDT)
commit8c670d8646abcfc2792c235a40cc552d3e042483 (patch)
treecacb5a4718bb7f25dbcb21a5044ccedb9af3275a /src
parentdecf35633cbc818892873603b56239a46c8d8fe5 (diff)
Better distinguish between build and host.
Diffstat (limited to 'src')
-rw-r--r--src/opkbuild.sh44
1 files changed, 23 insertions, 21 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index 4915787..a9f87d8 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -68,11 +68,11 @@ while true; do
shift 2
;;
-a)
- arch=${2}
+ host_arch=${2}
shift 2
;;
-p)
- platform=${2}
+ host_platform=${2}
shift 2
;;
-d)
@@ -121,37 +121,39 @@ if [ "$(cat format)" != '1.0' ]; then
exit 1
fi
-# If a host architecture is not specified ...
-if [ -z "${arch}" ]; then
- # 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
+# Attempt to detect the build architecture tuple.
+build_arch=$(opkg print-architecture | sed -n \
+ 's/^arch \([^ -][^ -]*-[^ -][^ -]*-[^ -][^ -]*\) [0-9][0-9]*$/\1/p')
+if [ -z "${build_arch}" ]; then
+ printf 'opkbuild: Error: No installable architecture found\n' >&2
+ exit 1
+elif [ $(echo "${build_arch}" | wc -l) -gt 1 ]; then
+ printf 'opkbuild: Error: Multiple installable architectures found\n' >&2
+ exit 1
+fi
+
+# If a host architecture is not specified, natively build.
+if [ -z "${host_arch}" ]; then
+ host_arch="${build_arch}"
fi
# Attempt to detect the host platform.
# If there no config files to copy, build platform-independent packages.
if [ ! -f config ]; then
- platform=''
+ host_platform=''
# If a host platform was not specified ...
-elif [ -z "${platform}" ]; then
- platform=$(opkg print-architecture | \
+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 "${platform}" ]; then
+ 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 "${platform}" | wc -l) -gt 1 ]; then
+ elif [ $(echo "${host_platform}" | wc -l) -gt 1 ]; then
printf 'opkbuild: Error: %s\n' \
'Multiple platforms found while detecting host' >&2
exit 1
@@ -178,8 +180,8 @@ export OH_SRCPKG="${srcpkg}"
export OH_PKGVER=${version}
# Set environment variables for the build configuration.
-export OH_HOST_PLATFORM="${platform}"
-export OH_HOST_ARCH_DIST="${arch}"
+export OH_HOST_PLATFORM="${host_platform}"
+export OH_HOST_ARCH_DIST="${host_arch}"
IFS=- read OH_HOST_ARCH_CPU OH_HOST_ARCH_KERNEL OH_HOST_ARCH_LIBS <<EOF
${OH_HOST_ARCH_DIST}
EOF