]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env bash | |
2 | # | |
3 | # This script will exec Brotli tool with -e/-d options. | |
4 | # | |
5 | # Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR> | |
6 | # SPDX-License-Identifier: BSD-2-Clause-Patent | |
7 | # | |
8 | QLT="-q 9 -w 22" | |
9 | ARGS= | |
10 | ||
11 | full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here | |
12 | dir=$(dirname "$full_cmd") | |
13 | cmd=${full_cmd##*/} | |
14 | ||
15 | while test $# -gt 0 | |
16 | do | |
17 | case $1 in | |
18 | -e) | |
19 | ;; | |
20 | -d) | |
21 | ARGS+="$1 " | |
22 | ;; | |
23 | -o|-g) | |
24 | ARGS+="$1 $2 " | |
25 | shift | |
26 | ;; | |
27 | -q) | |
28 | QLT="$1 $2 " | |
29 | shift | |
30 | ;; | |
31 | *) | |
32 | ARGS+="$1 " | |
33 | ;; | |
34 | esac | |
35 | shift | |
36 | done | |
37 | ||
38 | ||
39 | if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] | |
40 | then | |
41 | exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" | |
42 | elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] | |
43 | then | |
44 | if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] | |
45 | then | |
46 | echo "BaseTools C Tool binary was not found ($cmd)" | |
47 | echo "You may need to run:" | |
48 | echo " make -C $EDK_TOOLS_PATH/Source/C" | |
49 | else | |
50 | exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" $QLT $ARGS | |
51 | fi | |
52 | elif [ -e "$dir/../../Source/C/bin/$cmd" ] | |
53 | then | |
54 | exec "$dir/../../Source/C/bin/$cmd" $QLT $ARGS | |
55 | else | |
56 | echo "Unable to find the real '$cmd' to run" | |
57 | echo "This message was printed by" | |
58 | echo " $0" | |
59 | exit 127 | |
60 | fi |