Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Add a list-arch operation to build.sh.
details: https://anonhg.NetBSD.org/src/rev/311375bc40e7
branches: trunk
changeset: 331291:311375bc40e7
user: apb <apb%NetBSD.org@localhost>
date: Thu Aug 07 17:54:28 2014 +0000
description:
Add a list-arch operation to build.sh.
This lists all known MACHINE/MACHINE_ARCH values, optionally
filtered by glob patterns given in the "-m" and "-a" options.
For example: build.sh -a '*arm*' list-arch
diffstat:
build.sh | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 61 insertions(+), 3 deletions(-)
diffs (107 lines):
diff -r 69d88be1986a -r 311375bc40e7 build.sh
--- a/build.sh Thu Aug 07 17:24:03 2014 +0000
+++ b/build.sh Thu Aug 07 17:54:28 2014 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/env sh
-# $NetBSD: build.sh,v 1.291 2014/08/07 15:15:48 apb Exp $
+# $NetBSD: build.sh,v 1.292 2014/08/07 17:54:28 apb Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -848,6 +848,57 @@
esac
}
+# listarch -- list valid MACHINE/MACHINE_ARCH/ALIAS values,
+# optionally restricted to those where the MACHINE and/or MACHINE_ARCH
+# match specifed glob patterns.
+#
+listarch()
+{
+ local machglob="$1" archglob="$2"
+ local IFS
+ local wildcard="*"
+ local line xline frag
+ local line_matches_machine line_matches_arch
+ local found=false
+
+ # Empty machglob or archglob should match anything
+ : "${machglob:=${wildcard}}"
+ : "${archglob:=${wildcard}}"
+
+ IFS="${nl}"
+ for line in ${valid_MACHINE_ARCH}; do
+ line="${line%%#*}" # ignore comments
+ xline="$( IFS=" ${tab}" ; echo $line )" # normalise white space
+ [ -z "${xline}" ] && continue # skip blank or comment lines
+
+ line_matches_machine=false
+ line_matches_arch=false
+
+ IFS=" "
+ for frag in ${xline}; do
+ case "${frag}" in
+ MACHINE=${machglob})
+ line_matches_machine=true ;;
+ ALIAS=${machglob})
+ line_matches_machine=true ;;
+ MACHINE_ARCH=${archglob})
+ line_matches_arch=true ;;
+ esac
+ done
+
+ if $line_matches_machine && $line_matches_arch; then
+ found=true
+ echo "$line"
+ fi
+ done
+ if ! $found; then
+ echo >&2 "No match for" \
+ "MACHINE=${machglob} MACHINE_ARCH=${archglob}"
+ return 1
+ fi
+ return 0
+}
+
# nobomb_getmakevar --
# Given the name of a make variable in $1, print make's idea of the
# value of that variable, or return 1 if there's an error.
@@ -990,6 +1041,9 @@
disk-image=target Creae bootable disk image in
RELEASEDIR/RELEASEMACHINEDIR/binary/gzimg/target.img.gz.
params Display various make(1) parameters.
+ list-arch Display a list of valid MACHINE/MACHINE_ARCH values,
+ and exit. The list may be narrowed by passing glob
+ patterns or exact values in MACHINE or MACHINE_ARCH.
Options:
-a arch Set MACHINE_ARCH to arch. [Default: deduced from MACHINE]
@@ -1121,7 +1175,6 @@
-m)
eval ${optargcmd}
MACHINE="${OPTARG}"
- [ "${opt_a}" != "yes" ] && getarch
;;
-N)
@@ -1252,6 +1305,11 @@
usage
;;
+ list-arch)
+ listarch "${MACHINE}" "${MACHINE_ARCH}"
+ exit $?
+ ;;
+
makewrapper|cleandir|obj|tools|build|distribution|release|sets|sourcesets|syspkgs|params)
;;
@@ -1800,7 +1858,7 @@
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from: \$NetBSD: build.sh,v 1.291 2014/08/07 15:15:48 apb Exp $
+# Generated from: \$NetBSD: build.sh,v 1.292 2014/08/07 17:54:28 apb Exp $
# with these arguments: ${_args}
#
Home |
Main Index |
Thread Index |
Old Index