Rob Landley | 7e21d5f | 2006-04-27 23:34:46 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 3 | target="$1" |
| 4 | loc="$2" |
Rob Landley | 7e21d5f | 2006-04-27 23:34:46 +0000 | [diff] [blame] | 5 | |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 6 | test "$target" || exit 1 |
Rob Landley | 7e21d5f | 2006-04-27 23:34:46 +0000 | [diff] [blame] | 7 | test "$loc" || loc=. |
Bernhard Reutner-Fischer | a1e130f | 2006-05-21 10:45:01 +0000 | [diff] [blame] | 8 | test -x "$loc/usage" || exit 1 |
Denis Vlasenko | 7d219aa | 2006-10-05 10:17:08 +0000 | [diff] [blame] | 9 | test "$SED" || SED=sed |
| 10 | |
| 11 | sz=`"$loc/usage" | wc -c` || exit 1 |
| 12 | |
| 13 | exec >"$target" |
Rob Landley | 7e21d5f | 2006-04-27 23:34:46 +0000 | [diff] [blame] | 14 | |
Denis Vlasenko | 937b10f | 2008-02-09 09:26:43 +0000 | [diff] [blame] | 15 | echo 'static const char packed_usage[] ALIGN1 = {' |
| 16 | |
| 17 | # Extra effort to avoid using "od -t x1": -t is not available |
| 18 | # in non-CONFIG_DESKTOPed busybox od |
| 19 | |
| 20 | "$loc/usage" | bzip2 -1 | od -v -x \ |
| 21 | | $SED -e 's/^[^ ]*//' \ |
| 22 | | $SED -e 's/ //g' \ |
| 23 | | grep -v '^$' \ |
| 24 | | $SED -e 's/\(..\)\(..\)/0x\2,0x\1,/g' |
| 25 | |
| 26 | echo '};' |
Bernhard Reutner-Fischer | 7fca7e3 | 2006-05-26 13:28:39 +0000 | [diff] [blame] | 27 | echo '#define SIZEOF_usage_messages' `expr 0 + $sz` |