3 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
5 #hmmm: make this support multiple vars as parameters.
6 # replaces a specific environment variable with a dos approved equivalent.
7 function dossify_environment_variable()
11 #cygpath doesn't handle multiple path variables properly and otherwise operates only on one path element.
12 ## new_value="$(cygpath -p -d ${!var})"
13 ## eval "export $var=\"$new_value\""
14 ##echo "hey now the var is '${!var}'"
17 #echo "var is '$var' and old value is '$old_value'"
18 if [[ ! "$old_value" =~ \/cygdrive\/ ]]; then
19 #echo didnt have a cygdrive in it: $old_value
21 #hmmm: want this to continue in multi parm version.
24 # replace single back-slashes with double ones.
25 local new_value="$(unix_to_dos_path "${old_value}")"
27 # remove any quote characters in the value.
28 new_value="${new_value//\"/}"
30 eval "export $var=\"$new_value\""
31 echo "new value established: $var='${!var}'"
34 # for a windows build, this will replace any forward slashes
35 # and other cygwin notation with the appropriate dos style paths.
36 function dossify_and_run_commands()
38 if [ "$OS" != "Windows_NT" ]; then
39 # for non windows, just run the commands straight up.
44 # force all slashes to be dossy.
45 # export SERIOUS_SLASH_TREATMENT=true
47 dossify_environment_variable INCLUDE
49 declare -a darc_commands=()
52 if [[ "$i" =~ ^-[a-zA-z][/\"].* ]]; then
54 filename="$(unix_to_dos_path ${i:2})"
55 #echo "first two chars are $flag"
56 #echo "last after that are $filename"
57 recombined="$flag$filename"
58 #echo combined flag and file is $recombined
59 darc_commands+=("$recombined")
60 elif [[ "$i" =~ ^-libpath:.* ]]; then
62 filename="$(unix_to_dos_path ${i:9})"
63 #echo "libflag flag is $flag"
64 #echo "name after that is $filename"
65 recombined="$flag$filename"
66 #echo combined flag and file is $recombined
67 darc_commands+=("$recombined")
69 darc_commands+=($(unix_to_dos_path $i))
73 declare -a real_commands=()
74 for i in "${darc_commands[@]}"; do
75 real_commands+=($(echo $i | sed -e 's/\//\\/g'))
78 if [ ! -z "$DEBUG_FEISTY_MEOW" ]; then
79 echo commands are now:
80 for i in "${real_commands[@]}"; do
86 # this nonsense is only necessary because cygwin is screwing up our carefully constructed
87 # command line. it can't seem to leave the dos style paths alone in some cases, and insists
88 # on changing their form to use forward slashes, which breaks the windows compiler.
89 # this is NOT what cygwin is supposed to be doing, according to their documentation that
90 # claims all styles of paths are supported. and of course this worked fine in msys.
92 # now actually run the chewed command.
94 # old approach, not working since cygwin is hosing us on some paths.
95 #cmd /c "${real_commands[@]}"
97 #new approach that creates a cmd file.
98 cmdfile="$(mktemp $CLAM_TMP/build_cmds.XXXXXX)"
99 echo "${real_commands[@]}" >"$cmdfile"
100 #echo "**** cmd file is $cmdfile"
101 cmd /c $(cat "$cmdfile")
103 # leave the file for inspection if there was an error.
104 if [ $retval -eq 0 ]; then
110 dossify_and_run_commands "$@"