Trying to fix packaging of SDK
[LibreOffice.git] / set_soenv.in
blobabf12db3e45929805f118c62b3465e24e8a062c5
1 #!@PERL@ -w  # -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; -*-
3 # Program:     set_soenv.in
4 # Author:      Willem van Dorp, Ross Nicholson, Oisin Boydell - Sun Microsystems, Ireland.
6 #---------------------------------------------------------------------------
7 #---------------------------------------------------------------------------
8 # Description:
9 # set_soenv generates a file that contains all necessary
10 # environment variables for the build proces of OpenOffice
11 # on Linux, NetBSD, Solaris, Windows, Mac OS X and iOS.
13 # Program steps.
15 # I.    Checking the command-line arguments.
16 # IIa.  Declaring variables for the system commands, etc.
17 # IIb.  Declaring the environment variables.
18 # III.  Initialising the variables for the system commands, etc.
19 # IV.   Print out some important messages etc.
20 # V.    Initialising the environment variables.
21 # VI.   Open the output file.
22 # VII.  Writing the data to the output file.
23 # VIII. Closing output file.
25 #---------------------------------------------------------------------------
27 use strict;                        # pragma
28 use File::Basename;
32 #--------------------------------------------------------
33 # IIa. Declaring variables for the system commands, etc.
34 #--------------------------------------------------------
36 my ( $oldoutfile, $outfile, $bootfile, $newline, $comment,
37      $compiler, $ds, $ps,
38      $wps, $cur_dir, $par_dir, $I, $L, $tmp, $MINGW,
39      $platform,
40      $cygwinver, $empty, $no_ant, $no_gcc_include,
41      $no_gxx_include, $warnfile, $Warning, $result, $unsetvars, $exportvars, $win_format_var, $perl_os, @mingw_lib_include_paths, $mingw_lib_include_path);
43 #-------------------------------------------------
44 # IIb. Declaring environment values (constants).
45 #-------------------------------------------------
47 # Platform independent constant values.
48 my ( $CALL_CDECL, $COMMON_OUTDIR,
49      $common_build, $NO_REC_RES, $SO3, $SOLAR_JAVA,
50      $SOLAR_PLUGIN, $UPDATER, $VCL,
51      $CC, $CXX,
52      $ENABLEUNICODE, $NO_BSYMBOLIC);
54 # Platform dependent constant values.
55 my ( $COM, $ARCH, $CPU, $CPUNAME, $GUI, $GUIBASE,
56       $GVER, $OS, $OSVERSION, $OUTPATH, $INPATH, $PATH_SEPERATOR,
57       $DYNAMIC_CRT, $use_shl_versions, $JRELIBDIR,
58       $JRETOOLKITDIR, $JRETHREADDIR );
60 #-------------------------------------------
61 # IIc. Declaring the environment variables.
62 #-------------------------------------------
64 # Help variables.
65 my ( $USR, $ETC, $BIN, $LIB, $LIB64, $INC, $INCLUDE, $DEV, $OPT, $LOCAL, $SOLENV, $SOLVER, $CONFIG, $DEFIMGS,
66      $USR_BIN, $USR_LIB, $USR_LOCAL, $USR_CCS, $JAVA_BIN, $JAVA_LIB, $JAVA_INCLUDE,
67      $SOLARENVINC, $USR_DT, $USR_OPENWIN, $XLIB, $XINC,
68      $CYGWIN_PATH, $language, @languages, $ASM_PATH, $NSIS_PATH, $PERL_PATH, $CL_X64 );
70 # Environment variables.
71 my ( $oldPATH, $SRC_ROOT, $SO_HOME, $JAVA_HOME, $JDK, $JAVAFLAGS, $OOO_SHELL,
72      $L10N_MODULE, $WITH_POOR_HELP_LOCALIZATIONS,
73      $UPD, $WORK_STAMP, $gb_REPOS, $BUILD_TYPE,
74      $SOLARSRC, $DEVROOT, $SOLARVER, $SOLARVERSION, $WORKDIR, $OUTDIR, $SOLARENV, $SOLARDEFIMG,
75      $DMAKEROOT, $CLASSPATH, $XCLASSPATH, $COMPATH,
76      $MSPDB_PATH, $MIDL_PATH, $CSC_PATH, $SHOWINCLUDES_PREFIX,
77      $PATH, $SOLAREXTRAINC, $SOLAREXTRALIB, $SOLARLIB, $JAVALIB,
78      $SOLARINC, $FRAMEWORKSHOME, $COMEX, $PERL,
79      $COMP_ENV, $ILIB, $JAVAHOME, $WINDOWS_SDK_HOME, $DIRECTXSDK_LIB, $DOTNET_FRAMEWORK_HOME,
80      $USE_DIRECTX5, $ATL_LIB, $ATL_INCLUDE, $MFC_LIB, $MFC_INCLUDE, $TMPDIR,
81      $COMMON_BUILD_TOOLS, $WIN_GREP, $WIN_FIND, $WIN_LS,
82      $WIN_GNUCOPY, $WIN_TOUCH, $MOZILLA_VERSION, $MOZILLA_TOOLKIT, $PREBUILD_MOZAB, $MOZILLABUILD,
83      $PROEXT, $TARFILE_LOCATION, $GNUMAKE,
84      $PYTHON, $SYSTEM_PYTHON, $SYSTEM_MOZILLA, $EPM_FLAGS,
85      $MACOSX_SDK_PATH);
87 #-------------------------------------------
88 # IId. Declaring the aliases.
89 #-------------------------------------------
91 my ( $dmake, $build, $mkout, $deliver, $zipdep );
94 #-------------------------------------------------------------
95 # IIIa. Initialising constants.
96 #-------------------------------------------------------------
98 # $platform is needed for PathFormat()
100 $platform       = '@host@';
102 $UPD            = '@UPD@';          # the project's UPD
103 $newline        = "\n";             # Perl newline character
104 $ds             = "/";              # directory separator
105 $ps             = ":";              # path separator
106 $wps            = ":";              # path separator, will be set to ';' for windows later.
107 $cur_dir        = ".";              # current directory
108 $par_dir        = "..";             # parrent directory
109 $I              = " -I";            # include search path
110 $L              = " -L";            # library search path
111 $empty          = "";               # used as argument
112 $warnfile       = "warn";           # logfile configure warnings.
113 $Warning        = "";               # container for warning messages
114 $SYSTEM_PYTHON  = '@SYSTEM_PYTHON@';
115 if ($SYSTEM_PYTHON eq "NO") {
116     $PYTHON              = "python";
118 $SYSTEM_MOZILLA = '@SYSTEM_MOZILLA@';
119 $JDK            = '@JDK@';
120 $JAVAFLAGS              = '@JAVAFLAGS@';
121 $MINGW          = '@WITH_MINGW@';    # use MinGW for Windows build
122 $CC             = '@CC@';            # C compiler
123 $CXX            = '@CXX@';           # C++ compiler
124 $MOZILLA_VERSION        = '@MOZILLA_VERSION@'; # mozilla version to use to build mozilla
125 $MOZILLA_TOOLKIT        = '@MOZILLA_TOOLKIT@'; # GUI toolkit to use to build mozilla
126 $PROEXT         = "@PROEXT@";
127 $EPM_FLAGS      = "";
128 $CL_X64 = '@CL_X64@';
129 $GNUMAKE        = "@GNUMAKE@";
132 #--------------------------------------------------------------------
133 # IV. Initialise the warning container and print a note to the user.
134 #--------------------------------------------------------------------
136 # Add the configure (pre-requisite) warnings to the warning container
137 # , $Warning.
138 AddWarning( "configure", "" );
140 print ("Setting up the environment for building LibreOffice $newline");
142 #--------------------------------------------------
143 # V. Setting the environment variables/values.
144 #--------------------------------------------------
146 # A. Checking the platform first.
148 # get perls idea for OS
149 # needed to differentiate cygwin/native perl on windows
150 $perl_os = $^O;
153 # B. Gathering information from the system.
155 # 1. Path
156 $oldPATH = $ENV{"PATH"};
157 chomp( $oldPATH );                  # cut off new line
159 # C. Setting the constant values.
161 # Setting platform independent constant values.
162 # NB: Language options now set at 'ToFile' stage.
163 $CALL_CDECL           = "TRUE";
164 $COMMON_OUTDIR        = "";
165 $common_build         = "";
166 $NO_REC_RES           = "TRUE";
167 $SO3                  = "TRUE";
168 $SOLAR_JAVA           = "@SOLAR_JAVA@";
169 $SOLAR_PLUGIN         = "TRUE";
170 $UPDATER              = "YES";
171 $VCL                  = "TRUE";
172 $ENABLEUNICODE        = "TRUE";
173 $NO_BSYMBOLIC         = "TRUE";
174 $comment              = "#";           # UNIX script comment character
175 $TARFILE_LOCATION = "@TARFILE_LOCATION@"; # where to find tarballs with external sources
177 # Setting platform dependent constant values.
178 if ( $platform =~ m/solaris/ )
179 {     print "Setting Solaris specific values... ";
180    if ($platform =~ m/^i[3456]86/)
181    {
182       if ( $CC =~ "gcc") {
183          $oldoutfile     = "SolarisX86GccEnv.Set.sh";
184          $OUTPATH        = "unxsogi";
185       } else {
186          $oldoutfile     = "SolarisX86Env.Set.sh";
187          $OUTPATH        = "unxsoli4";
188       }
189       $CPU            = "I";
190       $CPUNAME        = "INTEL";
191           $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
192           $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."xawt";
193           $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
195    }
196    else
197    {
198       if ( $CC =~ "gcc") {
199          $oldoutfile     = "SolarisSparcGccEnv.Set.sh";
200          $OUTPATH        = "unxsogs";
201       } else {
202          $oldoutfile     = "SolarisSparcEnv.Set.sh";
203          $OUTPATH        = "unxsols4";
204       }
205       $CPU            = "S";
206       $CPUNAME        = "SPARC";
207           $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
208           $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."xawt";
209           $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
210    }
212    $COM            = "GCC";
213    $COMPATH        = '@COMPATH@';
214    $GUI            = "UNX";
215    $GUIBASE        = "unx";
216    $GVER           = "VCL";
217    $INPATH         = $OUTPATH.$PROEXT;
218    $OS             = "SOLARIS";
219    $PATH_SEPERATOR = $ps;
221 elsif ( $platform =~ m/netbsd/ )
223 #Set platform specific values:
224    if ($platform =~ m/^i[3456]86/)
225    {  print "Setting NetBSD x86 specific values... ";
226       $CPU            = "I";
227       $CPUNAME        = "INTEL";
228       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
229       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
230       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
231    }
232    elsif ($platform =~ m/^x86_64/)
233    {  print "Setting NetBSD x86-64 specific values... ";
234       $CPU            = "X";
235       $CPUNAME        = "X86_64";
236       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
237       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."client";
238       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
239    }
240    elsif ($platform =~ m/^sparc/)
241    {  print "Setting NetBSD Sparc specific values... ";
242       $CPU            = "S";
243       $CPUNAME        = "SPARC";
244       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
245       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."client";
246       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
247    }
248    elsif ($platform =~ m/powerpc/)
249    {  print "Setting NetBSD PPC specific values... ";
250       $CPU            = "P";
251       $CPUNAME        = "POWERPC";
252       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
253       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
254       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
255    }
256    else
257    { print "Unsupported NetBSD architecture: $platform \n";
258      exit 1;
259    }
260    # General NetBSD settings:
261       $COM            = "GCC";
262       $COMPATH        = '@COMPATH@';
263       $GUI            = "UNX";
264       $GUIBASE        = "unx";
265       $GVER           = "VCL";
266       $OS             = "NETBSD";
267       $PATH_SEPERATOR = $ps;
268       $OUTPATH        = "unxnbsd";
269       $oldoutfile     = "NetBSDEnv.Set.sh";
270       $INPATH         = $OUTPATH.$PROEXT;
272 elsif ( $platform =~ m/kfreebsd/ )
274 # General GNU/kFreeBSD settings:
275       $COM            = "GCC";
276       $COMPATH        = '@COMPATH@';
277       $GUI            = "UNX";
278       $GUIBASE        = "unx";
279       $GVER           = "VCL";
280       $OS             = "LINUX";
281       $PATH_SEPERATOR = $ps;
283 #Set platform specific values:
284    if ($platform =~ m/^i[3456]86/)
285    {  print "Setting GNU/kFreeBSD x86 specific values... ";
286       $oldoutfile     = "GNUkFreeBSDX86Env.Set.sh";
287       $CPU            = "I";
288       $CPUNAME        = "INTEL";
289       $OUTPATH        = "unxkfgi6";
291       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
292       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
293       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
295    }
296    elsif ($platform =~ m/^x86_64/)
297    {  print "Setting GNU/kFreeBSD x86-64 specific values... ";
298       $oldoutfile     = "GNUkFreeBSDX86-64Env.Set.sh";
299       $CPU            = "X";
300       $CPUNAME        = "X86_64";
301       $OUTPATH        = "unxkfgx6";
303       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
304       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
305       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
306    }
308    $INPATH         = $OUTPATH.$PROEXT;
310 elsif ( $platform =~ m/freebsd/ )
311 {     $COM            = "GCC";
312       $COMPATH        = '@COMPATH@';
313       $GUI            = "UNX";
314       $GUIBASE        = "unx";
315       $GVER           = "VCL";
316       $OS             = "FREEBSD";
317       $PATH_SEPERATOR = $ps;
318       $OSVERSION      = '@OSVERSION@';
319       $OUTPATH        = 'unxfbsd';
320       $oldoutfile     = 'FreeBSDEnv.Set.sh';
321    if ($platform =~ m/^(amd64|x86_64)/)
322    {  my ( $JAVA_OS );
323       print "Setting FreeBSD AMD64 specific values... ";
324       $CPU            = "X";
325       $CPUNAME        = "X86_64";
326       $JAVA_OS        = '@JAVA_HOME@';
327       $JAVA_OS        =~ s/.*\///;
328       if ($JAVA_OS =~ m/^linux/)
329       {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
330          $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
331          $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
332       }
333       else
334       {  $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
335          $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
336          $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
337       }
338    }
339    elsif ($platform =~ m/^i386/)
340    {  print "Setting FreeBSD x86 specific values... ";
341       $CPU            = "I";
342       $CPUNAME        = "INTEL";
343       $OUTPATH        = "unxfbsdi";
344       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
345       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
346       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
347    }
348    else
349    {  print "Unsupported FreeBSD architecture: $platform \n";
350          exit 1;
351    }
352       $INPATH         = $OUTPATH.$PROEXT;
354 elsif ( $platform =~ m/openbsd/ )
355 {     $COM            = "GCC";
356       $COMPATH        = '@COMPATH@';
357       $GUI            = "UNX";
358       $GUIBASE        = "unx";
359       $GVER           = "VCL";
360       $OS             = "OPENBSD";
361       $PATH_SEPERATOR = $ps;
362       $OSVERSION      = '@OSVERSION@';
363       $OUTPATH        = "unxobsd";
364       $oldoutfile     = "OpenBSDEnv.Set.sh";
365    if ($platform =~ m/^(amd64|x86_64)/)
366    {
367       print "Setting OpenBSD AMD64 specific values... ";
368       $CPU            = "X";
369       $CPUNAME        = "X86_64";
370       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
371       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
372       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
373    }
374    elsif ($platform =~ m/^i386/)
375    {  print "Setting OpenBSD x86 specific values... ";
376       $CPU            = "I";
377       $CPUNAME        = "INTEL";
378       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
379       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
380       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
381    }
382    else
383    {  print "Unsupported OpenBSD architecture: $platform \n";
384          exit 1;
385    }
386       $INPATH         = $OUTPATH.$PROEXT;
388 elsif ( $platform =~ m/linux/ )
390 # General Linux settings:
391       $COM            = "GCC";
392       $COMPATH        = '@COMPATH@';
393       $GUI            = "UNX";
394       $GUIBASE        = "unx";
395       $GVER           = "VCL";
396       $OS             = "LINUX";
397       $PATH_SEPERATOR = $ps;
399 #Set platform specific values:
400    if ($platform =~ m/^i[3456]86/)
401    {  print "Setting Linux x86 specific values... ";
402       $oldoutfile     = "LinuxX86Env.Set.sh";
403       $CPU            = "I";
404       $CPUNAME        = "INTEL";
406       if ($JDK =~ m/^[Ii][Bb][Mm]/)
407       { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."bin";
408         $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."bin".$ds."classic";
409         $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."bin"; }
411       elsif ($JDK =~ m/^[Bb][Ee][Aa]/)
412       { $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
413         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."jrockit";
414         $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads"; }
416       else {
417       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
418       # has both server and client
419       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
420       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
421       }
423       $OUTPATH     = "unxlngi6";
424    }
425    elsif ($platform =~ m/^x86_64/)
426    {  print "Setting Linux x86-64 specific values... ";
427       $oldoutfile     = "LinuxX86-64Env.Set.sh";
428       $CPU            = "X";
429       $CPUNAME        = "X86_64";
430       $OUTPATH        = "unxlngx6";
431       # Blackdown.org JDK porting project uses `amd64' and `server' in JDK 1.4.2 RC1
432       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
433       # has both server and client
434       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
435       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
436    }
437    elsif ($platform =~ m/^ia64/)
438    {  print "Setting Linux ia64 specific values... ";
439       $oldoutfile     = "LinuxIA64Env.Set.sh";
440       $CPU            = "A";
441       $CPUNAME        = "IA64";
442       $OUTPATH        = "unxlnga";
443       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64";
444       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."server";
445       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ia64".$ds."native_threads";
446    }
447    elsif ($platform =~ m/^sparc/)
449    {  print "Setting Linux Sparc specific values... ";
450       $oldoutfile     = "LinuxSparcEnv.Set.sh";
451       $CPU            = "S";
452       $CPUNAME        = "SPARC";
453       $OUTPATH        = "unxlngs";
454       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc";
455       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."server";
456       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."sparc".$ds."native_threads";
457    }
458    elsif ($platform =~ m/^powerpc/)
459    {
460       if (($platform =~ m/^powerpc64/) && ('@SIZEOF_LONG@' eq '8')) {
461          print "Setting Linux PPC64 specific values... ";
462          $oldoutfile = "LinuxPPC64Env.Set.sh";
463          $OUTPATH = "unxlngppc64";
464          $CPUNAME = "POWERPC64";
466          if ( $JDK eq "gcj" ) {
467             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64";
468             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."client";
469             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."native_threads";
470          }
471          # OpenJDK
472          elsif ($JDK =~ m/sun/) {
473             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64";
474             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."server";
475             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc64".$ds."native_threads";
476          }
477       }
478       else {
479          print "Setting Linux PPC specific values... ";
480          $oldoutfile = "LinuxPPCEnv.Set.sh";
481          $OUTPATH = "unxlngppc";
482          $CPUNAME = "POWERPC";
484          if ( $JDK eq "gcj" ) {
485             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
486             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."client";
487             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads"; }
488          elsif ($JDK =~ m/^[Ii][Bb][Mm]/)
489          {  $JRELIBDIR     = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
490             $JRETOOLKITDIR = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
491             $JRETHREADDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
492          }
493          # OpenJDK
494          elsif ($JDK =~ m/sun/) {
495             $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
496             $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."server";
497             $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
498          }
499       }
501       $CPU            = "P";
503    }
504    elsif ($platform =~ m/^s390/)
505    {
506       if (($platform =~ m/^s390x/) && ('@SIZEOF_LONG@' eq '8')) {
507          print "Setting Linux zSeries specific values... ";
508          $oldoutfile     = "LinuxS390XEnv.Set.sh";
509          $CPUNAME        = "S390X";
510          $ARCH           = "s390x";
511          $OUTPATH        = "unxlngs390x";
512       }
513       else {
514          print "Setting Linux S/390 specific values... ";
515          $oldoutfile     = "LinuxS390Env.Set.sh";
516          $CPUNAME        = "S390";
517          $ARCH           = "s390";
518          $OUTPATH        = "unxlngs390";
519       }
520       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH;
521       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."server";
522       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."native_threads";
523       $CPU            = "3";
524    }
525    elsif ($platform =~ m/^m68k/)
526    {  print "Setting Linux m68k specific values... ";
527       $oldoutfile     = "LinuxM68KEnv.Set.sh";
528       $CPU            = "6";
529       $CPUNAME        = "M68K";
530       $OUTPATH        = "unxlngm68k";
531       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k";
532       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."server";
533       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."m68k".$ds."native_threads";
534    }
535    elsif ($platform =~ m/^hppa/)
536    {  print "Setting Linux hppa specific values... ";
537       $oldoutfile     = "LinuxHPPAEnv.Set.sh";
538       $CPU            = "H";
539       $CPUNAME        = "HPPA";
540       $OUTPATH        = "unxlnghppa";
541       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa";
542       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa".$ds."server";
543       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."hppa".$ds."native_threads";
544       $EPM_FLAGS      = "-a hppa";
545    }
546    elsif ($platform =~ m/^alpha/)
547    {  print "Setting Linux Alpha specific values... ";
548       $oldoutfile     = "LinuxAlphaEnv.Set.sh";
549       $CPU            = "L";
550       $CPUNAME        = "AXP";
551       $OUTPATH        = "unxlngaxp";
552       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha";
553       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."server";
554       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."alpha".$ds."native_threads";
555    }
556    elsif ($platform =~ m/^arm.*?l-/)
557    {  print "Setting Linux ARM specific values... ";
558       $oldoutfile     = "LinuxARMEnv.Set.sh";
559       $CPU            = "R";
560       $CPUNAME        = "ARM";
561       $OUTPATH        = "unxlngr";
562       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm";
563       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."server";
564       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."native_threads";
565       $EPM_FLAGS      = "-a arm";
566    }
567    elsif ($platform =~ m/^arm.*-androideabi/)
568    {  print "Setting Android ARM specific values... ";
569       $GUIBASE        = "android";
570       $OS             = "ANDROID";
571       $oldoutfile     = "AndroidARMEnv.Set.sh";
572       $CPU            = "R";
573       $CPUNAME        = "ARM";
574       $OUTPATH        = "unxandr";
575       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm";
576       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."server";
577       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."arm".$ds."native_threads";
578       $EPM_FLAGS      = "-a arm";
579    }
580    elsif ($platform =~ m/^mips/)
581    {  print "Setting Linux MIPS specific values... ";
582       $oldoutfile     = "LinuxMIPSEnv.Set.sh";
583       $CPU            = "M";
584       $CPUNAME        = "GODSON";
585       $OUTPATH        = "unxlngmips";
587       if ('@SIZEOF_LONG@' eq '8') {
588         if ('@WORDS_BIGENDIAN@' ne 'yes') {
589           $EPM_FLAGS = "-a mips64el";
590           if ( $JDK eq "gcj" ) {
591             $ARCH = "mips64el";
592           }
593         }
594         else {
595           $ARCH = "mips64";
596         }
597       }
598       else {
599         if ('@WORDS_BIGENDIAN@' ne 'yes') {
600           $EPM_FLAGS = "-a mipsel";
601           if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
602            $ARCH = "mips32"; # Lemote
603           } else {
604            $ARCH = "mipsel";
605           }
606         }
607         else {
608           $ARCH = "mips";
609         }
610       }
612       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH;
613       if ( $JDK =~ m/sun/ && -d "@JAVA_HOME@".$ds."jre".$ds."lib".$ds."mips32" ) {
614         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."client"; # Lemote
615       } else {
616         $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."server";
617       }
618       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds.$ARCH.$ds."native_threads";
619    }
622    $INPATH         = $OUTPATH.$PROEXT;
624 elsif ( $platform =~ m/cygwin|mingw32/ )
626       $MSPDB_PATH     = PathFormat('@MSPDB_PATH@');
627       $MIDL_PATH      = PathFormat('@MIDL_PATH@');
628       $CSC_PATH       = PathFormat('@CSC_PATH@');
629       $SHOWINCLUDES_PREFIX = '@SHOWINCLUDES_PREFIX@';
630       $WINDOWS_SDK_HOME      = PathFormat('@WINDOWS_SDK_HOME@');
631       $DIRECTXSDK_LIB = PathFormat('@DIRECTXSDK_LIB@');
632       $USE_DIRECTX5   = "";
633       $DOTNET_FRAMEWORK_HOME = PathFormat('@DOTNET_FRAMEWORK_HOME@');
634       $CPUNAME        = "INTEL";
635       $CPUNAME        = "X86_64" if $CL_X64;
636       $CPU            = "I";
637       $CPU            = "X" if $CL_X64;
638       $GUI            = "WNT";
639       $GUIBASE        = "WIN";
640       $GVER           = "NT351";
641       $OS             = "WNT";
642       $DYNAMIC_CRT    = "TRUE";
643       $use_shl_versions = "TRUE";
644       $wps = ';' if '@build_os@' eq 'cygwin'; # Windows style path seperator
645   if ( $MINGW eq "yes" )
646   {   print "Setting Windows (MinGW cross-compilation) specific values... ";
648       die 'For building natively on Windows we support only MSVC' if ('@build_os@' eq 'cygwin');
650       $PATH_SEPERATOR = ':';
651       $oldoutfile     = "WindowsMinGWEnv.Set.sh";
652       $COMPATH        = PathFormat('@COMPATH@/bin');
653       $COMPATH        =~ s/\/bin$//i;
654       $COM            = "GCC";
655       $OUTPATH        = "wntgcci";
656       $OUTPATH        = "wntgccx" if $platform =~ m/^x86_64/;
657       $INPATH         = $OUTPATH.$PROEXT;
658   }
659   else # The MSVC section starts here
660   {   print "Setting Windows (MSVC) specific values... ";
661       $oldoutfile     = "WindowsMSVCEnv.Set.sh";
662       $COMPATH        = PathFormat('@COMPATH@');
663       $COM            = "MSC";
664       $OUTPATH        = "wntmsci@COMEX@";
665       $OUTPATH        = "wntmscx@COMEX@" if $CL_X64;
666       $INPATH         = $OUTPATH.$PROEXT;
667       $COMEX          = '@COMEX@';
668       if ( "@DISABLE_ACTIVEX@" ) {
669           $ATL_LIB     = $WINDOWS_SDK_HOME.$ds."lib"; # Doesn't exist for VSE
670           $ATL_INCLUDE = $WINDOWS_SDK_HOME.$ds."include".$ds."atl";
671           $MFC_LIB     = $WINDOWS_SDK_HOME.$ds."lib"; # Doesn't exist for VSE
672           $MFC_INCLUDE = $WINDOWS_SDK_HOME.$ds."include".$ds."mfc";
673       } else {
674           $ATL_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
675           $ATL_INCLUDE = $COMPATH.$ds."atlmfc".$ds."include";
676           $MFC_LIB     = $COMPATH.$ds."atlmfc".$ds."lib";
677           $MFC_INCLUDE = $WINDOWS_SDK_HOME.$ds."include".$ds."mfc";
678       }
679       if ($CL_X64) {
680           $ATL_LIB     .= $ds."amd64";
681           $MFC_LIB     .= $ds."amd64";
682       }
683       $PATH_SEPERATOR = ';';
684   }
686 elsif ( $platform =~ m/darwin/ )
688     $COM            = "GCC";
689     $COMPATH        = '@COMPATH@';
690     if ($platform =~ m/^arm/)
691     {
692         print "Setting values for iOS... ";
693         $oldoutfile     = "iOSEnv.Set.sh";
694         $CPU            = "R";
695         $CPUNAME        = "ARM";
696         $OUTPATH        = "unxiosr";
697         $GUI            = "UNX";
698         $OS             = "IOS";
699         $GUIBASE        = "cocoatouch";
700     }
701     elsif ($platform =~ m/^powerpc/)
702     {
703         print "Setting values for Mac OS X/Darwin on PowerPC... ";
704         $oldoutfile     = "MacOSXPPCEnv.Set.sh";
705         $CPU            = "P";
706         $CPUNAME        = "POWERPC";
707         $OUTPATH        = "unxmacxp";
708         $OS             = "MACOSX";
709         $GUI            = "UNX";
710         $GUIBASE        = "aqua";
711         $MACOSX_SDK_PATH='@MACOSX_SDK_PATH@';
712         $FRAMEWORKSHOME = $MACOSX_SDK_PATH."/System/Library/Frameworks";
713     }
714     else
715     {
716         print "Setting values for Mac OS X/Darwin on default x86... ";
717         $oldoutfile     = "MacOSXX86Env.Set.sh";
718         $CPU            = "I";
719         $CPUNAME        = "INTEL";
720         $OUTPATH        = "unxmacxi";
721         $OS             = "MACOSX";
722         $GUI            = "UNX";
723         $GUIBASE        = "aqua";
724         $MACOSX_SDK_PATH='@MACOSX_SDK_PATH@';
725         $FRAMEWORKSHOME = $MACOSX_SDK_PATH."/System/Library/Frameworks";
726     }
727     $GVER           = "VCL";
728     $INPATH         = $OUTPATH.$PROEXT;
729     $PATH_SEPERATOR = $ps;
731 elsif ( $platform =~ m/dragonfly/ )
733    if ($platform =~ m/^i386/)
734    {  print "Setting DragonFly i386 specific values... ";
735       $CPU            = "I";
736       $CPUNAME        = "INTEL";
737       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386";
738       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."client";
739       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."i386".$ds."native_threads";
740    }
741    elsif ($platform =~ m/^x86_64/)
742    {  print "Setting DragonFly x86-64 specific values... ";
743       $CPU            = "X";
744       $CPUNAME        = "X86_64";
745       $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64";
746       $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."server";
747       $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."amd64".$ds."native_threads";
748    }
749    else
750    { print "Unsupported DragonFly architecture: $platform \n";
751      exit 1;
752    }
753    # General DragonFly settings:
754       $COM            = "GCC";
755       $COMPATH        = '@COMPATH@';
756       $GUI            = "UNX";
757       $GUIBASE        = "unx";
758       $GVER           = "VCL";
759       $OS             = "DRAGONFLY";
760       $PATH_SEPERATOR = $ps;
761       $OUTPATH        = "unxdfly";
762       $oldoutfile     = "DragonFlyEnv.Set.sh";
763       $INPATH         = $OUTPATH.$PROEXT;
765 elsif ( $platform =~ m/aix/ )
767    print "Setting AIX PPC specific values... ";
768    $oldoutfile     = "aixPPCEnv.Set.sh";
769    $CPU            = "P";
770    $CPUNAME        = "POWERPC";
771    $OUTPATH        = "unxaigppc";
772    $JRELIBDIR      = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc";
773    $JRETOOLKITDIR  = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."classic";
774    $JRETHREADDIR   = '$JAVA_HOME'.$ds."jre".$ds."lib".$ds."ppc".$ds."native_threads";
775    $COM            = "GCC";
776    $COMPATH        = '@COMPATH@';
777    $GUI            = "UNX";
778    $GUIBASE        = "unx";
779    $GVER           = "VCL";
780    $INPATH         = $OUTPATH.$PROEXT;
781    $OS             = "AIX";
782    $PATH_SEPERATOR = $ps;
784 else {
785         print "\nset_soenv:  Cannot recognize the platform you are building for: $platform.\n";
786         exit 1;
788 print "done\n";
791 # D. Gathering directory information from the user.
793 # If the directory does not exist something is strange.
794 # 1. LibreOffice build home directory.
795 chomp($SRC_ROOT  = `pwd`);
796 $SRC_ROOT = PathFormat($SRC_ROOT);
797 CheckPathExist( $SRC_ROOT );
800 # 2. Java home directory.
801 # JAVA_HOME as argument from autoconf.
802 $JAVA_HOME = PathFormat('@JAVA_HOME@') ;
804 if ( $platform =~ m/cygwin/ ) {
805    $JAVA_HOME =~ s/[\s\/]+$//;  # remove trailing \n or \/ if there is any.
807 # 3. bash path.
808 $OOO_SHELL = '@BASH@';
810 # ml.exe assembler path for Windows users.
811 if ($platform =~ m/cygwin/)
812 {  $ASM_PATH = PathFormat('@ASM_HOME@');
815 # Check for prebuild mozab libraries if we don't build them # ourselves
816 # and we're also not using the external system mozilla installation.
818 # FIXME! This check should be done in configure and not here, but
819 # the $OS, $COM, $CPU variables are not yet present there.
821 if ( "@WITH_MOZILLA@" eq "YES" and "@BUILD_MOZAB@" ne "TRUE" and "@SYSTEM_MOZILLA@" ne "YES" )
823    print("Checking for prebuilt Mozilla libraries ...");
824    my $mozbinfile = $SRC_ROOT."/moz/zipped/";
825    if ( $^O eq 'MSWin32' ) {
826        chomp( $mozbinfile = qx{cygpath -d "$mozbinfile"} );
827    }
828    $mozbinfile .= $OS.$COM.$CPU;
829    if ( -e $mozbinfile."inc.zip"
830         and -e $mozbinfile."lib.zip"
831         and -e $mozbinfile."runtime.zip" )
832    {   print " found.\n";
833        $PREBUILD_MOZAB = "YES";
834    }
835    else
836    {   print " not found!\n\n";
837        print "If you don\'t use the system mozilla and also not build the needed\n";
838        print "mozilla libraries yourself you have to provide the needed files\n";
839        print "$OS$COM$CPU\{inc,lib,runtime\}.zip in moz/zipped/ .\n";
840        print "These files can be found here:\n";
841        print "  <http://dev-www.libreoffice.org/mozilla/>.\n\n";
842        die;
843    }
844    if ( $OS eq 'WNT' ) {
845        my $ext_msvc = $SRC_ROOT."/external/msvcp80";
846        chomp( $ext_msvc = qx{cygpath -d "$ext_msvc"} );
847        print("Checking for MSVC 2005 runtime needed for the prebuilt Mozilla ...");
848        if ( -e $ext_msvc."/Microsoft.VC80.CRT.manifest" and
849                -e $ext_msvc."/msvcp80.dll" and
850                -e $ext_msvc."/msvcr80.dll" ) 
851        {
852            print " found.\n";
853        }
854        else
855        {   print " not found!\n\n";
856            print "For the pre-built Mozilla libraries, you need MSVC 2005 runtime\n";
857            print "files Microsoft.VC80.CRT.manifest, msvcp80.dll, and msvcr80.dll\n";
858            print "in external/msvcp80.\n\n";
859            print "You can get them by installing:\n";
860            print "  <http://download.microsoft.com/download/8/B/4/8B42259F-5D70-43F4-AC2E-4B208FD8D66A/vcredist_x86.EXE>.\n";
861            print "and copying the abovementioned files from:\n";
862            print "  c:/windows/winsxs/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989/\n";
863            print "and\n";
864            print "  c:/windows/winsxs/manifests/x86_Microsoft.VC80.CRT_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_e6967989.manifest\n\n";
865            die;
866        }
867     }
869 else
871    $PREBUILD_MOZAB = "";
875 # E. Determining the envionment values based on the information
876 #    that was gathered earlier on.
878 $USR                  = $ds."usr";
879 $ETC                  = $ds."etc";
880 $BIN                  = $ds."bin";
881 $LIB                  = $ds."lib";
882 $LIB64                = $ds."lib";
883 $LIB64               .= "64"
884 if ($platform =~ m/x86_64-.*-linux/);
885 $LIB64               .= "64"
886 if (($platform =~ m/powerpc64-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
887 $LIB64               .= "64"
888 if (($platform =~ m/s390x-.*-linux/) && ('@SIZEOF_LONG@' eq '8'));
889 $LIB64               .= $ds."x64"
890 if ($platform =~ m/cygwin/);
891 $INC                  = $ds."inc";
892 $INCLUDE              = $ds."include";
893 $DEV                  = $ds."dev";
894 $OPT                  = $ds."opt";
895 $LOCAL                = $ds."local";
896 $SOLENV               = $ds."solenv";
897 $SOLVER               = $ds."solver";
898 $DEFIMGS              = $ds."default_images";
899 $CONFIG               = $ds."config";
900 $USR_BIN              = $USR.$BIN;
901 $USR_LIB              = $USR.$LIB64;
902 $USR_LOCAL            = $USR.$ds."local";
903 $USR_CCS              = $USR.$ds."ccs";
904 $USR_OPENWIN          = $USR.$ds."openwin";
905 $USR_DT               = $USR.$ds."dt";
906 $COMMON_BUILD_TOOLS   = '$SRC_ROOT'.$ds."external".$ds."common";
908 # Windows NT only variables
909 if ($platform =~ m/cygwin/)
911    if ( $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME" )
912    {
913       $JAVA_LIB             = $JAVA_HOME.$LIB;
914    }
915    # Import SystemDrive enviroment variable
916    use Env qw(SYSTEMDRIVE);
917    # Change $SYSTEMDRIVE to lower case.
918    $SYSTEMDRIVE          = lc $SYSTEMDRIVE;
919    use Env qw(SYSTEMROOT);
920    $CYGWIN_PATH          = PathFormat('/usr/bin'); # Windows bash path
921    $WIN_GREP             = '$CYGWIN_PATH'.$ds."grep.exe";
922    $WIN_FIND             = '$CYGWIN_PATH'.$ds."find.exe";
923    $WIN_LS               = '$CYGWIN_PATH'.$ds."ls.exe";
924    $WIN_GNUCOPY          = '$CYGWIN_PATH'.$ds."cp.exe";
925    $WIN_TOUCH            = '$CYGWIN_PATH'.$ds."touch.exe";
928 if ( $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME" )
930    $JAVA_BIN             = $JAVA_HOME.$BIN;
931    $JAVA_INCLUDE         = $JAVA_HOME.$INCLUDE;
935 $PERL                 = PathFormat('@PERL@'); # Perl program
936 $PERL_PATH            = dirname('@PERL@'); # Perl Path
937 $XLIB                 = PathFormat('@XLIB@'); # X11 libraries
938 $XINC                 = PathFormat('@XINC@'); # X11 includes
940 # The project's workstamp.
941 $WORK_STAMP            = "@SOURCEVERSION@";
942 # Location of the source.
943 $SOLARSRC             = '$SRC_ROOT';
945 # default TARFILE_LOCATION
946 if ('@TARFILE_LOCATION@' eq "DEFAULT")
947 {       $TARFILE_LOCATION="$SRC_ROOT/src";
951 $DEVROOT              = '$SRC_ROOT';
952 $SOLARENV             = PathFormat($SRC_ROOT.$SOLENV);
953 # Location of the solver tree.
954 if ('@LOCAL_SOLVER@' eq "DEFAULT")
955 {  $SOLARVER          = $SRC_ROOT.$SOLVER;
957 else
958 {  $SOLARVER          = PathFormat('@LOCAL_SOLVER@');
960 #Location of Solar version.
961 $SOLARVERSION         = '$SOLARVER';
963 #Location of gnu make directories.
964 $WORKDIR              = '$SRC_ROOT/workdir/$INPATH';
965 $OUTDIR              = '$SOLARVER/$INPATH';
966 #Some directories that are symlinks under rawbuild, have to use realpath on Cygwin
967 $SOLARDEFIMG          = PathFormat($SRC_ROOT.$DEFIMGS);
970 $SOLARENVINC          = '$SOLARENV'.$INC;
971 # Location of dmake resource.
972 $DMAKEROOT            = '$SOLARENVINC'.$ds."startup";
973 # Location of JDK classes .zip file.
974 # but in jdk 1.2 it is called rt.jar and it lives in jre/lib
975 $CLASSPATH            = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
976 # Location of the JDK supported standard classes.zip file.
977 # see above for why the change
978 $XCLASSPATH           = '$JAVA_HOME'.$ds.'jre'.$LIB.$ds."rt.jar".$wps.'.';
980 # Location of the translations module
981 $L10N_MODULE = PathFormat($SRC_ROOT."/translations");
983 # Check for poor help localizations, i.e. no help translation at all...
984 @languages=();
985 if (opendir(DIR,$L10N_MODULE . "/source"))
987     @languages = readdir(DIR);
988     closedir(DIR);
990 $WITH_POOR_HELP_LOCALIZATIONS = "";
992 foreach $language (@languages)
994     if ( ($language ne ".") && ($language ne "..") && (! -d $L10N_MODULE . "/source/" . $language . "/helpcontent2") )
995     {
996         $WITH_POOR_HELP_LOCALIZATIONS = $WITH_POOR_HELP_LOCALIZATIONS . " " . $language;
997     }
1000 # Location used by the linker to create libraries.
1001 if ($platform =~ m/solaris/)
1002 {  $SOLAREXTRALIB     = $L.$par_dir.$LIB.
1003                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$ds."lib.solaris.2.6".
1004                         $L.$LIB.
1005                         $L.$USR.$LIB.
1006                         $L.$USR.$LOCAL.$LIB.
1007                         $L.$USR_DT.$LIB.
1008                         $L.$USR_OPENWIN.$LIB;
1010 elsif ($platform =~ m/linux|netbsd|freebsd|aix|openbsd|dragonfly/)
1012    $SOLAREXTRALIB     = $L.$par_dir.$LIB64;
1014 elsif ($platform =~ m/darwin/ && $platform !~ m/^arm/)
1016   # Nothing should be needed
1018 elsif ($platform !~ m/cygwin/ && $platform !~ m/mingw32/ && $platform !~ m/^arm-apple/)
1019 {  AddWarning( "set_soenv", "$platform not configured for linkage create libraries" );
1022 # Windows NT only variables
1023 if ($platform =~ m/cygwin/)
1024 {  $COMP_ENV          = $OUTPATH;
1026    $JAVAHOME          = '$JAVA_HOME';
1028    $ILIB             = $cur_dir;
1030    $ILIB       .=    $wps.$SOLARVER.$ds.$INPATH.$LIB;
1031    if ( $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME" ) {
1032        $ILIB   .= $wps.$JAVA_HOME.$LIB;
1033    }
1034    if ( $CL_X64 ne "TRUE" ) {
1035        $ILIB   .= $wps.$COMPATH.$LIB.
1036                   $wps.$WINDOWS_SDK_HOME.$LIB;
1037    } else {
1038        $ILIB   .= $wps.$COMPATH.$LIB.$ds."amd64".
1039                   $wps.$WINDOWS_SDK_HOME.$LIB64;
1040    }
1041    $ILIB       .= $wps.$DOTNET_FRAMEWORK_HOME.$LIB;
1042    if ( '@ENABLE_DIRECTX@' ne "" ) {
1043        $ILIB   .= $wps.$DIRECTXSDK_LIB;
1044    }
1045    # ILIB needs to use '\' directory seperators;
1046    $ILIB = WinPath( $ILIB, ";" );
1048    $JAVAHOME          = '$JAVA_HOME';
1052 # The general environment path.
1053 if ($platform =~ m/linux|netbsd|freebsd|aix|solaris|openbsd|dragonfly/)
1054 {  $PATH              = $cur_dir.
1055 #                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1056                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1057                         $ps.'$SOLARENV'.$BIN;
1059    if ($platform =~ m/solaris/) {
1060         $PATH .= $ps.$USR_CCS.$BIN;
1061    }
1063    $PATH             .= $ps.$oldPATH;
1065    my @javaBits;
1066    if ( $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME"  &&  $JDK ne "gcj" ) {
1067       @javaBits = ( '$JAVA_HOME'.$BIN, 'javac' );
1068    } else {
1069       @javaBits = ();
1070    }
1071    $PATH              = GetCorrectPath ($PATH,
1072                                         $COMPATH, $CC,
1073                                         $PERL_PATH, 'perl',
1074                                         @javaBits);
1077 elsif ($platform =~ m/cygwin/)
1078 {  # The PATH variable is completely created from scratch. Elements
1079    # from oldPATH that are not yet included are appended to PATH at
1080    # the end.
1082    my ( $tmppath );
1084    $PATH              = $cur_dir.
1085 #                        $ps.CygFormat($SOLARVER).$ds.$INPATH.$BIN.
1086                         $ps.CygFormat($SOLARENV).$ds."bin".
1087                         $ps.CygFormat($SOLARENV).$ds.$OUTPATH.$BIN;
1089    if ( $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME" )
1090    {
1091       # hack either "hotspot" or "client" should be used, depending on the jdk version:
1092       # 1.2.x   -   no such directory, unsupported
1093       # 1.3.x   -   hotspot, client missing
1094       # 1.4.x   -   client, hotspot missing
1096       $PATH .= $ps.CygFormat($JAVA_HOME).$BIN;
1097           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."hotspot" ) {
1098                   $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."hotspot";
1099           }
1100           if ( -d $JAVA_HOME.$ds."jre".$ds."bin".$ds."client" ) {
1101                   $PATH .= $ps.CygFormat($JAVA_HOME).$ds."jre".$ds."bin".$ds."client";
1102           }
1103    }
1105    # Add path to compiler
1106    $tmppath = CygFormat($COMPATH).$BIN;
1107    $tmppath .= $ds."amd64" if $CL_X64;
1108    $tmppath =~ s/^\/\//\//;
1109    if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1110        $PATH .= $ps.$tmppath;
1111    }
1113     $tmppath = CygFormat($MSPDB_PATH);
1114     # for MSVC to find mspdb*.dll
1115     if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1116         $PATH .= $ps.$tmppath;
1117     }
1118     # need midl.exe
1119     $tmppath = CygFormat($MIDL_PATH);
1120     if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1121         $PATH .= $ps.$tmppath;
1122     }
1123     # needs csc.exe
1124     $tmppath = CygFormat($CSC_PATH);
1125     if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1126         $PATH .= $ps.$tmppath;
1127     }
1128     # Installer needs some files if the Windows Installer SDK
1129     $tmppath = CygFormat($WINDOWS_SDK_HOME);
1130     if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath\/bin)(?:[:]|\Z)/i ) {
1131         $PATH .= $ps.$tmppath.$BIN;
1132     }
1134    if ( $ASM_PATH ne "ASM_IN_PATH" )
1135    {   $PATH          .= $ps.CygFormat($ASM_PATH);
1136    }
1138    # Possible cygwin paths must follow behind the OOo and MS paths.
1139    # What the above comment means I have no idea.
1141    # Check if $PERL_PATH is already set in PATH
1142    $tmppath = CygFormat($PERL_PATH);
1143    if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1144       $PATH          .= $ps.$tmppath;
1145    }
1146    # makensis directory
1147    $NSIS_PATH = PathFormat('@NSIS_PATH@');
1148    $tmppath = CygFormat($NSIS_PATH);
1149    if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1150        $PATH          .= $ps.$tmppath;
1151    }
1152    # path to sn.exe (signing) for Windows users.
1153    my $sn_path = PathFormat('@DOTNET_FRAMEWORK_HOME@/bin');
1154    $tmppath = CygFormat($sn_path);
1155    if ( "$PATH:$oldPATH" !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1156        $PATH          .= $ps.$tmppath;
1157    }
1159    # Add the rest of the original path if it is still missing.
1160    my $expandedPATH = $PATH;
1161    $expandedPATH =~ s/(\$\w+)/$1/eeg;
1163    # fix situations where PATH may look like /bin:"C:\blah\bleh":/ugh
1164    my $fixedPATH = $oldPATH;
1165    if ( $oldPATH =~ /"/ ) {
1166    $fixedPATH = "";
1167    foreach my $pathentry ( split( '"',$oldPATH ) ) {
1168        if ( ( $pathentry =~ /^$ps/ ) || ( $pathentry =~ /$ps$/ ) ) {
1169        $fixedPATH .= $pathentry;
1170        } else {
1171        chomp( $pathentry = qx{cygpath -d "$pathentry"} ) ;
1172        chomp( $pathentry = qx{cygpath -u "$pathentry"} ) ;
1173        $fixedPATH .= $pathentry;
1174        }
1175    }
1176    }
1178    foreach my $pathentry (split($ps,$fixedPATH)) {
1179        if ( ! ( $expandedPATH =~ /(?:$ps|\A)(?:$pathentry)(?:$ps|\Z)/ ) ) {
1180            $PATH .= $ps.$pathentry;
1181            $expandedPATH .= $ps.$pathentry;
1182        }
1183    }
1185    # The path now is in cygwin posix format
1188 elsif ($platform =~ m/mingw32/)
1190    my ( $tmppath );
1192    $PATH              = $cur_dir.
1193 #                        $ps.CygFormat($SOLARVER).$ds.$INPATH.$BIN.
1194                         $ps.CygFormat($SOLARENV).$ds."bin".
1195                         $ps.CygFormat($SOLARENV).$ds.$OUTPATH.$BIN;
1197    # makensis directory
1198    $NSIS_PATH = PathFormat('@NSIS_PATH@');
1199    $tmppath = CygFormat($NSIS_PATH);
1200    if ( $PATH !~ /(?:[:]|\A)(?:$tmppath)(?:[:]|\Z)/ ) {
1201        $PATH          .= $ps.$tmppath;
1202    }
1203    $PATH              .= $ps.$oldPATH;
1205 elsif ($platform =~ m/darwin/)
1206 {  $PATH              = $cur_dir.
1207 #                        $ps.'$SOLARVER'.$ds.'$INPATH'.$BIN.
1208                         $ps.'$SOLARENV'.$ds.'$OUTPATH'.$BIN.
1209                         $ps.'$SOLARENV'.$BIN;
1211   # Append old PATH
1212   $PATH             .= $ps.$oldPATH;
1214 else
1215 {  AddWarning( "set_soenv", "$platform not configured for general environment paths" );
1218 # Linker library search directory paths.
1219 if ($platform =~ m/solaris/)
1220 {  $SOLARLIB          = $L.$par_dir.$LIB.
1221                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1222                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1223                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1224                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB."solaris.2.6".
1225                         $L.$LIB.
1226                         $L.$USR_LIB;
1227    if ( $CC =~ "gcc" ) {
1228       $SOLARLIB      .= $L.$COMPATH.$LIB;
1229    }
1230    $SOLARLIB         .= $L.$USR_LOCAL.$LIB.
1231                         $L.$USR_DT.$LIB.
1232                         $L.$USR_OPENWIN.$LIB.
1233                         $L.$XLIB;
1235    $JAVALIB          =  $L.'$JAVA_HOME'.$LIB.
1236                         $L.$JRELIBDIR.
1237                         $L.$JRETOOLKITDIR.
1238                         $L.$JRETHREADDIR;
1240 elsif ($platform =~ m/linux|netbsd|aix|freebsd|openbsd|dragonfly/)
1241 {  $SOLARLIB          = $L.$par_dir.$LIB.
1242                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1243                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB.
1244                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB;
1245    if ($platform =~ m/openbsd/) {
1246       $SOLARLIB       .= $L.$USR_LOCAL.$LIB;
1247    }
1248    if ( $XLIB ne "/usr/lib" && $XLIB ne "/usr/lib64" && $XLIB ne "no_x_libraries" ) {
1249       $SOLARLIB       .= $L.$XLIB;
1250    }
1251    $JAVALIB           = $L.'$JAVA_HOME'.$LIB64.
1252                         $L.$JRELIBDIR.
1253                         $L.$JRETOOLKITDIR.
1254                         $L.$JRETHREADDIR;
1256 elsif ($platform =~ m/cygwin|mingw32/)
1257 {  $SOLARLIB          = $L.$par_dir.$LIB.
1258                         $L.'$SOLARENV'.$ds.'$OUTPATH'.$LIB.
1259                         $L.'$SOLARVER'.$ds.'$INPATH'.$LIB;
1261 elsif ($platform =~ m/darwin/)
1262 {  $SOLARLIB          = $L.'$SOLARVER'.$ds.'$INPATH'.$LIB;
1263     # [ed] 6/15/02 Add in X11 libraries onto the library path
1264     if ($GUIBASE eq "unx") {
1265        $SOLARLIB      .= $L.$XLIB;
1266     }
1269 if ($SYSTEM_MOZILLA eq "YES")
1271        $SOLARLIB .= $L."@MOZ_LIB@"
1274 # Location of the compiler include search directory paths.
1275 $SOLARINC             = $I.$cur_dir.
1276                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."stl".
1277                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.$ds."external".
1278                         $I.'$SOLARVER'.$ds.'$INPATH'.$INC.
1279                         $I.'$SOLARENV'.$INC.$ds.'$OUTPATH'.
1280                         $I.'$SOLARENV'.$INC.
1281                         $I.'$SRC_ROOT'.$ds."res";
1283 if ($platform =~ m/solaris|linux|freebsd|netbsd|aix|openbsd|dragonfly/)
1285 if ($platform =~ m/solaris/ && ! $CC =~ "gcc")
1287 $SOLARINC            .= '/SC5 ';
1289 # Platform dependent include path at the top of this list of include paths
1290 if ($platform =~ m/solaris/ && ! $CC =~ "gcc")
1292     $SOLARINC         .= $I.$COMPATH.$INCLUDE;
1295         # pickup system jpeg over java jpeg on OpenBSD
1296         if ($platform =~ m/openbsd/)
1297         {   $SOLARINC  .= $I.$USR_LOCAL.$INCLUDE;
1298         }
1299     if ( $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME" )
1300     {   $SOLARINC  .= $I.'$JAVA_HOME'.$INCLUDE;
1301         }
1303         #include system dependent Java include directory
1304         if (!($JDK eq "gcj") && $JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME")
1305         {
1306                 if ($platform =~ m/solaris/)
1307                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."solaris";
1308                 }
1309                 elsif  ($platform =~ m/linux/)
1310                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1311                 }
1312                 elsif ($platform =~ m/freebsd/)
1313                 {
1314                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."freebsd";
1315                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."bsd";
1316                 $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."linux";
1317                 }
1318                 elsif ($platform =~ m/netbsd/)
1319                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."netbsd";
1320                 }
1321                 elsif ( $platform =~ m/aix/ )
1322                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."aix";
1323                 }
1324                 elsif ($platform =~ m/openbsd/)
1325                 {  $SOLARINC   .=$I.'$JAVA_HOME'.$INCLUDE.$ds."openbsd";
1326                 }
1328                 #java threads include path
1330         $SOLARINC .=$I.'$JAVA_HOME'.$INCLUDE.$ds."native_threads".$INCLUDE;
1331         }
1332     #The tail, if needed
1333     if ($platform =~ m/linux|freebsd|netbsd|aix|openbsd|dragonfly/)
1334     {  if ( $XINC ne "/usr/include" && $XINC ne 'no_x_includes' ) {
1335             $SOLARINC  .= $I.$XINC;
1336        }
1337     }
1339 elsif ($platform =~ m/cygwin/)
1340 {  if ($JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME")
1341    {  $SOLARINC       .= $I.'$JAVA_HOME'.$INCLUDE.$ds."win32".
1342                          $I.'$JAVA_HOME'.$INCLUDE;
1343    }
1344    $SOLARINC       .= $I.'$WINDOWS_SDK_HOME'.$INCLUDE.
1345                       $I.'$COMPATH'.$INCLUDE;
1346    if ( '@ENABLE_DIRECTX@' ne "" ) {
1347        $SOLARINC   .= $I.PathFormat('@DIRECTXSDK_HOME@').$INCLUDE;
1348    }
1350 elsif ($platform =~ m/mingw32/)
1351 {  if ($JAVA_HOME ne "" && $JAVA_HOME ne "NO_JAVA_HOME")
1352    {  if (  '@build_os' eq 'cygwin' )
1353       {  # Using MinGW from Cygwin. Use the normal Windows JDK
1354          # headers
1355          $SOLARINC       .= $I.'$JAVA_HOME'.$INCLUDE.$ds."win32".
1356                             $I.'$JAVA_HOME'.$INCLUDE;
1357       }
1358       else
1359       {  # Cross-compilation. Use our fake jni_md.h
1360          # and othewise the build platform JDK headers
1361          $SOLARINC       .= $I.$SOLARENVINC.$ds."win32".
1362                             $I.'$JAVA_HOME'.$INCLUDE;
1363       }
1364    }
1366 elsif ($platform =~ m/darwin/ && $platform !~ m/^arm/)
1367 {  $SOLARINC         .= $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Versions".$ds."Current".$ds."Headers".
1368                         $I.$FRAMEWORKSHOME.$ds."JavaVM.framework".$ds."Headers";
1370 elsif ($platform =~ m/^arm-apple/)
1373 else
1374 {  AddWarning( "set_soenv", "$platform not configured for system dependant include dir" );
1377 $gb_REPOS = $SRC_ROOT;
1378 $BUILD_TYPE = "@BUILD_TYPE@";
1380 if ('@WITH_LANG@' ne "")
1382     $BUILD_TYPE = "@BUILD_TYPE@ TRANSLATIONS";
1384 else
1386     $BUILD_TYPE = "@BUILD_TYPE@";
1390 # F. Setting the different aliases.
1392 # 1. alias for a full product make.
1393         $mkout           = '"perl $SOLARENV/bin/mkout.pl"';
1394         $deliver         = '"perl $SOLARENV/bin/deliver.pl"';
1395         $build           = '"perl $SOLARENV/bin/build.pl"';
1396         $zipdep          = '"perl $SOLARENV/bin/zipdep.pl"';
1399 #--------------------------
1400 # VI. Open the output file.
1401 #--------------------------
1403 if (-f $SRC_ROOT.$ds.$oldoutfile) {
1404     print "****\n";
1405     print "**** Note: There is no $oldoutfile any more. Now it is just called Env.Host.sh\n";
1406     print "****\n";
1407     unlink($SRC_ROOT.$ds.$oldoutfile);
1409 $outfile = 'Env.Host.sh';
1411 open( OUT, ">$SRC_ROOT/$outfile" ) ||
1412    die "Cannot open $SRC_ROOT/$outfile: $!\n";
1415 #------------------------------------------
1416 # VII. Writing the data to the output file.
1417 #------------------------------------------
1419 # Write file header.
1420 CreateFileHeader( *OUT, $UPD, $platform, "sh/bash/ksh", "#" );
1422 ToFile( "SRC_ROOT",          $SRC_ROOT,          "e" );
1423 ToFile( "OOO_SHELL",         $OOO_SHELL,         "e" );
1424 ToFile( "JAVA_HOME",         $JAVA_HOME,         "e" );
1425 ToFile( "L10N_MODULE",       $L10N_MODULE,       "e" );
1426 ToFile( "ANT_HOME",          PathFormat("@ANT_HOME@"), "e" );
1427 ToFile( "ANT_LIB",           PathFormat("@ANT_LIB@"), "e" );
1428 ToFile( "ANT",               PathFormat("@ANT@"), "e" );
1429 ToFile( "JDKLIB",            $JAVA_LIB,          "e" );
1430 ToFile( "ASM_PATH",          $ASM_PATH,          "e" );
1431 ToFile( "ML_EXE",            "@ML_EXE@",         "e" );
1432 ToFile( "FRAMEWORKSHOME",    $FRAMEWORKSHOME,    "e" );
1433 ToFile( "Empty",             $empty,             "n" );
1436 # Writing the platform independent constant values to file.
1437 # (c = comment, e = environment variable, a = alias )
1438 ToFile( "Platform independent constant values.", $empty, "c" );
1439 # Languages
1440 ToFile( "WITH_LANG",         "@WITH_LANG@",      "e" );
1441 ToFile( "WITH_LANG_LIST",    "@WITH_LANG_LIST@", "e" );
1442 ToFile( "INTRO_BITMAP",      "@INTRO_BITMAP@",   "e" );
1443 ToFile( "PROGRESSBARCOLOR",  "@PROGRESSBARCOLOR@",   "e" );
1444 ToFile( "PROGRESSSIZE",      "@PROGRESSSIZE@",       "e" );
1445 ToFile( "PROGRESSPOSITION",  "@PROGRESSPOSITION@",   "e" );
1446 ToFile( "PROGRESSFRAMECOLOR","@PROGRESSFRAMECOLOR@", "e" );
1447 ToFile( "ABOUT_BITMAP",      "@ABOUT_BITMAP@",   "e" );
1448 ToFile( "STARTCENTER_LEFT_BITMAP",      "@STARTCENTER_LEFT_BITMAP@",      "e" );
1449 ToFile( "STARTCENTER_RIGHT_BITMAP",     "@STARTCENTER_RIGHT_BITMAP@",     "e" );
1450 ToFile( "STARTCENTER_RTL_LEFT_BITMAP",  "@STARTCENTER_RTL_LEFT_BITMAP@",  "e" );
1451 ToFile( "STARTCENTER_RTL_RIGHT_BITMAP", "@STARTCENTER_RTL_RIGHT_BITMAP@", "e" );
1452 ToFile( "STARTCENTER_SPACE_BITMAP",     "@STARTCENTER_SPACE_BITMAP@",     "e" );
1453 ToFile( "OOO_VENDOR",        "@OOO_VENDOR@",     "e" );
1454 ToFile( "OOODMAKEMODE",      "YES",              "e" );
1455 ToFile( "PRODUCTVERSION",    "@PRODUCTVERSION@", "e" );
1456 ToFile( "WITH_POOR_HELP_LOCALIZATIONS", $WITH_POOR_HELP_LOCALIZATIONS, "e" );
1458 ToFile( "CALL_CDECL",        $CALL_CDECL,        "e" );
1459 ToFile( "COMMON_OUTDIR",     $COMMON_OUTDIR,     "e" );
1460 ToFile( "common_build",      $common_build,      "e" );
1461 ToFile( "NO_REC_RES",        $NO_REC_RES,        "e" );
1462 ToFile( "SO3",               $SO3,               "e" );
1463 ToFile( "SOLAR_PLUGIN",      $SOLAR_PLUGIN,      "e" );
1464 ToFile( "UPDATER",           $UPDATER,           "e" );
1465 ToFile( "VCL",               $VCL,               "e" );
1466 ToFile( "ENABLEUNICODE",     $ENABLEUNICODE,     "e" );
1467 ToFile( "NO_BSYMBOLIC",      $NO_BSYMBOLIC,      "e" );
1468 if ("@ENABLE_DEBUG@" eq "TRUE") {
1469 ToFile( "debug",             "true",             "e" );
1471 if ("@ENABLE_WERROR@" eq "FALSE") {
1472 ToFile( "EXTERNAL_WARNINGS_NOT_ERRORS", "TRUE",  "e" );
1474 ToFile( "PRODUCT",           "@PRODUCT@",        "e" );
1475 ToFile( "PROEXT",            $PROEXT,            "e" );
1476 ToFile( "VALGRIND_CFLAGS",   "@VALGRIND_CFLAGS@","e" );
1477 ToFile( "WITH_COMPAT_OOWRAPPERS", "@WITH_COMPAT_OOWRAPPERS@", "e" );
1478 ToFile( "UNIXWRAPPERNAME",   "@UNIXWRAPPERNAME@","e" );
1479 ToFile( "PRODUCTNAME",       "@PRODUCTNAME@",    "e" );
1480 ToFile( "INSTALLDIRNAME",    "@INSTALLDIRNAME@", "e" );
1481 ToFile( "PREFIXDIR",         "@PREFIXDIR@",      "e" );
1482 ToFile( "INSTALLDIR",        "@INSTALLDIR@",     "e" );
1483 ToFile( "LIBDIR",            "@LIBDIR@",         "e" );
1484 ToFile( "DATADIR",           "@DATADIR@",        "e" );
1485 ToFile( "MANDIR",            "@MANDIR@",         "e" );
1486 ToFile( "DOCDIR",            "@DOCDIR@",          "e" );
1487 ToFile( "BUILD_MOZAB",       "@BUILD_MOZAB@",    "e" );
1488 ToFile( "PREBUILD_MOZAB",    $PREBUILD_MOZAB,    "e" );
1489 ToFile( "MOZILLA_VERSION",   $MOZILLA_VERSION,   "e" );
1490 ToFile( "DEFAULT_MOZILLA_TOOLKIT", $MOZILLA_TOOLKIT, "e" );
1491 ToFile( "SYSTEM_NSS",  "@SYSTEM_NSS@", "e" );
1492 ToFile( "MOZILLA_HEADERS_CFLAGS",  "@MOZILLA_HEADERS_CFLAGS@", "e" );
1493 ToFile( "SYSTEM_MOZILLA_HEADERS",  "@SYSTEM_MOZILLA_HEADERS@", "e" );
1494 ToFile( "MOZILLABUILD",  "@MOZILLABUILD@", "e" );
1495 ToFile( "BUILD_VER_STRING",  "@BUILD_VER_STRING@", "e" );
1496 if ($platform =~ m/linux/ && $platform =~ m/powerpc/) {
1497 ToFile( "JITC_PROCESSOR_TYPE","6",                 "e" );
1499 ToFile( "DEFAULT_TO_ENGLISH_FOR_PACKING",  "yes", "e" );
1500 ToFile( "ENABLE_GTK",        "@ENABLE_GTK@",       "e" );
1501 ToFile( "GTK_CFLAGS",        "@GTK_CFLAGS@",       "e" );
1502 ToFile( "GTK_LIBS",          "@GTK_LIBS@",         "e" );
1503 ToFile( "ENABLE_GTK3",       "@ENABLE_GTK3@",      "e" );
1504 ToFile( "GTK3_CFLAGS",       "@GTK3_CFLAGS@",      "e" );
1505 ToFile( "GTK3_LIBS",         "@GTK3_LIBS@",        "e" );
1506 ToFile( "GTHREAD_CFLAGS",    "@GTHREAD_CFLAGS@",   "e" );
1507 ToFile( "GTHREAD_LIBS",      "@GTHREAD_LIBS@",     "e" );
1508 ToFile( "ENABLE_SYSTRAY_GTK", "@ENABLE_SYSTRAY_GTK@", "e" );
1509 ToFile( "ENABLE_STATIC_GTK", "@ENABLE_STATIC_GTK@", "e" );
1510 ToFile( "SPLIT_APP_MODULES", "@SPLIT_APP_MODULES@","e" );
1511 ToFile( "SPLIT_OPT_FEATURES","@SPLIT_OPT_FEATURES@","e" );
1512 ToFile( "ENABLE_CAIRO_CANVAS", "@ENABLE_CAIRO_CANVAS@",     "e" );
1513 ToFile( "ENABLE_OPENGL",     "@ENABLE_OPENGL@",    "e" );
1514 ToFile( "ENABLE_NSPLUGIN",     "@ENABLE_NSPLUGIN@",    "e" );
1515 ToFile( "ENABLE_PDFIMPORT",  "@ENABLE_PDFIMPORT@", "e" );
1516 ToFile( "ENABLE_MINIMIZER",   "@ENABLE_MINIMIZER@","e" );
1517 ToFile( "ENABLE_PRESENTER_SCREEN","@ENABLE_PRESENTER_SCREEN@","e" );
1518 ToFile( "ENABLE_REPORTBUILDER","@ENABLE_REPORTBUILDER@","e" );
1519 ToFile( "ENABLE_SCRIPTING_BEANSHELL","@ENABLE_SCRIPTING_BEANSHELL@","e" );
1520 ToFile( "ENABLE_SCRIPTING_JAVASCRIPT","@ENABLE_SCRIPTING_JAVASCRIPT@","e" );
1521 ToFile( "ENABLE_SCRIPTING_PYTHON","@ENABLE_SCRIPTING_PYTHON@","e" );
1522 ToFile( "ENABLE_QUICKSTART_LIBPNG", "@ENABLE_QUICKSTART_LIBPNG@", "e" );
1523 ToFile( "SYSTEM_JFREEREPORT","@SYSTEM_JFREEREPORT@","e" );
1524 ToFile( "WITH_THEMES",       "@WITH_THEMES@",      "e");
1525 ToFile( "WITH_HELPPACK_INTEGRATION",       "@WITH_HELPPACK_INTEGRATION@",      "e");
1526 ToFile( "WITH_EXTENSION_INTEGRATION",       "@WITH_EXTENSION_INTEGRATION@",      "e");
1527 ToFile( "OOO_JUNIT_JAR",     "@OOO_JUNIT_JAR@",    "e" );
1528 ToFile( "SAC_JAR",           "@SAC_JAR@",          "e" );
1529 ToFile( "LIBXML_JAR",        "@LIBXML_JAR@",       "e" );
1530 ToFile( "FLUTE_JAR",         "@FLUTE_JAR@",        "e" );
1531 ToFile( "JFREEREPORT_JAR",   "@JFREEREPORT_JAR@",  "e" );
1532 ToFile( "LIBLAYOUT_JAR",     "@LIBLAYOUT_JAR@",    "e" );
1533 ToFile( "LIBLOADER_JAR",     "@LIBLOADER_JAR@",    "e" );
1534 ToFile( "LIBFORMULA_JAR",    "@LIBFORMULA_JAR@",   "e" );
1535 ToFile( "LIBREPOSITORY_JAR", "@LIBREPOSITORY_JAR@","e" );
1536 ToFile( "LIBBASE_JAR",       "@LIBBASE_JAR@",      "e" );
1537 ToFile( "LIBFONTS_JAR",      "@LIBFONTS_JAR@",     "e" );
1538 ToFile( "LIBSERIALIZER_JAR", "@LIBSERIALIZER_JAR@","e" );
1539 ToFile( "ENABLE_MEDIAWIKI",  "@ENABLE_MEDIAWIKI@", "e" );
1540 ToFile( "SYSTEM_APACHE_COMMONS","@SYSTEM_APACHE_COMMONS@","e" );
1541 ToFile( "COMMONS_CODEC_JAR", "@COMMONS_CODEC_JAR@","e" );
1542 ToFile( "COMMONS_LANG_JAR",  "@COMMONS_LANG_JAR@", "e" );
1543 ToFile( "COMMONS_HTTPCLIENT_JAR","@COMMONS_HTTPCLIENT_JAR@","e" );
1544 ToFile( "COMMONS_LOGGING_JAR","@COMMONS_LOGGING_JAR@","e" );
1545 ToFile( "SYSTEM_SERVLETAPI", "@SYSTEM_SERVLETAPI@", "e" );
1546 ToFile( "SERVLETAPI_JAR",    "@SERVLETAPI_JAR@",   "e" );
1547 ToFile( "ENABLE_DBUS",       "@ENABLE_DBUS@",      "e" );
1548 ToFile( "DBUS_CFLAGS",       "@DBUS_CFLAGS@",      "e" );
1549 ToFile( "DBUS_LIBS",         "@DBUS_LIBS@",        "e" );
1550 ToFile( "ENABLE_GCONF",      "@ENABLE_GCONF@",     "e" );
1551 ToFile( "ENABLE_GNOMEVFS",   "@ENABLE_GNOMEVFS@",  "e" );
1552 ToFile( "ENABLE_GSTREAMER",  "@ENABLE_GSTREAMER@", "e" );
1553 ToFile( "ENABLE_GIO",        "@ENABLE_GIO@",       "e" );
1554 ToFile( "ENABLE_KDE",        "@ENABLE_KDE@",       "e" );
1555 ToFile( "KDE_CFLAGS",        "@KDE_CFLAGS@",       "e" );
1556 ToFile( "KDE_LIBS",          "@KDE_LIBS@",         "e" );
1557 ToFile( "MOC",               "@MOC@",              "e" );
1558 ToFile( "ENABLE_KDE4",       "@ENABLE_KDE4@",      "e" );
1559 ToFile( "KDE4_CFLAGS",       "@KDE4_CFLAGS@",      "e" );
1560 ToFile( "KDE4_LIBS",         "@KDE4_LIBS@",        "e" );
1561 ToFile( "MOC4",              "@MOC4@",             "e" );
1562 ToFile( "KDE_GLIB_CFLAGS",   "@KDE_GLIB_CFLAGS@",  "e" );
1563 ToFile( "KDE_GLIB_LIBS",     "@KDE_GLIB_LIBS@",    "e" );
1564 ToFile( "KDE_HAVE_GLIB",     "@KDE_HAVE_GLIB@",    "e" );
1565 ToFile( "ENABLE_KAB",        "@ENABLE_KAB@",       "e" );
1566 ToFile( "PSPRINT",           "TRUE",             "e" );
1567 ToFile( "MKDEPENDSOLVER",    "TRUE",             "e" );
1568 ToFile( "nodep",             "@nodep@",          "e" );
1569 ToFile( "TARFILE_LOCATION",  $TARFILE_LOCATION,  "e" );
1570 ToFile( "GIT_LINK_SRC", "@GIT_LINK_SRC@",  "e" );
1571 ToFile( "GIT_REPO_NAMES", "@GIT_REPO_NAMES@",  "e" );
1574 # Writing the platform dependent constant values to file.
1575 # (c = comment, e = environment variable, a = alias )
1576 ToFile( "Platform dependent constant values.", $empty, "c" );
1577 ToFile( "SOLAR_JAVA",        $SOLAR_JAVA,        "e" );
1578 ToFile( "COM",               $COM,               "e" );
1579 ToFile( "COMPATH",           $COMPATH,           "e" );
1580 ToFile( "CPU",               $CPU,               "e" );
1581 ToFile( "CPUNAME",           $CPUNAME,           "e" );
1582 ToFile( "GUI",               $GUI,               "e" );
1583 ToFile( "GUIBASE",           $GUIBASE,           "e" );
1584 ToFile( "GVER",              $GVER,              "e" );
1585 ToFile( "OS",                $OS,                "e" );
1586 ToFile( "OSVERSION",         $OSVERSION,         "e" );
1587 ToFile( "PTHREAD_CFLAGS",    "@PTHREAD_CFLAGS@", "e" );
1588 ToFile( "PTHREAD_LIBS",      "@PTHREAD_LIBS@",   "e" );
1589 ToFile( "OUTPATH",           $OUTPATH,           "e" );
1590 ToFile( "INPATH",            $INPATH,            "e" );
1591 ToFile( "PATH_SEPERATOR",    $PATH_SEPERATOR,    "e" );
1592 ToFile( "COMEX",             $COMEX,             "e" );
1593 ToFile( "DYNAMIC_CRT",       $DYNAMIC_CRT,       "e" );
1594 ToFile( "use_shl_versions",  $use_shl_versions,  "e" );
1596 if ( $platform =~ m/darwin/ && $platform !~ m/^arm/)
1598 # MAXOSX_DEPLOYMENT_TARGET : The minimum version required to run the build,
1599 # build can assume functions/libraries of that version to be available
1600 # unless you want to do runtime checks for 10.5 api, you also want to use the 10.4 sdk
1601 # (safer/easier than dealing with the MAC_OS_X_VERSION_MAX_ALLOWED macro)
1602 # http://developer.apple.com/technotes/tn2002/tn2064.html
1603     ToFile( "MACOSX_DEPLOYMENT_TARGET",       "@MACOSX_DEPLOYMENT_TARGET@",       "e" );
1604     ToFile( "MACOSX_SDK_PATH",                "@MACOSX_SDK_PATH@",                "e" );
1605     ToFile( "MAC_OS_X_VERSION_MIN_REQUIRED",  "@MAC_OS_X_VERSION_MIN_REQUIRED@", "e" );
1606     ToFile( "MAC_OS_X_VERSION_MAX_ALLOWED",   "@MAC_OS_X_VERSION_MAX_ALLOWED@",  "e" );
1610 # Writing the variables to file.
1611 # (c = comment, e = environment variable, a = alias, n = newline )
1612 ToFile( "Variable values.",  $empty,             "c" );
1613 if ( $platform =~ m/cygwin/ )
1614 {  ToFile( "CYGWIN_PATH",       $CYGWIN_PATH,       "e" );
1615    ToFile( "WINDOWS_SDK_HOME",  $WINDOWS_SDK_HOME,  "e" );
1616    ToFile( "DIRECTXSDK_LIB",    $DIRECTXSDK_LIB,    "e" );
1617    ToFile( "USE_DIRECTX5",      $USE_DIRECTX5,      "e" );
1618    ToFile( "ATL_LIB",           $ATL_LIB,           "e" );
1619    ToFile( "ATL_INCLUDE",       $ATL_INCLUDE,       "e" );
1620    ToFile( "MFC_LIB",           $MFC_LIB,         "e" );
1621    ToFile( "MFC_INCLUDE",       $MFC_INCLUDE,       "e" );
1622    ToFile( "NSIS_PATH",         $NSIS_PATH,         "e" );
1623    ToFile( "DISABLE_ACTIVEX",   "@DISABLE_ACTIVEX@","e" );
1624    ToFile( "DISABLE_ATL",   "@DISABLE_ATL@","e" );
1625    ToFile( "INCLUDE",           "",                 "e" );
1626    # Variables used when building the parts that needs to be available
1627    # also as 64-bit versions in a 32-bit LibreOffice build, like
1628    # the Explorer extension. If the configure script hasn't
1629    # found the 64-bit (cross-)compiler, then @BUILD_X64@ will be empty.
1630    ToFile( "BUILD_X64",         "@BUILD_X64@",      "e" );
1631    if ( "@BUILD_X64@" eq "TRUE" ) {
1632        ToFile( "CC_X64_BINARY", "@CC_X64_BINARY@",  "e" );
1633        ToFile( "CXX_X64_BINARY","@CXX_X64_BINARY@", "e" );
1634        ToFile( "LINK_X64_BINARY","@LINK_X64_BINARY@","e" );
1635        ToFile( "LIBMGR_X64_BINARY","@LIBMGR_X64_BINARY@","e" );
1636    }
1638    # Hack around dmake's mktmp not generating DOS paths.
1639    my $tmpdir = qx{cygpath -m "/tmp"};
1640    chomp($tmpdir);
1641    ToFile( "TMPDIR",     $tmpdir,            "e" );
1642    if ( !defined $ENV{"TMP"} || $ENV{"TMP"} eq "" ) {
1643       ToFile( "TMP", $tmpdir, "e" );
1644    } else {
1645       ToFile( "TMP", "$ENV{'TMP'}", "e" );
1646    }
1648 elsif ( $platform =~ m/mingw32/ )
1649 {  ToFile( "NSIS_PATH",         $NSIS_PATH,         "e" );
1650    ToFile( "DISABLE_ACTIVEX",   "@DISABLE_ACTIVEX@","e" );
1651    ToFile( "DISABLE_ATL",       "@DISABLE_ATL@",    "e" );
1652    ToFile( "MINGW_CLIB_DIR",    "@MINGW_CLIB_DIR@", "e" );
1653    ToFile( "MINGW_SHARED_GCCLIB", "@MINGW_SHARED_GCCLIB@", "e" );
1654    ToFile( "MINGW_SHARED_GXXLIB", "@MINGW_SHARED_GXXLIB@", "e" );
1655    ToFile( "MINGW_SHARED_LIBSTDCPP", "@MINGW_SHARED_LIBSTDCPP@", "e" );
1656    ToFile( "MINGW_GCCDLL",      "@MINGW_GCCDLL@",   "e" );
1657    ToFile( "MINGW_GXXDLL",      "@MINGW_GXXDLL@",   "e" );
1661 if ("@WITH_VC_REDIST@" eq "TRUE") {
1662 ToFile( "WITH_VC_REDIST", "TRUE",  "e" );
1664 ToFile( "PERL",              $PERL,              "e" );
1665 ToFile( "RPM",               "@RPM@",            "e" );
1666 ToFile( "DPKG",              "@DPKG@",           "e" );
1667 ToFile( "PKGMK",             "@PKGMK@",          "e" );
1668 ToFile( "GNUMAKE",           "@GNUMAKE@",        "e" );
1669 ToFile( "GNUTAR",            "@GNUTAR@",         "e" );
1670 ToFile( "UPD",               $UPD,               "e" );
1671 ToFile( "WORK_STAMP",        $WORK_STAMP,        "e" );
1672 ToFile( "SOLARVER",          $SOLARVER,          "e" );
1673 ToFile( "SOLARVERSION",      $SOLARVERSION,      "e" );
1674 ToFile( "WORKDIR",           $WORKDIR,           "e" );
1675 ToFile( "OUTDIR",            $OUTDIR,            "e" );
1676 ToFile( "SOLARENV",          $SOLARENV,          "e" );
1677 ToFile( "SOLARDEFIMG",       $SOLARDEFIMG,       "e" );
1678 ToFile( "SOLARENVINC",       $SOLARENVINC,       "e" );
1679 ToFile( "DMAKEROOT",         $DMAKEROOT,         "e" );
1680 if ( $JDK ne "gcj" ) {
1681    ToFile( "CLASSPATH",         $CLASSPATH,         "e" );
1682    ToFile( "XCLASSPATH",        $XCLASSPATH,        "e" );
1683    ToFile( "JAVACISKAFFE",     '@JAVACISKAFFE@',    "e" );
1685 else {
1686    ToFile( "JAVACISGCJ",       '@JAVACISGCJ@',      "e" );
1688 ToFile( "AWTLIB",           '@AWTLIB@',          "e" );
1689 if ( '@JDK@' ne '' )
1691    ToFile( "JDK",             "@JDK@",           "e" );
1692    ToFile( "JAVAFLAGS",             "@JAVAFLAGS@",           "e" );
1693    ToFile( "JAVA_SOURCE_VER", "@JAVA_SOURCE_VER@","e" );
1694    ToFile( "JAVA_TARGET_VER", "@JAVA_TARGET_VER@","e" );
1695    ToFile( "JAVAINTERPRETER", PathFormat("@JAVAINTERPRETER@"), "e" );
1696    ToFile( "JAVAIFLAGS",      "@JAVAIFLAGS@",    "e" );
1697    ToFile( "JAVACOMPILER",    PathFormat("@JAVACOMPILER@"), "e" );
1698    ToFile( "JAVADOC",         PathFormat("@JAVADOC@"), "e" );
1699    ToFile( "JVM_ONE_PATH_CHECK", "@JVM_ONE_PATH_CHECK@", "e" );
1701 ToFile( "SCPDEFS",           '@SCPDEFS@',        "e" );
1702 ToFile( "SOLAREXTRAINC",     $SOLAREXTRAINC,     "e" );
1703 ToFile( "SOLAREXTRALIB",     $SOLAREXTRALIB,     "e" );
1704 if ( '@CROSS_COMPILING@' eq 'YES' )
1706    # Obviously we shouldn't set PATH to contain host binaries
1707    ToFile( "PATH",           "@PATH_FOR_BUILD@", "e" );
1709 else
1711    ToFile( "PATH",           $PATH,              "e" );
1713 ToFile( "SOLARLIB",          $SOLARLIB,          "e" );
1714 ToFile( "JAVALIB",           $JAVALIB,           "e" );
1715 ToFile( "SOLARINC",          $SOLARINC,          "e" );
1716 ToFile( "COMP_ENV",          $COMP_ENV,          "e" );
1717 ToFile( "JAVAHOME",          $JAVAHOME,          "e" );
1718 ToFile( "CC",                $CC,                "e" );
1719 ToFile( "SYSBASE",           "$ENV{SYSBASE}",    "e" ) if defined $ENV{SYSBASE};
1720 ToFile( "CROSS_COMPILING",   "@CROSS_COMPILING@","e" );
1721 ToFile( "AR",                "@AR@",             "e" );
1722 ToFile( "DLLTOOL",           "@DLLTOOL@",        "e" );
1723 ToFile( "NM",                "@NM@",             "e" );
1724 ToFile( "OBJDUMP",           "@OBJDUMP@",        "e" );
1725 ToFile( "PKG_CONFIG",        "@PKG_CONFIG@",     "e" );
1726 ToFile( "RANLIB",            "@RANLIB@",         "e" );
1727 ToFile( "STRIP",             "@STRIP@",          "e" );
1728 ToFile( "WINDRES",           "@WINDRES@",        "e" );
1729 ToFile( "BUILD_PLATFORM",    "@build@",          "e" );
1730 ToFile( "HOST_PLATFORM",     "@host@",           "e" );
1731 if ( '@CROSS_COMPILING@' eq 'YES' )
1733    ToFile( "COM_FOR_BUILD",     "@COM_FOR_BUILD@",  "e" );
1734    ToFile( "GUI_FOR_BUILD",     "@GUI_FOR_BUILD@",  "e" );
1735    ToFile( "GUIBASE_FOR_BUILD", "@GUIBASE_FOR_BUILD@", "e" );
1736    ToFile( "OS_FOR_BUILD",      "@OS_FOR_BUILD@",   "e" );
1737    ToFile( "CPU_FOR_BUILD",     "@CPU_FOR_BUILD@",  "e" );
1738    ToFile( "CPUNAME_FOR_BUILD", "@CPUNAME_FOR_BUILD@", "e" );
1739    ToFile( "CC_FOR_BUILD",      "@CC_FOR_BUILD@",   "e" );
1740    ToFile( "CXX_FOR_BUILD",     "@CXX_FOR_BUILD@",  "e" );
1741    ToFile( "GXX_INCLUDE_PATH_FOR_BUILD", "@GXX_INCLUDE_PATH_FOR_BUILD@", "e" );
1742    ToFile( "INPATH_FOR_BUILD",  "@INPATH_FOR_BUILD@", "e" );
1743    ToFile( "OUTPATH_FOR_BUILD", "@OUTPATH_FOR_BUILD@", "e" );
1744    ToFile( "MACOSX_DEPLOYMENT_TARGET_FOR_BUILD", "@MACOSX_DEPLOYMENT_TARGET_FOR_BUILD@", "e" );
1745    ToFile( "SYSTEM_LIBXSLT_FOR_BUILD", "@SYSTEM_LIBXSLT_FOR_BUILD@", "e" );
1746    ToFile( "OUTDIR_FOR_BUILD",  "@OUTDIR_FOR_BUILD@", "e");
1747    ToFile( "SOLARINC_FOR_BUILD", "@SOLARINC_FOR_BUILD@", "e");
1748    ToFile( "SOLARLIB_FOR_BUILD", "@SOLARLIB_FOR_BUILD@", "e");
1749    ToFile( "WORKDIR_FOR_BUILD", "@WORKDIR_FOR_BUILD@", "e");
1751 else
1753    ToFile( "COM_FOR_BUILD",     $COM,            "e" );
1754    ToFile( "GUI_FOR_BUILD",     $GUI,            "e" );
1755    ToFile( "GUIBASE_FOR_BUILD", $GUIBASE,        "e" );
1756    ToFile( "OS_FOR_BUILD",      $OS,             "e" );
1757    ToFile( "CPU_FOR_BUILD",     $CPU,            "e" );
1758    ToFile( "CPUNAME_FOR_BUILD", $CPUNAME,        "e" );
1759    ToFile( "CC_FOR_BUILD",      $CC,             "e" );
1760    ToFile( "CXX_FOR_BUILD",     $CXX,            "e" );
1761    ToFile( "GXX_INCLUDE_PATH_FOR_BUILD", PathFormat("@GXX_INCLUDE_PATH@"), "e" );
1762    ToFile( "INPATH_FOR_BUILD",  $INPATH,         "e" );
1763    ToFile( "OUTPATH_FOR_BUILD", $OUTPATH,        "e" );
1764    ToFile( "SYSTEM_LIBXSLT_FOR_BUILD", "@SYSTEM_LIBXSLT@", "e" );
1765    ToFile( "OUTDIR_FOR_BUILD",  $OUTDIR,         "e" );
1766    ToFile( "PATH_FOR_BUILD",    $PATH,           "e" );
1767    ToFile( "SOLARINC_FOR_BUILD", $SOLARINC,      "e" );
1768    ToFile( "SOLARLIB_FOR_BUILD", $SOLARLIB,      "e" );
1769    ToFile( "WORKDIR_FOR_BUILD", $WORKDIR,        "e" );
1771 ToFile( "GMAKE_PARALLELISM",    "@GMAKE_PARALLELISM@", "e" );
1772 ToFile( "GMAKE_MODULE_PARALLELISM","@GMAKE_MODULE_PARALLELISM@", "e" );
1773 ToFile( "SIZEOF_SHORT",         "@SIZEOF_SHORT@", "e" );
1774 ToFile( "SIZEOF_INT",           "@SIZEOF_INT@",  "e" );
1775 ToFile( "SIZEOF_LONG",          "@SIZEOF_LONG@", "e" );
1776 ToFile( "SIZEOF_LONGLONG",      "@SIZEOF_LONGLONG@", "e" );
1777 ToFile( "SIZEOF_DOUBLE",        "@SIZEOF_DOUBLE@", "e" );
1778 ToFile( "SIZEOF_POINTER",       "@SIZEOF_POINTER@", "e" );
1779 ToFile( "ALIGNOF_SHORT",        "@ALIGNOF_SHORT@", "e" );
1780 ToFile( "ALIGNOF_INT",          "@ALIGNOF_INT@", "e" );
1781 ToFile( "ALIGNOF_LONG",         "@ALIGNOF_LONG@", "e" );
1782 ToFile( "ALIGNOF_DOUBLE",       "@ALIGNOF_DOUBLE@", "e" );
1783 ToFile( "WORDS_BIGENDIAN",      "@WORDS_BIGENDIAN@", "e" );
1784 ToFile( "HAVE_GCC_NO_LONG_DOUBLE", "@HAVE_GCC_NO_LONG_DOUBLE@", "e" );
1785 ToFile( "HAVE_GCC_AVX", "@HAVE_GCC_AVX@", "e" );
1786 ToFile( "HAVE_GCC_VISIBILITY_FEATURE",
1787                 "@HAVE_GCC_VISIBILITY_FEATURE@", "e" );
1788 ToFile( "HAVE_GCC_VISIBILITY_BROKEN",
1789         "@HAVE_GCC_VISIBILITY_BROKEN@", "e" );
1790 ToFile( "HAVE_LD_HASH_STYLE","@HAVE_LD_HASH_STYLE@","e" );
1791 ToFile( "WITH_LINKER_HASH_STYLE","@WITH_LINKER_HASH_STYLE@","e" );
1792 ToFile( "HAVE_LD_BSYMBOLIC_FUNCTIONS",
1793                 "@HAVE_LD_BSYMBOLIC_FUNCTIONS@","e" );
1794 ToFile( "HAVE_THREADSAFE_STATICS", "@HAVE_THREADSAFE_STATICS@", "e" );
1795 ToFile( "HAVE_CXX0X",        "@HAVE_CXX0X@",     "e" );
1796 ToFile( "CXX",               $CXX,               "e" );
1797 ToFile( "MINGWCXX",          "@MINGWCXX@",       "e" );
1798 ToFile( "MINGWSTRIP",        "@MINGWSTRIP@",     "e" );
1799 ToFile( "WITH_STLPORT",      "@WITH_STLPORT@", "e" );
1800 ToFile( "ALLOC",             "@ALLOC@",          "e" );
1801 ToFile( "ENABLE_LTO",        "@ENABLE_LTO@",        "e" );
1802 ToFile( "ENABLE_SYMBOLS",    "@ENABLE_SYMBOLS@",    "e" );
1803 ToFile( "DISABLE_LINKOO",    "@DISABLE_LINKOO@",    "e" );
1804 ToFile( "DISABLE_STRIP",     "@DISABLE_STRIP@",     "e" );
1805 ToFile( "LFS_CFLAGS",        "@LFS_CFLAGS@",     "e" );
1806 ToFile( "ENABLE_CRASHDUMP",  "@ENABLE_CRASHDUMP@",  "e" );
1807 ToFile( "ENABLE_RANDR",      "@ENABLE_RANDR@",      "e" );
1808 ToFile( "ENABLE_FONTCONFIG", "@ENABLE_FONTCONFIG@", "e" );
1809 ToFile( "FONTCONFIG_LIBS",   "@FONTCONFIG_LIBS@",   "e");
1810 ToFile( "FONTCONFIG_CFLAGS", "@FONTCONFIG_CFLAGS@", "e");
1811 ToFile( "ENABLE_DIRECTX",    "@ENABLE_DIRECTX@",    "e" );
1812 ToFile( "ENABLE_PCH",        "@ENABLE_PCH@",       "e" );
1813 ToFile( "ENABLE_GRAPHITE",   "@ENABLE_GRAPHITE@",   "e");
1814 ToFile( "SYSTEM_GRAPHITE",   "@SYSTEM_GRAPHITE@",   "e");
1815 ToFile( "GRAPHITE_LIBS",     "@GRAPHITE_LIBS@",     "e");
1816 ToFile( "GRAPHITE_CFLAGS",   "@GRAPHITE_CFLAGS@",   "e");
1817 ToFile( "CL_X64",            "@CL_X64@",            "e");
1818 ToFile( "WITH_MYSPELL_DICTS","@WITH_MYSPELL_DICTS@","e");
1819 ToFile( "SYSTEM_DICTS",      "@SYSTEM_DICTS@",     "e");
1820 ToFile( "DICT_SYSTEM_DIR",   "@DICT_SYSTEM_DIR@",  "e");
1821 ToFile( "HYPH_SYSTEM_DIR",   "@HYPH_SYSTEM_DIR@",  "e");
1822 ToFile( "THES_SYSTEM_DIR",   "@THES_SYSTEM_DIR@",  "e");
1823 ToFile( "ENABLE_LOCKDOWN",   "@ENABLE_LOCKDOWN@",  "e" );
1824 ToFile( "ENABLE_XMLSEC",     "@ENABLE_XMLSEC@",    "e" );
1825 ToFile( "WITH_LDAP",         "@WITH_LDAP@",        "e" );
1826 ToFile( "WITH_OPENLDAP",     "@WITH_OPENLDAP@",    "e" );
1827 ToFile( "WITH_MOZILLA",      "@WITH_MOZILLA@",     "e" );
1828 ToFile( "SYSTEM_MOZILLA",    "@SYSTEM_MOZILLA@",   "e" );
1829 ToFile( "MOZ_FLAVOUR",       "@MOZ_FLAVOUR@",      "e" );
1830 ToFile( "NSS_LIBS",          "@NSS_LIBS@",         "e" );
1831 ToFile( "NSS_CFLAGS",        "@NSS_CFLAGS@",       "e" );
1832 ToFile( "MOZ_INC",           "@MOZ_INC@",          "e" );
1833 ToFile( "MOZ_LIB",           "@MOZ_LIB@",          "e" );
1834 ToFile( "MOZ_LIB_XPCOM",     "@MOZ_LIB_XPCOM@",    "e" );
1835 ToFile( "MOZ_LDAP_CFLAGS",   "@MOZ_LDAP_CFLAGS@",  "e" );
1836 ToFile( "OOOP_GALLERY_PACK", "@OOOP_GALLERY_PACK@","e" );
1837 ToFile( "OOOP_TEMPLATES_PACK", "@OOOP_TEMPLATES_PACK@","e" );
1838 ToFile( "OOOP_FONTS_PACK",   "@OOOP_FONTS_PACK@","e" );
1839 ToFile( "OOOP_SAMPLES_PACK", "@OOOP_SAMPLES_PACK@","e" );
1840 ToFile( "CT2N_EXTENSION_PACK", "@CT2N_EXTENSION_PACK@","e" );
1841 ToFile( "BARCODE_EXTENSION_PACK", "@BARCODE_EXTENSION_PACK@","e" );
1842 ToFile( "DIAGRAM_EXTENSION_PACK", "@DIAGRAM_EXTENSION_PACK@","e" );
1843 ToFile( "VALIDATOR_EXTENSION_PACK", "@VALIDATOR_EXTENSION_PACK@","e" );
1844 ToFile( "WATCH_WINDOW_EXTENSION_PACK", "@WATCH_WINDOW_EXTENSION_PACK@","e" );
1845 ToFile( "NUMBERTEXT_EXTENSION_PACK", "@NUMBERTEXT_EXTENSION_PACK@","e" );
1846 ToFile( "HUNART_EXTENSION_PACK", "@HUNART_EXTENSION_PACK@","e" );
1847 ToFile( "TYPO_EXTENSION_PACK", "@TYPO_EXTENSION_PACK@","e" );
1848 ToFile( "GOOGLE_DOCS_EXTENSION_PACK", "@GOOGLE_DOCS_EXTENSION_PACK@","e" );
1849 ToFile( "OOOBLOGGER_EXTENSION_PACK", "@OOOBLOGGER_EXTENSION_PACK@","e" );
1850 ToFile( "SUNTEMPLATES_LANG", "@SUNTEMPLATES_LANG@","e" );
1851 ToFile( "SUNTEMPLATES_DE_PACK", "@SUNTEMPLATES_DE_PACK@","e" );
1852 ToFile( "SUNTEMPLATES_EN_US_PACK", "@SUNTEMPLATES_EN_US_PACK@","e" );
1853 ToFile( "SUNTEMPLATES_ES_PACK", "@SUNTEMPLATES_ES_PACK@","e" );
1854 ToFile( "SUNTEMPLATES_FR_PACK", "@SUNTEMPLATES_FR_PACK@","e" );
1855 ToFile( "SUNTEMPLATES_HU_PACK", "@SUNTEMPLATES_HU_PACK@","e" );
1856 ToFile( "SUNTEMPLATES_IT_PACK", "@SUNTEMPLATES_IT_PACK@","e" );
1857 ToFile( "LIGHTPROOF_EN_US_PACK", "@LIGHTPROOF_EN_US_PACK@","e" );
1858 ToFile( "LIGHTPROOF_HU_PACK", "@LIGHTPROOF_HU_PACK@","e" );
1859 ToFile( "LIGHTPROOF_RU_PACK", "@LIGHTPROOF_RU_PACK@","e" );
1860 ToFile( "LIGHTPROOF_LANG",   "@LIGHTPROOF_LANG@",  "e" );
1861 ToFile( "WITH_FONTS",        "@WITH_FONTS@",       "e" );
1862 ToFile( "WITH_AGFA_MONOTYPE_FONTS",  "@WITH_AGFA_MONOTYPE_FONTS@", "e" );
1863 ToFile( "WITHOUT_AFMS",      "@WITHOUT_AFMS@",     "e" );
1864 ToFile( "WITHOUT_PPDS",      "@WITHOUT_PPDS@",     "e" );
1865 ToFile( "WITH_BINFILTER",    "@WITH_BINFILTER@",   "e" );
1866 ToFile( "BUILD_TYPE",        "$BUILD_TYPE",       "e" );
1867 ToFile( "MINGW_EXTERNAL_DLLS","@MINGW_EXTERNAL_DLLS@","e");
1868 ToFile( "VERBOSE",           "@VERBOSE@",          "e" );
1869 ToFile( "ENABLE_ZENITY",           "@ENABLE_ZENITY@",          "e" );
1870 ToFile( "ENABLE_EVOAB2",     "@ENABLE_EVOAB2@",    "e" );
1871 ToFile( "ENABLE_UGLY",       "@ENABLE_UGLY@",      "e" );
1872 ToFile( "ENABLE_SILENT_MSI", "@ENABLE_SILENT_MSI@", "e" );
1873 ToFile( "ENABLE_RELEASE_BUILD", "@ENABLE_RELEASE_BUILD@", "e" );
1874 ToFile( "GOBJECT_CFLAGS",    "@GOBJECT_CFLAGS@",   "e" );
1875 ToFile( "GOBJECT_LIBS",      "@GOBJECT_LIBS@",     "e" );
1876 if ( '@ENABLE_RPATH@' eq "no" ) {
1877   ToFile( "LINKFLAGSRUNPATH",'',                   "e" );
1879 ToFile( "EPM",               "@EPM@",              "e" );
1880 ToFile( "EPM_FLAGS",         $EPM_FLAGS,           "e" );
1881 ToFile( "BUILD_EPM",         "@BUILD_EPM@",        "e" );
1882 ToFile( "GPERF",             "@GPERF@",            "e" );
1883 ToFile( "PKGFORMAT",         "@PKGFORMAT@",        "e" );
1884 ToFile( "SYSTEM_STDLIBS",    "@SYSTEM_STDLIBS@",   "e" );
1885 ToFile( "SYSTEM_ZLIB",       "@SYSTEM_ZLIB@",      "e" );
1886 ToFile( "SYSTEM_OPENSSL",    "@SYSTEM_OPENSSL@",   "e" );
1887 ToFile( "OPENSSL_CFLAGS",    "@OPENSSL_CFLAGS@",   "e" );
1888 ToFile( "OPENSSL_LIBS",      "@OPENSSL_LIBS@",     "e" );
1889 ToFile( "DISABLE_PYTHON",    "@DISABLE_PYTHON@",   "e" );
1890 ToFile( "SYSTEM_PYTHON",     "@SYSTEM_PYTHON@",    "e" );
1891 ToFile( "PYTHON",            "@PYTHON@",           "e" );
1892 ToFile( "PYTHON_CFLAGS",     "@PYTHON_CFLAGS@",    "e" );
1893 ToFile( "PYTHON_LIBS",       "@PYTHON_LIBS@",      "e" );
1894 ToFile( "SYSTEM_ICU",        "@SYSTEM_ICU@",       "e" );
1895 ToFile( "ICU_MAJOR",         "@ICU_MAJOR@",        "e" );
1896 ToFile( "ICU_MINOR",         "@ICU_MINOR@",        "e" );
1897 ToFile( "ICU_MICRO",         "@ICU_MICRO@",        "e" );
1898 ToFile( "ICU_RECLASSIFIED_CLOSE_PARENTHESIS", "@ICU_RECLASSIFIED_CLOSE_PARENTHESIS@", "e" );
1899 ToFile( "SYSTEM_GENBRK",     "@SYSTEM_GENBRK@",    "e" );
1900 ToFile( "SYSTEM_GENCCODE",   "@SYSTEM_GENCCODE@",  "e" );
1901 ToFile( "SYSTEM_GENCMN",     "@SYSTEM_GENCMN@",    "e" );
1902 ToFile( "SYSTEM_JPEG",       "@SYSTEM_JPEG@",      "e" );
1903 ToFile( "FREETYPE_CFLAGS",   "@FREETYPE_CFLAGS@",  "e" );
1904 ToFile( "FREETYPE_LIBS",     "@FREETYPE_LIBS@",    "e" );
1905 ToFile( "SYSTEM_POPPLER",    "@SYSTEM_POPPLER@",   "e" );
1906 ToFile( "POPPLER_CFLAGS",    "@POPPLER_CFLAGS@",   "e" );
1907 ToFile( "POPPLER_LIBS",      "@POPPLER_LIBS@",     "e" );
1908 ToFile( "GSTREAMER_CFLAGS",  "@GSTREAMER_CFLAGS@", "e" );
1909 ToFile( "GSTREAMER_LIBS",    "@GSTREAMER_LIBS@",   "e" );
1910 ToFile( "SYSTEM_CAIRO",      "@SYSTEM_CAIRO@",     "e" );
1911 ToFile( "CAIRO_CFLAGS",      "@CAIRO_CFLAGS@",     "e" );
1912 ToFile( "CAIRO_LIBS",        "@CAIRO_LIBS@",       "e" );
1913 ToFile( "XRANDR_CFLAGS",     "@XRANDR_CFLAGS@",    "e" );
1914 ToFile( "XRANDR_LIBS",       "@XRANDR_LIBS@",      "e" );
1915 ToFile( "XRANDR_DLOPEN",     "@XRANDR_DLOPEN@",    "e" );
1916 ToFile( "LIBPNG_CFLAGS",     "@LIBPNG_CFLAGS@",    "e" );
1917 ToFile( "LIBPNG_LIBS",       "@LIBPNG_LIBS@",      "e" );
1918 ToFile( "SYSTEM_LIBWPD",     "@SYSTEM_LIBWPD@",    "e" );
1919 ToFile( "WPD_CFLAGS",     "@WPD_CFLAGS@",    "e" );
1920 ToFile( "WPD_LIBS",       "@WPD_LIBS@",      "e" );
1921 ToFile( "SYSTEM_LIBWPS",     "@SYSTEM_LIBWPS@",    "e" );
1922 ToFile( "WPS_CFLAGS",     "@WPS_CFLAGS@",    "e" );
1923 ToFile( "WPS_LIBS",       "@WPS_LIBS@",      "e" );
1924 ToFile( "SYSTEM_LIBWPG",     "@SYSTEM_LIBWPG@",    "e" );
1925 ToFile( "WPG_CFLAGS",     "@WPG_CFLAGS@",    "e" );
1926 ToFile( "WPG_LIBS",       "@WPG_LIBS@",      "e" );
1927 ToFile( "SYSTEM_LIBVISIO",   "@SYSTEM_LIBVISIO@",  "e" );
1928 ToFile( "VISIO_CFLAGS",   "@VISIO_CFLAGS@",  "e" );
1929 ToFile( "VISIO_LIBS",     "@VISIO_LIBS@",    "e" );
1930 ToFile( "SYSTEM_LIBCMIS",    "@SYSTEM_LIBCMIS@",  "e" );
1931 ToFile( "LIBCMIS_CFLAGS",    "@LIBCMIS_CFLAGS@",  "e" );
1932 ToFile( "LIBCMIS_LIBS",      "@LIBCMIS_LIBS@",    "e" );
1933 ToFile( "SYSTEM_CPPUNIT",    "@SYSTEM_CPPUNIT@",   "e" );
1934 ToFile( "CPPUNIT_CFLAGS",    "@CPPUNIT_CFLAGS@",   "e" );
1935 ToFile( "CPPUNIT_LIBS",      "@CPPUNIT_LIBS@",     "e" );
1936 ToFile( "SYSTEM_LIBXML",     "@SYSTEM_LIBXML@",    "e" );
1937 ToFile( "USE_FT_EMBOLDEN",   "@USE_FT_EMBOLDEN@",  "e" );
1938 ToFile( "LIBXML_CFLAGS",     "@LIBXML_CFLAGS@",    "e" );
1939 ToFile( "LIBXML_LIBS",       "@LIBXML_LIBS@",      "e" );
1940 ToFile( "SYSTEM_EXPAT",      "@SYSTEM_EXPAT@",     "e" );
1941 ToFile( "WITH_EXTRA_GALLERY",       "@WITH_EXTRA_GALLERY@",      "e" );
1942 ToFile( "WITH_EXTRA_TEMPLATE",       "@WITH_EXTRA_TEMPLATE@",      "e" );
1943 ToFile( "WITH_EXTRA_SAMPLE",       "@WITH_EXTRA_SAMPLE@",      "e" );
1944 ToFile( "WITH_EXTRA_FONT",       "@WITH_EXTRA_FONT@",      "e" );
1945 ToFile( "SYSTEM_DB",         "@SYSTEM_DB@",        "e" );
1946 ToFile( "SYSTEM_DB_CFLAGS",  "@SYSTEM_DB_CFLAGS@", "e" );
1947 ToFile( "DB_LIB",            "@DB_LIB@",           "e" );
1948 ToFile( "DB_CPPLIB",         "@DB_CPPLIB@",        "e" );
1949 ToFile( "ENABLE_MYSQLC",     "@ENABLE_MYSQLC@",    "e" );
1950 ToFile( "ENABLE_LOMENUBAR",  "@ENABLE_LOMENUBAR@", "e" );
1951 ToFile( "DBUSMENUGTK_CFLAGS",  "@DBUSMENUGTK_CFLAGS@", "e" );
1952 ToFile( "DBUSMENUGTK_LIBS",  "@DBUSMENUGTK_LIBS@", "e" );
1953 ToFile( "ENABLE_ONLINE_UPDATE","@ENABLE_ONLINE_UPDATE@", "e" );
1954 ToFile( "SYSTEM_MYSQL",      "@SYSTEM_MYSQL@",     "e" );
1955 ToFile( "SYSTEM_MYSQL_CPPCONN","@SYSTEM_MYSQL_CPPCONN@","e" );
1956 ToFile( "MYSQL_INC",         "@MYSQL_INC@",        "e" );
1957 ToFile( "MYSQL_LIB",         "@MYSQL_LIB@",        "e" );
1958 ToFile( "MYSQL_DEFINES",     "@MYSQL_DEFINES@",    "e" );
1959 ToFile( "LIBMYSQL_PATH",     "@LIBMYSQL_PATH@",    "e" );
1960 ToFile( "SYSTEM_HSQLDB",     "@SYSTEM_HSQLDB@",    "e" );
1961 ToFile( "HSQLDB_JAR",        "@HSQLDB_JAR@",       "e" );
1962 ToFile( "SYSTEM_LUCENE",     "@SYSTEM_LUCENE@",    "e" );
1963 ToFile( "LUCENE_CORE_JAR",   "@LUCENE_CORE_JAR@",  "e" );
1964 ToFile( "LUCENE_ANALYZERS_JAR",   "@LUCENE_ANALYZERS_JAR@",  "e" );
1965 ToFile( "SYSTEM_BSH",        "@SYSTEM_BSH@",       "e" );
1966 ToFile( "BSH_JAR",           "@BSH_JAR@",          "e" );
1967 ToFile( "SYSTEM_SAXON",      "@SYSTEM_SAXON@",     "e" );
1968 ToFile( "SAXON_JAR",         "@SAXON_JAR@",        "e" );
1969 ToFile( "SYSTEM_ODBC_HEADERS","@SYSTEM_ODBC_HEADERS@","e" );
1970 ToFile( "SYSTEM_LIBXSLT",    "@SYSTEM_LIBXSLT@",   "e" );
1971 ToFile( "LIBXSLT_CFLAGS",    "@LIBXSLT_CFLAGS@",   "e" );
1972 ToFile( "LIBXSLT_LIBS",      "@LIBXSLT_LIBS@",     "e" );
1973 ToFile( "XSLTPROC",          "@XSLTPROC@",         "e" );
1974 ToFile( "SYSTEM_SANE_HEADER","@SYSTEM_SANE_HEADER@","e" );
1975 ToFile( "SYSTEM_MESA_HEADERS","@SYSTEM_MESA_HEADERS@","e" );
1976 ToFile( "SYSTEM_CURL",       "@SYSTEM_CURL@",      "e" );
1977 ToFile( "CURL_CFLAGS",       "@CURL_CFLAGS@",      "e" );
1978 ToFile( "CURL_LIBS",         "@CURL_LIBS@",        "e" );
1979 ToFile( "SYSTEM_BOOST",      "@SYSTEM_BOOST@",     "e" );
1980 ToFile( "MDDS_CPPFLAGS",     "@MDDS_CPPFLAGS@",     "e" );
1981 ToFile( "SYSTEM_MDDS",       "@SYSTEM_MDDS@",      "e" );
1982 ToFile( "SYSTEM_VIGRA",      "@SYSTEM_VIGRA@",     "e" );
1983 ToFile( "SYSTEM_NEON",       "@SYSTEM_NEON@",      "e" );
1984 ToFile( "ENABLE_LIBRSVG",    "@ENABLE_LIBRSVG@",   "e" );
1985 ToFile( "SYSTEM_LIBRSVG",    "@SYSTEM_LIBRSVG@",   "e" );
1986 ToFile( "SYSTEM_GDKPIXBUF",  "@SYSTEM_GDKPIXBUF@",   "e" );
1987 ToFile( "SYSTEM_GLIB",       "@SYSTEM_GLIB@",   "e" );
1988 ToFile( "SYSTEM_GETTEXT",    "@SYSTEM_GETTEXT@",   "e" );
1989 ToFile( "SYSTEM_LIBCROCO",   "@SYSTEM_LIBCROCO@",   "e" );
1990 ToFile( "SYSTEM_PANGO",      "@SYSTEM_PANGO@",   "e" );
1991 ToFile( "SYSTEM_LIBGSF",     "@SYSTEM_LIBGSF@",   "e" );
1992 ToFile( "SYSTEM_LIBPNG",     "@SYSTEM_LIBPNG@",   "e" );
1993 ToFile( "SYSTEM_LIBJPEG",    "@SYSTEM_LIBJPEG@",   "e" );
1994 ToFile( "NEON_VERSION",      "@NEON_VERSION@",     "e" );
1995 ToFile( "NEON_LIBS",         "@NEON_LIBS@",        "e" );
1996 ToFile( "NEON_CFLAGS",       "@NEON_CFLAGS@",      "e" );
1997 ToFile( "DISABLE_NEON",      "@DISABLE_NEON@",     "e" );
1998 ToFile( "BUILD_DMAKE",       "@BUILD_DMAKE@",      "e" );
1999 ToFile( "BUILD_STAX",        "@BUILD_STAX@",       "e" );
2000 ToFile( "BUILD_UNOWINREG",   "@BUILD_UNOWINREG@",  "e" );
2001 ToFile( "USE_XINERAMA",      "@USE_XINERAMA@",     "e" );
2002 ToFile( "XINERAMA_LINK",     "@XINERAMA_LINK@",    "e" );
2003 ToFile( "SYSTEM_REDLAND",    "@SYSTEM_REDLAND@",   "e" );
2004 ToFile( "REDLAND_CFLAGS",    "@REDLAND_CFLAGS@",   "e" );
2005 ToFile( "REDLAND_LIBS",      "@REDLAND_LIBS@",     "e" );
2006 ToFile( "BUILD_POSTGRESQL_SDBC",   "@BUILD_POSTGRESQL_SDBC@", "e" );
2007 ToFile( "SYSTEM_POSTGRESQL", "@SYSTEM_POSTGRESQL@", "e" );
2008 ToFile( "POSTGRESQL_INC",    "@POSTGRESQL_INC@",   "e" );
2009 ToFile( "POSTGRESQL_LIB",    "@POSTGRESQL_LIB@",   "e" );
2010 ToFile( "SYSTEM_HUNSPELL",   "@SYSTEM_HUNSPELL@",  "e" );
2011 ToFile( "HUNSPELL_CFLAGS",   "@HUNSPELL_CFLAGS@",  "e" );
2012 ToFile( "HUNSPELL_LIBS",     "@HUNSPELL_LIBS@",    "e" );
2013 ToFile( "SYSTEM_LPSOLVE",    "@SYSTEM_LPSOLVE@",   "e" );
2014 ToFile( "HAVE_GETOPT",       "@HAVE_GETOPT@",      "e" );
2015 ToFile( "HAVE_READDIR_R",    "@HAVE_READDIR_R@",   "e" );
2016 ToFile( "SYSTEM_LIBC",       "@SYSTEM_LIBC@",      "e" );
2017 ToFile( "SYSTEM_HYPH",       "@SYSTEM_HYPH@",      "e" );
2018 ToFile( "HYPHEN_LIB",        "@HYPHEN_LIB@",       "e" );
2019 ToFile( "SYSTEM_MYTHES",     "@SYSTEM_MYTHES@",    "e" );
2020 ToFile( "MYTHES_CFLAGS",     "@MYTHES_CFLAGS@",    "e" );
2021 ToFile( "MYTHES_LIBS",       "@MYTHES_LIBS@",      "e" );
2022 ToFile( "SYSTEM_LIBEXTTEXTCAT", "@SYSTEM_LIBEXTTEXTCAT@", "e" );
2023 ToFile( "SYSTEM_LIBEXTTEXTCAT_DATA","@SYSTEM_LIBEXTTEXTCAT_DATA@","e" );
2024 ToFile( "LIBEXTTEXTCAT_CFLAGS", "@LIBEXTTEXTCAT_CFLAGS@", "e" );
2025 ToFile( "LIBEXTTEXTCAT_LIBS", "@LIBEXTTEXTCAT_LIBS@", "e" );
2026 ToFile( "XAU_LIBS",          "@XAU_LIBS@",         "e" );
2027 ToFile( "GXX_INCLUDE_PATH",  PathFormat("@GXX_INCLUDE_PATH@"), "e" );
2028 ToFile( "COMMON_BUILD_TOOLS",$COMMON_BUILD_TOOLS,  "e" );
2029 ToFile( "MERGELIBS",         "@MERGELIBS@",           "e" );
2031 if ($platform !~ m/cygwin/) {
2032    if ( !defined $ENV{"TMPDIR"} || $ENV{"TMPDIR"} eq "" ) {
2033       ToFile( "TMPDIR",      "/tmp",               "e" );
2034    } else {
2035       ToFile( "TMPDIR",      "$ENV{'TMPDIR'}",     "e" );
2036    }
2038 ToFile( "SOLARSRC",           $SOLARSRC,           "e" );
2039 ToFile( "gb_REPOS",           $gb_REPOS,           "e" );
2041 if ( $platform =~ m/cygwin/ )
2043    ToFile( "ILIB",              $ILIB,              "e" );
2044    ToFile( "GREP",              $WIN_GREP,          "e" );
2045    ToFile( "FIND",              $WIN_FIND,          "e" );
2046    ToFile( "LS",                $WIN_LS,            "e" );
2047    ToFile( "GNUCOPY",           $WIN_GNUCOPY,       "e" );
2048    ToFile( "TOUCH",             $WIN_TOUCH,         "e" );
2051 ToFile( "DELIVER",       "deliver.pl",     "e" );
2052 ToFile( "MKOUT",         "mkout.pl",       "e" );
2053 ToFile( "ZIPDEP",        "zipdep.pl",      "e" );
2056 # Writing the aliases to file.
2057 ToFile( "Aliases.",          $empty,             "c" );
2058 ToFile( "Don't set aliases when bootstrapping", $empty, "c" );
2060 ToFile( "alias mkout",       $mkout,             "a" );
2061 ToFile( "alias deliver",     $deliver,           "a" );
2062 ToFile( "alias build",       $build,             "a" );
2063 ToFile( "alias zipdep",      $zipdep,            "a" );
2065 # on Solaris, MacOSX and FreeBSD, set GNUCOPY and GNUPATCH
2066 if ($platform =~ m/solaris|darwin|freebsd/)
2068   ToFile( "GNUPATCH",   "@GNUPATCH@",   "e");
2070 ToFile( "GNUCOPY",      "@GNUCP@",      "e");
2071 ToFile( "SAL_ENABLE_FILE_LOCKING",      "1",    "e");
2073 ToFile( "ENV_SCRIPT", "$outfile", "e" );
2075 # Writing unset variables you might not need to file.
2077 print OUT "export $exportvars$newline";
2078 print OUT "unset $unsetvars$newline";
2081 #---------------------------
2082 # VIII. Closing output file.
2083 #---------------------------
2085 close( OUT ) || print "Can't close $SRC_ROOT/$outfile: $!";
2087 #--------------------------------------------------------
2088 # XII. Message at the end.
2089 #--------------------------------------------------------
2092 print "$newline";
2093 print "*********************************************************".
2094       "*******************$newline*$newline";
2095 print "* LibreOffice configuration finished. $newline*$newline";
2097 if ( $Warning ne "" )
2098 {  print "$Warning*$newline";
2101 print "*********************************************************".
2102       "******************* $newline";
2104 print "To build, issue:\n$GNUMAKE\n\n";
2105 print "To install when the build is finished, issue:\n$GNUMAKE install\n\n";
2106 print "If you want to develop LibreOffice, you might prefer:\n$GNUMAKE dev-install\n\n";
2107 print "If you want to run the smoketest, issue:\n$GNUMAKE check\n\n";
2109 if ("@STALE_MAKE@" eq "TRUE" && $platform =~ m/cygwin/ ) {
2110 print << 'EOS'
2111 WARNING:
2112 Your make version is known to be horribly slow, and hard to debug
2113 problems with. To get a reasonably functional make please do:
2115 to install a pre-compiled binary make for cygwin
2117 mkdir -p /opt/lo/bin
2118 cd /opt/lo/bin
2119 wget http://dev-www.libreoffice.org/bin/cygwin/make
2120 chmod +x make
2122 to install from source:
2123 place yourself in a working directory of you choice.
2125 git clone git://anongit.freedesktop.org/libreoffice/contrib/dev-tools
2126 cd dev-tools/make-3.82-gbuild
2127 ./configure --prefix=/opt/lo
2128 make
2129 sudo make install
2131 Then re-run autogen.sh
2133 Note: autogen.sh will try to use /opt/lo/bin/make if the environment variable GNUMAKE is not already defined.
2134 Alternatively, you can install the 'new' make where ever you want and make sure that `which make` finds it.
2139 if ( $Warning ne "" ) {
2140         print "***** WARNINGS ISSUED *****\n";
2144 #-----------------
2145 # XII. Functions.
2146 #-----------------
2148 #-------------------------------------------------------------
2149 # Function name: CheckPathName
2150 # Description:   chops off the '/' character if it's the last
2151 #                character in a pathname. also adds the '/'
2152 #                character if it's not the first character
2153 #                in a path.
2154 # Arguments:     1. Path (string)
2155 # Return value:  Path (string)
2156 #-------------------------------------------------------------
2157 sub CheckPathName
2158 {  my $retrn = $_[ 0 ];
2159    if ($platform =~ m/cygwin/)
2160    {  # Check if the first character is not a '/'.
2161       if ( !( $_[ 0 ] =~ /^\// ) )
2162       {  $retrn = $ds.$_[ 0 ];
2163       }
2164    }
2165    # kill the last '/','\','\n' if they exists.
2166    $retrn =~ s![\s/\\]+$!!;
2167    # Done!
2168    return( $retrn );
2170 #-------------------------------------------------------------
2171 # Function name: CheckPathExist
2172 # Description:   Checks whether the directory that is given
2173 #                as an argument exists. If not abort.
2174 # Arguments:     1. Path (string)
2175 # Return value:  void
2176 #-------------------------------------------------------------
2177 sub CheckPathExist
2178 {  my $dir = $_[ 0 ];
2179    if ( !( -d $dir ) and $^O ne 'MSWin32' )
2180    {  print ( "The directory $_[ 0 ] does not exist. Please create first.\n" );
2181       exit 1;
2182    }
2183    else
2184    {  # Don't check under ActiveState Perl (Windows). The path is possibly
2185       # posix and it cannot handle it.
2186       # Hmm, but the above test also checks for existance, so presumably
2187       # the mention of ActiveState in the above comment is just a red
2188       # herring.
2189       return "true";
2190    }
2192 #------------------------------------------------------------
2193 # Function name: CreateFileHeader
2194 # Description:   Creates a header for the outfile.
2195 # Arguments:     1. File to write to
2196 #                2. UPD (string)
2197 #                3. Platform (string)
2198 #                4. name of shell for this file
2199 #                5. comment to use for this file
2200 # Return value:  void
2201 #------------------------------------------------------------
2202 sub CreateFileHeader
2203 {  my $timestamp = `date`;
2204    chomp( $timestamp );
2205    my $filehandle = $_[0];
2206    my $comment = $_[4];
2207    print { $filehandle } "$comment #################################################################";
2208    print { $filehandle } $newline;
2209    print { $filehandle } "$comment LibreOffice $_[ 1 ] build environment file for: $_[ 2 ]. $newline";
2210    print { $filehandle } "$comment Generated on: $timestamp $newline";
2211    print { $filehandle } "$comment Source this file to set up the build environment. $newline";
2212    print { $filehandle } "$comment 1. exec $_[3] $newline";
2213    print { $filehandle } "$comment 2. source $outfile $newline";
2214    print { $filehandle } "$comment #################################################################";
2215    print { $filehandle } $newline;
2217 #---------------------------------------------------------
2218 # Function name: ToFile
2219 # Description:   Writes the environment variable in the
2220 #                output file.
2221 # Arguments:     1. Name of environment variable (string)
2222 #                2. Value of environment variable (string)
2223 #                3. e - env. var
2224 #                   a - alias
2225 #                   c - comment
2226 #                   n - newline
2227 #                   z - raw, write as is to OUT
2228 # Return value:  void
2229 #---------------------------------------------------------
2230 sub ToFile {
2231    if ( $_[ 2 ] eq "e" ) {
2232       # Write an environment variable to file.
2233       if (defined $_[ 1 ] && $_[ 1 ] ne "" ) {
2234          my $envvar = $_[ 1 ];
2236          # Tcsh/bash needs backslashes quoted
2237          $envvar =~ s/\\/\\\\/g;
2239          printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", $envvar) if ( '@VERBOSE@' eq 'TRUE' );
2240          print OUT "$_[ 0 ]=\"$envvar\"$newline";      # to sh file
2241          $exportvars .= " $_[ 0 ]";                        # add to export list for sh file
2243       } else {
2244          printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", "unset") if ( '@VERBOSE@' eq 'TRUE' );
2245          $unsetvars .= " $_[ 0 ]";                             # for sh file
2246       }
2247    }
2248    elsif ( $_[ 2 ] eq "a" )
2249    {  # Write an alias to file.
2250       print "The $_[ 0 ] is set to: $_[ 1 ]\n" if ( '@VERBOSE@' eq 'TRUE' );    # to stdout
2251       print OUT "$_[ 0 ]=$_[ 1 ]$newline";      # to sh file
2252    }
2253    elsif ( $_[ 2 ] eq "c" )
2254    {  # Write a comment to file.
2255       if ( '@VERBOSE@' eq 'TRUE' )
2256       {
2257          print "$newline";
2258          print "$comment$newline";
2259          print "$comment $_[ 0 ]$newline";
2260          print "$comment$newline";
2261       }
2262       print OUT "$newline";
2263       print OUT "$comment$newline";
2264       print OUT "$comment $_[ 0 ]$newline";
2265       print OUT "$comment$newline";
2266    }
2267    elsif ( $_[ 2 ] eq "n" )
2268    {  #Write a newline to a file
2269       print OUT "$newline";
2270    }
2271    elsif ( $_[ 2 ] eq "z" )
2272    {
2273       #Write first argument as is, and nothing else
2274       print OUT "$_[ 0 ]$newline";
2275    }
2276    else
2277    {  print "Unknown type!$newline";
2278    }
2280 #----------------------------------------------------------
2281 # Function name: PathFormat
2282 # Description:   Reformat path to either POSIX or mixed mode style.
2283 # Arguments:     1. Variable (string)
2284 # Return value:  Reformatted String
2285 #----------------------------------------------------------
2286 sub PathFormat
2287 {  my ( $variable, $d1, $d2 );
2288    $variable = $_[ 0 ];
2290    if ( $platform =~ m/cygwin/ )
2291    {   $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2292        $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2294        # Complain if PosixPath is used on a PATH-like string
2295        if ( $variable =~ m/;/ ) {
2296            die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2297        }
2299        # Replace path with space with short dos path
2300        if ( $variable =~ / / ) {
2301            chomp( $variable = qx{cygpath -d "$variable"} ) ;
2302        }
2304        # Replace absolute paths or DOS paths with ...
2305        if ( ( $variable =~ m/^\// ) or ( $variable =~ m/:/ ) ) {
2306            # mixed mode paths
2307            chomp( $variable = qx{realpath "$variable"} ) unless ($variable =~ m/:/);
2308            chomp( $variable = qx{cygpath -m "$variable"} );
2309        }
2310    }
2311    return $variable;
2313 #----------------------------------------------------------
2314 # Function name: CygFormat
2315 # Description:   Format variables to cygwin posix style path
2316 #                unless .
2317 # Arguments:     1. Variable (string)
2318 # Return value:  Reformatted String
2319 #----------------------------------------------------------
2320 sub CygFormat
2321 {  my ( $variable, $d1, $d2 );
2322    $variable = $_[ 0 ];
2323    # ToDo: Do the replacement only if Windows and var contains "\" and ":"
2324    if ( $platform =~ m/cygwin/ )
2325    {
2326        # Complain if PosixPath is used on a PATH-like string
2327        if ( $variable =~ m/;/ ) {
2328            die( "Do not use on PATH lists (i.e., 'c:\\foo;d:\\bar')");
2329        }
2331        # Replace DOS paths with posix paths
2332        if ( ( $variable =~ m/\\/ ) or ( $variable =~ m/:/ ) ) {
2333            chomp( $variable = qx{cygpath -u "$variable"} );
2334        }
2335    }
2336    return $variable;
2338 #----------------------------------------------------------
2339 # Function name: WinPath
2340 # Description:   Reformat a $sep seperated path using DOS paths.
2341 # Arguments:     1. Variable (string)
2342 #                2. Separaror (string)
2343 # Return value:  Reformatted String
2344 #----------------------------------------------------------
2345 sub WinPath
2347     my ( $variable, $d1, $sep, @split_var );
2349     if ( $platform =~ m/cygwin/ ) {
2350         $variable = $_[ 0 ];
2351         $sep = $_[ 1 ];
2352         $variable =~ s/^\s+//g ; #remove leading spaces
2353         $variable =~ s/\s+$//g ; #remove trailing spaces
2354         $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables
2355         $variable =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables twice!
2357         @split_var = split(/$sep/,$variable);
2358         foreach $d1 ( @split_var ) {
2359             if ( $d1 =~ /(?:^\/[\w\.~ ]+)+/ ) {
2360                 if ( $d1 =~ / / ) {
2361                     # Use DOS 8.3 style to avoid quoting
2362                     chomp( $d1 = qx{cygpath -d "$d1"} );
2363                 } else {
2364                     # Use "normal" filenames
2365                     chomp( $d1 = qx{cygpath -w "$d1"} );
2366                 }
2367             }
2368         }
2369         $variable = join(';',@split_var);
2371         $variable =~ s/\//\\/g; # Remaining \ come from e.g.: ../foo/baa
2372     }
2374     return $variable;
2377 #--------------------------------------------------------
2378 # Function name: GetCorrectPath
2379 # Description:   Creates the build environment.
2380 # Arguments:     1.   existing / original path
2381 #                2... pairs of <path, executable>
2382 # Return value:  String - Correct Path
2383 #--------------------------------------------------------
2384 sub GetCorrectPath
2386         sub PathLookup
2387         {
2388             my $cmd = shift;
2389             while (@_) {
2390                 my $elem = shift;
2392                 -x "$elem/$cmd" && return $elem;
2393             }
2394             return '';
2395         }
2397         sub SaneGrep
2398         {
2399             # Perl grep is unbelievably strange.
2400             my $needle = shift;
2401             while (@_) {
2402                 my $haystack = shift;
2403                 if ($needle eq $haystack) {
2404                     return 1;
2405                 }
2406             }
2407             return 0;
2408         }
2410         sub CleanupPath
2411         {
2412             my @elements = @_;
2413             my @cleanName = ();
2415             while (@elements) {
2416                 my $elem = shift @elements;
2417                 if (!SaneGrep ($elem, @cleanName)) {
2418                         push @cleanName, $elem;
2419                 }
2420             }
2422             return @cleanName;
2423         }
2425         my $oldPath = shift;
2426         my @originalPairs = @_;
2427         my @pairs = @originalPairs;
2428         my @Path = split /$ps/, $oldPath;
2430         while (@pairs) {
2431             my $path = shift @pairs;
2432             my $cmd = shift @pairs;
2433             my $to_append = 1;
2434             my $elem;
2436             if (! -x "$path/$cmd") {
2437                 AddWarning ("Missing executable $path/$cmd\n");
2438             }
2440             for $elem (@Path) {
2441                 if ($elem eq $path) {
2442 #                   print "Hit duplicate path in path; break\n";
2443                     $to_append = 0;
2444                     last;
2445                 }
2446                 if (-f "$elem/$cmd") {
2447 #                   print "Element already in path ...\n";
2448                     unshift @Path, $path;
2449                     $to_append = 0;
2450                     last;
2451                 } else {
2452 #                   print "No file $elem/$cmd\n";
2453                 }
2454             }
2455             if ($to_append) {
2456                 push @Path, $path;
2457             }
2458         }
2460         @pairs = @originalPairs;
2461         while (@pairs) {
2462             my $path = shift @pairs;
2463             my $cmd = shift @pairs;
2464             my $realpath;
2466             $realpath = PathLookup ($cmd, @Path);
2467             if (!($realpath eq $path)) {
2468                 AddWarning ("Path conflict for executables " .
2469                             "$path/$cmd against $realpath");
2470             }
2471         }
2473         return join $ps, CleanupPath (@Path);
2476 #------------------------------------------------------------
2477 # Function name: AddWarning
2478 # Description:   Adds any kind of warning for the user.
2479 #                The warning will be shown at the end
2480 #                of this script.
2481 # Arguments:     1. Add the configure warnings or the set_soenv
2482 #                   warning (string).
2483 #                2. Warning (string).
2484 # Return value:  void
2485 #------------------------------------------------------------
2486 sub AddWarning
2487 {  if ( $_[ 0 ] eq "configure" )
2488    {  open( IN, $warnfile );
2489       while ( <IN> )
2490       {  $Warning = $Warning."* - ".$_;
2491       }
2492       close( IN );
2493       # Remove the temporary warning file.
2494       # unlink ( $warnfile );
2495    }
2496    elsif ( $_[ 0 ] eq "set_soenv" )
2497    {  my ( $arg1 );
2498       $arg1 = $_[ 1 ];
2499       chomp( $arg1 );                            # cut off new line
2500       $Warning = $Warning."* - set_soenv: warning: $arg1 $newline";  # add the warning
2501    }
2504 # vim:set shiftwidth=4 softtabstop=4 expandtab: #