dougm 00/04/16 17:02:26
Modified: . Makefile.PL
lib/Apache Build.pm
patches link-hack.pat
src/modules/perl modperl_log.h
Log:
add Apache::Build::{ccopts,ldopts} methods
enable libgtop linking if debug and available
beef up logic for generating/cleaning files
Revision Changes Path
1.9 +5 -5 modperl-2.0/Makefile.PL
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl-2.0/Makefile.PL,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Makefile.PL 2000/04/16 01:41:21 1.8
+++ Makefile.PL 2000/04/17 00:02:22 1.9
@@ -10,7 +10,7 @@
our $VERSION;
-my $build = Apache::Build->new;
+my $build = Apache::Build->new(debug => 1);
my $code = ModPerl::Code->new;
#quick hack until build system is complete
@@ -43,6 +43,7 @@
$httpd_version, $VERSION, $^V;
$build->save;
+ $build->save_ldopts;
$code->generate;
}
@@ -57,17 +58,16 @@
my $opts = shift;
return clean() if $opts->{m} eq 'c';
- my $ccopts = ExtUtils::Embed::ccopts();
+ my $ccopts = $build->ccopts;
my @inc = $build->inc;
my($cc, $ar) = map { $build->perl_config($_) } qw(cc ar);
chdir $code->path;
- my $flags = "-g -Wall";
- $flags .= " -E" if $opts->{E};
+ $ccopts .= " -E" if $opts->{E};
for (sort { (stat $b)[9] <=> (stat $a)[9] } @{ $code->c_files }) {
- echo_cmd "$cc $flags $ccopts @inc -c $_";
+ echo_cmd "$cc $ccopts @inc -c $_";
}
echo_cmd "$ar crv libmodperl.a @{ $code->o_files }";
1.4 +70 -8 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Build.pm 2000/04/15 17:38:45 1.3
+++ Build.pm 2000/04/17 00:02:23 1.4
@@ -5,6 +5,7 @@
use warnings;
use Config;
use Cwd ();
+use ExtUtils::Embed ();
use constant is_win32 => $^O eq 'MSWin32';
use constant IS_MOD_PERL_BUILD => grep { -e "$_/lib/mod_perl.pm" } qw(. ..);
@@ -60,6 +61,40 @@
#--- Perl Config stuff ---
+sub gtop_ldopts {
+ my $xlibs = "-L/usr/X11/lib -L/usr/X11R6/lib -lXau";
+ return " -lgtop -lgtop_sysdeps -lgtop_common $xlibs";
+}
+
+sub ldopts {
+ my($self) = @_;
+
+ my $ldopts = ExtUtils::Embed::ldopts();
+ chomp $ldopts;
+
+ if ($self->{use_gtop}) {
+ $ldopts .= $self->gtop_ldopts;
+ }
+
+ $ldopts;
+}
+
+sub ccopts {
+ my($self) = @_;
+
+ my $ccopts = ExtUtils::Embed::ccopts();
+
+ if ($self->{use_gtop}) {
+ $ccopts .= " -DMP_USE_GTOP";
+ }
+
+ if ($self->{debug}) {
+ $ccopts .= " -g -Wall -DMP_TRACE";
+ }
+
+ $ccopts;
+}
+
sub perl_config {
my($self, $key) = @_;
@@ -181,22 +216,37 @@
sub new {
my $class = shift;
+
+ my $self = bless {
+ cwd => Cwd::fastcwd(),
+ @_,
+ }, $class;
- bless {
- cwd => Cwd::fastcwd(),
- @_,
- }, $class;
+ if ($self->{debug}) {
+ $self->{use_gtop} = 1 if $self->find_dlfile('gtop');
+ }
+
+ $self;
}
sub DESTROY {}
-my $save_file = 'lib/Apache/BuildConfig.pm';
+my %default_files = (
+ 'build_config' => 'lib/Apache/BuildConfig.pm',
+ 'ldopts' => 'src/modules/perl/ldopts',
+);
sub clean_files {
my $self = shift;
- $self->{save_file} || $save_file;
+ map { $self->default_file($_) } keys %default_files;
}
+sub default_file {
+ my($self, $name, $override) = @_;
+ my $key = join '_', 'file', $name;
+ $self->{$key} ||= ($override || $default_files{$name});
+}
+
sub freeze {
require Data::Dumper;
local $Data::Dumper::Terse = 1;
@@ -205,12 +255,24 @@
$data;
}
+sub save_ldopts {
+ my($self, $file) = @_;
+
+ $file ||= $self->default_file('ldopts', $file);
+ my $ldopts = $self->ldopts;
+
+ open my $fh, '>', $file or die "open $file: $!";
+ print $fh "#!/bin/sh\n\necho $ldopts\n";
+ close $fh;
+ chmod 0755, $file;
+}
+
sub save {
my($self, $file) = @_;
- $self->{save_file} = $file || $save_file;
+ $file ||= $self->default_file('build_config');
(my $obj = $self->freeze) =~ s/^/ /;
- open my $fh, '>', $self->{save_file} or die "open $file: $!";
+ open my $fh, '>', $file or die "open $file: $!";
print $fh <<EOF;
package Apache::BuildConfig;
1.2 +6 -9 modperl-2.0/patches/link-hack.pat
Index: link-hack.pat
===================================================================
RCS file: /home/cvs/modperl-2.0/patches/link-hack.pat,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- link-hack.pat 2000/04/16 16:56:35 1.1
+++ link-hack.pat 2000/04/17 00:02:24 1.2
@@ -1,22 +1,19 @@
-here's how to hack libmodperl.a into apache-2.0 until the build system
-is completed. (ithrperl == -Dusethreads perl)
-
Index: src/build/program.mk
===================================================================
RCS file: /home/cvs/apache-2.0/src/build/program.mk,v
retrieving revision 1.3
diff -u -u -r1.3 program.mk
--- src/build/program.mk 2000/03/31 07:02:31 1.3
-+++ src/build/program.mk 2000/04/16 16:54:10
-@@ -53,8 +53,10 @@
- #
++++ src/build/program.mk 2000/04/16 23:43:14
+@@ -54,7 +54,10 @@
# The build environment was provided by Sascha Schumann.
#
-+LIBMODPERL=../../modperl-2.0/src/modules/perl/libmodperl.a
-+MP_LIBS = $(LIBMODPERL) `ithrperl -MExtUtils::Embed -e ldopts`
++MP_SRC = ../../modperl-2.0/src/modules/perl
++MP_LDADD = $(MP_SRC)/libmodperl.a `$(MP_SRC)/ldopts`
++
PROGRAM_OBJECTS = $(PROGRAM_SOURCES:.c=.lo)
$(PROGRAM_NAME): $(PROGRAM_DEPENDENCIES) $(PROGRAM_OBJECTS)
- $(LINK) $(PROGRAM_LDFLAGS) $(PROGRAM_OBJECTS) $(PROGRAM_LDADD)
-+ $(LINK) $(PROGRAM_LDFLAGS) $(PROGRAM_OBJECTS) $(PROGRAM_LDADD) $(MP_LIBS)
++ $(LINK) $(PROGRAM_LDFLAGS) $(PROGRAM_OBJECTS) $(PROGRAM_LDADD) $(MP_LDADD)
1.2 +0 -2 modperl-2.0/src/modules/perl/modperl_log.h
Index: modperl_log.h
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_log.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- modperl_log.h 2000/04/15 01:38:24 1.1
+++ modperl_log.h 2000/04/17 00:02:25 1.2
@@ -1,8 +1,6 @@
#ifndef MODPERL_LOG_H
#define MODPERL_LOG_H
-#define MP_TRACE /* XXX: make optional */
-
#define MP_FUNC __FUNCTION__ /* XXX: not every cc supports this
* sort out later
*/