Index: config_office/set_soenv.in =================================================================== RCS file: /cvs/tools/config_office/set_soenv.in,v retrieving revision 1.4.2.2.2.1 diff -u -r1.4.2.2.2.1 set_soenv.in --- config_office/set_soenv.in 26 Feb 2003 17:56:16 -0000 1.4.2.2.2.1 +++ config_office/set_soenv.in 27 Feb 2003 20:32:51 -0000 @@ -42,10 +42,10 @@ # IIa. Declaring variables for the system commands, etc. #-------------------------------------------------------- # -my ( $outfile, $outfile_sh, $bootfile, $newline, $comment, $compiler, $unsetenv, $setenv, $unset, $set, $ds, $ps, $cur_dir, +my ( $outfile, $outfile_sh, $outfile_bat, $bootfile, $newline, $comment, $comment4nt, $compiler, $unsetenv, $setenv, $unset, $set, $ds, $ps, $cur_dir, $par_dir, $I, $L, $D, $buildenv, $answer, $tmp, $Solaris, $Linux, $FreeBSD, $NetBSD, $Tru64, $Irix, $Irix64, $Winnt, $Macosx, $MINGWIN32, $USE_SHELL, $WScomp, $GNUcomp, $platform, $cygwinver, $machine_type, $empty, $no_jdk, $no_ant, $no_stl, $no_tcsh, $no_cl, $no_gcc, $no_gcc_home, $no_gcc_include, - $no_gxx_include, $warnfile, $Warning, $result, $unsetvars, $unsetvarssh, $exportvars, $win_format_var, $perl_os); + $no_gxx_include, $warnfile, $Warning, $result, $unsetvars, $unsetvarssh, $unsetvarsbat, $exportvars, $win_format_var, $perl_os); # #------------------------------------------------- # IIb. Declaring environment values (constants). @@ -524,7 +524,7 @@ $MULTITHREAD_OBJ = "TRUE"; if ( $MINGWIN32 eq "yes" ) { print "Setting Windows NT cygwin mingwin32 specific values... "; - $outfile = "winenv"; + $outfile = "winmingw.set"; $COM = "GCC"; # Change path to lower case. $COMPATH = lc $COMPATH; @@ -554,7 +554,7 @@ } else { print "Setting Windows NT specific values... "; - $outfile = "winenv.bat"; + $outfile = "winenv.set"; $COM = "MSC"; # Change path to lower case. $COMPATH = lc $COMPATH; @@ -588,18 +588,8 @@ $PROSWITCH = "-DPRODUCT"; # GUIBASE is set below; may be "aqua" or "unx". } -if ($platform eq $Winnt) -{ - if ( $USE_SHELL eq "4nt" ) { # USE_SHELL equal 4nt means: use 4NT - $comment = "rem"; # Windows script comment character - } - else { - $comment = "#"; - } -} -else -{ $comment = "#"; # UNIX script comment character -} +$comment4nt = "rem"; # Windows 4nt script comment character +$comment = "#"; # UNIX script comment character print "done\n"; # @@ -763,6 +753,15 @@ { undef $outfile_sh; } +# Generate output file for 4nt? +if ($USE_SHELL eq "4nt") +{ $outfile_bat = $outfile; + $outfile_bat =~ s/set$/bat/i; +} +else +{ undef $outfile_bat; +} + if ($STLPORT4 ne $no_stl) { $ps_STLPORT_LIB = $ps.'$STLPORT4'.$LIB; $L_STLPORT_LIB = $L.'$STLPORT4'.$LIB; @@ -1351,14 +1350,21 @@ die "Cannot open $outfile_sh: $!\n"; } +if(defined($outfile_bat)) +{ # Create bat environment file + open( OUT_BAT, ">$outfile_bat" ) || + die "Cannot open $outfile_bat: $!\n"; +} + # #------------------------------------------ # VII. Writing the data to the output file. #------------------------------------------ # # Write file header. -CreateFileHeader( *OUT, $UPD, $platform, "(t)csh" ); -CreateFileHeader( *OUT_SH, $UPD, $platform, "sh/bash/ksh" ) if defined($outfile_sh); +CreateFileHeader( *OUT, $UPD, $platform, "(t)csh", "#" ); +CreateFileHeader( *OUT_SH, $UPD, $platform, "sh/bash/ksh", "#" ) if defined($outfile_sh); +CreateFileHeader( *OUT_BAT, $UPD, $platform, "4nt", "rem" ) if defined($outfile_bat); # # Writing the platform independent constant values to file. # (c = comment, e = environment variable, a = alias ) @@ -1769,6 +1775,9 @@ { print OUT_SH "export $exportvars $newline"; print OUT_SH "unset $unsetvarssh $newline"; } +if(defined($outfile_bat)) +{ print OUT_BAT $unsetvarsbat; +} # #--------------------------- @@ -1779,6 +1788,9 @@ if( defined($outfile_sh)) { close( OUT_SH ) || print "Can't close $outfile_sh: $!"; } +if( defined($outfile_bat)) +{ close( OUT_BAT ) || print "Can't close $outfile_bat: $!"; +} # #------------------------------ # IX. Sourcing the output file. @@ -1828,6 +1840,14 @@ { `mv -f $outfile_sh $tmp`; } } +if(defined($outfile_bat)) +{ + $tmp = $SRC_ROOT.$ds.$outfile_bat; + if (rename( $outfile_bat, $tmp ) ne 1) + { `mv -f $outfile_bat $tmp`; + } +} + # #-------------------------------------------------------- # XII. Message at the end. @@ -1865,9 +1885,10 @@ $bootfile = "bootstrap"; open( OUT, ">$bootfile" ) || die "Cannot open $bootfile: $!\n"; -if (( $platform ne "$Winnt" ) or ( $USE_SHELL ne "4nt" )) -{ print OUT "#!$SHELL\n"; +if ( $USE_SHELL eq "4nt" ) +{ $SHELL="tcsh"; } +print OUT "#!$SHELL\n"; close( OUT ) || print "Can't close $bootfile: $!"; open( OUT, ">>$bootfile" ) || die "Cannot open $bootfile: $!\n"; @@ -1969,12 +1990,14 @@ # 2. UPD (string) # 3. Platform (string) # 4. name of shell for this file +# 5. comment to use for this file # Return value: void #------------------------------------------------------------ sub CreateFileHeader { my $timestamp = `date`; chomp( $timestamp ); my $filehandle = $_[0]; + my $comment = $_[4]; print { $filehandle } "$comment #################################################################"; print { $filehandle } $newline; print { $filehandle } "$comment OpenOffice.org $_[ 1 ] build environment file for: $_[ 2 ]. $newline"; @@ -1999,42 +2022,33 @@ { # Write an environment variable to file. if (defined $_[ 1 ]) { printf("%-12s %-17s %-10s %-39s\n", "The variable", $_[ 0 ], "is set to:", $_[ 1 ]) ; # to stdout - if (( $platform ne "$Winnt" ) or ( $USE_SHELL ne "4nt" )) - { - print OUT "$setenv $_[ 0 ] \"$_[ 1 ]\"$newline"; # to tcsh file - if(defined($outfile_sh)) - { print OUT_SH "$_[ 0 ]=\"$_[ 1 ]\"$newline"; # to sh file - $exportvars .= " $_[ 0 ]"; # add to export list for sh file - } + print OUT "$setenv $_[ 0 ] \"$_[ 1 ]\"$newline"; # to tcsh file + if(defined($outfile_sh)) + { print OUT_SH "$_[ 0 ]=\"$_[ 1 ]\"$newline"; # to sh file + $exportvars .= " $_[ 0 ]"; # add to export list for sh file } - else + if(defined($outfile_bat)) { $win_format_var = WinFormat( $_[ 1 ] ); #Filter for Windows - print OUT "IF DEFINED $_[ 0 ] $unset $_[ 0 ] $newline"; - print OUT "$set $_[ 0 ]=$win_format_var $newline"; + print OUT_BAT "IF DEFINED $_[ 0 ] $unset $_[ 0 ] $newline"; + print OUT_BAT "$set $_[ 0 ]=$win_format_var $newline"; } } else { printf("%-12s %-17s %-10s %-39s\n", "The variable", $_[ 0 ], "is set to:", "unset") ; # to stdout - if (( $platform ne "$Winnt" ) or ( $USE_SHELL ne "4nt" )) - { - $unsetvars .= "$unsetenv $_[ 0 ] >& /dev/null$newline"; # for tcsh file - $unsetvarssh .= " $_[ 0 ]"; # for sh file - } - else - { $unsetvars .= "$unset $_[ 0 ] >& NUL$newline"; + $unsetvars .= "$unsetenv $_[ 0 ] >& /dev/null$newline"; # for tcsh file + $unsetvarssh .= " $_[ 0 ]"; # for sh file + if(defined($outfile_bat)) + { $unsetvarsbat .= "$unset $_[ 0 ] >& NUL$newline"; } } } elsif ( $_[ 2 ] eq "a" ) { # Write an alias to file. print "The $_[ 0 ] is set to: $_[ 1 ]\n"; # to stdout - if (( $platform ne "$Winnt" ) or ( $USE_SHELL ne "4nt" )) - { - print OUT "$_[ 0 ] $_[ 1 ] $newline"; # to tcsh file - print OUT_SH "$_[ 0 ]=$_[ 1 ] $newline" if defined($outfile_sh); # to sh file - } - else - { print OUT "$_[ 0 ]=$_[ 1 ] $newline"; + print OUT "$_[ 0 ] $_[ 1 ] $newline" if !defined($outfile_bat); # to tcsh file (only if no 4nt build) + print OUT_SH "$_[ 0 ]=$_[ 1 ] $newline" if defined($outfile_sh); # to sh file + if(defined($outfile_bat)) + { print OUT_BAT "$_[ 0 ]=$_[ 1 ] $newline"; } } elsif ( $_[ 2 ] eq "c" ) @@ -2055,32 +2069,38 @@ print OUT_SH "$comment $_[ 0 ] $newline"; print OUT_SH "$comment $newline"; } + if(defined($outfile_bat)) + { + print OUT_BAT "$newline"; + print OUT_BAT "$comment4nt $newline"; + print OUT_BAT "$comment4nt $_[ 0 ] $newline"; + print OUT_BAT "$comment4nt $newline"; + } } elsif ( $_[ 2 ] eq "n" ) { #Write a newline to a file print OUT "$newline"; print OUT_SH "$newline" if defined($outfile_sh); + print OUT_BAT "$newline" if defined($outfile_bat); } elsif ( $_[ 2 ] eq "x" ) { #Write first argument as is, and nothing else - print OUT "$_[ 0 ] $newline"; + #Only useful for 4nt + print OUT_BAT "$_[ 0 ] $newline" if defined($outfile_bat); } elsif ( $_[ 2 ] eq "j" ) { if ((defined $_[ 1 ]) and ( $platform eq "$Winnt" )) { printf("%-12s %-17s %-10s %-39s\n", "The variable", $_[ 0 ], "is set to:", $_[ 1 ]) ; # to stdout - if ( $USE_SHELL ne "4nt" ) - { - $win_format_var = WinFormat( $_[ 1 ] ); #Filter for Windows - $win_format_var =~ s/\\/\\\\/g; - print OUT "$setenv $_[ 0 ] \"$win_format_var\" $newline"; - } - else + $win_format_var = WinFormat( $_[ 1 ] ); #Filter for Windows + $win_format_var =~ s/\\/\\\\/g; + print OUT "$setenv $_[ 0 ] \"$win_format_var\" $newline"; + if (defined($outfile_bat)) { $win_format_var = WinFormat( $_[ 1 ] ); #Filter for Windows - print OUT "IF DEFINED $_[ 0 ] $unset $_[ 0 ] $newline"; - print OUT "$set $_[ 0 ]=$win_format_var $newline"; + print OUT_BAT "IF DEFINED $_[ 0 ] $unset $_[ 0 ] $newline"; + print OUT_BAT "$set $_[ 0 ]=$win_format_var $newline"; } } else