]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/BinWrappers/PosixLike/BrotliCompress
BaseTools: Fix BrotliCompress run issue on Linux
[mirror_edk2.git] / BaseTools / BinWrappers / PosixLike / BrotliCompress
CommitLineData
de87f232
SB
1#!/usr/bin/env bash
2#
83e901a5 3# This script will exec Brotli tool with -e/-d options.
de87f232 4#
dd4f667e 5# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
2e351cbe 6# SPDX-License-Identifier: BSD-2-Clause-Patent
de87f232 7#
dd4f667e 8QLT="-q 9 -w 22"
83e901a5 9ARGS=
de87f232 10
078400ee
YF
11full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
12dir=$(dirname "$full_cmd")
13cmd=${full_cmd##*/}
14
83e901a5
LG
15while test $# -gt 0
16do
17 case $1 in
18 -e)
83e901a5
LG
19 ;;
20 -d)
83e901a5
LG
21 ARGS+="$1 "
22 ;;
23 -o|-g)
98cb4684 24 ARGS+="$1 $2 "
de87f232 25 shift
83e901a5
LG
26 ;;
27 -q)
98cb4684 28 QLT="$1 $2 "
de87f232 29 shift
83e901a5
LG
30 ;;
31 *)
dd4f667e 32 ARGS+="$1 "
83e901a5
LG
33 ;;
34 esac
35 shift
de87f232
SB
36done
37
078400ee
YF
38
39if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
40then
41 exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
42elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
43then
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
52elif [ -e "$dir/../../Source/C/bin/$cmd" ]
53then
54 exec "$dir/../../Source/C/bin/$cmd" $QLT $ARGS
55else
56 echo "Unable to find the real '$cmd' to run"
57 echo "This message was printed by"
58 echo " $0"
59 exit 127
60fi