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) = @_;
33 # The following variables are needed in the path file list
34 # solarenvpath, os, pmiscpath
36 my $solarenvpath = "";
38 if ( $ENV{'SO_PACK'} ) { $solarenvpath = $ENV{'SO_PACK'}; }
39 # overriding with STAR_INSTPATH, if set
40 if ( $ENV{'STAR_INSTPATH'} ) { $solarenvpath = $ENV{'STAR_INSTPATH'}; }
42 $variables{'solarenvpath'} = $solarenvpath;
44 my $localpath = $environment->{'LOCAL_OUT'};
45 $variables{'localpath'} = $localpath;
47 my $localcommonpath = $environment->{'LOCAL_COMMON_OUT'};
48 $variables{'localcommonpath'} = $localcommonpath;
50 my $installscriptdir = $environment->{'WORKDIR'} . $installer::globals
::separator
. "InstallScriptTarget";
51 $variables{'installscriptdir'} = $installscriptdir;
53 my $extensionsdir = $environment->{'WORKDIR'} . $installer::globals
::separator
. "Extension";
54 $variables{'extensionsdir'} = $extensionsdir;
56 my $customtargetpath = $environment->{'WORKDIR'} . $installer::globals
::separator
. "CustomTarget";
57 $variables{'customtargetpath'} = $customtargetpath;
59 my $filelistpath = $environment->{'WORKDIR'};
60 $variables{'filelistpath'} = $filelistpath;
62 my $licensepath = $environment->{'SRCDIR'} . $installer::globals
::separator
. "readlicense_oo/license";
63 $variables{'licensepath'} = $licensepath;
65 my $packinfopath = $environment->{'SRCDIR'} . $installer::globals
::separator
. "setup_native/source/packinfo";
66 $variables{'packinfopath'} = $packinfopath;
71 ##################################################
72 # Replacing tilde in paths, because of
73 # problem with deep recursion (task 104830)
74 ##################################################
76 sub check_tilde_in_directory
80 my $home = $ENV{'HOME'};
81 $home =~ s/\Q$installer::globals::separator\E\s*$//;
82 $installer::globals
::localinstalldir
=~ s/~/$home/;
83 my $infoline = "Info: Changing LOCALINSTALLDIR to $installer::globals::localinstalldir\n";
84 push(@installer::globals
::logfileinfo
, $infoline);
88 # exit, because "~" is not allowed, if HOME is not set
89 my $infoline = "ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n";
90 push(@installer::globals
::logfileinfo
, $infoline);
91 die 'If "~" is used in "LOCALINSTALLDIR", environment variable "HOME" needs to be defined!';
95 ##################################################
96 # Setting some fundamental global variables.
97 # All these variables can be overwritten
99 ##################################################
101 sub set_global_environment_variables
103 my ( $environment ) = @_;
105 $installer::globals
::build
= $environment->{'LIBO_VERSION_MAJOR'}.$environment->{'LIBO_VERSION_MINOR'}."0";
106 $installer::globals
::os
= $environment->{'OS'};
107 $installer::globals
::com
= $environment->{'COM'};
108 $installer::globals
::cpuname
= $environment->{'CPUNAME'};
109 $installer::globals
::platformid
= $environment->{'PLATFORMID'};
111 if ( $ENV{'LAST_MINOR'} ) { $installer::globals
::lastminor
= $ENV{'LAST_MINOR'}; }
113 if ( $ENV{'ENABLE_DBGUTIL'} ) {} else { $installer::globals
::pro
= 1; }
115 if ( $ENV{'VERBOSE'} && ( (lc $ENV{'VERBOSE'}) eq "false" ) ) { $installer::globals
::quiet
= 1; }
116 if ( $ENV{'PREPARE_WINPATCH'} ) { $installer::globals
::prepare_winpatch
= 1; }
117 if ( $ENV{'PREVIOUS_IDT_DIR'} ) { $installer::globals
::previous_idt_dir
= $ENV{'PREVIOUS_IDT_DIR'}; }
118 if ( $ENV{'LOCALINSTALLDIR'} ) { $installer::globals
::localinstalldir
= $ENV{'LOCALINSTALLDIR'}; }
119 if ( $ENV{'LOCALUNPACKDIR'} ) { $installer::globals
::localunpackdir
= $ENV{'LOCALUNPACKDIR'}; }
120 if ( $ENV{'MAX_LANG_LENGTH'} ) { $installer::globals
::max_lang_length
= $ENV{'MAX_LANG_LENGTH'}; }
122 if ( $ENV{'RPM'} ) { $installer::globals
::rpm
= $ENV{'RPM'}; }
123 if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals
::solarisdontcompress
= 1; }
124 if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals
::ignore_error_in_logfile
= 1; }
125 if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals
::strip
= 0; }
127 if ( $installer::globals
::localinstalldir
) { $installer::globals
::localinstalldirset
= 1; }
128 # Special handling, if LOCALINSTALLDIR contains "~" in the path
129 if ( $installer::globals
::localinstalldir
=~ /^\s*\~/ ) { check_tilde_in_directory
(); }