stas 2003/12/14 21:29:35
Modified: lib/ModPerl BuildOptions.pm lib/Apache Build.pm . Changes Log: libgtop config (needed for enabling MOD_PERL_TRACE=m) is now searched using the gnome packaging tools if available (pkg-config for gnome-2.x and gnome-config for gnome-1.x) Revision Changes Path 1.24 +4 -2 modperl-2.0/lib/ModPerl/BuildOptions.pm Index: BuildOptions.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildOptions.pm,v retrieving revision 1.23 retrieving revision 1.24 diff -u -u -r1.23 -r1.24 --- BuildOptions.pm 16 Oct 2003 21:33:28 -0000 1.23 +++ BuildOptions.pm 15 Dec 2003 05:29:35 -0000 1.24 @@ -4,6 +4,7 @@ use warnings; use Apache::Build (); +use Apache::TestTrace; my $param_qr = qr([\s=]+); use constant VERBOSE => 1; @@ -21,8 +22,9 @@ parse_file($build); parse_argv($build); - if ($build->{MP_DEBUG} and $build->{MP_USE_GTOP}) { - $build->{MP_USE_GTOP} = 0 unless $build->find_dlfile('gtop'); + if ($build->{MP_DEBUG} and $build->{MP_USE_GTOP} and !$build->find_gtop) { + error "Can't find libgtop, resetting MP_USE_GTOP=0"; + $build->{MP_USE_GTOP} = 0; } unless ($build->{MP_USE_DSO} or $build->{MP_USE_STATIC}) { 1.151 +63 -1 modperl-2.0/lib/Apache/Build.pm Index: Build.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v retrieving revision 1.150 retrieving revision 1.151 diff -u -u -r1.150 -r1.151 --- Build.pm 7 Nov 2003 08:48:21 -0000 1.150 +++ Build.pm 15 Dec 2003 05:29:35 -0000 1.151 @@ -196,9 +196,62 @@ #--- Perl Config stuff --- +my %gtop_config = (); +sub find_gtop { + my $self = shift; + + return %gtop_config if %gtop_config; + + if (%gtop_config = find_gtop_config()) { + return %gtop_config; + } + + if ($self->find_dlfile('gtop')) { + $gtop_config{ldopts} = $self->gtop_ldopts_old(); + $gtop_config{ccopts} = ''; + return %gtop_config; + } + + return (); +} + +sub find_gtop_config { + my %c = (); + + if (system('pkg-config --exists libgtop-2.0') == 0) { + # 2.x + chomp($c{ccopts} = qx|pkg-config --cflags libgtop-2.0|); + chomp($c{ldopts} = qx|pkg-config --libs libgtop-2.0|); + + # 2.0.0 bugfix + chomp(my $libdir = qx|pkg-config --variable=libdir libgtop-2.0|); + $c{ldopts} =~ s|\$\(libdir\)|$libdir|; + } + elsif (system('gnome-config --libs libgtop') == 0) { + chomp($c{ccopts} = qx|gnome-config --cflags libgtop|); + chomp($c{ldopts} = qx|gnome-config --libs libgtop|); + + # buggy ( < 1.0.9?) versions fixup + $c{ccopts} =~ s|^/|-I/|; + $c{ldopts} =~ s|^/|-L/|; + } + + if ($c{ccopts}) { + chomp(my $ginc = `glib-config --cflags`); + $c{ccopts} .= " $ginc"; + } + + if (%c) { + $c{ccopts} = " $c{ccopts}"; + $c{ldopts} = " $c{ldopts}"; + } + + return %c; +} + my @Xlib = qw(/usr/X11/lib /usr/X11R6/lib); -sub gtop_ldopts { +sub gtop_ldopts_old { my $self = shift; my $xlibs = ""; @@ -214,6 +267,14 @@ return " -lgtop -lgtop_sysdeps -lgtop_common $xlibs"; } +sub gtop_ldopts { + exists $gtop_config{ldopts} ? $gtop_config{ldopts} : ''; +} + +sub gtop_ccopts { + exists $gtop_config{ccopts} ? $gtop_config{ccopts} : ''; +} + sub ldopts { my($self) = @_; @@ -266,6 +327,7 @@ if ($self->{MP_USE_GTOP}) { $ccopts .= " -DMP_USE_GTOP"; + $ccopts .= $self->gtop_ccopts; } if ($self->{MP_MAINTAINER}) { 1.282 +4 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.281 retrieving revision 1.282 diff -u -u -r1.281 -r1.282 --- Changes 15 Dec 2003 03:13:36 -0000 1.281 +++ Changes 15 Dec 2003 05:29:35 -0000 1.282 @@ -12,6 +12,10 @@ =item 1.99_12-dev +libgtop config (needed for enabling MOD_PERL_TRACE=m) is now searched +using the gnome packaging tools if available (pkg-config for gnome-2.x +and gnome-config for gnome-1.x) [Stas] + Prevent a problem where an autovivified package (stash) prevents from modperl_mgv to load the file with that package (until now it was checking whether the stash existed already and skipped the loading if