randyk 2003/07/30 22:35:39
Modified: perl-framework/Apache-Test/lib/Apache TestConfig.pm
TestConfigC.pm
Log:
Reviewed by: stas
Changes to allow use of apxs on Win32:
- ensure $self->{APXS} has backslashes as directory separator, so as
to be invoked from a Makefile
- write a Win32-specific Makefile for c-modules
Revision Changes Path
1.167 +2 -0
httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm
Index: TestConfig.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.166
retrieving revision 1.167
diff -u -r1.166 -r1.167
--- TestConfig.pm 29 Jul 2003 15:19:24 -0000 1.166
+++ TestConfig.pm 31 Jul 2003 05:35:39 -0000 1.167
@@ -284,6 +284,8 @@
return unless $self->{APXS};
+ $self->{APXS} =~ s{/}{\\}g if WIN32;
+
my $vars = $self->{vars};
$vars->{bindir} ||= $self->apxs('BINDIR', 1);
1.21 +40 -1
httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigC.pm
Index: TestConfigC.pm
===================================================================
RCS file:
/home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfigC.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- TestConfigC.pm 31 Mar 2003 06:58:40 -0000 1.20
+++ TestConfigC.pm 31 Jul 2003 05:35:39 -0000 1.21
@@ -9,6 +9,8 @@
use Apache::TestTrace;
use File::Find qw(finddepth);
+use constant WIN32 => Apache::TestConfig::WIN32;
+
sub cmodule_find {
my($self, $mod) = @_;
@@ -76,7 +78,8 @@
EOF
}
-my %lib_dir = (1 => "", 2 => ".libs/");
+my %lib_dir = WIN32 ? (1 => "", 2 => "") :
+ (1 => "", 2 => ".libs/");
sub cmodules_build_so {
my($self, $name) = @_;
@@ -126,6 +129,13 @@
}
sub cmodules_write_makefile {
+ my ($self, $mod) = @_;
+ my $write = \&{"cmodules_write_makefile_$^O"};
+ $write = \&cmodules_write_makefile_default unless defined &$write;
+ $write->($self, $mod);
+}
+
+sub cmodules_write_makefile_default {
my($self, $mod) = @_;
my $dversion = $self->server->dversion;
@@ -147,6 +157,35 @@
clean:
-rm -rf $name.o $name.lo $name.slo $name.la .libs
+EOF
+
+ close $fh or die "close $makefile: $!";
+}
+
+sub cmodules_write_makefile_MSWin32 {
+ my($self, $mod) = @_;
+
+ my $dversion = $self->server->dversion;
+ my $name = $mod->{name};
+ my $makefile = "$mod->{dir}/Makefile";
+ debug "writing $makefile";
+
+ my $lib = $self->cmodules_build_so($name);
+ my $extras = ' -llibhttpd -p ';
+ my $goners = join ' ', (map {$name . '.' . $_} qw(exp lib so lo));
+
+ my $fh = Symbol::gensym();
+ open $fh, ">$makefile" or die "open $makefile: $!";
+
+ print $fh <<EOF;
+APXS=$self->{APXS}
+all: $lib
+
+$lib: $name.c
+ \$(APXS) $dversion -I$self->{cmodules_dir} $extras -c $name.c
+
+clean:
+ -erase $goners
EOF
close $fh or die "close $makefile: $!";