perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ran...@apache.org
Subject svn commit: r123271 - /perl/modperl/trunk/Changes /perl/modperl/trunk/lib/Apache/Build.pm /perl/modperl/trunk/lib/ModPerl/BuildMM.pm
Date Fri, 24 Dec 2004 03:59:55 GMT
Author: randyk
Date: Thu Dec 23 19:59:54 2004
New Revision: 123271

URL: http://svn.apache.org/viewcvs?view=rev&rev=123271
Log:
speed up the 'perl Makefile.PL' stage
 - in ModPerl::BuildMM, introduce an overall $build, and call
   build_config() to define it only when it's not defined
 - in Apache::Build, change the apxs_cflags, apxs_extra_cflags,
   and apxs_extra_cppflags subs to call apxs as a method, if
   possible, so as to cache the result of the call
 - in the apxs sub of Apache::Build, return the cached result
   only if it's defined

Modified:
   perl/modperl/trunk/Changes
   perl/modperl/trunk/lib/Apache/Build.pm
   perl/modperl/trunk/lib/ModPerl/BuildMM.pm

Modified: perl/modperl/trunk/Changes
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?view=diff&rev=123271&p1=perl/modperl/trunk/Changes&r1=123270&p2=perl/modperl/trunk/Changes&r2=123271
==============================================================================
--- perl/modperl/trunk/Changes	(original)
+++ perl/modperl/trunk/Changes	Thu Dec 23 19:59:54 2004
@@ -12,6 +12,13 @@
 
 =item 1.99_20-dev
 
+speed up the 'perl Makefile.PL' stage [Randy Kobes]:
+ - reduce the number of calls to build_config() of
+   Apache::Build within ModPerl::BuildMM
+ - cache the results of the calls to apxs_cflags, apxs_extra_cflags,
+   and apxs_extra_cppflags in Apache::Build
+ - in apxs of Apache::Build, return a cached result only when defined
+
 move ModPerl::Util::exit() into mod_perl.so, since it needs to work,
 even if ModPerl::Util wasn't loaded [Stas]
 

Modified: perl/modperl/trunk/lib/Apache/Build.pm
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache/Build.pm?view=diff&rev=123271&p1=perl/modperl/trunk/lib/Apache/Build.pm&r1=123270&p2=perl/modperl/trunk/lib/Apache/Build.pm&r2=123271
==============================================================================
--- perl/modperl/trunk/lib/Apache/Build.pm	(original)
+++ perl/modperl/trunk/lib/Apache/Build.pm	Thu Dec 23 19:59:54 2004
@@ -152,7 +152,7 @@
     my $query_key;
     if ($is_query) {
         $query_key = 'APXS_' . uc $_[1];
-        if ($self->{$query_key}) {
+        if (defined $self->{$query_key}) {
             return $self->{$query_key};
         }
     }
@@ -185,21 +185,29 @@
 }
 
 sub apxs_cflags {
-    my $cflags = __PACKAGE__->apxs('-q' => 'CFLAGS');
+    my $who = who_am_i(shift);
+    my $cflags = $who->apxs('-q' => 'CFLAGS');
     $cflags =~ s/\"/\\\"/g;
     $cflags;
 }
 
 sub apxs_extra_cflags {
-    my $flags = __PACKAGE__->apxs('-q' => 'EXTRA_CFLAGS');
+    my $who = who_am_i(shift);
+    my $flags = $who->apxs('-q' => 'EXTRA_CFLAGS');
     $flags =~ s/\"/\\\"/g;
     $flags;
 }
 
 sub apxs_extra_cppflags {
-    my $flags = __PACKAGE__->apxs('-q' => 'EXTRA_CPPFLAGS');
+    my $who = who_am_i(shift);
+    my $flags = $who->apxs('-q' => 'EXTRA_CPPFLAGS');
     $flags =~ s/\"/\\\"/g;
     $flags;
+}
+
+sub who_am_i {
+    my $arg = shift;
+    return ($arg and ref($arg) eq __PACKAGE__) ? $arg : __PACKAGE__;
 }
 
 my %threaded_mpms = map { $_ => 1}

Modified: perl/modperl/trunk/lib/ModPerl/BuildMM.pm
Url: http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/ModPerl/BuildMM.pm?view=diff&rev=123271&p1=perl/modperl/trunk/lib/ModPerl/BuildMM.pm&r1=123270&p2=perl/modperl/trunk/lib/ModPerl/BuildMM.pm&r2=123271
==============================================================================
--- perl/modperl/trunk/lib/ModPerl/BuildMM.pm	(original)
+++ perl/modperl/trunk/lib/ModPerl/BuildMM.pm	Thu Dec 23 19:59:54 2004
@@ -44,9 +44,11 @@
     q{-e "ModPerl::MM::install({@ARGV},'$(VERBINST)',0,'$(UNINST)');"}."\n";
 }
 
+my $build;
+
 sub build_config {
     my $key = shift;
-    my $build = Apache::Build->build_config;
+    $build ||= Apache::Build->build_config;
     return $build unless $key;
     $build->{$key};
 }
@@ -68,7 +70,7 @@
 sub WriteMakefile {
     my %args = @_;
 
-    my $build = build_config();
+    $build ||= build_config();
     ModPerl::MM::my_import(__PACKAGE__);
 
     my $inc = $build->inc;
@@ -133,7 +135,7 @@
 
 sub ModPerl::BuildMM::MY::constants {
     my $self = shift;
-    my $build = build_config();
+    $build ||= build_config();
 
     #install everything relative to the Apache2/ subdir
     if ($build->{MP_INST_APACHE2}) {
@@ -301,7 +303,7 @@
 
 sub ModPerl::BuildMM::MY::post_initialize {
     my $self = shift;
-    my $build = build_config();
+    $build ||= build_config();
     my $pm = $self->{PM};
 
     while (my($k, $v) = each %PM) {
@@ -343,10 +345,12 @@
     '';
 }
 
+my $apr_config;
+
 sub ModPerl::BuildMM::MY::libscan {
     my($self, $path) = @_;
 
-    my $apr_config = build_config()->get_apr_config();
+    $apr_config ||= $build->get_apr_config();
 
     if ($path =~ m/(Thread|Global)Mutex/) {
         return unless $apr_config->{HAS_THREADS};

Mime
View raw message