← Index
NYTProf Performance Profile   « block view • line view • sub view »
For C:/lo/libo-master/solenv/bin/make_installer.pl
  Run on Mon Sep 24 00:52:54 2012
Reported on Mon Sep 24 07:34:55 2012

Filename/cygdrive/c/lo/libo-master/instsetoo_native/util/C:/lo/libo-master/solenv/bin/modules/installer/windows/strip.pm
StatementsExecuted 13 statements in 1.57ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111388µs471µsinstaller::windows::strip::::BEGIN@30installer::windows::strip::BEGIN@30
11119µs53µsinstaller::windows::strip::::BEGIN@33installer::windows::strip::BEGIN@33
11118µs20µsinstaller::windows::strip::::BEGIN@35installer::windows::strip::BEGIN@35
11117µs19µsinstaller::windows::strip::::BEGIN@34installer::windows::strip::BEGIN@34
11117µs20µsinstaller::windows::strip::::BEGIN@31installer::windows::strip::BEGIN@31
11114µs16µsinstaller::windows::strip::::BEGIN@32installer::windows::strip::BEGIN@32
0000s0sinstaller::windows::strip::::do_stripinstaller::windows::strip::do_strip
0000s0sinstaller::windows::strip::::need_to_stripinstaller::windows::strip::need_to_strip
0000s0sinstaller::windows::strip::::strip_binariesinstaller::windows::strip::strip_binaries
Call graph for these subroutines as a Graphviz dot language file.
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
28package installer::windows::strip;
29
30268µs2555µ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
use File::Temp qw(tmpnam);
# spent 471µs making 1 call to installer::windows::strip::BEGIN@30 # spent 83µs making 1 call to Exporter::import
31257µs224µ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
use installer::converter;
# spent 20µs making 1 call to installer::windows::strip::BEGIN@31 # spent 4µs making 1 call to UNIVERSAL::import
32253µs219µ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
use installer::globals;
# spent 16µs making 1 call to installer::windows::strip::BEGIN@32 # spent 3µs making 1 call to UNIVERSAL::import
33258µs287µ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
use installer::logger;
# spent 53µs making 1 call to installer::windows::strip::BEGIN@33 # spent 34µs making 1 call to Exporter::import
34255µs222µ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
use installer::pathanalyzer;
# spent 19µs making 1 call to installer::windows::strip::BEGIN@34 # spent 2µs making 1 call to UNIVERSAL::import
3521.27ms222µ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
use installer::systemactions;
# 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
41sub 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
64sub 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
91sub 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
15817µs1;