1#!@bash@/bin/bash
2sep='--' # whether to add -- before new options
3cxx=0 # whether cxx was explicitly requested
4lastWasx=0 # whether the last argument passed was -x
5for 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;
22done;
23cxxflags=
24if [[ $cxx -eq 1 ]]; then
25 cxxflags="@cxxincludes@"
26fi;
27if [[ -n "$NIX_DEBUG" ]]; then
28 set -x;
29fi;
30# shellcheck disable=SC2086
31# cxxflags and NIX_CFLAGS_COMPILE should be word-split
32exec -a "$0" @unwrapped@/bin/bindgen "$@" $sep $cxxflags @cincludes@ $NIX_CFLAGS_COMPILE
33# note that we add the flags after $@ which is incorrect. This is only for the sake
34# of simplicity.