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