tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / solenv / bin / modules / installer / environment.pm
blobc04971431f40d93dcbd9c159e81f97cf7db30a5e
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 strict;
22 use warnings;
24 use installer::globals;
26 ######################################################
27 # Create path variables from environment variables
28 ######################################################
30 sub create_pathvariables
32 my ($environment) = @_;
34 my %variables = ();
36 # The following variables are needed in the path file list
37 # solarenvpath, os, pmiscpath
39 my $solarenvpath = "";
41 if ( $ENV{'SO_PACK'} ) { $solarenvpath = $ENV{'SO_PACK'}; }
42 # overriding with STAR_INSTPATH, if set
43 if ( $ENV{'STAR_INSTPATH'} ) { $solarenvpath = $ENV{'STAR_INSTPATH'}; }
45 $variables{'solarenvpath'} = $solarenvpath;
47 my $localpath = $environment->{'LOCAL_OUT'};
48 $variables{'localpath'} = $localpath;
50 my $localcommonpath = $environment->{'LOCAL_COMMON_OUT'};
51 $variables{'localcommonpath'} = $localcommonpath;
53 my $installscriptdir = $environment->{'WORKDIR'} . $installer::globals::separator . "InstallScriptTarget";
54 $variables{'installscriptdir'} = $installscriptdir;
56 my $extensionsdir = $environment->{'WORKDIR'} . $installer::globals::separator . "Extension";
57 $variables{'extensionsdir'} = $extensionsdir;
59 my $customtargetpath = $environment->{'WORKDIR'} . $installer::globals::separator . "CustomTarget";
60 $variables{'customtargetpath'} = $customtargetpath;
62 my $filelistpath = $environment->{'WORKDIR'};
63 $variables{'filelistpath'} = $filelistpath;
65 my $licensepath = $environment->{'WORKDIR'} . $installer::globals::separator . "CustomTarget/readlicense_oo/license";
66 $variables{'licensepath'} = $licensepath;
68 my $packinfopath = $environment->{'SRCDIR'} . $installer::globals::separator . "setup_native/source/packinfo";
69 $variables{'packinfopath'} = $packinfopath;
71 return \%variables;
74 ##################################################
75 # Replacing tilde in paths, because of
76 # problem with deep recursion (task 104830)
77 ##################################################
79 sub check_tilde_in_directory
81 if ( $ENV{'HOME'} )
83 my $home = $ENV{'HOME'};
84 $home =~ s/\Q$installer::globals::separator\E\s*$//;
85 $installer::globals::localinstalldir =~ s/~/$home/;
86 my $infoline = "Info: Changing LOCALINSTALLDIR to $installer::globals::localinstalldir\n";
87 push(@installer::globals::logfileinfo, $infoline);
89 else
91 # exit, because "~" is not allowed, if HOME is not set
92 my $infoline = "ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n";
93 push(@installer::globals::logfileinfo, $infoline);
94 die 'If "~" is used in "LOCALINSTALLDIR", environment variable "HOME" needs to be defined!';
98 ##################################################
99 # Setting some fundamental global variables.
100 # All these variables can be overwritten
101 # by parameters.
102 ##################################################
104 sub set_global_environment_variables
106 my ( $environment ) = @_;
108 $installer::globals::build = $environment->{'LIBO_VERSION_MAJOR'}.$environment->{'LIBO_VERSION_MINOR'}."0";
109 $installer::globals::os = $environment->{'OS'};
110 $installer::globals::com = $environment->{'COM'};
111 $installer::globals::cpuname = $environment->{'CPUNAME'};
112 $installer::globals::platformid = $environment->{'PLATFORMID'};
114 if ( $ENV{'ENABLE_DBGUTIL'} ) {} else { $installer::globals::pro = 1; }
116 if ( $ENV{'VERBOSE'} && ( (lc $ENV{'VERBOSE'}) eq "false" ) ) { $installer::globals::quiet = 1; }
117 if ( $ENV{'PREPARE_WINPATCH'} ) { $installer::globals::prepare_winpatch = 1; }
118 if ( $ENV{'PREVIOUS_IDT_DIR'} ) { $installer::globals::previous_idt_dir = $ENV{'PREVIOUS_IDT_DIR'}; }
119 if ( $ENV{'LOCALINSTALLDIR'} ) { $installer::globals::localinstalldir = $ENV{'LOCALINSTALLDIR'}; }
120 if ( $ENV{'LOCALUNPACKDIR'} ) { $installer::globals::localunpackdir = $ENV{'LOCALUNPACKDIR'}; }
121 if ( $ENV{'MAX_LANG_LENGTH'} ) { $installer::globals::max_lang_length = $ENV{'MAX_LANG_LENGTH'}; }
123 if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; }
124 if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; }
125 if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals::ignore_error_in_logfile = 1; }
126 if (( $ENV{'ENABLE_STRIP'} ) && ( $ENV{'ENABLE_STRIP'} ne '' )) { $installer::globals::strip = 1; }
127 if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals::strip = 0; }
129 if ( $installer::globals::localinstalldir ) { $installer::globals::localinstalldirset = 1; }
130 # Special handling, if LOCALINSTALLDIR contains "~" in the path
131 if ( $installer::globals::localinstalldir =~ /^\s*\~/ ) { check_tilde_in_directory(); }