| Filename | /cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/strip.pm |
| Statements | Executed 13 statements in 1.57ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 388µs | 471µs | installer::windows::strip::BEGIN@30 |
| 1 | 1 | 1 | 19µs | 53µs | installer::windows::strip::BEGIN@33 |
| 1 | 1 | 1 | 18µs | 20µs | installer::windows::strip::BEGIN@35 |
| 1 | 1 | 1 | 17µs | 19µs | installer::windows::strip::BEGIN@34 |
| 1 | 1 | 1 | 17µs | 20µs | installer::windows::strip::BEGIN@31 |
| 1 | 1 | 1 | 14µs | 16µs | installer::windows::strip::BEGIN@32 |
| 0 | 0 | 0 | 0s | 0s | installer::windows::strip::do_strip |
| 0 | 0 | 0 | 0s | 0s | installer::windows::strip::need_to_strip |
| 0 | 0 | 0 | 0s | 0s | installer::windows::strip::strip_binaries |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | #************************************************************************* | ||||
| 2 | # | ||||
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||||
| 4 | # | ||||
| 5 | # Copyright 2000, 2010 Oracle and/or its affiliates. | ||||
| 6 | # | ||||
| 7 | # OpenOffice.org - a multi-platform office productivity suite | ||||
| 8 | # | ||||
| 9 | # This file is part of OpenOffice.org. | ||||
| 10 | # | ||||
| 11 | # OpenOffice.org is free software: you can redistribute it and/or modify | ||||
| 12 | # it under the terms of the GNU Lesser General Public License version 3 | ||||
| 13 | # only, as published by the Free Software Foundation. | ||||
| 14 | # | ||||
| 15 | # OpenOffice.org is distributed in the hope that it will be useful, | ||||
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
| 18 | # GNU Lesser General Public License version 3 for more details | ||||
| 19 | # (a copy is included in the LICENSE file that accompanied this code). | ||||
| 20 | # | ||||
| 21 | # You should have received a copy of the GNU Lesser General Public License | ||||
| 22 | # version 3 along with OpenOffice.org. If not, see | ||||
| 23 | # <http://www.openoffice.org/license.html> | ||||
| 24 | # for a copy of the LGPLv3 License. | ||||
| 25 | # | ||||
| 26 | #************************************************************************* | ||||
| 27 | |||||
| 28 | package installer::windows::strip; | ||||
| 29 | |||||
| 30 | 2 | 68µs | 2 | 555µs | # spent 471µs (388+83) within installer::windows::strip::BEGIN@30 which was called:
# once (388µs+83µs) by installer::BEGIN@81 at line 30 # spent 471µs making 1 call to installer::windows::strip::BEGIN@30
# spent 83µs making 1 call to Exporter::import |
| 31 | 2 | 57µs | 2 | 24µs | # spent 20µs (17+4) within installer::windows::strip::BEGIN@31 which was called:
# once (17µs+4µs) by installer::BEGIN@81 at line 31 # spent 20µs making 1 call to installer::windows::strip::BEGIN@31
# spent 4µs making 1 call to UNIVERSAL::import |
| 32 | 2 | 53µs | 2 | 19µs | # spent 16µs (14+3) within installer::windows::strip::BEGIN@32 which was called:
# once (14µs+3µs) by installer::BEGIN@81 at line 32 # spent 16µs making 1 call to installer::windows::strip::BEGIN@32
# spent 3µs making 1 call to UNIVERSAL::import |
| 33 | 2 | 58µs | 2 | 87µs | # spent 53µs (19+34) within installer::windows::strip::BEGIN@33 which was called:
# once (19µs+34µs) by installer::BEGIN@81 at line 33 # spent 53µs making 1 call to installer::windows::strip::BEGIN@33
# spent 34µs making 1 call to Exporter::import |
| 34 | 2 | 55µs | 2 | 22µs | # spent 19µs (17+3) within installer::windows::strip::BEGIN@34 which was called:
# once (17µs+3µs) by installer::BEGIN@81 at line 34 # spent 19µs making 1 call to installer::windows::strip::BEGIN@34
# spent 2µs making 1 call to UNIVERSAL::import |
| 35 | 2 | 1.27ms | 2 | 22µs | # spent 20µs (18+2) within installer::windows::strip::BEGIN@35 which was called:
# once (18µs+2µs) by installer::BEGIN@81 at line 35 # spent 20µs making 1 call to installer::windows::strip::BEGIN@35
# spent 2µs making 1 call to UNIVERSAL::import |
| 36 | |||||
| 37 | ##################################################################### | ||||
| 38 | # Checking whether a file has to be stripped | ||||
| 39 | ##################################################################### | ||||
| 40 | |||||
| 41 | sub need_to_strip | ||||
| 42 | { | ||||
| 43 | my ( $filename ) = @_; | ||||
| 44 | |||||
| 45 | my $strip = 0; | ||||
| 46 | |||||
| 47 | # Check using the "nm" command | ||||
| 48 | |||||
| 49 | $filename =~ s/\\/\\\\/g; | ||||
| 50 | |||||
| 51 | open (FILE, "nm $filename 2>&1 |"); | ||||
| 52 | my $nmoutput = <FILE>; | ||||
| 53 | close (FILE); | ||||
| 54 | |||||
| 55 | if ( $nmoutput && !( $nmoutput =~ /no symbols/i || $nmoutput =~ /not recognized/i )) { $strip = 1; } | ||||
| 56 | |||||
| 57 | return $strip | ||||
| 58 | } | ||||
| 59 | |||||
| 60 | ##################################################################### | ||||
| 61 | # Checking whether a file has to be stripped | ||||
| 62 | ##################################################################### | ||||
| 63 | |||||
| 64 | sub do_strip | ||||
| 65 | { | ||||
| 66 | my ( $filename ) = @_; | ||||
| 67 | |||||
| 68 | my $systemcall = "strip" . " " . $filename; | ||||
| 69 | |||||
| 70 | my $returnvalue = system($systemcall); | ||||
| 71 | |||||
| 72 | my $infoline = "Systemcall: $systemcall\n"; | ||||
| 73 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 74 | |||||
| 75 | if ($returnvalue) | ||||
| 76 | { | ||||
| 77 | $infoline = "ERROR: Could not strip $filename!\n"; | ||||
| 78 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 79 | } | ||||
| 80 | else | ||||
| 81 | { | ||||
| 82 | $infoline = "SUCCESS: Stripped library $filename!\n"; | ||||
| 83 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 84 | } | ||||
| 85 | } | ||||
| 86 | |||||
| 87 | ##################################################################### | ||||
| 88 | # Resolving all variables in the packagename. | ||||
| 89 | ##################################################################### | ||||
| 90 | |||||
| 91 | sub strip_binaries | ||||
| 92 | { | ||||
| 93 | my ( $filelist, $languagestringref ) = @_; | ||||
| 94 | |||||
| 95 | installer::logger::include_header_into_logfile("Stripping files:"); | ||||
| 96 | |||||
| 97 | my $strippeddirbase = installer::systemactions::create_directories("stripped", $languagestringref); | ||||
| 98 | |||||
| 99 | if (! grep {$_ eq $strippeddirbase} @installer::globals::removedirs) | ||||
| 100 | { | ||||
| 101 | push(@installer::globals::removedirs, $strippeddirbase); | ||||
| 102 | } | ||||
| 103 | |||||
| 104 | my ($tmpfilehandle, $tmpfilename) = tmpnam(); | ||||
| 105 | open SOURCEPATHLIST, ">$tmpfilename" or die "oops...\n"; | ||||
| 106 | for ( my $i = 0; $i <= $#{$filelist}; $i++ ) | ||||
| 107 | { | ||||
| 108 | print SOURCEPATHLIST "${$filelist}[$i]->{'sourcepath'}\n"; | ||||
| 109 | } | ||||
| 110 | close SOURCEPATHLIST; | ||||
| 111 | my @filetypelist = qx{file -f "$tmpfilename"}; | ||||
| 112 | chomp @filetypelist; | ||||
| 113 | unlink "$tmpfilename" or die "oops\n"; | ||||
| 114 | for ( my $i = 0; $i <= $#{$filelist}; $i++ ) | ||||
| 115 | { | ||||
| 116 | ${$filelist}[$i]->{'is_executable'} = ( $filetypelist[$i] =~ /:.*PE executable/ ); | ||||
| 117 | } | ||||
| 118 | |||||
| 119 | if ( $^O =~ /cygwin/i ) { installer::worker::generate_cygwin_paths($filelist); } | ||||
| 120 | |||||
| 121 | for ( my $i = 0; $i <= $#{$filelist}; $i++ ) | ||||
| 122 | { | ||||
| 123 | my $sourcefilename = ${$filelist}[$i]->{'cyg_sourcepath'}; | ||||
| 124 | |||||
| 125 | if ( ${$filelist}[$i]->{'is_executable'} && need_to_strip($sourcefilename) ) | ||||
| 126 | { | ||||
| 127 | my $shortfilename = $sourcefilename; | ||||
| 128 | installer::pathanalyzer::make_absolute_filename_to_relative_filename(\$shortfilename); | ||||
| 129 | |||||
| 130 | $infoline = "Strip: $shortfilename\n"; | ||||
| 131 | push( @installer::globals::logfileinfo, $infoline); | ||||
| 132 | |||||
| 133 | # copy file into directory for stripped libraries | ||||
| 134 | |||||
| 135 | my $onelanguage = ${$filelist}[$i]->{'specificlanguage'}; | ||||
| 136 | |||||
| 137 | # files without language into directory "00" | ||||
| 138 | |||||
| 139 | if ($onelanguage eq "") { $onelanguage = "00"; } | ||||
| 140 | |||||
| 141 | my $strippeddir = $strippeddirbase . $installer::globals::separator . $onelanguage; | ||||
| 142 | installer::systemactions::create_directory($strippeddir); # creating language specific subdirectories | ||||
| 143 | |||||
| 144 | my $destfilename = $strippeddir . $installer::globals::separator . $shortfilename; | ||||
| 145 | installer::systemactions::copy_one_file($sourcefilename, $destfilename); | ||||
| 146 | |||||
| 147 | # change sourcepath in files collector | ||||
| 148 | |||||
| 149 | ${$filelist}[$i]->{'sourcepath'} = $destfilename; | ||||
| 150 | |||||
| 151 | # strip file | ||||
| 152 | |||||
| 153 | do_strip($destfilename); | ||||
| 154 | } | ||||
| 155 | } | ||||
| 156 | } | ||||
| 157 | |||||
| 158 | 1 | 7µs | 1; |