Mercurial > hg > toybox
annotate scripts/single.sh @ 1727:c0ef9b7976f0 draft
Use xsignal() instead of signal().
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 10 Mar 2015 11:07:28 -0500 |
parents | f18d0a08b471 |
children |
rev | line source |
---|---|
1032
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Build a standalone toybox command |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 if [ -z "$1" ] |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 then |
1504
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
7 echo "usage: single.sh command..." >&2 |
1032
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 exit 1 |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 fi |
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 |
1504
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
11 for i in "$@" |
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
12 do |
1680
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
13 |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
14 TOYFILE="$(egrep -l "TOY[(]($i)[ ,]" toys/*/*.c)" |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
15 |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
16 if [ -z "$TOYFILE" ] |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
17 then |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
18 echo "Unknown command '$i'" >&2 |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
19 exit 1 |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
20 fi |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
21 |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
22 DEPENDS="$(sed -n 's/^[ \t]*depends on //;T;s/[!][A-Z0-9_]*//g;s/ *&& */|/g;p' $TOYFILE | xargs | tr ' ' '|')" |
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
23 |
1504
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
24 NAME=$(echo $i | tr a-z- A-Z_) |
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
25 export KCONFIG_CONFIG=.singleconfig |
1032
40d0c96a8e89
Add scripts/single.sh to build individual non-multiplexed standalone commands.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
26 |
1504
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
27 make allnoconfig > /dev/null && |
1680
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
28 sed -ri -e "s/CONFIG_TOYBOX=y/# CONFIG_TOYBOX is not set/;t" \ |
1696
f18d0a08b471
Fix --help for single.sh builds.
Rob Landley <rob@landley.net>
parents:
1680
diff
changeset
|
29 -e "s/# (CONFIG_(TOYBOX(|_HELP.*|_I18N|_FLOAT)|$NAME|${NAME}_.*${DEPENDS:+|$DEPENDS})) is not set/\1=y/" \ |
1680
543bee60af4c
Build standalone commands where "depends on" config entries need to be switched on.
Rob Landley <rob@landley.net>
parents:
1506
diff
changeset
|
30 "$KCONFIG_CONFIG" && |
1504
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
31 make && |
1506
448e47e2ad46
Multi-build single.sh should exit with an error when build breaks.
Rob Landley <rob@landley.net>
parents:
1504
diff
changeset
|
32 mv toybox $PREFIX$i || exit 1 |
1504
c86e27992c4a
Allow single.sh to build more than one command per invocation.
Rob Landley <rob@landley.net>
parents:
1435
diff
changeset
|
33 done |