biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / rust / bindgen / wrapper.sh
blobb7110385c26d69e8c2518390654adfaf744fa4ef
1 #!@bash@/bin/bash
2 sep='--' # whether to add -- before new options
3 cxx=0 # whether cxx was explicitly requested
4 lastWasx=0 # whether the last argument passed was -x
5 for e in "$@"; do
6 if [[ "$e" == "--" ]]; then
7 sep=
8 fi;
9 if [[ "$sep" == "" ]]; then
10 # we look for -x c++ after -- only
11 if [[ "$e" == "-x" ]]; then
12 lastWasx=1
13 fi;
14 if [[ $lastWasx -eq 1 && "$e" == "c++" ]]; then
15 lastWasx=0
16 cxx=1
17 fi;
18 if [[ "$e" == "-xc++" || "$e" == -std=c++* ]]; then
19 cxx=1
20 fi;
21 fi;
22 done;
23 cxxflags=
24 if [[ $cxx -eq 1 ]]; then
25 cxxflags="@cxxincludes@"
26 fi;
27 if [[ -n "$NIX_DEBUG" ]]; then
28 set -x;
29 fi;
30 export LIBCLANG_PATH="@libclang@/lib"
31 # shellcheck disable=SC2086
32 # cxxflags and NIX_CFLAGS_COMPILE should be word-split
33 exec -a "$0" @unwrapped@/bin/bindgen "$@" $sep $cxxflags @cincludes@ $NIX_CFLAGS_COMPILE
34 # note that we add the flags after $@ which is incorrect. This is only for the sake
35 # of simplicity.