From 6bac9446c8b7c594001ea05afc4b425a10a49113 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Tue, 23 Jun 2015 16:09:35 -0400 Subject: [PATCH] a few mods to get over the DOS problems we've had a while. these were multifarious, but i blame both windows and cygwin now. and of course bill gates, as per custom. --- scripts/clam/cpp/rebuild_oldies.sh | 2 +- scripts/core/functions.sh | 15 +++++++++++++-- scripts/generator/vis_stu_vars.sh | 18 +++++++++++++++++- scripts/generator/wrapdoze.sh | 30 ++++++++++++++++++++++++++++-- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/scripts/clam/cpp/rebuild_oldies.sh b/scripts/clam/cpp/rebuild_oldies.sh index 21a49c29..92e83a74 100755 --- a/scripts/clam/cpp/rebuild_oldies.sh +++ b/scripts/clam/cpp/rebuild_oldies.sh @@ -1,6 +1,6 @@ #!/bin/bash if [ -f "$BUILD_LIST_FILE" ]; then - echo Compiling [$(cat $BUILD_LIST_FILE | while read line; do echo $(basename $line); done )] + echo Compiling [$(cat $BUILD_LIST_FILE | while read line; do echo $(basename $line); done )] rm -f $(cat $BUILD_WHACK_FILE) #echo got line to run: $* eval "${@}" diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index 0f185ee5..006851be 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -237,11 +237,22 @@ if [ -z "$skip_all" ]; then # switches from a /X/path form to an X:/ form. this also processes cygwin paths. function unix_to_dos_path() { # we usually remove dos slashes in favor of forward slashes. + local DOSSYHOME + if [[ ! "$OS" =~ ^WIN ]]; then + # fake this value for non-windows (non-cygwin) platforms. + DOSSYHOME="$HOME" + else + # for cygwin, we must replace the /home/X path with an absolute one, since cygwin + # insists on the /home form instead of /c/cygwin/home being possible. this is + # super frustrating and nightmarish. + DOSSYHOME="$(cygpath -am "$HOME")" + fi + if [ ! -z "$SERIOUS_SLASH_TREATMENT" ]; then # unless this flag is set, in which case we force dos slashes. - echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' | sed -e 's/\//\\/g' + echo "$1" | sed -e "s?^$HOME?$DOSSYHOME?g" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' | sed -e 's/\//\\/g' else - echo "$1" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' + echo "$1" | sed -e "s?^$HOME?$DOSSYHOME?g" | sed -e 's/\\/\//g' | sed -e 's/\/cygdrive//' | sed -e 's/\/\([a-zA-Z]\)\/\(.*\)/\1:\/\2/' fi } diff --git a/scripts/generator/vis_stu_vars.sh b/scripts/generator/vis_stu_vars.sh index 3f9c50ec..1fe1a438 100644 --- a/scripts/generator/vis_stu_vars.sh +++ b/scripts/generator/vis_stu_vars.sh @@ -60,7 +60,23 @@ function setup_visual_studio_variables() #on hold: export PLATFORM_DIR="$(short_path "$PROGRAMFILES/Microsoft SDKs/Windows/v7.0A" | tr "A-Z" "a-z" | sed -e 's/^\(.*\)\/[^\/]*\/[^\/]*[\/]$/\1/' )" ##| sed -e 's/^\(.\):/\/\1/' )" -export PLATFORM_DIR="c:\progra~2\micros~1\windows\v7.0a" + # guess at where we can find this damned directory in its short form. +#hmmm: this is needed until there's a replacement for short path, or we can build again. + export PLATFORM_DIR="c:/progra~2/micros~1/windows/v7.0a" + if [ ! -d "$PLATFORM_DIR" ]; then + PLATFORM_DIR="c:/progra~1/micros~1/windows/v7.0a" + if [ ! -d "$PLATFORM_DIR" ]; then + PLATFORM_DIR="c:/progra~1/micros~2/windows/v7.0a" + if [ ! -d "$PLATFORM_DIR" ]; then + PLATFORM_DIR="c:/progra~2/micros~2/windows/v7.0a" + fi + fi + fi + + if [ ! -d "$PLATFORM_DIR" ]; then + echo "*** Failure to calculate the platform directory based on several attempts using c:\\program files\\microsoft sdks\\windows\\v7.0a as the basic pattern" + fi + fi export WindowsSdkDir="$PLATFORM_DIR" diff --git a/scripts/generator/wrapdoze.sh b/scripts/generator/wrapdoze.sh index ab0a9998..b3a3dd1c 100755 --- a/scripts/generator/wrapdoze.sh +++ b/scripts/generator/wrapdoze.sh @@ -49,6 +49,14 @@ function dossify_and_run_commands() #echo "first two chars are $flag" #echo "last after that are $filename" recombined="$flag$filename" +#echo combined flag and file is $recombined + darc_commands+=("$recombined") + elif [[ "$i" =~ ^-libpath:.* ]]; then + flag="-libpath:" + filename="$(unix_to_dos_path ${i:9})" +#echo "libflag flag is $flag" +#echo "name after that is $filename" + recombined="$flag$filename" #echo combined flag and file is $recombined darc_commands+=("$recombined") else @@ -58,7 +66,7 @@ function dossify_and_run_commands() declare -a real_commands=() for i in "${darc_commands[@]}"; do - real_commands+=($(echo $i | sed -e 's/\\/\\\\/g')) + real_commands+=($(echo $i | sed -e 's/\//\\/g')) done if [ ! -z "$SHELL_DEBUG" ]; then @@ -69,8 +77,26 @@ function dossify_and_run_commands() echo fi +# this nonsense is only necessary because cygwin is screwing up our carefully constructed +# command line. it can't seem to leave the dos style paths alone in some cases, and insists +# on changing their form to use forward slashes, which breaks the windows compiler. +# this is NOT what cygwin is supposed to be doing, according to their documentation that +# claims all styles of paths are supported. and of course this worked fine in msys. + # now actually run the chewed command. - cmd /c "${real_commands[@]}" + +# old approach, not working since cygwin is hosing us on some paths. +#cmd /c "${real_commands[@]}" + +#new approach that creates a cmd file. + cmdfile="$(mktemp $CLAM_TMP/build_cmds.XXXXXX)" + echo "${real_commands[@]}" >"$cmdfile" +#echo "**** cmd file is $cmdfile" + cmd /c $(cat "$cmdfile") + retval=$? + rm "$cmdfile" + + return $retval } dossify_and_run_commands "$@" -- 2.34.1