bump product version to 4.1.6.2
[LibreOffice.git] / solenv / bin / modules / installer / environment.pm
blob63689a0158e689660965743156e74ffd3f8a8f46
2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 # This file incorporates work covered by the following license notice:
10 # Licensed to the Apache Software Foundation (ASF) under one or more
11 # contributor license agreements. See the NOTICE file distributed
12 # with this work for additional information regarding copyright
13 # ownership. The ASF licenses this file to you under the Apache
14 # License, Version 2.0 (the "License"); you may not use this file
15 # except in compliance with the License. You may obtain a copy of
16 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package installer::environment;
21 use installer::globals;
23 ######################################################
24 # Create path variables from environment variables
25 ######################################################
27 sub create_pathvariables
29 my ($environment) = @_;
31 my %variables = ();
33 # The following variables are needed in the path file list
34 # solarpath, solarenvpath, solarcommonpath, os, pmiscpath
36 my $solarpath = $environment->{'SOLARVERSION'} . $installer::globals::separator . $installer::globals::compiler . $installer::globals::productextension;
37 $variables{'solarpath'} = $solarpath;
39 my $solarcommonpath = $environment->{'SOLARVERSION'} . $installer::globals::separator . "common" . $installer::globals::productextension;
40 $variables{'solarcommonpath'} = $solarcommonpath;
42 my $shlxthdlpath = $ENV{'INSTDIR'} . $installer::globals::separator . "program" . $installer::globals::separator . "shlxthdl";
43 $variables{'shlxthdlpath'} = $shlxthdlpath;
45 $variables{'os'} = $installer::globals::compiler;
47 my $solarenvpath = "";
49 if ( $ENV{'SO_PACK'} ) { $solarenvpath = $ENV{'SO_PACK'}; }
50 # overriding with STAR_INSTPATH, if set
51 if ( $ENV{'STAR_INSTPATH'} ) { $solarenvpath = $ENV{'STAR_INSTPATH'}; }
53 $variables{'solarenvpath'} = $solarenvpath;
55 my $localpath = $environment->{'LOCAL_OUT'};
56 $variables{'localpath'} = $localpath;
58 my $localcommonpath = $environment->{'LOCAL_COMMON_OUT'};
59 $variables{'localcommonpath'} = $localcommonpath;
61 my $platformname = $environment->{'OUTPATH'};
62 $variables{'platformname'} = $platformname;
64 my $filelistpath = $environment->{'WORKDIR'};
65 $variables{'filelistpath'} = $filelistpath;
67 return \%variables;
70 ##################################################
71 # Replacing tilde in paths, because of
72 # problem with deep recursion (task 104830)
73 ##################################################
75 sub check_tilde_in_directory
77 if ( $ENV{'HOME'} )
79 my $home = $ENV{'HOME'};
80 $home =~ s/\Q$installer::globals::separator\E\s*$//;
81 $installer::globals::localinstalldir =~ s/~/$home/;
82 my $infoline = "Info: Changing LOCALINSTALLDIR to $installer::globals::localinstalldir\n";
83 push(@installer::globals::logfileinfo, $infoline);
85 else
87 # exit, because "~" is not allowed, if HOME is not set
88 my $infoline = "ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n";
89 push(@installer::globals::logfileinfo, $infoline);
90 die 'If "~" is used in "LOCALINSTALLDIR", environment variable "HOME" needs to be defined!';
94 ##################################################
95 # Setting some fundamental global variables.
96 # All these variables can be overwritten
97 # by parameters.
98 ##################################################
100 sub set_global_environment_variables
102 my ( $environment ) = @_;
104 $installer::globals::build = $environment->{'WORK_STAMP'};
105 $installer::globals::compiler = $environment->{'OUTPATH'};
107 if ( $ENV{'LAST_MINOR'} ) { $installer::globals::lastminor = $ENV{'LAST_MINOR'}; }
109 if ( $ENV{'PROEXT'} ) { $installer::globals::pro = 1; }
111 if ( $ENV{'VERBOSE'} && ( (lc $ENV{'VERBOSE'}) eq "false" ) ) { $installer::globals::quiet = 1; }
112 if ( $ENV{'PREPARE_WINPATCH'} ) { $installer::globals::prepare_winpatch = 1; }
113 if ( $ENV{'PREVIOUS_IDT_DIR'} ) { $installer::globals::previous_idt_dir = $ENV{'PREVIOUS_IDT_DIR'}; }
114 if ( $ENV{'LOCALINSTALLDIR'} ) { $installer::globals::localinstalldir = $ENV{'LOCALINSTALLDIR'}; }
115 if ( $ENV{'LOCALUNPACKDIR'} ) { $installer::globals::localunpackdir = $ENV{'LOCALUNPACKDIR'}; }
116 if ( $ENV{'MAX_LANG_LENGTH'} ) { $installer::globals::max_lang_length = $ENV{'MAX_LANG_LENGTH'}; }
118 if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; }
119 if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; }
120 if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals::ignore_error_in_logfile = 1; }
121 if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals::strip = 0; }
123 if ( $installer::globals::localinstalldir ) { $installer::globals::localinstalldirset = 1; }
124 # Special handling, if LOCALINSTALLDIR contains "~" in the path
125 if ( $installer::globals::localinstalldir =~ /^\s*\~/ ) { check_tilde_in_directory(); }