-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathcommand_wrapper.sh
More file actions
executable file
·39 lines (29 loc) · 949 Bytes
/
command_wrapper.sh
File metadata and controls
executable file
·39 lines (29 loc) · 949 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
# According to the CMake folks, this is the way to do things.
# http://www.cmake.org/pipermail/cmake/2010-April/036566.html
trim() {
local var="$*"
var="${var#"${var%%[![:space:]]*}"}" # remove leading whitespace characters
var="${var%"${var##*[![:space:]]}"}" # remove trailing whitespace characters
echo -n "$var"
}
: "${CFLAGS:=}"
: "${CXXFLAGS:=}"
: "${CPPFLAGS:=}"
: "${LDFLAGS:=}"
_CFLAGS=$(trim "${_CFLAGS} ${CFLAGS}")
_CXXFLAGS=$(trim "${_CXXFLAGS} ${CXXFLAGS}")
_CPPFLAGS=$(trim "${_CPPFLAGS} ${CPPFLAGS}")
_LDFLAGS=$(trim "${_LDFLAGS} ${LDFLAGS}")
[[ ! -z ${_CFLAGS} ]] && export CFLAGS=${_CFLAGS}
[[ ! -z ${_CXXFLAGS} ]] && export CXXFLAGS=${_CXXFLAGS}
[[ ! -z ${_CPPFLAGS} ]] && export CPPFLAGS=${_CPPFLAGS}
[[ ! -z ${_LDFLAGS} ]] && export LDFLAGS=${_LDFLAGS}
unset _CFLAGS
unset _CXXFLAGS
unset _CPPFLAGS
unset _LDFLAGS
export CONFIG_SITE=
COMMAND_NAME="$1"
shift
${COMMAND_NAME} "$@"