Index: set_soenv.1 =================================================================== RCS file: /cvs/oo/tools/config_office/set_soenv.1,v retrieving revision 1.70 diff -u -r1.70 set_soenv.1 --- set_soenv.1 2002/06/13 14:56:32 1.70 +++ set_soenv.1 2002/06/22 21:41:57 @@ -503,7 +503,7 @@ } elsif ( $platform eq "$Winnt" ) { - $COMPATH = $ARGV[ 0 ]; + $COMPATH = PosixFormat($ARGV[ 0 ]); $CPUNAME = "INTEL"; $CPU = "I"; $GUI = "WNT"; @@ -627,12 +627,13 @@ } else { # JAVA_HOME as argument from autoconf. - $JAVA_HOME = $ARGV[ 3 ]; + $JAVA_HOME = PosixFormat($ARGV[ 3 ]) ; } # Restore white spaces in Windows pathnames. if ( $platform eq "$Winnt") { $JAVA_HOME =~ s/#/ /g; -} + $JAVA_HOME =~ s/[\s\/]+$//; # remove trailing \n or \/ if there is any. +} # 3. Tcsh path. # Check whether autoconf found the Tcsh path. if ( $ARGV[ 4 ] eq $no_tcsh and $USE_SHELL eq "tcsh" ) @@ -672,7 +673,7 @@ CheckPathExist( $ASM_PATH ); } else - { $ASM_PATH = $ARGV[ 15 ]; + { $ASM_PATH = PosixFormat($ARGV[ 15 ]); } } # unzip.exe path for Windows users. @@ -683,7 +684,7 @@ CheckPathExist( $UNZIP_PATH ); } else - { $UNZIP_PATH = $ARGV[ 16 ]; + { $UNZIP_PATH = PosixFormat($ARGV[ 16 ]); } } @@ -753,7 +754,7 @@ } else { # GCC_INCLUDE as argument from autoconf. - $GCC_INCLUDE = $ARGV[ 1 ]; + $GCC_INCLUDE = PosixFormat($ARGV[ 1 ]); } # 6. G++ include directory. # Check whether autoconf found the g++ 2.95.2 include directory. @@ -769,7 +770,7 @@ } else { # GXX_INCLUDE as argument from autoconf. - $GXX_INCLUDE = $ARGV[ 2 ]; + $GXX_INCLUDE = PosixFormat($ARGV[ 2 ]); } } } @@ -821,8 +822,10 @@ } # Import SystemDrive enviroment variable use Env qw(SYSTEMDRIVE); + # Change $SYSTEMDRIVE to lower case. + $SYSTEMDRIVE = lc $SYSTEMDRIVE; use Env qw(SYSTEMROOT); - $CYGWIN = $ARGV[ 11 ]; # Windows bash path + $CYGWIN = PosixFormat($ARGV[ 11 ]); # Windows bash path $CYGWIN =~ s/#/ /g; # Replace white spaces $WIN_GREP = '$CYGWIN'.$ds."grep.exe"; $WIN_FIND = '$CYGWIN'.$ds."find.exe"; @@ -836,9 +839,9 @@ $JAVA_BIN = $JAVA_HOME.$BIN; $JAVA_INCLUDE = $JAVA_HOME.$ds."include"; } -$PERL_PATH = $ARGV[ 5 ]; # Perl Path -$XLIB = $ARGV[ 6 ]; # X11 libraries -$XINC = $ARGV[ 7 ]; # X11 includes +$PERL_PATH = PosixFormat($ARGV[ 5 ]); # Perl Path +$XLIB = PosixFormat($ARGV[ 6 ]); # X11 libraries +$XINC = PosixFormat($ARGV[ 7 ]); # X11 includes # Macosx only variables. @@ -868,7 +871,7 @@ { $SOLARENV = $SRC_ROOT.$SOLENV; } else -{ $SOLARENV = $ARGV[ 8 ]; +{ $SOLARENV = PosixFormat($ARGV[ 8 ]); # Restore white spaces in Windows pathnames if ( $platform eq "$Winnt") { $SOLARENV =~ s/#/ /g; @@ -879,7 +882,7 @@ { $SOLARVER = $SRC_ROOT.$SOLVER; } else -{ $SOLARVER = $ARGV[ 9 ]; +{ $SOLARVER = PosixFormat($ARGV[ 9 ]); # Restore white spaces in Windows pathnames if ( $platform eq "Winnt") { $SOLARVER =~ s/#/ /g; @@ -1061,6 +1064,7 @@ # Restore white spaces in Windows pathnames. $PERL_PATH =~ s/#/ /g; + $PERL_PATH =~ s/[\/\s]+$//; # Remove trailing / and spaces $PERL = $PERL_PATH.$ds."perl.exe"; $WIN_HOME = " "; @@ -1113,17 +1117,12 @@ { my ( $noldPATH ); $noldPATH = $oldPATH; - - # convert path to posix if using native perl - if ( ! $perl_os =~ /cygwin/ and $USE_SHELL eq "4nt" ) - { - $noldPATH =~ s#(\w):#/cygdrive/$1#g; - $noldPATH =~ s/\\/\//g; - $noldPATH =~ s/;/:/g; - } - + + # convert path to posix if using native NT perl + $noldPATH = PosixFormat($noldPATH); + $COMPATH_ROOT = $COMPATH; - $COMPATH_ROOT =~ s/\/vc98$//; + $COMPATH_ROOT =~ s/\/vc98$//i; $PATH = $cur_dir. $ps.'$SOLARVER'.$ds.'$UPD'.$ds.'$INPATH'.$BIN. @@ -1759,12 +1758,9 @@ if ( !( $_[ 0 ] =~ /^\// ) ) { $retrn = $ds.$_[ 0 ]; } - } - # Check if the last character is a '/'. - if ( $retrn =~ /\/$/ ) - { chop( $retrn ); } - # Replacing multiple occurences of /. + # kill the last '/','\','\n' if they exists. + $retrn =~ s![\s/\\]+$!!; # Done! return( $retrn ); } @@ -1794,8 +1790,9 @@ } return "false"; } - else - { return "true"; + else + { # Don't check under "$Winnt". The path is possibly posix and you could use a native NT perl! + return "true"; } } #------------------------------------------------------------ @@ -1910,6 +1907,31 @@ } } #---------------------------------------------------------- +# Function name: PosixFormat +# Description: Format variables to Posix Style Format. Should only be used +# with DOS-style path variables +# Arguments: 1. Variable (string) +# Return value: Reformatted String +#---------------------------------------------------------- +sub PosixFormat +{ my ( $variable ); + $variable = $_[ 0 ]; + # ToDo: Do the replacement only if "Winnt" and var contains "\" and ":" + if ( $platform eq "$Winnt" ) + { $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables + $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables twice! + if ( ( $variable =~ /\\/ ) and ( $variable =~ /:/ ) ) + { $variable =~ s{([c-z]):}{/cygdrive/$1}gi; + # Map drives to /cgydrive/drive + # We do this also for old cygwins, back + # replacement in winformat. + } + $variable =~ s!\\!/!g; + $variable =~ s/;/:/g; + } + return $variable; +} +#---------------------------------------------------------- # Function name: WinFormat # Description: Format variables to Windows Format. # Arguments: 1. Variable (string) @@ -1920,23 +1942,33 @@ $variable = $_[ 0 ]; $variable =~ s/^"//; $variable =~ s/"$//; + # Here should be NO "\"! If yes, PosixFormat() was forgotten before ! + if ( $variable =~ /\\/ ) + { + die("Error! Variable contains \"\\\" : $variable PosixFormat() missing?"); + } + $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables + $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables twice! + $variable =~ s/\$\{PATH\}/%PATH/g ; # explicit replace ${PATH} + $variable =~ s/:+/:/g ; # remove multiple ; + if ( $cygwinver eq "b" ) - { $variable =~ s/\//\\/g; - $variable =~ s/\$/%/g; - $variable =~ s/:/;/g; - $variable =~ s/^\\\\(\w)\\/$1:\\/g; - $variable =~ s/^\\/$SYSTEMDRIVE\\/; - $variable =~ s/;\\/;$SYSTEMDRIVE\\/g; + { + $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables + $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables twice! + $variable =~ s/\$\{PATH\}/%PATH/g ; # explicit replace ${PATH} + $variable =~ s/:/;/g; # Change path-separator + $variable =~ s{//([c-z])/}{$1:\\}gi; # drives from cgywin-b20 (just in case ...) + $variable =~ s{/cygdrive/([c-z])/}{$1:\\}gi; # more drives for cgywin-b20 + $variable =~ s!([;]|\A|-[iIlL])/!$1$SYSTEMDRIVE/!g; # get back the hidden drives + $variable =~ s!/!\\!g; # Rest is windows stuff } - else + else # New cygwin { - $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables - $variable =~ s/(\$\w+)/$1/eeg ; # expand the variables twice! - $variable =~ s/\$\{PATH\}/%PATH/g ; # explicit replace ${PATH} - $variable =~ s/\\/\//g; $variable =~ s/:/;/g; - $variable =~ s/([;]|\A|-[iIlL])(\w);/$1$2:/g; # get back the drives - # Search for posix path ;entry; and replace with cygpath -w entry +# $variable =~ s/([;]|\A|-[iIlL])(\w);/$1$2:/g; # get back the drives + $variable =~ s{/cygdrive/([c-z])/}{$1:\\}gi; # more drives cgywin style + # Search for posix path entry and replace with cygpath -w entry if ( $variable =~ /^\s+-\w/ ) { # Include paths @@ -1966,12 +1998,10 @@ } } $variable = join(';',@split_var); - } - $variable =~ s/\//\\/g; # Remaining \ come from e.g.: ../foo/baa } - return $variable; + return $variable; } #---------------------------------------------------------- # Function name: CheckBuildEnv