Hi,
    On Win32, it would be handy in debugging to generate pdb
files, which contain symbol information (Apache and ActiveState
now do this by default in their source distributions).  Below is
a diff that does this when MP_DEBUG is enabled; the pdb files are
placed in the same directory as the correspoding .dll (.so)
files, and for mod_perl.pdb, an install target is created so as
it gets copied to where mod_perl.so goes. I've also added a
needed -debug flag to the linker, in cases where the present
s/-release/-debug/ doesn't work (which happens for me).
   I've also included in this an install target for the
generated mod_perl.lib, for use with 3rd party modules
(as suggested in the modperl_libs_MSWin32 sub).
==================================================================
Index: Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.127
diff -u -r1.127 Build.pm
--- Build.pm    12 Jun 2003 23:42:23 -0000      1.127
+++ Build.pm    19 Jul 2003 21:14:28 -0000
@@ -319,7 +319,9 @@

     if ($self->{MP_DEBUG}) {
         if (MSVC) {
-            $val =~ s/-release/-debug/;
+            unless ($val =~ s/-release/-debug/) {
+                $val .= ' -debug';
+            }
         }
     }

@@ -1058,8 +1060,11 @@
 sub dynamic_link_MSWin32 {
     my $self = shift;
     my $defs = $self->export_files_MSWin32;
+    my $symbols = $self->modperl_symbols_MSWin32;
     return $self->dynamic_link_header_default .
-           "\t$defs" . ' -out:$@';
+        "\t$defs" .
+            ($symbols ? ' \\' . "\n\t-pdb:$symbols" : '') .
+                ' -out:$@';
 }

 sub dynamic_link_aix {
@@ -1104,11 +1109,35 @@
     $libs->($self);
 }

+sub modperl_symbols_MSWin32 {
+    my $self = shift;
+    return "" unless $self->{MP_DEBUG};
+    "$self->{cwd}/src/modules/perl/$self->{MP_LIBNAME}.pdb";
+}
+
+sub modperl_symbols {
+    my $self = shift;
+    my $symbols = \&{"modperl_symbols_$^O"};
+    return "" unless defined &$symbols;
+    $symbols->($self);
+}
+
 sub write_src_makefile {
     my $self = shift;
     my $code = ModPerl::Code->new;
     my $path = $code->path;

+    my $install = <<'EOI';
+install:
+# install mod_perl.so
+       @$(MKPATH) $(MODPERL_AP_LIBEXECDIR)
+       $(MODPERL_TEST_F) $(MODPERL_LIB_DSO) && \
+       $(MODPERL_CP) $(MODPERL_LIB_DSO) $(MODPERL_AP_LIBEXECDIR)
+# install mod_perl .h files
+       @$(MKPATH) $(MODPERL_AP_INCLUDEDIR)
+       $(MODPERL_CP) $(MODPERL_H_FILES) $(MODPERL_AP_INCLUDEDIR)
+EOI
+
     my $mf = $self->default_file('makefile');

     open my $fh, '>', $mf or die "open $mf: $!";
@@ -1141,6 +1170,28 @@
         print $fh $self->canon_make_attr("lib_$type", $libs{$type});
     }

+    if (my $symbols = $self->modperl_symbols) {
+        print $fh $self->canon_make_attr('lib_symbols', $symbols);
+        $install .= <<'EOI';
+# install mod_perl symbol file
+       @$(MKPATH) $(MODPERL_AP_LIBEXECDIR)
+       $(MODPERL_TEST_F) $(MODPERL_LIB_SYMBOLS) && \
+       $(MODPERL_CP) $(MODPERL_LIB_SYMBOLS) $(MODPERL_AP_LIBEXECDIR)
+EOI
+    }
+
+    if (my $libs = $self->modperl_libs) {
+        print $fh $self->canon_make_attr('libs', $libs);
+        print $fh $self->canon_make_attr('ap_libdir',
+                                         "$self->{MP_AP_PREFIX}/lib");
+        $install .= <<'EOI';
+# install mod_perl.lib
+       @$(MKPATH) $(MODPERL_AP_LIBDIR)
+       $(MODPERL_TEST_F) $(MODPERL_LIBS) && \
+       $(MODPERL_CP) $(MODPERL_LIBS) $(MODPERL_AP_LIBDIR)
+EOI
+    }
+
     my $libperl = join '/',
       $self->perl_config('archlibexp'), 'CORE', $self->perl_config('libperl');

@@ -1172,7 +1223,7 @@
     }

     my $xs_targ = $self->make_xs($fh);
-
+
     print $fh <<'EOF';
 MODPERL_CCFLAGS = $(MODPERL_INC) $(MODPERL_CCOPTS) $(MODPERL_OPTIMIZE)

@@ -1188,14 +1239,11 @@

 lib: $(MODPERL_LIB)

-install:
-# install mod_perl.so
-       @$(MKPATH) $(MODPERL_AP_LIBEXECDIR)
-       $(MODPERL_TEST_F) $(MODPERL_LIB_DSO) && \
-       $(MODPERL_CP) $(MODPERL_LIB_DSO) $(MODPERL_AP_LIBEXECDIR)
-# install mod_perl .h files
-       @$(MKPATH) $(MODPERL_AP_INCLUDEDIR)
-       $(MODPERL_CP) $(MODPERL_H_FILES) $(MODPERL_AP_INCLUDEDIR)
+EOF
+
+    print $fh $install;
+
+    print $fh <<'EOF';

 .SUFFIXES: .xs .c $(MODPERL_OBJ_EXT) .lo .i .s

@@ -1264,6 +1312,13 @@
     my $flags = \&{"otherldflags_$^O"};
     return $self->otherldflags_default unless defined &$flags;
     $flags->($self);
+}
+
+sub otherldflags_MSWin32 {
+    my $self = shift;
+    my $flags = $self->otherldflags_default;
+    $flags .= " -pdb:\$(INST_ARCHAUTODIR)\\\$(BASEEXT).pdb" if $self->{MP_DEBUG};
+    $flags;
 }

 sub typemaps {
======================================================================

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to