xref: /trunk/main/set_soenv.in (revision ac6ad240)
1#!@PERL@ -w
2#
3# Program:     set_soenv.in
4# Version:     $Revision: 1.201 $
5# Date:        $Date: 2008-09-05 14:14:29 $
6# Author:      Willem van Dorp, Ross Nicholson, Oisin Boydell - Sun Microsystems, Ireland.
7#
8#---------------------------------------------------------------------------
9#---------------------------------------------------------------------------
10# Description:
11# set_soenv generates a file that contains all necessary
12# environment variables for the build proces of OpenOffice
13# on Linux, NetBSD, Solaris, Windows NT and Mac OS X/Darwin.
14#
15# Program steps.
16#
17# I.    Checking the command-line arguments.
18# IIa.  Declaring variables for the system commands, etc.
19# IIb.  Declaring the environment variables.
20# III.  Initialising the variables for the system commands, etc.
21# IV.   Print out some important messages etc.
22# V.    Initialising the environment variables.
23# VI.   Open the output file.
24# VII.  Writing the data to the output file.
25# VIII. Closing output file.
26# IX.   Sourcing the output file.
27# X.    Set up the build environment.
28# XI.   Moving the output file to the build home directory.
29#
30#---------------------------------------------------------------------------
31#
32use strict;                        # pragma
33use File::Basename;
34
35
36#
37#--------------------------------------------------------
38# IIa. Declaring variables for the system commands, etc.
39#--------------------------------------------------------
40#
41my ( $outfile, $outfile_sh, $outfile_bat, $bootfile, $newline, $comment,
42     $compiler, $unsetenv, $setenv, $unset, $set, $ds, $ps,
43     $wps, $cur_dir, $par_dir, $I, $L, $D, $buildenv, $answer, $tmp, $MINGW,
44     $USE_MINGW, $platform,
45     $cygwinver, $empty, $no_ant, $no_stl, $no_gcc_include,
46     $no_gxx_include, $warnfile, $Warning, $result, $unsetvars, $unsetvarssh, $unsetvarsbat, $exportvars, $win_format_var, $perl_os, @mingw_lib_include_paths, $mingw_lib_include_path);
47#
48#-------------------------------------------------
49# IIb. Declaring environment values (constants).
50#-------------------------------------------------
51#
52# Platform independent constant values.
53my @DICTIONARIES = ("DADK", "DEDE", "ENGB", "ENUS", "HUHU", "ITIT", "RURU", "THTH", "SWTZ" );
54my ( $CALL_CDECL, $COMMON_OUTDIR, $BMP_WRITES_FLAG,
55     $common_build, $NO_REC_RES, $SO3, $SOLAR_JAVA,
56     $SOLAR_PLUGIN, $UPDATER, $BUILD_DELIVER, $VCL,
57     $CC, $CXX,
58     $BUILD_SOSL, $ENABLEUNICODE, $NEW_JAR_PACK, $NO_BSYMBOLIC,
59     $BUILD_SOSL_RELEASE, $RSC_ONCE );
60#
61# Platform dependent constant values.
62my ( $BIG_SVX, $COM, $ARCH, $CPU, $CPUNAME, $CVER, $GLIBC, $GUI, $GUIBASE,
63      $GVER, $OS, $OSVERSION, $OUTPATH, $INPATH, $PATH_SEPERATOR,
64      $DYNAMIC_CRT, $SET_EXCEPTIONS, $use_shl_versions, $CDPATHx, $JRELIBDIR,
65      $JRETOOLKITDIR, $JRETHREADDIR,
66      $FLIPCMD );
67#
68#-------------------------------------------
69# IIc. Declaring the environment variables.
70#-------------------------------------------
71#
72# Help variables.
73my ( $USR, $ETC, $BIN, $LIB, $LIB64, $INC, $INCLUDE, $DEV, $OPT, $LOCAL, $SOLENV, $SOLVER, $CONFIG,
74     $USR_BIN, $USR_LIB, $USR_LOCAL, $USR_CCS, $JAVA_BIN, $JAVA_LIB, $JAVA_INCLUDE,
75     $SOLARENVINC, $USR_DT, $USR_OPENWIN, $XLIB, $XINC,
76     $CYGWIN_PATH, $language, $dict, $ASM_PATH, $NSIS_PATH, $ps_STLPORT_LIB, $L_STLPORT_LIB,
77     $STLPORT_stlport, $STLPORT_inc_stlport, $PERL_PATH );
78
79# Environment variables.
80my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL,
81     $UPD, $WORK_STAMP, $SOURCE_ROOT_DIR , $gb_REPOS,
82     $SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $WORKDIR, $OUTDIR, $SOLARENV,
83     $STAR_INIROOT, $STAR_INIROOTOLD, $STAR_STANDLST, $STAR_SSCOMMON, $STAR_SSOLARINI,
84     $DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH,
85     $MSPDB_PATH, $MIDL_PATH, $CSC_PATH,
86     $PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB,
87     $SOLARINC, $LOCALINI, $FRAMEWORKSHOME, $COMEX, $PERL,
88     $COMP_ENV, $ILIB, $JAVAHOME, $PSDK_HOME, $DIRECTXSDK_LIB, $USE_NEW_SDK, $FRAME_HOME,
89     $USE_DIRECTX5, $ATL_LIB, $ATL_INCLUDE, $MFC_LIB, $MFC_INCLUDE, $TMPDIR,
90     $COMMON_BUILD_TOOLS, $WIN_GREP, $WIN_FIND, $WIN_LS,
91     $WIN_GNUCOPY, $WIN_TOUCH, $STLPORT4, $MOZILLA_VERSION, $MOZILLA_TOOLKIT, $PREBUILD_MOZAB, $MOZILLABUILD,
92	 $PROEXT, $TARFILE_LOCATION,
93     $DISABLE_SAXON, $DISABLE_HUNSPELL, $DISABLE_HYPHEN, $DISABLE_LIBWPD,
94     $SYSTEM_PYTHON, $SYSTEM_MOZILLA, $EPM_FLAGS);
95#
96#-------------------------------------------
97# IId. Declaring the aliases.
98#-------------------------------------------
99#
100my ( $dmake, $build, $build_client, $nmake, $mkout, $deliver, $zipdep );
101#
102
103#-------------------------------------------------------------
104# IIIa. Initialising constants.
105#-------------------------------------------------------------
106#
107# $platform is needed for PathFormat()
108#
109$platform          = `./config.guess`;
110chomp( $platform );
111
112$UPD            = '@UPD@';          # the project's UPD
113$newline        = "\n";             # Perl newline character
114$unsetenv       = "unsetenv";       # c-shell command
115$setenv         = "setenv";         # c-shell command
116$unset          = "unset";          # msdos batch file command
117$set            = "set";            # msdos batch file command
118$ds             = "/";              # directory separator
119$ps             = ":";              # path separator
120$wps            = ":";              # path separator, will be set to ';' for windows later.
121$cur_dir        = ".";              # current directory
122$par_dir        = "..";             # parrent directory
123$I              = " -I";            # include search path
124$L              = " -L";            # library search path
125$D              = " -D";            # define search path
126$empty          = "";               # used as argument
127$no_stl         = "NO_STLPORT4";    # possible argument
128$warnfile       = "warn";           # logfile configure warnings.
129$Warning        = "";               # container for warning messages
130$STLPORT4       = '@STLPORT4@';     # Location of STLport4
131$SYSTEM_PYTHON	= '@SYSTEM_PYTHON@';
132$SYSTEM_MOZILLA = '@SYSTEM_MOZILLA@';
133$JDK 		= '@JDK@';
134$JAVAFLAGS 		= '@JAVAFLAGS@';
135$MINGW          = '@WITH_MINGWIN@'; # use MinGW for Windows build
136$USE_MINGW      = '@USE_MINGW@';     # use MinGW in cygwin or pure-mingw
137if ( $MINGW eq "yes" )
138{ $CC             = '@CC@';           # C compiler
139  $CXX            = '@CXX@'; }        # C++ compiler
140else
141{ $CC             = PathFormat('@CC@');           # C compiler
142  $CXX            = PathFormat('@CXX@'); }        # C++ compiler
143$MOZILLA_VERSION	= '@MOZILLA_VERSION@'; # mozilla version to use to build mozilla
144$MOZILLA_TOOLKIT	= '@MOZILLA_TOOLKIT@'; # GUI toolkit to use to build mozilla
145$FLIPCMD        = "";               # Flip '/' to '\' wrapper (only for winnt)
146$GLIBC          = "";               # Whether the platform uses glibc
147$PROEXT         = "@PROEXT@";
148$EPM_FLAGS	= "";
149
150#
151#--------------------------------------------------------------------
152# IV. Initialise the warning container and print a note to the user.
153#--------------------------------------------------------------------
154#
155# Add the configure (pre-requisite) warnings to the warning container
156# , $Warning.
157AddWarning( "configure", "" );
158#
159print ("Setting up the environment for building OpenOffice.org $newline");
160#
161#--------------------------------------------------
162# V. Setting the environment variables/values.
163#--------------------------------------------------
164#
165# A. Checking the platform first.
166#
167# get perls idea for OS
168# needed to differentiate cygwin/native perl on windows
169$perl_os = $^O;
170
171#
172# B. Gathering information from the system.
173#
174# 1. Path
175$oldPATH = $ENV{"PATH"};
176chomp( $oldPATH );                  # cut off new line
177#
178# C. Setting the constant values.
179#
180# Setting platform independent constant values.
181print "Setting platform independent values... ";
182# NB: Language options now set at 'ToFile' stage.
183$BMP_WRITES_FLAG      = "TRUE";
184$BUILD_SOSL_RELEASE   = "TRUE";
185$RSC_ONCE             = "TRUE";
186$CALL_CDECL           = "TRUE";
187$COMMON_OUTDIR        = "";
188$common_build         = "";
189$NO_REC_RES           = "TRUE";
190$SO3                  = "TRUE";
191$SOLAR_JAVA           = "@SOLAR_JAVA@";
192$SOLAR_PLUGIN         = "TRUE";
193$UPDATER              = "YES";
194$BUILD_DELIVER        = "true";
195$VCL                  = "TRUE";
196$BUILD_SOSL           = "true";
197$ENABLEUNICODE        = "TRUE";
198$NEW_JAR_PACK         = "TRUE";
199$NO_BSYMBOLIC         = "TRUE";
200$comment              = "#";           # UNIX script comment character
201$TARFILE_LOCATION = "@TARFILE_LOCATION@"; # where to find tarballs with external sources
202
203# Setting platform dependent constant values.
204if ( $platform =~ m/solaris/ )
205{     print "Setting Solaris specific values... ";
206   if ($platform =~ m/^i[3456]86/)
207   {
208      if ( $CC =~ "gcc") {
209         $outfile        = "SolarisX86GccEnv.Set";
210         $OUTPATH        = "unxsogi";
211      } else {
212         $outfile        = "SolarisX86Env.Set";
213         $OUTPATH        = "unxsoli4";
214      }
215      $CPU            = "I";
216      $CPUNAME        = "INTEL";
217	  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
218	  $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."xawt";
219	  $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
220
221   }
222   else
223   {
224      if ( $CC =~ "gcc") {
225         $outfile        = "SolarisSparcGccEnv.Set";
226         $OUTPATH        = "unxsogs";
227      } else {
228         $outfile        = "SolarisSparcEnv.Set";
229         $OUTPATH        = "unxsols4";
230      }
231      $CPU            = "S";
232      $CPUNAME        = "SPARC";
233	  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
234	  $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."xawt";
235	  $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
236   }
237
238   if ( $CC =~ "gcc") {
239       $COM            = "GCC";
240       $CVER           = "C300";
241   } else {
242       $COM            = "C52";
243       $CVER           = "C52";
244       $COMEX          = 4;
245   }
246   $BIG_SVX        = "TRUE";
247   $COMPATH        = '@COMPATH@';
248   $GUI            = "UNX";
249   $GUIBASE        = "unx";
250   $GVER           = "VCL";
251   $INPATH         = $OUTPATH.$PROEXT;
252   $OS             = "SOLARIS";
253   $PATH_SEPERATOR = $ps;
254}
255elsif ( $platform =~ m/netbsd/ )
256{
257#Set platform specific values:
258   if ($platform =~ m/^i[3456]86/)
259   {  print "Setting NetBSD x86 specific values... ";
260      $outfile        = "NetBSDX86Env.Set";
261      $CPU            = "I";
262      $CPUNAME        = "INTEL";
263      $OUTPATH        = "unxbsdi";
264      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
265      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
266      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
267   }
268   elsif ($platform =~ m/^sparc/)
269   {  print "Setting NetBSD Sparc specific values... ";
270      $outfile        = "NetBSDSparcEnv.Set";
271      $CPU            = "S";
272      $CPUNAME        = "SPARC";
273      $OUTPATH        = "unxbsds";
274      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
275      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."client";
276      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
277   }
278   elsif ($platform =~ m/powerpc/)
279   {  print "Setting NetBSD PPC specific values... ";
280      $outfile        = "NetBSDPPCEnv.Set";
281      $CPU            = "P";
282      $CPUNAME        = "POWERPC";
283      $OUTPATH        = "unxbsdppc";
284      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
285      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
286      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
287   }
288   else
289   { print "Unsupported NetBSD architecture: $platform \n";
290     exit 1;
291   }
292   #Conditional setting depending on gcc3:
293      $CVER           = "C300";
294      $OUTPATH        = $OUTPATH."2";
295   # General NetBSD settings:
296      $BIG_SVX        = "TRUE";
297      $COM            = "GCC";
298      $COMPATH        = '@COMPATH@';
299      $GUI            = "UNX";
300      $GUIBASE        = "unx";
301      $GVER           = "VCL";
302      $INPATH         = $OUTPATH.$PROEXT;
303      $OS             = "NETBSD";
304      $PATH_SEPERATOR = $ps;
305}
306elsif ( $platform =~ m/kfreebsd/ )
307{
308# General GNU/kFreeBSD settings:
309      $CVER           = "C341";
310      $BIG_SVX        = "TRUE";
311      $COM            = "GCC";
312      $COMPATH        = '@COMPATH@';
313      $GLIBC          = "2REDHAT60";
314      $GUI            = "UNX";
315      $GUIBASE        = "unx";
316      $GVER           = "VCL";
317      $OS             = "LINUX";
318      $PATH_SEPERATOR = $ps;
319
320#Set platform specific values:
321   if ($platform =~ m/^i[3456]86/)
322   {  print "Setting GNU/kFreeBSD x86 specific values... ";
323      $outfile        = "GNUkFreeBSDX86Env.Set";
324      $CPU            = "I";
325      $CPUNAME        = "INTEL";
326      $OUTPATH        = "unxkfgi6";
327
328      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
329      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
330      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
331
332   }
333   elsif ($platform =~ m/^x86_64/)
334   {  print "Setting GNU/kFreeBSD x86-64 specific values... ";
335      $outfile        = "GNUkFreeBSDX86-64Env.Set";
336      $CPU            = "X";
337      $CPUNAME        = "X86_64";
338      $OUTPATH        = "unxkfgx6";
339
340      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
341      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
342      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
343   }
344
345   $INPATH         = $OUTPATH.$PROEXT;
346}
347elsif ( $platform =~ m/freebsd/ )
348{     $BIG_SVX        = "TRUE";
349      $COM            = "GCC";
350      $COMPATH        = '@COMPATH@';
351      $CVER           = "C300";
352      $GUI            = "UNX";
353      $GUIBASE        = "unx";
354      $GVER           = "VCL";
355      $OS             = "FREEBSD";
356      $PATH_SEPERATOR = $ps;
357      $OSVERSION      = '@OSVERSION@';
358   if (($platform =~ m/^amd64/) || ($platform =~ m/^x86_64/))
359   {  my ( $JAVA_OS );
360      print "Setting FreeBSD AMD64 specific values... ";
361      $outfile        = "FreeBSDAMDEnv.Set";
362      $CPU            = "X";
363      $CPUNAME        = "X86_64";
364      $OUTPATH        = "unxfbsdx";
365      $JAVA_OS        = '@JAVA_HOME@';
366      $JAVA_OS        =~ s/.*\///;
367      if ($JAVA_OS =~ m/^linux/)
368      {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
369         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
370         $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
371      }
372      else
373      {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
374         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
375         $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
376      }
377   }
378   elsif ($platform =~ m/^i386/)
379   {  print "Setting FreeBSD x86 specific values... ";
380      $outfile        = "FreeBSDX86Env.Set";
381      $CPU            = "I";
382      $CPUNAME        = "INTEL";
383      $OUTPATH        = "unxfbsdi";
384      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
385      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
386      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
387   }
388   else
389   {  print "Unsupported FreeBSD architecture: $platform \n";
390         exit 1;
391   }
392   if( @GCCVER@ >= 30401 ) {
393      $CVER        = "C341";
394   }
395      $INPATH         = $OUTPATH.$PROEXT;
396}
397elsif ( $platform =~ m/linux/ )
398{
399# General Linux settings:
400      $CVER           = "C341";
401      $BIG_SVX        = "TRUE";
402      $COM            = "GCC";
403      $COMPATH        = '@COMPATH@';
404      $GLIBC          = "2REDHAT60";
405      $GUI            = "UNX";
406      $GUIBASE        = "unx";
407      $GVER           = "VCL";
408      $OS             = "LINUX";
409      $PATH_SEPERATOR = $ps;
410
411#Set platform specific values:
412   if ($platform =~ m/^i[3456]86/)
413   {  print "Setting Linux x86 specific values... ";
414      $outfile        = "LinuxX86Env.Set";
415      $CPU            = "I";
416      $CPUNAME        = "INTEL";
417
418      if ($JDK =~ m/^[Ii][Bb][Mm]/)
419      { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."bin";
420        $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."bin".$ds."classic";
421        $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."bin"; }
422
423      elsif ($JDK =~ m/^[Bb][Ee][Aa]/)
424      { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
425        $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."jrockit";
426        $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads"; }
427
428      else {
429      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
430      # has both server and client
431      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
432      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
433      }
434
435      $OUTPATH     = "unxlngi6";
436   }
437   elsif ($platform =~ m/^x86_64/)
438   {  print "Setting Linux x86-64 specific values... ";
439      $outfile        = "LinuxX86-64Env.Set";
440      $CPU            = "X";
441      $CPUNAME        = "X86_64";
442      $OUTPATH        = "unxlngx6";
443      # Blackdown.org JDK porting project uses `amd64' and `server' in JDK 1.4.2 RC1
444      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
445      # has both server and client
446      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
447      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
448   }
449   elsif ($platform =~ m/^ia64/)
450   {  print "Setting Linux ia64 specific values... ";
451      $outfile        = "LinuxIA64Env.Set";
452      $CPU            = "A";
453      $CPUNAME        = "IA64";
454      $OUTPATH        = "unxlnga";
455      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64";
456      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."server";
457      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."native_threads";
458   }
459   elsif ($platform =~ m/^sparc/)
460
461   {  print "Setting Linux Sparc specific values... ";
462      $outfile        = "LinuxSparcEnv.Set";
463      $CPU            = "S";
464      $CPUNAME        = "SPARC";
465      $OUTPATH        = "unxlngs";
466      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
467      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."server";
468      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
469   }
470   elsif ($platform =~ m/^powerpc/)
471   {
472      if (($platform =~ m/^powerpc64/) && ('@SIZEOF_LONG@' eq '8')) {
473         print "Setting Linux PPC64 specific values... ";
474         $outfile = "LinuxPPC64Env.Set";
475         $OUTPATH = "unxlngppc64";
476         $CPUNAME = "POWERPC64";
477
478         if ( $JDK eq "gcj" ) {
479            $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64";
480            $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."client";
481            $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."native_threads";
482         }
483      }
484      else {
485         print "Setting Linux PPC specific values... ";
486         $outfile = "LinuxPPCEnv.Set";
487         $OUTPATH = "unxlngppc";
488         $CPUNAME = "POWERPC";
489
490         if ( $JDK eq "gcj" ) {
491            $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
492            $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."client";
493            $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads"; }
494         elsif ($JDK =~ m/^[Ii][Bb][Mm]/)
495         {  $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
496            $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
497            $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
498         }
499	 # OpenJDK
500	 elsif ($JDK =~ m/sun/) {
501	    $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
502	    $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."server";
503	    $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
504	 }
505      }
506
507      $CPU            = "P";
508
509   }
510   elsif ($platform =~ m/^s390/)
511   {
512      if (($platform =~ m/^s390x/) && ('@SIZEOF_LONG@' eq '8')) {
513         print "Setting Linux zSeries specific values... ";
514         $outfile        = "LinuxS390XEnv.Set";
515         $CPUNAME        = "S390X";
516	 $ARCH           = "s390x";
517         $OUTPATH        = "unxlngs390x";
518      }
519      else {
520         print "Setting Linux S/390 specific values... ";
521         $outfile        = "LinuxS390Env.Set";
522         $CPUNAME        = "S390";
523	 $ARCH           = "s390";
524         $OUTPATH        = "unxlngs390";
525      }
526      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH;
527      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."server";
528      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."native_threads";
529      $CPU            = "3";
530   }
531   elsif ($platform =~ m/^m68k/)
532   {  print "Setting Linux m68k specific values... ";
533      $outfile        = "LinuxM68KEnv.Set";
534      $CPU            = "6";
535      $CPUNAME        = "M68K";
536      $OUTPATH        = "unxlngm68k";
537      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k";
538      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."server";
539      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."native_threads";
540   }
541   elsif ($platform =~ m/^hppa/)
542   {  print "Setting Linux hppa specific values... ";
543      $outfile        = "LinuxHPPAEnv.Set";
544      $CPU            = "H";
545      $CPUNAME        = "HPPA";
546      $OUTPATH        = "unxlnghppa";
547      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa";
548      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa".$ds."server";
549      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa".$ds."native_threads";
550      $EPM_FLAGS      = "-a hppa";
551   }
552   elsif ($platform =~ m/^alpha/)
553   {  print "Setting Linux Alpha specific values... ";
554      $outfile        = "LinuxAlphaEnv.Set";
555      $CPU            = "L";
556      $CPUNAME        = "AXP";
557      $OUTPATH        = "unxlngaxp";
558      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
559      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."server";
560      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
561   }
562   elsif ($platform =~ m/^arm.*?l-/)
563   {  print "Setting Linux ARM specific values... ";
564      $outfile        = "LinuxARMEnv.Set";
565      $CPU            = "R";
566      $CPUNAME        = "ARM";
567      $OUTPATH        = "unxlngr";
568      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm";
569      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."server";
570      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."native_threads";
571      $EPM_FLAGS      = "-a arm";
572   }
573   elsif ($platform =~ m/^mips/)
574   {  print "Setting Linux MIPS specific values... ";
575      $outfile        = "LinuxMIPSEnv.Set";
576      $CPU            = "M";
577      $CPUNAME        = "GODSON";
578      $OUTPATH        = "unxlngmips";
579
580      if ('@SIZEOF_LONG@' eq '8') {
581        if ('@WORDS_BIGENDIAN@' ne 'yes') {
582          $EPM_FLAGS = "-a mips64el";
583          if ( $JDK eq "gcj" ) {
584	    $ARCH = "mips64el";
585          }
586        }
587        else {
588          $ARCH = "mips64";
589        }
590      }
591      else {
592        if ('@WORDS_BIGENDIAN@' ne 'yes') {
593          $EPM_FLAGS = "-a mipsel";
594	  if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
595	   $ARCH = "mips32"; # Lemote
596	  } else {
597	   $ARCH = "mipsel";
598 	  }
599        }
600        else {
601          $ARCH = "mips";
602        }
603      }
604
605      $JRELIBDIR      = '$JAVA_HOME'.$ds."lib".$ds.$ARCH;
606      if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
607      	$JRETOOLKITDIR  = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."client"; # Lemote
608      } else {
609      	$JRETOOLKITDIR  = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."server";
610      }
611      $JRETHREADDIR   = '$JAVA_HOME'.$ds."lib".$ds.$ARCH.$ds."native_threads";
612   }
613
614
615   $INPATH         = $OUTPATH.$PROEXT;
616}
617elsif ( $platform =~ m/osf1/ )
618{     print "Setting Tru64 specific values... ";
619      $outfile        = "Tru64AlphaEnv.Set";
620      $BIG_SVX        = "TRUE";
621      $COM            = "CXX";
622      $COMPATH        = '@COMPATH@';
623      $CPU            = "A";
624      $CPUNAME        = "ALPHA_";
625      $CVER           = "C62";
626      $GUI            = "UNX";
627      $GUIBASE        = "unx";
628      $GVER           = "VCL";
629      $OUTPATH        = "unxt64";
630      $INPATH         = $OUTPATH.$PROEXT;
631      $OS             = "TRU64";
632      $PATH_SEPERATOR = $ps;
633      $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
634      $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."client";
635      $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
636}
637elsif ( $platform =~ m/cygwin/ )
638{
639      $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
640      $MIDL_PATH      = PathFormat('@MIDL_PATH@');
641      $CSC_PATH       = PathFormat('@CSC_PATH@');
642      $PSDK_HOME      = PathFormat('@PSDK_HOME@');
643      $DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@');
644      $USE_DIRECTX5   = "";
645      $FRAME_HOME     = PathFormat('@FRAME_HOME@');
646      $USE_NEW_SDK    = "TRUE";
647      $CPUNAME        = "INTEL";
648      $CPU            = "I";
649      $GUI            = "WNT";
650      $GUIBASE        = "WIN";
651      $GVER           = "NT351";
652      $OS             = "WNT";
653      $DYNAMIC_CRT    = "TRUE";
654      $SET_EXCEPTIONS = "TRUE";
655      $use_shl_versions = "TRUE";
656      $wps = ';'; # Windows style path seperator
657  if ( $MINGW eq "yes" )
658  {   # At the moment this implies the use of tcsh
659      print "Setting Windows NT cygwin MinGW specific values... ";
660      $FLIPCMD        = "slfl.pl";
661      $PATH_SEPERATOR = ';';
662      $outfile        = "winmingw.set";
663      $COMPATH        = PathFormat('@COMPATH@/bin');
664      $COMPATH        =~ s/\/bin$//i;
665      $COM            = "GCC";
666      $CVER           = "C341";
667      $OUTPATH        = "wntgcci";
668      $INPATH         = $OUTPATH.$PROEXT;
669      $ATL_INCLUDE = '$SOLARVER'.$ds.'$INPATH'.$ds."inc".$ds."external".$ds."mingw".$ds."include".$ds."atl". " ".'$PSDK_HOME'.$ds."include".$ds."atl";
670  }
671  else # The MSVC section starts here
672  {   $outfile        = "winenv.set";
673      $COMPATH        = PathFormat('@COMPATH@');
674      $COM            = "MSC";
675      $OUTPATH        = "wntmsci@COMEX@";
676      $INPATH         = $OUTPATH.$PROEXT;
677      $COMEX          = '@COMEX@';
678      if ( "@COMEX@" eq "10" ) { # .NET 2003 needs M1310
679          $CVER        = "M1310";
680          $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
681          $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
682          $MFC_LIB     = "";
683          $MFC_INCLUDE = "";
684      } elsif ( "@COMEX@" ge "11" ) { # .NET 2005 needs M1400
685	  if ( "@COMEX@" eq "11" ) {
686	      $CVER        = "M1400";
687	  } elsif ( "@COMEX@" eq "12" ) {
688	      $CVER        = "M1500";
689	  } else {                   # Unsupported
690	      die "Unsupported value for COMEX variable.\n";
691	  }
692          if ( "@DISABLE_ACTIVEX@" ) {
693              $ATL_LIB     = $PSDK_HOME.$ds."lib"; # Doesn't exist for VSE
694              $ATL_INCLUDE = $PSDK_HOME.$ds."include".$ds."atl";
695              $MFC_LIB     = $PSDK_HOME.$ds."lib"; # Doesn't exist for VSE
696              $MFC_INCLUDE = $PSDK_HOME.$ds."include".$ds."mfc";
697          } else {
698              $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
699              $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
700              $MFC_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
701              $MFC_INCLUDE = $PSDK_HOME.$ds."include".$ds."mfc";
702          }
703      }
704	  print "Setting W32 build with bash shell specific values... ";
705	  # No speacial treatment for CC an CXX anymore.
706	  $FLIPCMD        = "slfl.pl";
707	  $PATH_SEPERATOR = ';';
708  }
709}
710elsif ( $platform =~ m/os2/ )
711{
712      $COMPATH        = PathFormat('@COMPATH@');
713      $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
714      $MIDL_PATH      = PathFormat('@MIDL_PATH@');
715      $CSC_PATH       = PathFormat('@CSC_PATH@');
716      $PSDK_HOME      = PathFormat('@PSDK_HOME@');
717      $FRAME_HOME     = PathFormat('@FRAME_HOME@');
718      $USE_NEW_SDK    = "TRUE";
719      $CPUNAME        = "INTEL";
720      $CPU            = "I";
721      $GUI            = "OS2";
722      $GUIBASE        = "os2";
723      $GVER           = "VCL";
724      $OS             = "OS2";
725      $DYNAMIC_CRT    = "TRUE";
726      $SET_EXCEPTIONS = "TRUE";
727      $use_shl_versions = "TRUE";
728  {
729      print "Setting OS/2 gcc 3.3.5 specific values... \n";
730      $outfile        = "os2env.set";
731      $COM            = "GCC";
732      $CVER           = "C300";
733      $OUTPATH        = "os2gcci";
734      $INPATH         = $OUTPATH.$PROEXT;
735      $COMEX          = '@COMEX@';
736
737  {   print "Setting OS/2 with 4OS2 specific values... ";
738      # Change path to lower case.
739      $COMPATH        = lc $COMPATH;
740      $PATH_SEPERATOR = ';';
741      $ps = ';';
742      $wps = ';'; # Windows style path seperator
743  }
744
745  }
746}
747elsif ( $platform =~ m/darwin/ )
748{     print "Setting Mac OS X/Darwin specific values... ";
749      $BIG_SVX        = "TRUE";
750      $COM            = "GCC";
751      $COMPATH        = '@COMPATH@';
752      if ($platform =~ m/^i[3456]86/)
753      {
754          print "Setting values for Mac OS X/Darwin on x86... ";
755          $outfile        = "MacOSXX86Env.Set";
756          $CPU            = "I";
757          $CPUNAME        = "INTEL";
758          $OUTPATH        = "unxmacxi";
759      }
760      elsif ($platform =~ m/^powerpc/)
761      {
762          print "Setting values for Mac OS X/Darwin on PowerPC... ";
763          $outfile        = "MacOSXPPCEnv.Set";
764          $CPU            = "P";
765          $CPUNAME        = "POWERPC";
766          $OUTPATH        = "unxmacxp";
767      }
768      if (@GCCVER@ >= 30401) {
769	  $CVER           = "C341";
770      } else {
771	  $CVER           = "C300";
772      }
773      $GUI            = "UNX";
774      $GVER           = "VCL";
775      $INPATH         = $OUTPATH.$PROEXT;
776      $OS             = "MACOSX";
777      $PATH_SEPERATOR = $ps;
778      # GUIBASE is set below; may be "aqua" or "unx".
779}
780elsif ( $platform =~ m/aix/ )
781{
782   if( $platform !~ m/^powerpc/ )
783   {
784	print "\nAIX has only been ported and tested on powerpc\n";
785	AddWarning( "set_soenv", "Platform $platform has not been tested");
786   }
787   print "Setting AIX PPC specific values... ";
788   $outfile        = "aixPPCEnv.Set";
789   $CPU            = "P";
790   $CPUNAME        = "POWERPC";
791   $OUTPATH        = "unxlngppc";
792   $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
793   $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
794   $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
795   $BIG_SVX        = "TRUE";
796   $COM            = "GCC";
797   $CVER           = "C300";
798   $COMPATH        = '@COMPATH@';
799   $GUI            = "UNX";
800   $GUIBASE        = "unx";
801   $GVER           = "VCL";
802   $INPATH         = $OUTPATH.$PROEXT;
803   $OS             = "AIX";
804   $PATH_SEPERATOR = $ps;
805}
806else {
807	print "\nset_soenv:  Cannot figure out what platform you are running\n";
808	print "For $platform.\n";
809	exit 1;
810}
811print "done\n";
812
813#
814# D. Gathering directory information from the user.
815#
816# If the directory does not exist something is strange.
817# 1. OpenOffice.org build home directory.
818chomp($SRC_ROOT  = `pwd`);
819$SRC_ROOT =~ s/\/config_office//;
820$SRC_ROOT = PathFormat($SRC_ROOT);
821CheckPathExist( $SRC_ROOT );
822
823
824#-----------------------------------------------------------------------------------------------------
825# Copy top level makefile from config_office/ to $SRC_ROOT
826#-----------------------------------------------------------------------------------------------------
827if (! -e "makefile.rc")
828{  AddWarning( "set_soenv", "makefile.rc not found in config_office/. Could not copy to SRC_ROOT." );
829}
830else
831{  `cp -f makefile.rc $SRC_ROOT/makefile.mk`;
832}
833
834# 2. Java home directory.
835# JAVA_HOME as argument from autoconf.
836$JAVA_HOME = PathFormat('@JAVA_HOME@') ;
837
838if ( $platform =~ m/cygwin|os2/ ) {
839   $JAVA_HOME =~ s/[\s\/]+$//;	# remove trailing \n or \/ if there is any.
840}
841# 3. shell path.
842$OOO_SHELL = '@SHELLPATH@'."\/bash";
843
844if ( '@STLPORT4@' eq $no_stl )
845{
846   $STLPORT4 = "$no_stl";
847}
848
849# ml.exe assembler path for Windows users.
850if ($platform =~ m/cygwin/)
851{  $ASM_PATH = PathFormat('@ASM_HOME@');
852}
853
854# Check for prebuild mozab libraries if we don't build them # ourselves
855# and we're also not using the external system mozilla installation.
856#
857# FIXME! This check should be done in configure and not here, but
858# the $OS, $COM, $CPU variables are not yet present there.
859#
860if ( "@WITH_MOZILLA@" eq "YES" and "@BUILD_MOZAB@" ne "TRUE" and "@SYSTEM_MOZILLA@" ne "YES" )
861{  print("\nChecking for prebuilt Mozilla libraries ...");
862   my $mozbinfile = $SRC_ROOT."/moz/zipped/";
863   if ( $^O eq 'MSWin32' ) {
864       chomp( $mozbinfile = qx{cygpath -d "$mozbinfile"} );
865   }
866   $mozbinfile .= $OS.$COM.$CPU;
867   if ( -e $mozbinfile."inc.zip"
868        and -e $mozbinfile."lib.zip"
869        and -e $mozbinfile."runtime.zip" )
870   {   print " found.\n";
871       $PREBUILD_MOZAB = "YES";
872   }
873   else
874   {   print " not found!\n\n";
875       print "If you don\'t use the system mozilla and also not build the needed\n";
876       print "mozilla libraries yourself you have to provide the needed files\n";
877       print "$OS$COM$CPU\{inc,lib,runtime\}.zip in moz/zipped/ .\n";
878       print "These files can be found here:\n";
879       print "  <http://tools.openoffice.org/moz_prebuild/680/>.\n\n";
880       die;
881   }
882}
883else
884{
885   $PREBUILD_MOZAB = "";
886}
887
888#
889# E. Determining the envionment values based on the information
890#    that was gathered earlier on.
891#
892print "Setting the environment variables... ";
893$USR                  = $ds."usr";
894$ETC                  = $ds."etc";
895$BIN                  = $ds."bin";
896$LIB                  = $ds."lib";
897$LIB64                = $ds."lib";
898$LIB64               .= "64"
899if ($platform =~ m/x86_64-.*-linux/);
900$LIB64               .= "64"
901if (($platform =~ m/powerpc64-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
902$LIB64               .= "64"
903if (($platform =~ m/s390x-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
904$INC                  = $ds."inc";
905$INCLUDE              = $ds."include";
906$DEV                  = $ds."dev";
907$OPT                  = $ds."opt";
908$LOCAL                = $ds."local";
909$SOLENV               = $ds."solenv";
910$SOLVER               = $ds."solver";
911$CONFIG               = $ds."config";
912$USR_BIN              = $USR.$BIN;
913$USR_LIB              = $USR.$LIB64;
914$USR_LOCAL            = $USR.$ds."local";
915$USR_CCS              = $USR.$ds."ccs";
916$USR_OPENWIN          = $USR.$ds."openwin";
917$USR_DT               = $USR.$ds."dt";
918$COMMON_BUILD_TOOLS   = '$SRC_ROOT'.$ds."external".$ds."common";
919
920# Generate alternate output file for sh?
921$outfile_sh = $outfile.".sh";
922
923if ($GUI eq "OS2")
924{
925   # Generate output file for 4os2?
926   $outfile_bat = $outfile;
927   $outfile_bat =~ s/set$/cmd/i;
928}
929
930if ($STLPORT4 ne $no_stl) {
931	$ps_STLPORT_LIB		= $ps.'$STLPORT4'.$LIB64;
932	$L_STLPORT_LIB		= $L.'$STLPORT4'.$LIB64;
933	$STLPORT_stlport 	= $I.'$STLPORT4'.$ds.'stlport';
934	$STLPORT_inc_stlport	= $I.'$STLPORT4'.$ds.'include'.$ds.'stlport';
935} else {
936        $ps_STLPORT_LIB         = "";
937        $L_STLPORT_LIB          = "";
938        $STLPORT_stlport        = $I.$SRC_ROOT.$SOLVER.$ds.$UPD.$ds.$INPATH.$INC.$ds."stl";
939        $STLPORT_inc_stlport    = "";
940}
941
942
943# Windows NT only variables
944if ($platform =~ m/cygwin/)
945{
946   if ( $JAVA_HOME ne "" )
947   {
948      $JAVA_LIB             = $JAVA_HOME.$LIB;
949   }
950   # Import SystemDrive enviroment variable
951   use Env qw(SYSTEMDRIVE);
952   # Change $SYSTEMDRIVE to lower case.
953   $SYSTEMDRIVE          = lc $SYSTEMDRIVE;
954   use Env qw(SYSTEMROOT);
955   $CYGWIN_PATH          = PathFormat('@CYGWIN_PATH@'); # Windows bash path
956   $WIN_GREP             = '$CYGWIN_PATH'.$ds."grep.exe";
957   $WIN_FIND             = '$CYGWIN_PATH'.$ds."find.exe";
958   $WIN_LS               = '$CYGWIN_PATH'.$ds."ls.exe";
959   $WIN_GNUCOPY          = '$CYGWIN_PATH'.$ds."cp.exe";
960   $WIN_TOUCH            = '$CYGWIN_PATH'.$ds."touch.exe";
961}
962
963if ( $JAVA_HOME ne "" )
964{
965   $JAVA_BIN             = $JAVA_HOME.$BIN;
966   $JAVA_INCLUDE         = $JAVA_HOME.$ds."include";
967}
968
969
970$PERL                 = PathFormat('@PERL@'); # Perl program
971$PERL_PATH            = dirname('@PERL@'); # Perl Path
972$XLIB                 = PathFormat('@XLIB@'); # X11 libraries
973$XINC                 = PathFormat('@XINC@'); # X11 includes
974
975
976# Mac OS X/Darwin only variables.
977if ( $platform =~ m/darwin/ )
978{  $FRAMEWORKSHOME       = $ds."Developer".$ds."SDKs".$ds."MacOSX10.4u.sdk".$ds."System".$ds."Library".$ds."Frameworks";
979   if ( $XLIB eq "no_x_libraries" ) {
980      $GUIBASE  = "aqua";
981   } else {
982      $GUIBASE  = "unx";
983   }
984}
985
986# The project's workstamp.
987$WORK_STAMP            = "@SOURCEVERSION@";
988# Location of the source.
989$SOLARSRC             = '$SRC_ROOT';
990# Location of the repository.
991my @splitlist = split( /\//, $SRC_ROOT );
992pop @splitlist;
993$SOURCE_ROOT_DIR      = join("/", @splitlist);
994
995# default TARFILE_LOCATION
996if ('@TARFILE_LOCATION@' eq "DEFAULT")
997{	$TARFILE_LOCATION="$SOURCE_ROOT_DIR/ext_sources";
998}
999
1000#
1001$DEVROOT              = '$SRC_ROOT';
1002# Set solenv and solver to given or default values.
1003# Location of the solenv tree.
1004if ('@LOCAL_SOLENV@' eq "DEFAULT")
1005{  $SOLARENV          = $SRC_ROOT.$SOLENV;
1006}
1007else
1008{  $SOLARENV          =  PathFormat('@LOCAL_SOLENV@');
1009}
1010# Location of the solver tree.
1011if ('@LOCAL_SOLVER@' eq "DEFAULT")
1012{  $SOLARVER          = $SRC_ROOT.$SOLVER.$ds.$UPD;
1013}
1014else
1015{  $SOLARVER          = PathFormat('@LOCAL_SOLVER@').$ds.$UPD;
1016}
1017#Location of Solar version.
1018$SOLARVERSION         = '$SOLARVER';
1019
1020#Location of gnu make directories.
1021$WORKDIR              = '$SOLARVER/$INPATH/workdir';
1022$OUTDIR              = '$SOLARVER/$INPATH';
1023
1024$SOLARENVINC          = '$SOLARENV'.$INC;
1025# Location of
1026$LOCALINI             = '$SOLARENV'.$CONFIG;
1027# Location of
1028$STAR_INIROOT         = '$SOLARENV'.$CONFIG;
1029# Location of
1030$STAR_INIROOTOLD      = '$SOLARENV'.$CONFIG;
1031# Location of
1032$STAR_STANDLST        = '$SOLARENV'.$CONFIG.$ds."stand.lst";
1033# Location of
1034$STAR_SSCOMMON        = '$SOLARENV'.$CONFIG.$ds."ssolar.cmn";
1035# Location of
1036$STAR_SSOLARINI       = '$SOLARENV'.$CONFIG.$ds."ssolar.ini";
1037# Location of dmake resource.
1038$DMAKEROOT            = '$SOLARENVINC'.$ds."startup";
1039# Location of JDK classes .zip file.
1040# but in jdk 1.2 it is called rt.jar and it lives in jre/lib
1041$CLASSPATH            = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
1042# Location of the JDK supported standard classes.zip file.
1043# see above for why the change
1044$XCLASSPATH           = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
1045
1046# Location used by the linker to create libraries.
1047if ($platform =~ m/solaris/)
1048{  $SOLAREXTRALIB     = $L.$par_dir.$LIB.
1049                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$ds."lib.solaris.2.6".
1050                        $L.$LIB.
1051                        $L.$USR.$LIB.
1052                        $L.$USR.$LOCAL.$LIB.
1053                        $L.$USR_DT.$LIB.
1054                        $L.$USR_OPENWIN.$LIB;
1055}
1056elsif ($platform =~ m/linux|netbsd|osf1|freebsd|aix/)
1057{
1058   $SOLAREXTRALIB     = $L.$par_dir.$LIB64;
1059}
1060elsif ($platform =~ m/darwin/)
1061{  $SOLAREXTRALIB     = $L.$LIB.
1062                        $L.$USR.$LIB;
1063}
1064elsif ($platform !~ m/cygwin|os2/ )
1065{  AddWarning( "set_soenv", "$platform not configured for linkage create libraries" );
1066}
1067
1068# Windows NT only variables
1069if ($platform =~ m/cygwin|os2/)
1070{  $COMP_ENV          = $OUTPATH;
1071
1072   $JAVAHOME          = '$JAVA_HOME';
1073
1074   $ILIB             = $cur_dir;
1075
1076   if ($STLPORT4 ne $no_stl) {
1077       $ILIB      .=   $wps.$STLPORT4.$LIB64;
1078   }
1079
1080   # Mingw is different
1081   if ( $COM eq "MSC" )
1082   {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
1083                        $wps.$JAVA_HOME.$LIB.
1084                        $wps.$PSDK_HOME.$LIB.
1085                        $wps.$FRAME_HOME.$LIB.
1086                        $wps.$COMPATH.$LIB;
1087      if ( '@ENABLE_DIRECTX@' ne "" ) {
1088          # We may have DirectX but not DirectDraw
1089          if ( '@ENABLE_DIRECT_DRAW@' ne "") {
1090              $ILIB   .= $wps.$DIRECTXSDK_LIB;
1091              if ( '@COMEX@' eq "10" ) {
1092                  # .NET2003 provides and compiles against DirectX 5 libraries and is
1093                  # hereby still Win9x compatible.
1094                  $ILIB .= $wps.'$COMPATH'.$ds.'PlatformSDK'.$LIB;
1095                  $USE_DIRECTX5 = "YES";
1096              }
1097          }
1098      }
1099      # ILIB needs to use '\' directory seperators;
1100      $ILIB = WinPath( $ILIB, ";" );
1101   }
1102   elsif ( $COM eq "GCC" )
1103   {  $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB.
1104                        $wps.$SOLARVER.$ds.$INPATH.$BIN.
1105                        $wps.$JAVA_HOME.$LIB;
1106      if ( $USE_MINGW eq "cygwin" )
1107      {  $ILIB    .= $wps.PathFormat($USR.$LIB.$ds."mingw").
1108                     $wps.PathFormat($USR.$LIB.$ds."w32api");
1109      }
1110      else
1111      {  $ILIB       .= $wps.$COMPATH.$LIB;
1112      }
1113      $ILIB       .= $wps.PathFormat("@MINGW_CLIB_DIR@").
1114                     $wps.$PSDK_HOME.$LIB;
1115      if ( '@ENABLE_DIRECTX@' )
1116      {   $ILIB   .= $wps.PathFormat("@DIRECTXSDK_LIB@");
1117      }
1118   }
1119
1120   $JAVAHOME          = '$JAVA_HOME';
1121
1122}
1123
1124# The general environment path.
1125if ($platform =~ m/linux|netbsd|odf1|freebsd|aix|solaris/)
1126{  $PATH              = $cur_dir.
1127#                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1128                        $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1129                        $ps.'$SOLARENV'.$BIN;
1130
1131   if ($platform =~ m/solaris/) {
1132	$PATH .= $ps.$USR_CCS.$BIN;
1133   }
1134
1135   $PATH             .= $ps.$oldPATH;
1136
1137   my @javaBits;
1138   if (( $JAVA_HOME ne "" ) && ( $JDK ne "gcj" )) {
1139      @javaBits = ( '$JAVA_HOME'.$BIN, 'javac' );
1140   } else {
1141      @javaBits = ();
1142   }
1143   $PATH              = GetCorrectPath ($PATH,
1144                                        $COMPATH, $CC,
1145                                        $PERL_PATH, 'perl',
1146                                        @javaBits);
1147}
1148
1149elsif ($platform =~ m/cygwin/)
1150{  # The PATH variable is completely created from scratch. Elements
1151   # from oldPATH that are not yet included are appended to PATH at
1152   # the end.
1153
1154   my ( $tmppath );
1155
1156   $PATH              = $cur_dir.
1157#                        $ps.CygFormat($SOLARVER).$ds.$INPATH.$BIN.
1158                        $ps.CygFormat($SOLARENV).$ds."bin".
1159                        $ps.CygFormat($SOLARENV).$ds.$OUTPATH.$BIN;
1160
1161   if ( $JAVA_HOME ne "" )
1162   {
1163      # hack either "hotspot" or "client" should be used, depending on the jdk version:
1164      # 1.2.x   -   no such directory, unsupported
1165      # 1.3.x   -   hotspot, client missing
1166      # 1.4.x   -   client, hotspot missing
1167
1168      $PATH .= $ps.CygFormat($JAVA_HOME).$BIN;
1169	  if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1170		  $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."hotspot";
1171	  }
1172	  if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1173		  $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."client";
1174	  }
1175   }
1176
1177   # Add path to compiler
1178   $tmppath = CygFormat($COMPATH).$BIN;
1179   $tmppath =~ s/^\/\//\//;
1180   $PATH .= $ps.$tmppath;
1181
1182   if ( $COM eq "MSC" ) {
1183       $tmppath = CygFormat($MSPDB_PATH);
1184	   # for .NET to find mspdb71.dll (needed by CL.EXE C/C++ Compiler)
1185	   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1186		   $PATH .= $ps.$tmppath;
1187	   }
1188	   if ( ( $COMEX ge "10" ) ) {
1189		   # .NET needs midl.exe
1190               $tmppath = CygFormat($MIDL_PATH);
1191		   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1192			   $PATH .= $ps.$tmppath;
1193		   }
1194		   # .NET needs csc.exe
1195               $tmppath = CygFormat($CSC_PATH);
1196		   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1197			   $PATH .= $ps.$tmppath;
1198		   }
1199		   # Native installer needs some files if the Windows Installer SDK
1200               $tmppath = CygFormat($PSDK_HOME);
1201		   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1202			   $PATH .= $ps.$tmppath.$BIN;
1203		   }
1204	   }
1205   } else { # Mingw is different
1206	   # Native installer needs some files if the Windows Installer SDK
1207               $tmppath = CygFormat($PSDK_HOME);
1208	   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1209		   $PATH .= $ps.$tmppath.$BIN;
1210	   }
1211   }
1212
1213   if ( $ASM_PATH ne "ASM_IN_PATH" )
1214   {   $PATH          .= $ps.CygFormat($ASM_PATH);
1215   }
1216   # zip.exe / unzip.exe path for Windows users.
1217   my $zip_home_path = PathFormat('@ZIP_HOME@');
1218   $tmppath = CygFormat($zip_home_path);
1219   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1220       $PATH          .= $ps.$tmppath;
1221   }
1222
1223   # Possible cygwin paths must follow behind the OOo and MS paths
1224
1225   # Check if $PERL_PATH is already set in PATH
1226   $tmppath = CygFormat($PERL_PATH);
1227   if ( ! ( $PATH =~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) )
1228   {
1229      $PATH          .= $ps.$tmppath;
1230   }
1231   # Check if $CYGWIN_PATH is already set in PATH
1232   $tmppath = CygFormat($CYGWIN_PATH);
1233   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1234      $PATH           .= $ps.$tmppath;
1235   }
1236   $PATH              .= $ps_STLPORT_LIB;
1237   # nsis path for Windows users.
1238   $NSIS_PATH = PathFormat('@NSIS_PATH@');
1239   $tmppath = CygFormat($NSIS_PATH);
1240   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1241       $PATH          .= $ps.$tmppath;
1242   }
1243   # path to sn.exe (signing) for Windows users.
1244   my $sn_path = PathFormat('@FRAME_HOME@/bin');
1245   $tmppath = CygFormat($sn_path);
1246   if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1247       $PATH          .= $ps.$tmppath;
1248   }
1249
1250
1251   # Add the rest of the original path if it is still missing.
1252   if (($^O eq "cygwin")) { # Not for ActiveState perl
1253       my $expandedPATH = $PATH;
1254       $expandedPATH =~ s/(\$\w+)/$1/eeg;
1255
1256       # fix situations where PATH may look like /bin:"C:\blah\bleh":/ugh
1257       my $fixedPATH = $oldPATH;
1258       if ( $oldPATH =~ /"/ ) {
1259	   $fixedPATH = "";
1260	   foreach my $pathentry ( split( '"',$oldPATH ) ) {
1261	       if ( ( $pathentry =~ /^$ps/ ) || ( $pathentry =~ /$ps$/ ) ) {
1262		   $fixedPATH .= $pathentry;
1263	       } else {
1264		   chomp( $pathentry = qx{cygpath -d "$pathentry"} ) ;
1265		   chomp( $pathentry = qx{cygpath -u "$pathentry"} ) ;
1266		   $fixedPATH .= $pathentry;
1267	       }
1268	   }
1269       }
1270
1271       foreach my $pathentry (split($ps,$fixedPATH)) {
1272           if ( ! ( $expandedPATH =~ /(?:$ps|\A)(?:$pathentry)(?:$ps|\Z)/ ) ) {
1273               $PATH .= $ps.$pathentry;
1274               $expandedPATH .= $ps.$pathentry;
1275           }
1276       }
1277   } else {
1278       $PATH          .= $ps.$oldPATH;
1279   }
1280
1281   # The path now is in cygwin posix format
1282
1283}
1284
1285elsif ($platform =~ m/os2/)
1286{  # The PATH variable is completely created from scratch. Everything that is not
1287   # needed is appended to the end.
1288
1289   $PATH              = $cur_dir.
1290#                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1291                        $ps.'$SOLARENV'.$ds."bin".
1292                        $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN;
1293
1294   if ( $JAVA_HOME ne "" )
1295   {
1296      # hack either "hotspot" or "client" should be used, depending on the jdk version:
1297      # 1.2.x   -   no such directory, unsupported
1298      # 1.3.x   -   hotspot, client missing
1299      # 1.4.x   -   client, hotspot missing
1300
1301      $PATH .= $ps.$JAVA_HOME.$BIN;
1302	  if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1303		  $PATH .= $ps.$JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot";
1304	  }
1305	  if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1306		  $PATH .= $ps.$JAVA_HOME.$ds."jre".$ds."bin".$ds."client";
1307	  }
1308   }
1309
1310  if ( '@ANT_HOME@' ne '' )
1311  {
1312     $PATH .= $ps.'@ANT_HOME@';
1313  }
1314
1315  # Append old PATH
1316  my $temp = $oldPATH;
1317  $temp =~ s/\\/\//g ;
1318  $PATH             .= $ps.$temp;
1319}
1320
1321elsif ($platform =~ m/darwin/)
1322{  $PATH              = $cur_dir.
1323#                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1324                        $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1325                        $ps.'$SOLARENV'.$BIN;
1326
1327  # Append old PATH
1328  $PATH             .= $ps.$oldPATH;
1329}
1330else
1331{  AddWarning( "set_soenv", "$platform not configured for general environment paths" );
1332}
1333
1334# Linker library search directory paths.
1335if ($platform =~ m/solaris/)
1336{  $SOLARLIB          = $L.$par_dir.$LIB.
1337                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1338                        $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1339                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1340                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB."solaris.2.6".
1341                        $L.$LIB.
1342                        $L.$USR_LIB;
1343   if ( $CC =~ "gcc" ) {
1344      $SOLARLIB      .= $L.$COMPATH.$LIB;
1345   }
1346   $SOLARLIB         .= $L.$USR_LOCAL.$LIB.
1347                        $L.$USR_DT.$LIB.
1348                        $L.$USR_OPENWIN.$LIB.
1349                        $L.'$JAVA_HOME'.$LIB.
1350                        $L.$JRELIBDIR.
1351                        $L.$JRETOOLKITDIR.
1352                        $L.$JRETHREADDIR.
1353                        $L_STLPORT_LIB.
1354                        $L.$XLIB;
1355}
1356elsif ($platform =~ m/linux|netbasd|osf1|aix|freebsd/)
1357{  $SOLARLIB          = $L.$par_dir.$LIB.
1358                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1359                        $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1360                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1361                        $L.'$JAVA_HOME'.$LIB64.
1362                        $L.$JRELIBDIR.
1363                        $L.$JRETOOLKITDIR.
1364                        $L.$JRETHREADDIR.
1365                        $L_STLPORT_LIB.
1366                        $L.$XLIB;
1367}
1368elsif ($platform =~ m/cygwin|os2/)
1369{  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1370                        $L.$par_dir.$LIB.
1371                        $L_STLPORT_LIB.
1372                        $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB;
1373}
1374elsif ($platform =~ m/darwin/)
1375{  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1376                        $L_STLPORT_LIB.
1377                        $L.$USR_LIB;
1378    # [ed] 6/15/02 Add in X11 libraries onto the library path
1379    if ($GUIBASE eq "unx") {
1380       $SOLARLIB      .= $L.$XLIB;
1381    }
1382
1383}
1384
1385if ($SYSTEM_MOZILLA eq "YES")
1386{
1387       $SOLARLIB .= $L."@MOZ_LIB@"
1388}
1389
1390# Location of the compiler include search directory paths.
1391$SOLARINC             = $I.$cur_dir.
1392                        $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."stl".
1393                        $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".
1394                        $I.'$SOLARVER'.$ds.'$INPATH'.$INC.
1395                        $I.'$SOLARENV'.$ds.'$OUTPATH'.$INC.
1396                        $I.'$SOLARENV'.$INC.
1397                        $I.'$SRC_ROOT'.$ds."res";
1398
1399if ($platform =~ m/solaris|linux|osf1|freebsd|netbsd/)
1400{
1401$SOLARINC	     .= $STLPORT_stlport;
1402if ($platform =~ m/linux|freebsd|netbsd/)
1403{
1404# This simply adds an include path, so even cases that break the FHS work
1405$SOLARINC            .= $STLPORT_inc_stlport;
1406}
1407if ($platform =~ m/solaris/ && ! $CC =~ "gcc")
1408{
1409$SOLARINC            .= '/SC5 ';
1410}
1411# Platform dependent include path at the top of this list of include paths
1412if ($platform =~ m/solaris/)
1413{
1414    $SOLARINC         .= $I.$COMPATH.$ds."include";
1415}
1416if ($platform =~ m/linux/)
1417{
1418# This simply adds an include path, so even cases that break the FHS work
1419   $SOLARINC         .= $STLPORT_inc_stlport;
1420}
1421
1422
1423   	$SOLARINC      .= $I.'$SOLARENV'.$INC.$ds."Xp31".
1424                     $I.'$JAVA_HOME'.$INCLUDE;
1425
1426	#include system dependent Java include directory
1427	if (!($JDK eq "gcj"))
1428	{
1429   		if ($platform =~ m/solaris/)
1430   		{  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."solaris";
1431   		}
1432   		elsif  ($platform =~ m/linux|osf1/)
1433   		{  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1434   		}
1435   		elsif ($platform =~ m/freebsd/)
1436   		{
1437      		$SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."freebsd";
1438      		$SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."bsd";
1439      		$SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1440   		}
1441   		elsif ($platform =~ m/netbsd/)
1442   		{  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."netbsd";
1443   		}
1444
1445   		#java threads include path
1446
1447   		$SOLARINC .=$I.'$JAVA_HOME'.$INCLUDE.$ds."native_threads".$ds."include";
1448	}
1449    #The tail, if needed
1450    if ($platform =~ m/linux|freebsd|netbsd/)
1451    {  $SOLARINC  .= $I.$XINC;
1452    }
1453    elsif ($platform =~ m/osf1/)
1454    {  $SOLARINC  .= $I.$XINC.
1455                     $I.$USR.$INCLUDE;
1456    }
1457}
1458elsif ($platform =~ m/cygwin/)
1459{  $SOLARINC         .= $STLPORT_stlport.
1460                        $I.'$JAVA_HOME'.$ds."include".$ds."win32".
1461                        $I.'$JAVA_HOME'.$ds."include";
1462   # Mingw is different
1463   if ( $COM eq "MSC" )
1464   {  $SOLARINC       .= $I.'$PSDK_HOME'.$INCLUDE.
1465                         $I.'$COMPATH'.$ds."include";
1466      if ( '@ENABLE_DIRECTX@' ne "" ) {
1467          $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1468          if ( '@COMEX@' eq "10" ) {
1469              # .NET2003 provides and compiles against DirectX 5 libraries and is
1470              # hereby still Win9x compatible.
1471              $SOLARINC .= $I.'$COMPATH'.$ds.'PlatformSDK'.$ds."include";
1472          }
1473      }
1474   }
1475   elsif ( $COM eq "GCC" )
1476   {  $SOLARINC       .= $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".$ds."mingw".$ds."include";
1477     if ( $USE_MINGW eq "cygwin" )
1478     {  $SOLARINC    .= $I.PathFormat($USR.$ds."include".$ds."mingw").
1479                        $I.PathFormat($USR.$ds."include".$ds."w32api").
1480                        $I.PathFormat($USR.$ds."include"); }
1481     else
1482     {  $SOLARINC    .= $I.'$COMPATH'.$ds."include"; }
1483     @mingw_lib_include_paths = split( / /, "@MINGW_LIB_INCLUDE_PATH@" );
1484     $SOLARINC .= $I.PathFormat("@MINGW_BACKWARD_INCLUDE_PATH@");
1485     foreach $mingw_lib_include_path (@mingw_lib_include_paths)
1486       {   chomp $mingw_lib_include_path;
1487           if ( $mingw_lib_include_path ne $COMPATH.$ds."include" && $mingw_lib_include_path ne "" )
1488           {
1489              $SOLARINC   .= $I.PathFormat($mingw_lib_include_path);
1490           }
1491       }
1492     $SOLARINC .= $I.PathFormat("@GXX_INCLUDE_PATH@").$I.PathFormat("@GXX_INCLUDE_PATH@".$ds."mingw32").
1493                  $I.'$PSDK_HOME'.$INCLUDE;
1494   }
1495   if ( '@ENABLE_DIRECTX@' ne "" ) {
1496       $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1497   }
1498}
1499elsif ($platform =~ m/darwin/)
1500{  $SOLARINC         .= $STLPORT_stlport.
1501						$I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Versions".$ds."Current".$ds."Headers".
1502                        $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Headers";
1503   # [ed] 6/15/02 Add in X11 headers as appropriate for the build
1504   if ($GUIBASE eq "unx") {
1505      $SOLARINC      .= $I.$XINC.
1506                        $I.$XINC.$ds."freetype2";
1507   }
1508}
1509else
1510{  AddWarning( "set_soenv", "$platform not configured for system dependant include dir" );
1511}
1512
1513#
1514print "done\n";
1515$gb_REPOS = $SRC_ROOT;
1516my $BUILD_TYPE = "@BUILD_TYPE@";
1517
1518if ('@WITH_LANG@' ne "")
1519{
1520    $gb_REPOS .= " ".$SOURCE_ROOT_DIR."/extras";
1521    $BUILD_TYPE = "@BUILD_TYPE@ L10N";
1522}
1523
1524#
1525# F. Setting the different aliases.
1526#
1527print "Setting the aliases... ";
1528# 1. alias for a full product make.
1529	$mkout           = '"perl $SOLARENV/bin/mkout.pl"';
1530	$deliver         = '"perl $SOLARENV/bin/deliver.pl"';
1531	$build           = '"perl $SOLARENV/bin/build.pl"';
1532	$build_client    = '"perl $SOLARENV/bin/build_client.pl"';
1533	$zipdep          = '"perl $SOLARENV/bin/zipdep.pl"';
1534# 3. alias for a full product make
1535$nmake           = '"dmake"';
1536print "done\n";
1537#
1538#--------------------------
1539# VI. Open the output file.
1540#--------------------------
1541#
1542open( OUT, ">$outfile" ) ||
1543   die "Cannot open $outfile: $!\n";
1544
1545# Create sh environment file
1546open( OUT_SH, ">$outfile_sh" ) ||
1547  die "Cannot open $outfile_sh: $!\n";
1548
1549if(defined($outfile_bat))
1550{  # Create bat environment file
1551   open( OUT_BAT, ">$outfile_bat" ) ||
1552   die "Cannot open $outfile_bat: $!\n";
1553}
1554
1555#
1556#------------------------------------------
1557# VII. Writing the data to the output file.
1558#------------------------------------------
1559#
1560# Write file header.
1561CreateFileHeader( *OUT, $UPD, $platform, "(t)csh", "#" );
1562CreateFileHeader( *OUT_SH, $UPD, $platform, "sh/bash/ksh", "#" );
1563CreateFileHeader( *OUT_BAT, $UPD, $platform, "4nt", "rem" ) if defined($outfile_bat);
1564
1565ToFile( "SRC_ROOT",	     $SRC_ROOT,          "e" );
1566ToFile( "OOO_SHELL",         $OOO_SHELL,         "e" );
1567ToFile( "JAVA_HOME",         $JAVA_HOME,         "e" );
1568ToFile( "ANT_HOME",          PathFormat("@ANT_HOME@"), "e" );
1569ToFile( "ANT_LIB",           PathFormat("@ANT_LIB@"), "e" );
1570ToFile( "ANT",               PathFormat("@ANT@"), "e" );
1571ToFile( "JDKLIB",            $JAVA_LIB,          "e" );
1572ToFile( "STLPORT4",          $STLPORT4,          "e" );
1573ToFile( "STLPORT_VER",       "@STLPORT_VER@",    "e" );
1574ToFile( "ASM_PATH",          $ASM_PATH,          "e" );
1575ToFile( "BUILD_SOSL",        $BUILD_SOSL,        "e" );
1576ToFile( "FRAMEWORKSHOME",    $FRAMEWORKSHOME,    "e" );
1577ToFile( "Empty",             $empty,             "n" );
1578
1579#
1580# Writing the platform independent constant values to file.
1581# (c = comment, e = environment variable, a = alias )
1582ToFile( "Platform independent constant values.", $empty, "c" );
1583# dictionaries
1584if ('@WITH_DICT@' =~ m/ALL,/s)
1585{
1586   foreach $dict (@DICTIONARIES)
1587   {
1588      ToFile( "DIC_$dict",     "TRUE",          "e" );
1589   }
1590   ToFile( "DIC_ALL",          "TRUE",          "e" );
1591}
1592else
1593{
1594   foreach $dict (@DICTIONARIES)
1595   {   if ('@WITH_DICT@' =~ m/$dict,/s)
1596       {   my $val="TRUE";
1597           ToFile( "DIC_$dict",     $val,          "e" );
1598       }
1599       else
1600       {   my $val;
1601           undef $val;
1602           ToFile( "DIC_$dict",     $val,          "e" );
1603       }
1604   }
1605}
1606# Languages
1607ToFile( "WITH_LANG",         "@WITH_LANG@",      "e" );
1608ToFile( "INTRO_BITMAPS",     "@INTRO_BITMAPS@",  "e" );
1609ToFile( "ABOUT_BITMAPS",     "@ABOUT_BITMAPS@",  "e" );
1610ToFile( "OOO_VENDOR",        "@OOO_VENDOR@",     "e" );
1611ToFile( "OOODMAKEMODE",      "YES",              "e" );
1612ToFile( "WITH_POOR_HELP_LOCALIZATIONS", "@WITH_POOR_HELP_LOCALIZATIONS@", "e" );
1613
1614ToFile( "CALL_CDECL",        $CALL_CDECL,        "e" );
1615ToFile( "COMMON_OUTDIR",     $COMMON_OUTDIR,     "e" );
1616ToFile( "common_build",      $common_build,      "e" );
1617ToFile( "BMP_WRITES_FLAG",   $BMP_WRITES_FLAG,   "e" );
1618ToFile( "BUILD_SOSL_RELEASE", $BUILD_SOSL_RELEASE, "e" );
1619ToFile( "NO_REC_RES",        $NO_REC_RES,        "e" );
1620ToFile( "SO3",               $SO3,               "e" );
1621ToFile( "SOLAR_PLUGIN",      $SOLAR_PLUGIN,      "e" );
1622ToFile( "UPDATER",           $UPDATER,           "e" );
1623ToFile( "build_deliver",     $BUILD_DELIVER,     "e" );
1624ToFile( "VCL",               $VCL,               "e" );
1625ToFile( "ENABLEUNICODE",     $ENABLEUNICODE,     "e" );
1626ToFile( "NEW_JAR_PACK",      $NEW_JAR_PACK,      "e" );
1627ToFile( "NO_BSYMBOLIC",      $NO_BSYMBOLIC,      "e" );
1628ToFile( "TF_FILTER",         "TRUE",             "e" );
1629if ("@ENABLE_DEBUG@" eq "TRUE") {
1630ToFile( "debug",             "true",             "e" );
1631}
1632if ("@ENABLE_WERROR@" eq "FALSE") {
1633ToFile( "EXTERNAL_WARNINGS_NOT_ERRORS", "TRUE",  "e" );
1634}
1635ToFile( "PRODUCT",           "@PRODUCT@",        "e" );
1636ToFile( "PROFULLSWITCH",     "@PROFULLSWITCH@",  "e" );
1637ToFile( "PROEXT",            $PROEXT,            "e" );
1638ToFile( "VALGRIND_CFLAGS",   "@VALGRIND_CFLAGS@",  "e" );
1639ToFile( "UNIXWRAPPERNAME",   "@UNIXWRAPPERNAME@","e" );
1640ToFile( "BUILD_MOZAB",       "@BUILD_MOZAB@",    "e" );
1641ToFile( "PREBUILD_MOZAB",    $PREBUILD_MOZAB,    "e" );
1642ToFile( "MOZILLA_VERSION",   $MOZILLA_VERSION,   "e" );
1643ToFile( "DEFAULT_MOZILLA_TOOLKIT", $MOZILLA_TOOLKIT, "e" );
1644ToFile( "ENABLE_NSS_MODULE",  "@ENABLE_NSS_MODULE@", "e" );
1645ToFile( "MOZILLABUILD",  "@MOZILLABUILD@", "e" );
1646ToFile( "BUILD_VER_STRING",  "@BUILD_VER_STRING@", "e" );
1647if ($platform =~ m/linux/ && $platform =~ m/powerpc/) {
1648ToFile( "JITC_PROCESSOR_TYPE","6",                 "e" );
1649}
1650ToFile( "DEFAULT_TO_ENGLISH_FOR_PACKING",  "yes", "e" );
1651ToFile( "ENABLE_GTK",        "@ENABLE_GTK@",       "e" );
1652ToFile( "GTK_CFLAGS",        "@GTK_CFLAGS@",       "e" );
1653ToFile( "GTK_LIBS",          "@GTK_LIBS@",         "e" );
1654ToFile( "GTHREAD_CFLAGS",        "@GTHREAD_CFLAGS@",       "e" );
1655ToFile( "GTHREAD_LIBS",          "@GTHREAD_LIBS@",         "e" );
1656ToFile( "ENABLE_SYSTRAY_GTK", "@ENABLE_SYSTRAY_GTK@", "e" );
1657ToFile( "ENABLE_STATIC_GTK", "@ENABLE_STATIC_GTK@", "e" );
1658ToFile( "ENABLE_GSTREAMER",  "@ENABLE_GSTREAMER@", "e" );
1659ToFile( "ENABLE_CAIRO",      "@ENABLE_CAIRO@",     "e" );
1660ToFile( "ENABLE_CAIRO_CANVAS", "@ENABLE_CAIRO_CANVAS@",     "e" );
1661ToFile( "ENABLE_OPENGL",     "@ENABLE_OPENGL@",    "e" );
1662ToFile( "ENABLE_PDFIMPORT",  "@ENABLE_PDFIMPORT@", "e" );
1663ToFile( "ENABLE_PRESENTER_EXTRA_UI","@ENABLE_PRESENTER_EXTRA_UI@","e" );
1664ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
1665ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
1666ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
1667ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
1668ToFile( "OOO_JUNIT_JAR",     "@OOO_JUNIT_JAR@",    "e" );
1669ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
1670ToFile( "LIBXML_JAR",        "@LIBXML_JAR@",       "e" );
1671ToFile( "FLUTE_JAR",         "@FLUTE_JAR@",        "e" );
1672ToFile( "JFREEREPORT_JAR",   "@JFREEREPORT_JAR@",  "e" );
1673ToFile( "LIBLAYOUT_JAR",     "@LIBLAYOUT_JAR@",    "e" );
1674ToFile( "LIBLOADER_JAR",     "@LIBLOADER_JAR@",    "e" );
1675ToFile( "LIBFORMULA_JAR",    "@LIBFORMULA_JAR@",   "e" );
1676ToFile( "LIBREPOSITORY_JAR", "@LIBREPOSITORY_JAR@","e" );
1677ToFile( "LIBBASE_JAR",       "@LIBBASE_JAR@",      "e" );
1678ToFile( "LIBFONTS_JAR",      "@LIBFONTS_JAR@",     "e" );
1679ToFile( "LIBSERIALIZER_JAR", "@LIBSERIALIZER_JAR@","e" );
1680ToFile( "ENABLE_MEDIAWIKI",  "@ENABLE_MEDIAWIKI@", "e" );
1681ToFile( "SYSTEM_APACHE_COMMONS","@SYSTEM_APACHE_COMMONS@","e" );
1682ToFile( "COMMONS_CODEC_JAR", "@COMMONS_CODEC_JAR@","e" );
1683ToFile( "COMMONS_LANG_JAR",  "@COMMONS_LANG_JAR@", "e" );
1684ToFile( "COMMONS_HTTPCLIENT_JAR","@COMMONS_HTTPCLIENT_JAR@","e" );
1685ToFile( "COMMONS_LOGGING_JAR","@COMMONS_LOGGING_JAR@","e" );
1686ToFile( "SYSTEM_SERVLETAPI", "@SYSTEM_SERVLETAPI@", "e" );
1687ToFile( "SERVLETAPI_JAR",    "@SERVLETAPI_JAR@",   "e" );
1688ToFile( "ENABLE_DBUS",       "@ENABLE_DBUS@",      "e" );
1689ToFile( "ENABLE_GCONF",      "@ENABLE_GCONF@",     "e" );
1690ToFile( "ENABLE_GNOMEVFS",   "@ENABLE_GNOMEVFS@",  "e" );
1691ToFile( "ENABLE_GIO",        "@ENABLE_GIO@",       "e" );
1692ToFile( "ENABLE_KDE",        "@ENABLE_KDE@",       "e" );
1693ToFile( "KDE_CFLAGS",        "@KDE_CFLAGS@",       "e" );
1694ToFile( "KDE_LIBS",          "@KDE_LIBS@",         "e" );
1695ToFile( "MOC",               "@MOC@",              "e" );
1696ToFile( "ENABLE_KDE4",       "@ENABLE_KDE4@",      "e" );
1697ToFile( "KDE4_CFLAGS",       "@KDE4_CFLAGS@",      "e" );
1698ToFile( "KDE4_LIBS",         "@KDE4_LIBS@",        "e" );
1699ToFile( "MOC4",              "@MOC4@",             "e" );
1700ToFile( "ENABLE_KAB",        "@ENABLE_KAB@",       "e" );
1701ToFile( "PSPRINT",           "TRUE",             "e" );
1702ToFile( "MKDEPENDSOLVER",    "TRUE",             "e" );
1703ToFile( "nodep",             "@nodep@",          "e" );
1704ToFile( "TARFILE_LOCATION",  $TARFILE_LOCATION,  "e" );
1705ToFile( "DO_FETCH_TARBALLS", "@DO_FETCH_TARBALLS@",  "e" );
1706#
1707# Writing the platform dependent constant values to file.
1708# (c = comment, e = environment variable, a = alias )
1709ToFile( "Platform dependent constant values.", $empty, "c" );
1710ToFile( "SOLAR_JAVA",        $SOLAR_JAVA,        "e" );
1711ToFile( "BIG_SVX",           $BIG_SVX,           "e" );
1712ToFile( "COM",               $COM,               "e" );
1713ToFile( "COMPATH",           $COMPATH,           "e" );
1714ToFile( "CPU",               $CPU,               "e" );
1715ToFile( "CPUNAME",           $CPUNAME,           "e" );
1716ToFile( "CVER",              $CVER,              "e" );
1717ToFile( "GUI",               $GUI,               "e" );
1718ToFile( "GLIBC",             $GLIBC,             "e" );
1719ToFile( "GUIBASE",           $GUIBASE,           "e" );
1720ToFile( "GVER",              $GVER,              "e" );
1721ToFile( "OS",                $OS,                "e" );
1722ToFile( "OSVERSION",         $OSVERSION,         "e" );
1723ToFile( "PTHREAD_CFLAGS",    "@PTHREAD_CFLAGS@", "e" );
1724ToFile( "PTHREAD_LIBS",      "@PTHREAD_LIBS@",   "e" );
1725ToFile( "OUTPATH",           $OUTPATH,           "e" );
1726ToFile( "INPATH",            $INPATH,            "e" );
1727ToFile( "PATH_SEPERATOR",    $PATH_SEPERATOR,    "e" );
1728ToFile( "COMEX",             $COMEX,             "e" );
1729ToFile( "CDPATHx",           $CDPATHx,           "e" );
1730ToFile( "DYNAMIC_CRT",       $DYNAMIC_CRT,       "e" );
1731ToFile( "SET_EXCEPTIONS",    $SET_EXCEPTIONS,    "e" );
1732ToFile( "use_shl_versions",  $use_shl_versions,  "e" );
1733ToFile( "FLIPCMD",           $FLIPCMD,           "e" );
1734ToFile( "ARM_TARGET",        "@ARM_TARGET@",     "e" );
1735if ( $platform =~ m/darwin/ )
1736{
1737# MAXOSX_DEPLOYMENT_TARGET : The minimum version required to run the build,
1738# build can assume functions/libraries of that version to be available
1739# unless you want to do runtime checks for 10.5 api, you also want to use the 10.4 sdk
1740# (safer/easier than dealing with the MAC_OS_X_VERSION_MAX_ALLOWED macro)
1741# http://developer.apple.com/technotes/tn2002/tn2064.html
1742    ToFile( "MACOSX_DEPLOYMENT_TARGET",       "10.4",       "e" );
1743}
1744
1745#
1746# Writing the variables to file.
1747# (c = comment, e = environment variable, a = alias, n = newline )
1748ToFile( "Variable values.",  $empty,             "c" );
1749if ( $platform =~ m/cygwin/ )
1750{  ToFile( "CYGWIN_PATH",       $CYGWIN_PATH,       "e" );
1751   ToFile( "PSDK_HOME",         $PSDK_HOME,         "e" );
1752   ToFile( "WINDOWS_VISTA_PSDK","@WINDOWS_VISTA_PSDK@","e" );
1753   ToFile( "DIRECTXSDK_LIB",    $DIRECTXSDK_LIB,    "e" );
1754   ToFile( "USE_DIRECTX5",      $USE_DIRECTX5,      "e" );
1755   ToFile( "ATL_LIB",           $ATL_LIB,         "e" );
1756   if ( $MINGW ne "yes" )
1757   {  ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
1758   }
1759   ToFile( "MFC_LIB",           $MFC_LIB,         "e" );
1760   ToFile( "MFC_INCLUDE",       $MFC_INCLUDE,       "e" );
1761   ToFile( "NSIS_PATH",         $NSIS_PATH,         "e" );
1762   ToFile( "DISABLE_ACTIVEX",   "@DISABLE_ACTIVEX@","e" );
1763   ToFile( "DISABLE_ATL",   "@DISABLE_ATL@","e" );
1764   ToFile( "USE_NEW_SDK",       $USE_NEW_SDK,       "e" );
1765
1766   # Hack around dmake's mktmp not generating DOS paths.
1767   my $tmpdir = qx{cygpath -m "/tmp"};
1768   chomp($tmpdir);
1769   ToFile( "TMPDIR",     $tmpdir,            "e" );
1770}
1771ToFile( "DISABLE_SAXON",	"@DISABLE_SAXON@", "e" );
1772ToFile( "DISABLE_HUNSPELL",	"@DISABLE_HUNSPELL@", "e" );
1773ToFile( "DISABLE_HYPHEN",	"@DISABLE_HYPHEN@", "e" );
1774ToFile( "DISABLE_LIBWPD",	"@DISABLE_LIBWPD@", "e" );
1775
1776
1777ToFile( "PERL",              $PERL,              "e" );
1778ToFile( "RPM",               "@RPM@",            "e" );
1779ToFile( "DPKG",              "@DPKG@",           "e" );
1780ToFile( "PKGMK",             "@PKGMK@",          "e" );
1781ToFile( "GNUMAKE",           "@GNUMAKE@",        "e" );
1782ToFile( "GNUTAR",            "@GNUTAR@",         "e" );
1783ToFile( "UPD",               $UPD,               "e" );
1784ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
1785ToFile( "SOLARVER",          $SOLARVER,          "e" );
1786ToFile( "SOLARVERSION",      $SOLARVERSION,      "e" );
1787ToFile( "WORKDIR",           $WORKDIR,           "e" );
1788ToFile( "OUTDIR",            $OUTDIR,            "e" );
1789ToFile( "SOLARENV",          $SOLARENV,          "e" );
1790ToFile( "SOLARENVINC",       $SOLARENVINC,       "e" );
1791ToFile( "LOCALINI",          $LOCALINI,          "e" );
1792ToFile( "STAR_INIROOT",      $STAR_INIROOT,      "e" );
1793ToFile( "STAR_INIROOTOLD",   $STAR_INIROOTOLD,   "e" );
1794ToFile( "STAR_STANDLST",     $STAR_STANDLST,     "e" );
1795ToFile( "STAR_SSCOMMON",     $STAR_SSCOMMON,     "e" );
1796ToFile( "STAR_SSOLARINI",    $STAR_SSOLARINI,    "e" );
1797ToFile( "DMAKEROOT",         $DMAKEROOT,         "e" );
1798if ( $JDK ne "gcj" ) {
1799   ToFile( "CLASSPATH",         $CLASSPATH,         "e" );
1800   ToFile( "XCLASSPATH",        $XCLASSPATH,        "e" );
1801}
1802else {
1803   ToFile( "JAVACISGCJ",       '@JAVACISGCJ@',      "e" );
1804}
1805if ( $GUI eq "UNX" ) {
1806   ToFile( "AWTLIB",           '@AWTLIB@',          "e" );
1807}
1808if ( '@JDK@' ne '' )
1809{
1810   ToFile( "JDK",             "@JDK@",           "e" );
1811   ToFile( "JAVAFLAGS",             "@JAVAFLAGS@",           "e" );
1812   ToFile( "JAVAINTERPRETER", PathFormat("@JAVAINTERPRETER@"), "e" );
1813   ToFile( "JAVAIFLAGS",      "@JAVAIFLAGS@",    "e" );
1814   ToFile( "JAVACOMPILER",    PathFormat("@JAVACOMPILER@"), "e" );
1815   ToFile( "JAVAAOTCOMPILER", PathFormat("@JAVAAOTCOMPILER@"), "e" );
1816   ToFile( "JAVADOC",         PathFormat("@JAVADOC@"), "e" );
1817}
1818ToFile( "SCPDEFS",           '@SCPDEFS@',        "e" );
1819ToFile( "SOLAREXTRAINC",     $SOLAREXTRAINC,     "e" );
1820ToFile( "SOLAREXTRALIB",     $SOLAREXTRALIB,     "e" );
1821ToFile( "PATH",              $PATH,              "e" );
1822ToFile( "SOLARLIB",          $SOLARLIB,          "e" );
1823ToFile( "SOLARINC",          $SOLARINC,          "e" );
1824ToFile( "COMP_ENV",          $COMP_ENV,          "e" );
1825ToFile( "JAVAHOME",          $JAVAHOME,          "e" );
1826ToFile( "CC",                $CC,                "e" );
1827ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
1828		"@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
1829ToFile( "HAVE_LD_HASH_STYLE","@HAVE_LD_HASH_STYLE@","e" );
1830ToFile( "HAVE_LD_BSYMBOLIC_FUNCTIONS",
1831		"@HAVE_LD_BSYMBOLIC_FUNCTIONS@","e" );
1832ToFile( "CXX",               $CXX,               "e" );
1833ToFile( "USE_CCACHE",        "@USE_CCACHE@",     "e" );
1834ToFile( "MINGWCXX",          "@MINGWCXX@",       "e" );
1835ToFile( "MINGWSTRIP",        "@MINGWSTRIP@",     "e" );
1836ToFile( "USE_SYSTEM_STL",    "@USE_SYSTEM_STL@", "e" );
1837ToFile( "ALLOC",             "@ALLOC@",          "e" );
1838ToFile( "ENABLE_SYMBOLS",    "@ENABLE_SYMBOLS@",    "e" );
1839ToFile( "DISABLE_STRIP",     "@DISABLE_STRIP@",     "e" );
1840ToFile( "LFS_CFLAGS",        "@LFS_CFLAGS@",     "e" );
1841ToFile( "ENABLE_CRASHDUMP",  "@ENABLE_CRASHDUMP@",  "e" );
1842ToFile( "ENABLE_CUPS",       "@ENABLE_CUPS@",       "e" );
1843ToFile( "ENABLE_RANDR",      "@ENABLE_RANDR@",      "e" );
1844ToFile( "ENABLE_FONTCONFIG", "@ENABLE_FONTCONFIG@", "e" );
1845ToFile( "ENABLE_DIRECTX",    "@ENABLE_DIRECTX@",    "e" );
1846ToFile( "ENABLE_DIRECT_DRAW","@ENABLE_DIRECT_DRAW@","e" );
1847ToFile( "ENABLE_LAYOUT",     "@ENABLE_LAYOUT@",     "e" );
1848ToFile( "ENABLE_PCH",        "@ENABLE_PCH@",       "e" );
1849ToFile( "ENABLE_GRAPHITE",   "@ENABLE_GRAPHITE@",   "e");
1850ToFile( "SYSTEM_GRAPHITE",   "@SYSTEM_GRAPHITE@",   "e");
1851ToFile( "GRAPHITE_LIBS",     "@GRAPHITE_LIBS@",     "e");
1852ToFile( "GRAPHITE_CFLAGS",   "@GRAPHITE_CFLAGS@",   "e");
1853ToFile( "VC_STANDARD",       "@VC_STANDARD@",      "e" );
1854ToFile( "WITH_MYSPELL_DICTS","@WITH_MYSPELL_DICTS@","e");
1855ToFile( "SYSTEM_DICTS",      "@SYSTEM_DICTS@",     "e");
1856ToFile( "DICT_SYSTEM_DIR",   "@DICT_SYSTEM_DIR@",  "e");
1857ToFile( "HYPH_SYSTEM_DIR",   "@HYPH_SYSTEM_DIR@",  "e");
1858ToFile( "THES_SYSTEM_DIR",   "@THES_SYSTEM_DIR@",  "e");
1859ToFile( "ENABLE_LOCKDOWN",   "@ENABLE_LOCKDOWN@",  "e" );
1860ToFile( "WITH_LDAP",         "@WITH_LDAP@",        "e" );
1861ToFile( "WITH_OPENLDAP",     "@WITH_OPENLDAP@",    "e" );
1862ToFile( "WITH_MOZILLA",      "@WITH_MOZILLA@",     "e" );
1863ToFile( "SYSTEM_MOZILLA",    "@SYSTEM_MOZILLA@",   "e" );
1864ToFile( "MOZ_FLAVOUR",       "@MOZ_FLAVOUR@",      "e" );
1865ToFile( "NSPR_LIB",          "@NSPR_LIB@",         "e" );
1866ToFile( "NSS_LIB",           "@NSS_LIB@",          "e" );
1867ToFile( "MOZ_INC",           "@MOZ_INC@",          "e" );
1868ToFile( "MOZ_LIB",           "@MOZ_LIB@",          "e" );
1869ToFile( "MOZ_LIB_XPCOM",     "@MOZ_LIB_XPCOM@",    "e" );
1870ToFile( "MOZ_NSPR_CFLAGS",   "@MOZ_NSPR_CFLAGS@",  "e" );
1871ToFile( "MOZ_NSS_CFLAGS",    "@MOZ_NSS_CFLAGS@",   "e" );
1872ToFile( "MOZ_LDAP_CFLAGS",   "@MOZ_LDAP_CFLAGS@",  "e" );
1873ToFile( "WITH_FONTS",        "@WITH_FONTS@",       "e" );
1874ToFile( "WITHOUT_AFMS",      "@WITHOUT_AFMS@",     "e" );
1875ToFile( "WITHOUT_PPDS",      "@WITHOUT_PPDS@",     "e" );
1876ToFile( "WITH_BINFILTER",    "@WITH_BINFILTER@",   "e" );
1877ToFile( "BUILD_TYPE",        "$BUILD_TYPE",       "e" );
1878ToFile( "VERBOSE",           "@VERBOSE@",          "e" );
1879ToFile( "ENABLE_EVOAB2",     "@ENABLE_EVOAB2@",    "e" );
1880ToFile( "GOBJECT_CFLAGS",    "@GOBJECT_CFLAGS@",   "e" );
1881ToFile( "GOBJECT_LIBS",      "@GOBJECT_LIBS@",     "e" );
1882if ( '@ENABLE_RPATH@' eq "no" ) {
1883  ToFile( "LINKFLAGSRUNPATH",'',                   "e" );
1884}
1885ToFile( "EPM",               "@EPM@",              "e" );
1886ToFile( "EPM_FLAGS",         $EPM_FLAGS,           "e" );
1887ToFile( "BUILD_EPM",         "@BUILD_EPM@",        "e" );
1888ToFile( "PKGFORMAT",         "@PKGFORMAT@",        "e" );
1889ToFile( "SYSTEM_STDLIBS",    "@SYSTEM_STDLIBS@",   "e" );
1890ToFile( "SYSTEM_ZLIB",       "@SYSTEM_ZLIB@",      "e" );
1891ToFile( "SYSTEM_OPENSSL",    "@SYSTEM_OPENSSL@",   "e" );
1892ToFile( "OPENSSL_CFLAGS",    "@OPENSSL_CFLAGS@",   "e" );
1893ToFile( "OPENSSL_LIBS",      "@OPENSSL_LIBS@",     "e" );
1894ToFile( "SYSTEM_PYTHON",     "@SYSTEM_PYTHON@",    "e" );
1895ToFile( "PYTHON_CFLAGS",     "@PYTHON_CFLAGS@",    "e" );
1896ToFile( "PYTHON_LIBS",       "@PYTHON_LIBS@",      "e" );
1897if ($SYSTEM_PYTHON eq "NO") {
1898ToFile( "HOME",              "@HOME@",             "e" );
1899}
1900ToFile( "SYSTEM_ICU",        "@SYSTEM_ICU@",       "e" );
1901ToFile( "ICU_MAJOR",         "@ICU_MAJOR@",        "e" );
1902ToFile( "ICU_MINOR",         "@ICU_MINOR@",        "e" );
1903ToFile( "ICU_MICRO",         "@ICU_MICRO@",        "e" );
1904ToFile( "SYSTEM_GENBRK",     "@SYSTEM_GENBRK@",    "e" );
1905ToFile( "SYSTEM_GENCCODE",   "@SYSTEM_GENCCODE@",  "e" );
1906ToFile( "SYSTEM_GENCMN",     "@SYSTEM_GENCMN@",    "e" );
1907ToFile( "SYSTEM_JPEG",       "@SYSTEM_JPEG@",      "e" );
1908ToFile( "FREETYPE_CFLAGS",   "@FREETYPE_CFLAGS@",  "e" );
1909ToFile( "FREETYPE_LIBS",     "@FREETYPE_LIBS@",    "e" );
1910ToFile( "SYSTEM_POPPLER",    "@SYSTEM_POPPLER@",   "e" );
1911ToFile( "POPPLER_CFLAGS",    "@POPPLER_CFLAGS@",   "e" );
1912ToFile( "POPPLER_LIBS",      "@POPPLER_LIBS@",     "e" );
1913ToFile( "GSTREAMER_CFLAGS",  "@GSTREAMER_CFLAGS@", "e" );
1914ToFile( "GSTREAMER_LIBS",    "@GSTREAMER_LIBS@",   "e" );
1915ToFile( "SYSTEM_CAIRO",      "@SYSTEM_CAIRO@",     "e" );
1916ToFile( "BUILD_PIXMAN",      "@BUILD_PIXMAN@",     "e" );
1917ToFile( "CAIRO_CFLAGS",      "@CAIRO_CFLAGS@",     "e" );
1918ToFile( "CAIRO_LIBS",        "@CAIRO_LIBS@",       "e" );
1919ToFile( "XRANDR_CFLAGS",     "@XRANDR_CFLAGS@",    "e" );
1920ToFile( "XRANDR_LIBS",       "@XRANDR_LIBS@",      "e" );
1921ToFile( "XRANDR_DLOPEN",     "@XRANDR_DLOPEN@",    "e" );
1922ToFile( "SYSTEM_LIBWPD",     "@SYSTEM_LIBWPD@",    "e" );
1923ToFile( "LIBWPD_CFLAGS",     "@LIBWPD_CFLAGS@",    "e" );
1924ToFile( "LIBWPD_LIBS",       "@LIBWPD_LIBS@",      "e" );
1925ToFile( "SYSTEM_CPPUNIT",    "@SYSTEM_CPPUNIT@",   "e" );
1926ToFile( "CPPUNIT_CFLAGS",    "@CPPUNIT_CFLAGS@",   "e" );
1927ToFile( "CPPUNIT_LIBS",      "@CPPUNIT_LIBS@",     "e" );
1928ToFile( "SYSTEM_LIBXML",     "@SYSTEM_LIBXML@",    "e" );
1929ToFile( "USE_FT_EMBOLDEN",   "@USE_FT_EMBOLDEN@",  "e" );
1930ToFile( "LIBXML_CFLAGS",     "@LIBXML_CFLAGS@",    "e" );
1931ToFile( "LIBXML_LIBS",       "@LIBXML_LIBS@",      "e" );
1932ToFile( "SYSTEM_EXPAT",      "@SYSTEM_EXPAT@",     "e" );
1933ToFile( "SYSTEM_DB",         "@SYSTEM_DB@",        "e" );
1934ToFile( "DB_VERSION",        "@DB_VERSION@",       "e" );
1935ToFile( "DB_INCLUDES",       "@DB_INCLUDES@",      "e" );
1936ToFile( "ENABLE_MYSQLC",     "@ENABLE_MYSQLC@",    "e" );
1937ToFile( "SYSTEM_MYSQL",      "@SYSTEM_MYSQL@",     "e" );
1938ToFile( "SYSTEM_MYSQL_CPPCONN","@SYSTEM_MYSQL_CPPCONN@","e" );
1939ToFile( "MYSQL_INC",         "@MYSQL_INC@",        "e" );
1940ToFile( "MYSQL_LIB",         "@MYSQL_LIB@",        "e" );
1941ToFile( "MYSQL_DEFINES",     "@MYSQL_DEFINES@",    "e" );
1942ToFile( "LIBMYSQL_PATH",     "@LIBMYSQL_PATH@",    "e" );
1943ToFile( "SYSTEM_HSQLDB",     "@SYSTEM_HSQLDB@",    "e" );
1944ToFile( "HSQLDB_JAR",        "@HSQLDB_JAR@",       "e" );
1945ToFile( "SYSTEM_LUCENE",     "@SYSTEM_LUCENE@",    "e" );
1946ToFile( "LUCENE_CORE_JAR",   "@LUCENE_CORE_JAR@",  "e" );
1947ToFile( "LUCENE_ANALYZERS_JAR",   "@LUCENE_ANALYZERS_JAR@",  "e" );
1948ToFile( "SYSTEM_BSH",        "@SYSTEM_BSH@",       "e" );
1949ToFile( "BSH_JAR",           "@BSH_JAR@",          "e" );
1950ToFile( "SYSTEM_SAXON",      "@SYSTEM_SAXON@",     "e" );
1951ToFile( "SAXON_JAR",         "@SAXON_JAR@",        "e" );
1952ToFile( "SYSTEM_ODBC_HEADERS","@SYSTEM_ODBC_HEADERS@","e" );
1953ToFile( "SYSTEM_LIBXSLT",    "@SYSTEM_LIBXSLT@",   "e" );
1954ToFile( "LIBXSLT_CFLAGS",    "@LIBXSLT_CFLAGS@",   "e" );
1955ToFile( "LIBXSLT_LIBS",      "@LIBXSLT_LIBS@",     "e" );
1956ToFile( "SYSTEM_SANE_HEADER","@SYSTEM_SANE_HEADER@","e" );
1957ToFile( "SYSTEM_XRENDER_HEADERS","@SYSTEM_XRENDER_HEADERS@","e" );
1958ToFile( "SYSTEM_CURL",       "@SYSTEM_CURL@",      "e" );
1959ToFile( "CURL_CFLAGS",       "@CURL_CFLAGS@",      "e" );
1960ToFile( "CURL_LIBS",         "@CURL_LIBS@",        "e" );
1961ToFile( "SYSTEM_BOOST",      "@SYSTEM_BOOST@",     "e" );
1962ToFile( "SYSTEM_MDDS",       "@SYSTEM_MDDS@",      "e" );
1963ToFile( "SYSTEM_VIGRA",      "@SYSTEM_VIGRA@",     "e" );
1964ToFile( "SYSTEM_NEON",       "@SYSTEM_NEON@",      "e" );
1965ToFile( "SYSTEM_LIBRSVG",    "@SYSTEM_LIBRSVG@",   "e" );
1966ToFile( "SYSTEM_GDKPIXBUF",  "@SYSTEM_GDKPIXBUF@",   "e" );
1967ToFile( "SYSTEM_GLIB",       "@SYSTEM_GLIB@",   "e" );
1968ToFile( "SYSTEM_GETTEXT",    "@SYSTEM_GETTEXT@",   "e" );
1969ToFile( "SYSTEM_LIBCROCO",   "@SYSTEM_LIBCROCO@",   "e" );
1970ToFile( "SYSTEM_PANGO",      "@SYSTEM_PANGO@",   "e" );
1971ToFile( "SYSTEM_LIBGSF",     "@SYSTEM_LIBGSF@",   "e" );
1972ToFile( "SYSTEM_LIBPNG",     "@SYSTEM_LIBPNG@",   "e" );
1973ToFile( "SYSTEM_LIBJPEG",    "@SYSTEM_LIBJPEG@",   "e" );
1974ToFile( "NEON_VERSION",      "@NEON_VERSION@",     "e" );
1975ToFile( "NEON_LIBS",         "@NEON_LIBS@",        "e" );
1976ToFile( "NEON_CFLAGS",       "@NEON_CFLAGS@",      "e" );
1977ToFile( "DISABLE_NEON",      "@DISABLE_NEON@",     "e" );
1978ToFile( "DISABLE_XAW",       "@DISABLE_XAW@",      "e" );
1979ToFile( "ENABLE_AGG",        "@ENABLE_AGG@",       "e" );
1980ToFile( "SYSTEM_AGG",	     "@SYSTEM_AGG@",       "e" );
1981ToFile( "AGG_VERSION",	     "@AGG_VERSION@",      "e" );
1982ToFile( "BUILD_DMAKE",       "@BUILD_DMAKE@",      "e" );
1983ToFile( "BUILD_STAX",        "@BUILD_STAX@",       "e" );
1984ToFile( "BUILD_UNOWINREG",   "@BUILD_UNOWINREG@",  "e" );
1985ToFile( "USE_XINERAMA",      "@USE_XINERAMA@",     "e" );
1986ToFile( "XINERAMA_LINK",     "@XINERAMA_LINK@",    "e" );
1987ToFile( "SYSTEM_REDLAND",    "@SYSTEM_REDLAND@",   "e" );
1988ToFile( "REDLAND_CFLAGS",    "@REDLAND_CFLAGS@",   "e" );
1989ToFile( "REDLAND_LIBS",      "@REDLAND_LIBS@",     "e" );
1990ToFile( "SYSTEM_HUNSPELL",   "@SYSTEM_HUNSPELL@",  "e" );
1991ToFile( "HUNSPELL_CFLAGS",   "@HUNSPELL_CFLAGS@",  "e" );
1992ToFile( "HUNSPELL_LIBS",     "@HUNSPELL_LIBS@",    "e" );
1993ToFile( "HAVE_GETOPT",       "@HAVE_GETOPT@",      "e" );
1994ToFile( "HAVE_READDIR_R",    "@HAVE_READDIR_R@",   "e" );
1995ToFile( "SYSTEM_LIBC",       "@SYSTEM_LIBC@",      "e" );
1996ToFile( "SYSTEM_HYPH",       "@SYSTEM_HYPH@",      "e" );
1997ToFile( "HYPHEN_LIB",        "@HYPHEN_LIB@",       "e" );
1998ToFile( "SYSTEM_MYTHES",     "@SYSTEM_MYTHES@",    "e" );
1999ToFile( "MYTHES_CFLAGS",     "@MYTHES_CFLAGS@",    "e" );
2000ToFile( "MYTHES_LIBS",       "@MYTHES_LIBS@",      "e" );
2001ToFile( "SYSTEM_LIBTEXTCAT", "@SYSTEM_LIBTEXTCAT@","e" );
2002ToFile( "SYSTEM_LIBTEXTCAT_DATA","@SYSTEM_LIBTEXTCAT_DATA@","e" );
2003ToFile( "PAM",               "@PAM@",              "e" );
2004ToFile( "NEW_SHADOW_API",    "@NEW_SHADOW_API@",   "e" );
2005ToFile( "PAM_LINK",          "@PAM_LINK@",         "e" );
2006ToFile( "CRYPT_LINK",        "@CRYPT_LINK@",       "e" );
2007ToFile( "XAU_LIBS",          "@XAU_LIBS@",         "e" );
2008ToFile( "GXX_INCLUDE_PATH",  PathFormat("@GXX_INCLUDE_PATH@"), "e" );
2009ToFile( "COMMON_BUILD_TOOLS",$COMMON_BUILD_TOOLS,  "e" );
2010if ($platform !~ m/cygwin|os2/) {
2011   if ( $ENV{"TMPDIR"} eq "" ) {
2012      ToFile( "TMPDIR",      "/tmp",               "e" );
2013   } else {
2014      ToFile( "TMPDIR",      "$ENV{'TMPDIR'}",     "e" );
2015   }
2016}
2017ToFile( "SOLARSRC",           $SOLARSRC,           "e" );
2018ToFile( "SOURCE_ROOT_DIR",    $SOURCE_ROOT_DIR,    "e" );
2019ToFile( "gb_REPOS",           $gb_REPOS,           "e" );
2020
2021if ( $platform =~ m/cygwin/ )
2022{
2023   ToFile( "ILIB",              $ILIB,              "e" );
2024   if ( $MINGW eq "yes" )
2025   {  ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
2026      ToFile( "EXCEPTIONS",        "@EXCEPTIONS@",        "e" );
2027      ToFile( "DIRECTXSDK_HOME",    PathFormat("@DIRECTXSDK_HOME@"),    "e" );
2028      ToFile( "USE_MINGW",         $USE_MINGW,              "e" );
2029      ToFile( "MINGW_CLIB_DIR",         PathFormat("@MINGW_CLIB_DIR@"),              "e" );
2030      ToFile( "MINGW_SHARED_GCCLIB",         "@MINGW_SHARED_GCCLIB@",              "e" );
2031      ToFile( "MINGW_GCCLIB_EH",      "@MINGW_GCCLIB_EH@",              "e" );
2032      ToFile( "MINGW_SHARED_GXXLIB",         "@MINGW_SHARED_GXXLIB@",              "e" );
2033      ToFile( "MINGW_SHARED_LIBSTDCPP",         "@MINGW_SHARED_LIBSTDCPP@",              "e" );
2034      ToFile( "MINGW_GCCDLL",         "@MINGW_GCCDLL@",              "e" );
2035      ToFile( "MINGW_GXXDLL",         "@MINGW_GXXDLL@",              "e" );
2036   }
2037   ToFile( "GREP",              $WIN_GREP,          "e" );
2038   ToFile( "FIND",              $WIN_FIND,          "e" );
2039   ToFile( "LS",                $WIN_LS,            "e" );
2040   ToFile( "GNUCOPY",           $WIN_GNUCOPY,       "e" );
2041   ToFile( "TOUCH",             $WIN_TOUCH,         "e" );
2042}
2043if ( $platform =~ m/os2/ )
2044{
2045   #ToFile( "ILIB",              $ILIB,              "e" );
2046
2047   ToFile( "GREP",              "grep.exe",         "e" );
2048   ToFile( "FIND",              "find.exe",         "e" );
2049   ToFile( "LS",                "ls.exe",           "e" );
2050   ToFile( "GNUCOPY",           "cp.exe",           "e" );
2051   ToFile( "TOUCH",             "touch",            "e" );
2052}
2053
2054# $perlpre is only used for the following three variables
2055# and only set for OS2.
2056my $perlpre = "";
2057if (( $platform =~ m/os2/ )) {
2058   $perlpre = "perl ".${SOLARENV}.${BIN}.${ds};
2059}
2060ToFile( "DELIVER",       $perlpre."deliver.pl",     "e" );
2061ToFile( "MKOUT",         $perlpre."mkout.pl",       "e" );
2062ToFile( "ZIPDEP",        $perlpre."zipdep.pl",      "e" );
2063
2064#
2065# Writing the aliases to file.
2066ToFile( "Aliases.",          $empty,             "c" );
2067ToFile( "Don't set aliases when bootstrapping", $empty, "c" );
2068ToFile( 'if ( ! ${?_ISBOOTSTRAP_} ) then', $empty, "y");
2069ToFile( "if test -z \"\$_ISBOOTSTRAP_\"; then", $empty, "z");
2070
2071ToFile( "alias mkout",       $mkout,             "a" );
2072ToFile( "alias deliver",     $deliver,           "a" );
2073ToFile( "alias build",       $build,             "a" );
2074ToFile( "alias build_client",$build_client,      "a" );
2075ToFile( "alias zipdep",      $zipdep,            "a" );
2076if ( $platform !~ m/cygwin/ )
2077{  ToFile( "alias nmake",       $nmake,             "a" );
2078}
2079if ( $platform =~ m/os2/ )
2080{  ToFile( "alias gunzip",       "gzip -d",         "a" );
2081}
2082
2083ToFile( "endif",             $empty, "y");
2084ToFile( "fi",                $empty, "z");
2085
2086# Check if the right dmake version is used. (W32 only)
2087if ( $platform =~ m/cygwin/ ) {
2088    ToFile( "Check if the right dmake version is used.", $empty, "c" );
2089    # Invalidate build environment.
2090    ToFile( "WORK_STAMP", "_invalid_", "e" );
2091    # Don't test the dmake version if this file is sourced by bootstrap
2092    ToFile( "bash -c 'if test -n \"\$_ISBOOTSTRAP_\" || (dmake.exe -V | grep -e \"-cygwin\\|OS := cygwin\" > /dev/null ); then true; else echo -e \"\\n\\nERROR: Not a cygwin build dmake or dmake missing, please check!\\n\\n\" ; sleep 5; false ; fi' || exit 1", $empty, "y");
2093    # Restore valid environment if test was successful.
2094    ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
2095    ToFile( "", $empty, "n");
2096}
2097
2098# on Solaris, MacOSX and FreeBSD set GNUCOPY, GNUPATCH and GPERF
2099if ($platform =~ m/solaris|darwin|freebsd/)
2100{
2101  ToFile( "GNUPATCH",   "@GNUPATCH@",	"e");
2102}
2103ToFile( "GNUCOPY",	"@GNUCP@",	"e");
2104ToFile( "GPERF", "@GPERF@",	"e");
2105# OS/2 define .pl as executable for 4os2
2106# use - as switch char for dmake (os2/switchar.c)
2107if ($platform =~ m/os2/)
2108{
2109  ToFile( ".pl",   	"perl",	"e");
2110  ToFile( "SWITCHAR",   "-",	"e");
2111}
2112ToFile( "SAL_ENABLE_FILE_LOCKING",	"1",	"e");
2113#
2114# Writing unset variables you might not need to file.
2115#
2116print OUT $unsetvars;
2117
2118print OUT_SH "export $exportvars$newline";
2119print OUT_SH "unset $unsetvarssh$newline";
2120
2121if(defined($outfile_bat))
2122{  print OUT_BAT $unsetvarsbat;
2123}
2124
2125#
2126#---------------------------
2127# VIII. Closing output file.
2128#---------------------------
2129#
2130close( OUT ) || print "Can't close $outfile: $!";
2131
2132close( OUT_SH ) || print "Can't close $outfile_sh: $!";
2133
2134if( defined($outfile_bat))
2135{  close( OUT_BAT ) || print "Can't close $outfile_bat: $!";
2136}
2137
2138#
2139#------------------------------
2140# IX. Sourcing the output file.
2141#------------------------------
2142#
2143#---------------------------------
2144# X. Set up the build environment.
2145#---------------------------------
2146#
2147#--------------------------------------------------------
2148# XI. Moving the output file to the build home directory.
2149#--------------------------------------------------------
2150#
2151$tmp = $SRC_ROOT.$ds.$outfile;
2152if (rename( $outfile, $tmp ) ne 1)
2153{  `mv -f $outfile $tmp`;
2154}
2155
2156$tmp = $SRC_ROOT.$ds.$outfile_sh;
2157if (rename( $outfile_sh, $tmp ) ne 1)
2158{  `mv -f $outfile_sh $tmp`;
2159}
2160
2161if(defined($outfile_bat))
2162{
2163    $tmp = $SRC_ROOT.$ds.$outfile_bat;
2164    if (rename( $outfile_bat, $tmp ) ne 1)
2165    {  `mv -f $outfile_bat $tmp`;
2166    }
2167}
2168
2169#
2170#--------------------------------------------------------
2171# XII. Message at the end.
2172#--------------------------------------------------------
2173#
2174#
2175print "*********************************************************".
2176      "******************* $newline"."*"."$newline";
2177print "* OpenOffice.org $UPD configuration. $newline";
2178for ( $tmp = 0; $tmp < 2; $tmp++ )
2179{  print "* $newline";
2180}
2181print "* Configuration part of OpenOffice.org $UPD build is finished. $newline* $newline";
2182print "* NB! Be aware that you might not be able to build OpenOffice.org if you $newline".
2183      "* ignore any warning message that were generated during this configuration $newline".
2184      "* process. $newline* $newline";
2185
2186if ( $Warning ne "" )
2187{  print "$Warning*";
2188   print "$newline";
2189}
2190
2191print "*$newline* USAGE: $newline";
2192print "* Source $outfile (in tcsh)";
2193print " or $outfile.sh (in sh)";
2194print "$newline";
2195print "* in order to set up the build-environment variables.$newline";
2196for ( $tmp = 0; $tmp < 2; $tmp++ )
2197{  print "* $newline";
2198}
2199print "*********************************************************".
2200      "******************* $newline";
2201
2202$bootfile = "bootstrap";
2203open( OUT, ">$bootfile" ) ||
2204die "Cannot open $bootfile: $!\n";
2205print OUT "#!/bin/sh\n";
2206print OUT "_ISBOOTSTRAP_=TRUE ; export _ISBOOTSTRAP_ ; . $SRC_ROOT/$outfile.sh\n";
2207print OUT "unset _ISBOOTSTRAP_; export _ISBOOTSTRAP_\n";
2208if ( $MINGW eq "yes" )
2209{  print OUT 'PATH="/usr/bin:$PATH" : export PATH'."\n"; }
2210close( OUT ) || print "Can't close $bootfile: $!";
2211system(`cat bootstrap.1 >> bootstrap`);
2212system(`chmod +x bootstrap`);
2213#
2214#--------------------------------------------------------
2215# Moving the bootstrap file to the build home directory.
2216#--------------------------------------------------------
2217#
2218$tmp = $SRC_ROOT.$ds.$bootfile;
2219if (rename( $bootfile, $tmp ) ne 1)
2220{  `mv -f $bootfile $tmp`;
2221}
2222
2223print "Configure completed";
2224if ( $Warning ne "" ) {
2225	print ", but\n***** WARNINGS WERE ISSUED *****";
2226}
2227print "\n\nRun ./bootstrap in $SRC_ROOT to provide build tools and get third-party packages\n";
2228
2229#
2230#-----------------
2231# XII. Functions.
2232#-----------------
2233#
2234#-------------------------------------------------------------
2235# Function name: CheckPathName
2236# Description:   chops off the '/' character if it's the last
2237#                character in a pathname. also adds the '/'
2238#                character if it's not the first character
2239#                in a path.
2240# Arguments:     1. Path (string)
2241# Return value:  Path (string)
2242#-------------------------------------------------------------
2243sub CheckPathName
2244{  my $retrn = $_[ 0 ];
2245   if ($platform =~ m/cygwin/)
2246   {  # Check if the first character is not a '/'.
2247      if ( !( $_[ 0 ] =~ /^\// ) )
2248      {  $retrn = $ds.$_[ 0 ];
2249      }
2250   }
2251   # kill the last '/','\','\n' if they exists.
2252   $retrn =~ s![\s/\\]+$!!;
2253   # Done!
2254   return( $retrn );
2255}
2256#-------------------------------------------------------------
2257# Function name: CheckPathExist
2258# Description:   Checks whether the directory that is given
2259#                as an argument exists. If not abort.
2260# Arguments:     1. Path (string)
2261# Return value:  void
2262#-------------------------------------------------------------
2263sub CheckPathExist
2264{  my $dir = $_[ 0 ];
2265   if ( !( -d $dir ) and $^O ne 'MSWin32' )
2266   {  print ( "The directory $_[ 0 ] does not exist. Please create first.\n" );
2267      exit 1;
2268   }
2269   else
2270   {  # Don't check under ActiveState Perl (Windows). The path is possibly
2271      # posix and it cannot handle it.
2272      return "true";
2273   }
2274}
2275#------------------------------------------------------------
2276# Function name: CreateFileHeader
2277# Description:   Creates a header for the outfile.
2278# Arguments:     1. File to write to
2279#                2. UPD (string)
2280#                3. Platform (string)
2281#                4. name of shell for this file
2282#                5. comment to use for this file
2283# Return value:  void
2284#------------------------------------------------------------
2285sub CreateFileHeader
2286{  my $timestamp = `date`;
2287   chomp( $timestamp );
2288   my $filehandle = $_[0];
2289   my $comment = $_[4];
2290   print { $filehandle } "$comment #################################################################";
2291   print { $filehandle } $newline;
2292   print { $filehandle } "$comment OpenOffice.org $_[ 1 ] build environment file for: $_[ 2 ]. $newline";
2293   print { $filehandle } "$comment Generated on: $timestamp $newline";
2294   print { $filehandle } "$comment Source this file to set up the build environment. $newline";
2295   print { $filehandle } "$comment 1. exec $_[3] $newline";
2296   print { $filehandle } "$comment 2. source $outfile $newline";
2297   print { $filehandle } "$comment #################################################################";
2298   print { $filehandle } $newline;
2299}
2300#---------------------------------------------------------
2301# Function name: ToFile
2302# Description:   Writes the environment variable in the
2303#                output file.
2304# Arguments:     1. Name of environment variable (string)
2305#                2. Value of environment variable (string)
2306#                3. e - env. var
2307#                   a - alias
2308#                   c - comment
2309#                   n - newline
2310#                   x - raw, write as is to OUT_BAT
2311#                   y - raw, write as is to OUT
2312#                   z - raw, write as is to OUT_SH
2313# Return value:  void
2314#---------------------------------------------------------
2315sub ToFile {
2316   if ( $_[ 2 ] eq "e" ) {
2317      # Write an environment variable to file.
2318      if (defined $_[ 1 ] && $_[ 1 ] ne "" ) {
2319         my $envvar = $_[ 1 ];
2320         my $envvarbash = $envvar;
2321
2322         if ($platform =~ m/os2/) {
2323             # expand the variables
2324             $envvar =~ s/(\$\{?\w+\}?)/$1/eeg ;
2325             # Some variables need to be translated
2326             #if ( ($_[ 0 ] =~ /^PATH$/) and ($platform !~ m/os2/) ) {
2327             #    # PATH is in cygwin format, but for 4nt it needs to be DOS.
2328             #    $win_format_var = WinPath( $envvar, ":" );
2329             #} else {
2330             #    $win_format_var = WinFormat( $envvar );
2331             #}
2332             ## The excluded variables are translated by cygwin
2333             #if ( $_[ 0 ] !~ /^PATH$|^TMP$|^TEMP$|^TMPDIR$|^HOME$/i ) {
2334             #    $envvar = $win_format_var;
2335             #}
2336         }
2337
2338         # Tcsh/bash needs backslashes quoted
2339         $envvar =~ s/\\/\\\\/g;
2340         $envvarbash = $envvar;
2341
2342         if ($platform =~ m/os2/) {
2343             # expand the variables
2344             $envvar =~ s/(\$\{?\w+\}?)/$1/eeg ;
2345             if ($_[ 0 ] =~ /^PATH$|^BEGINLIBPATH$/) {
2346                # always use \ for them
2347                $envvar =~ s/\//\\/g ;
2348             }
2349             $win_format_var = $envvar;
2350         }
2351
2352         printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", $envvar);
2353         print OUT "$setenv $_[ 0 ] \"$envvar\"$newline";  # to tcsh file
2354         print OUT_SH "$_[ 0 ]=\"$envvarbash\"$newline";   # to sh file
2355         $exportvars .= " $_[ 0 ]";                        # add to export list for sh file
2356
2357         if(defined($outfile_bat)) {
2358             print OUT_BAT "IF DEFINED $_[ 0 ] $unset $_[ 0 ]$newline";
2359             print OUT_BAT "$set $_[ 0 ]=$win_format_var$newline";
2360         }
2361
2362      } else {
2363         printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", "unset") ; # to stdout
2364         $unsetvars .= "$unsetenv $_[ 0 ] >& /dev/null$newline"; # for tcsh file
2365         $unsetvarssh .= " $_[ 0 ]";                             # for sh file
2366         if(defined($outfile_bat)) {
2367             $unsetvarsbat .= "$unset $_[ 0 ] >& NUL$newline";
2368         }
2369      }
2370   }
2371   elsif ( $_[ 2 ] eq "a" )
2372   {  # Write an alias to file.
2373      print "The $_[ 0 ] is set to: $_[ 1 ]\n";    # to stdout
2374      print OUT "$_[ 0 ] $_[ 1 ]$newline";         # to tcsh file
2375      print OUT_SH "$_[ 0 ]=$_[ 1 ]$newline";      # to sh file
2376      if(defined($outfile_bat)) # create the correct 4nt alias format
2377      {  my $aliastmp = $_[ 1 ];
2378         $aliastmp =~ s/\$/\%/g;
2379         $aliastmp =~ s!/!\\!g;
2380         $aliastmp =~ s!"!!g;
2381         print OUT_BAT "$_[ 0 ]=".'`'.$aliastmp.'`'.$newline;
2382      }
2383   }
2384   elsif ( $_[ 2 ] eq "c" )
2385   {  # Write a comment to file.
2386      print "$newline";
2387      print "$comment$newline";
2388      print "$comment $_[ 0 ]$newline";
2389      print "$comment$newline";
2390      print OUT "$newline";
2391      print OUT "$comment$newline";
2392      print OUT "$comment $_[ 0 ]$newline";
2393      print OUT "$comment$newline";
2394      print OUT_SH "$newline";
2395      print OUT_SH "$comment$newline";
2396      print OUT_SH "$comment $_[ 0 ]$newline";
2397      print OUT_SH "$comment$newline";
2398      if(defined($outfile_bat)) {
2399          print OUT_BAT "$newline";
2400          print OUT_BAT "rem $newline";
2401          print OUT_BAT "rem $_[ 0 ]$newline";
2402          print OUT_BAT "rem $newline";
2403      }
2404   }
2405   elsif ( $_[ 2 ] eq "n" )
2406   {  #Write a newline to a file
2407      print OUT "$newline";
2408      print OUT_SH "$newline";
2409      print OUT_BAT "$newline" if defined($outfile_bat);
2410   }
2411   elsif ( $_[ 2 ] eq "y" )
2412   {
2413      #Write first argument as is, and nothing else
2414      print OUT "$_[ 0 ]$newline";
2415   }
2416   elsif ( $_[ 2 ] eq "z" )
2417   {
2418      #Write first argument as is, and nothing else
2419      print OUT_SH "$_[ 0 ]$newline";
2420   }
2421   else
2422   {  print "Unknown type!$newline";
2423   }
2424}
2425#----------------------------------------------------------
2426# Function name: PathFormat
2427# Description:   Reformat path to either POSIX or mixed mode style.
2428# Arguments:     1. Variable (string)
2429# Return value:  Reformatted String
2430#----------------------------------------------------------
2431sub PathFormat
2432{  my ( $variable, $d1, $d2 );
2433   $variable = $_[ 0 ];
2434
2435   if ( $platform =~ m/cygwin/ )
2436   {   $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2437       $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2438
2439       # Complain if PosixPath is used on a PATH-like string
2440       if ( $variable =~ m/;/ ) {
2441           die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2442       }
2443
2444       # Replace path with space with short dos path
2445       if ( $variable =~ / / ) {
2446           chomp( $variable = qx{cygpath -d "$variable"} ) ;
2447       }
2448
2449       # Replace absolute paths or DOS paths with ...
2450       if ( ( $variable =~ m/^\// ) or ( $variable =~ m/:/ ) ) {
2451           # mixed mode paths
2452           chomp( $variable = qx{cygpath -m "$variable"} );
2453       }
2454   }
2455   return $variable;
2456}
2457#----------------------------------------------------------
2458# Function name: CygFormat
2459# Description:   Format variables to cygwin posix style path
2460#                unless .
2461# Arguments:     1. Variable (string)
2462# Return value:  Reformatted String
2463#----------------------------------------------------------
2464sub CygFormat
2465{  my ( $variable, $d1, $d2 );
2466   $variable = $_[ 0 ];
2467   # ToDo: Do the replacement only if Windows and var contains "\" and ":"
2468   if ( $platform =~ m/cygwin|os2/ )
2469   {
2470       # Complain if PosixPath is used on a PATH-like string
2471       if ( $variable =~ m/;/ ) {
2472           die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2473       }
2474
2475       # Replace DOS paths with posix paths
2476       if ( ( $variable =~ m/\\/ ) or ( $variable =~ m/:/ ) ) {
2477           chomp( $variable = qx{cygpath -u "$variable"} );
2478       }
2479   }
2480   return $variable;
2481}
2482#----------------------------------------------------------
2483# Function name: WinFormat
2484# Description:   Format variables to Windows Format.
2485# Arguments:     1. Variable (string)
2486# Return value:  Reformatted String
2487#----------------------------------------------------------
2488sub WinFormat
2489{  my ( $variable, $d1 );
2490   $variable = $_[ 0 ];
2491   $variable =~ s/^\s+//g ; #remove leading spaces
2492   $variable =~ s/\s+$//g ; #remove trailing spaces
2493   $variable =~ s/(\$\{?\w+\}?)/$1/eeg ;   # expand the variables
2494   $variable =~ s/(\$\{?\w+\}?)/$1/eeg ;   # expand the variables twice!
2495   $variable =~ s/:+/:/g ;                 # remove multiple ;
2496
2497   # Some variables are already in DOS path format, return early.
2498   if ( $variable =~ /\\/ ) {
2499       return $variable;
2500   }
2501   if ( $variable eq ";" ) {
2502       # Ignore single ';'
2503       return $variable;
2504   }
2505   if ( $variable =~ /;/ and $variable =~ /\// ) {
2506       # Mixed mode path-style entry, separated with ;, like CLASSPATH
2507       return $variable;
2508   }
2509
2510   # Search for posix path entry and replace with cygpath -w entry
2511   # ( -d if filename contains space )
2512
2513   # Normal paths
2514
2515   # One special case is if "perl " is prepended.
2516   $variable =~ /^(perl\s+)?(.*)$/;
2517   my $perlpre = $1;
2518   if ( !defined($perlpre) ) {
2519       $perlpre = "";
2520   }
2521   $variable = $2;
2522
2523   if ( $variable =~ /^\/[\w\.~ ]+/ ) {
2524       if ( $variable =~ / / ) {
2525           # Use DOS 8.3 style to avoid quoting
2526           chomp( $variable = qx{cygpath -d "$variable"} );
2527       } else {
2528           # Use "normal" filenames
2529           chomp( $variable = qx{cygpath -w "$variable"} );
2530       }
2531   } else {
2532       # relative or absolute DOS paths here
2533       $variable =~ s#/#\\#g;
2534   }
2535
2536   $variable = $perlpre.$variable;
2537   if ( ($perlpre ne "") && ($^O eq "cygwin")) {
2538       # Cygwin's perl needs quoted backslashes
2539       $variable =~ s#\\#\\\\#g;
2540   }
2541
2542   return $variable;
2543}
2544
2545#----------------------------------------------------------
2546# Function name: WinPath
2547# Description:   Reformat a $sep seperated path using DOS paths.
2548# Arguments:     1. Variable (string)
2549#                2. Separaror (string)
2550# Return value:  Reformatted String
2551#----------------------------------------------------------
2552sub WinPath
2553{
2554    my ( $variable, $d1, $sep, @split_var );
2555
2556    if ( $platform =~ m/cygwin/ ) {
2557        $variable = $_[ 0 ];
2558        $sep = $_[ 1 ];
2559        $variable =~ s/^\s+//g ; #remove leading spaces
2560        $variable =~ s/\s+$//g ; #remove trailing spaces
2561        $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2562        $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2563
2564        @split_var = split(/$sep/,$variable);
2565        foreach $d1 ( @split_var ) {
2566            if ( $d1 =~ /(?:^\/[\w\.~ ]+)+/ ) {
2567                if ( $d1 =~ / / ) {
2568                    # Use DOS 8.3 style to avoid quoting
2569                    chomp( $d1 = qx{cygpath -d "$d1"} );
2570                } else {
2571                    # Use "normal" filenames
2572                    chomp( $d1 = qx{cygpath -w "$d1"} );
2573                }
2574            }
2575        }
2576        $variable = join(';',@split_var);
2577
2578        $variable =~ s/\//\\/g; # Remaining \ come from e.g.: ../foo/baa
2579    }
2580
2581    return $variable;
2582}
2583
2584#--------------------------------------------------------
2585# Function name: GetCorrectPath
2586# Description:   Creates the build environment.
2587# Arguments:     1.   existing / original path
2588#                2... pairs of <path, executable>
2589# Return value:  String - Correct Path
2590#--------------------------------------------------------
2591sub GetCorrectPath
2592{
2593	sub PathLookup
2594	{
2595	    my $cmd = shift;
2596	    while (@_) {
2597		my $elem = shift;
2598
2599		-x "$elem/$cmd" && return $elem;
2600	    }
2601	    return '';
2602	}
2603
2604	sub SaneGrep
2605	{
2606	    # Perl grep is unbelievably strange.
2607	    my $needle = shift;
2608	    while (@_) {
2609		my $haystack = shift;
2610		if ($needle eq $haystack) {
2611		    return 1;
2612		}
2613	    }
2614	    return 0;
2615	}
2616
2617	sub CleanupPath
2618	{
2619	    my @elements = @_;
2620	    my @cleanName = ();
2621
2622	    while (@elements) {
2623		my $elem = shift @elements;
2624		if (!SaneGrep ($elem, @cleanName)) {
2625			push @cleanName, $elem;
2626		}
2627	    }
2628
2629	    return @cleanName;
2630	}
2631
2632	my $oldPath = shift;
2633	my @originalPairs = @_;
2634	my @pairs = @originalPairs;
2635	my @Path = split /$ps/, $oldPath;
2636
2637	while (@pairs) {
2638	    my $path = shift @pairs;
2639	    my $cmd = shift @pairs;
2640	    my $to_append = 1;
2641	    my $elem;
2642
2643	    if (! -x "$path/$cmd") {
2644		AddWarning ("Missing executable $path/$cmd\n");
2645	    }
2646
2647	    for $elem (@Path) {
2648		if ($elem eq $path) {
2649#		    print "Hit duplicate path in path; break\n";
2650		    $to_append = 0;
2651		    last;
2652		}
2653		if (-f "$elem/$cmd") {
2654#		    print "Element already in path ...\n";
2655		    unshift @Path, $path;
2656		    $to_append = 0;
2657		    last;
2658		} else {
2659#		    print "No file $elem/$cmd\n";
2660		}
2661	    }
2662	    if ($to_append) {
2663		push @Path, $path;
2664	    }
2665	}
2666
2667	@pairs = @originalPairs;
2668	while (@pairs) {
2669	    my $path = shift @pairs;
2670	    my $cmd = shift @pairs;
2671	    my $realpath;
2672
2673	    $realpath = PathLookup ($cmd, @Path);
2674	    if (!($realpath eq $path)) {
2675		AddWarning ("Path conflict for executables " .
2676                            "$path/$cmd against $realpath");
2677	    }
2678	}
2679
2680	return join $ps, CleanupPath (@Path);
2681}
2682
2683#------------------------------------------------------------
2684# Function name: AddWarning
2685# Description:   Adds any kind of warning for the user.
2686#                The warning will be shown at the end
2687#                of this script.
2688# Arguments:     1. Add the configure warnings or the set_soenv
2689#                   warning (string).
2690#                2. Warning (string).
2691# Return value:  void
2692#------------------------------------------------------------
2693sub AddWarning
2694{  if ( $_[ 0 ] eq "configure" )
2695   {  open( IN, $warnfile );
2696      while ( <IN> )
2697      {  $Warning = $Warning."* - ".$_;
2698      }
2699      close( IN );
2700      # Remove the temporary warning file.
2701      # unlink ( $warnfile );
2702   }
2703   elsif ( $_[ 0 ] eq "set_soenv" )
2704   {  my ( $arg1 );
2705      $arg1 = $_[ 1 ];
2706      chomp( $arg1 );                            # cut off new line
2707      $Warning = $Warning."* - set_soenv: warning: $arg1 $newline";  # add the warning
2708   }
2709}
2710#-------------------
2711# That's all folks!
2712#-------------------
2713