upx.pm (9780544f) upx.pm (b274bc22)
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

--- 54 unchanged lines hidden (view full) ---

63 my ( $filename ) = @_;
64
65 my $compression = "9";
66 my $systemcall = $installer::globals::upxfile . " -" . $compression . " " . $filename;
67
68 my $returnvalue = system($systemcall);
69
70 my $infoline = "Systemcall: $systemcall\n";
1#**************************************************************
2#
3# Licensed to the Apache Software Foundation (ASF) under one
4# or more contributor license agreements. See the NOTICE file
5# distributed with this work for additional information
6# regarding copyright ownership. The ASF licenses this file
7# to you under the Apache License, Version 2.0 (the
8# "License"); you may not use this file except in compliance

--- 54 unchanged lines hidden (view full) ---

63 my ( $filename ) = @_;
64
65 my $compression = "9";
66 my $systemcall = $installer::globals::upxfile . " -" . $compression . " " . $filename;
67
68 my $returnvalue = system($systemcall);
69
70 my $infoline = "Systemcall: $systemcall\n";
71 push( @installer::globals::logfileinfo, $infoline);
71 $installer::logger::Lang->print($infoline);
72
73 if ($returnvalue)
74 {
75 $infoline = "WARNING: Could not successfully upx $filename! Using original file.\n";
72
73 if ($returnvalue)
74 {
75 $infoline = "WARNING: Could not successfully upx $filename! Using original file.\n";
76 push( @installer::globals::logfileinfo, $infoline);
76 $installer::logger::Lang->print($infoline);
77 }
78 else
79 {
80 $infoline = "SUCCESS: upx $filename!\n";
77 }
78 else
79 {
80 $infoline = "SUCCESS: upx $filename!\n";
81 push( @installer::globals::logfileinfo, $infoline);
81 $installer::logger::Lang->print($infoline);
82 }
83
84 return $returnvalue;
85}
86
87#####################################################################
88# Using upx to decrease file size
89#####################################################################
90
91sub upx_on_libraries
92{
93 my ( $filelist, $languagestringref) = @_;
94
95 installer::logger::include_header_into_logfile("UPX'ing files:");
96 my $infoline = "";
97
98 if ( ! $installer::globals::upx_in_path )
99 {
82 }
83
84 return $returnvalue;
85}
86
87#####################################################################
88# Using upx to decrease file size
89#####################################################################
90
91sub upx_on_libraries
92{
93 my ( $filelist, $languagestringref) = @_;
94
95 installer::logger::include_header_into_logfile("UPX'ing files:");
96 my $infoline = "";
97
98 if ( ! $installer::globals::upx_in_path )
99 {
100 $infoline = "\n\nWarning: This is an UPX product, but upx was not found in PATH!\n\n";
101 push( @installer::globals::logfileinfo, $infoline);
100 $installer::logger::Lang->print("\n");
101 $installer::logger::Lang->print("\n");
102 $installer::logger::Lang->print("Warning: This is an UPX product, but upx was not found in PATH!\n");
103 $installer::logger::Lang->print("\n");
102 }
103 else
104 {
105 $infoline = "Using upx: $installer::globals::upxfile\n";
104 }
105 else
106 {
107 $infoline = "Using upx: $installer::globals::upxfile\n";
106 push( @installer::globals::logfileinfo, $infoline);
108 $installer::logger::Lang->print($infoline);
107
108 my $upxdirbase = installer::systemactions::create_directories("upx", $languagestringref);
109
110 if (! installer::existence::exists_in_array($upxdirbase, \@installer::globals::removedirs))
111 {
112 push(@installer::globals::removedirs, $upxdirbase);
113 }
114
115 for ( my $i = 0; $i <= $#{$filelist}; $i++ )
116 {
117 my $sourcefilename = ${$filelist}[$i]->{'sourcepath'};
118
119 if ( is_upx_candidate($sourcefilename, ${$filelist}[$i]) )
120 {
121 my $shortfilename = $sourcefilename;
122 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename);
123
109
110 my $upxdirbase = installer::systemactions::create_directories("upx", $languagestringref);
111
112 if (! installer::existence::exists_in_array($upxdirbase, \@installer::globals::removedirs))
113 {
114 push(@installer::globals::removedirs, $upxdirbase);
115 }
116
117 for ( my $i = 0; $i <= $#{$filelist}; $i++ )
118 {
119 my $sourcefilename = ${$filelist}[$i]->{'sourcepath'};
120
121 if ( is_upx_candidate($sourcefilename, ${$filelist}[$i]) )
122 {
123 my $shortfilename = $sourcefilename;
124 installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename);
125
124 $infoline = "\nUpx: $shortfilename";
125 push( @installer::globals::logfileinfo, $infoline);
126 $installer::logger::Lang->print("\n");
127 $installer::logger::Lang->printf("Upx: %s", $shortfilename);
126
127 # copy file into directory for stripped libraries
128 my $onelanguage = ${$filelist}[$i]->{'specificlanguage'};
129
130 # files without language into directory "00"
131 if ($onelanguage eq "") { $onelanguage = "00"; }
132
133 my $upxdir = $upxdirbase . $installer::globals::separator . $onelanguage;

--- 19 unchanged lines hidden ---
128
129 # copy file into directory for stripped libraries
130 my $onelanguage = ${$filelist}[$i]->{'specificlanguage'};
131
132 # files without language into directory "00"
133 if ($onelanguage eq "") { $onelanguage = "00"; }
134
135 my $upxdir = $upxdirbase . $installer::globals::separator . $onelanguage;

--- 19 unchanged lines hidden ---