perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject [mp1] win32 Makefile.PL patch
Date Sat, 13 Sep 2003 03:07:18 GMT
In a thread on the mod_perl list about building
Apache::Dispatch on Win32 using mod_perl 1, Steve raised the
point about the entry in Apache::MyConfig pointing to
mod_perl.lib referred to the source location. For building
3rd party modules, it would be more convenient if
mod_perl.lib was, first of all, installed into the Apache/
tree, and secondly, if Apache::MyConfig pointed rather to
this location. The patch below to the current cvs
Makefile.PL carries this out. In order to do this, I dropped
support for being able to build mod_perl on Win32 using an
Apache source tree, and instead now demand that APACHE_SRC
point to an installed Apache/ directory (which it could
before) - otherwise, the logic of trying to figure out where
to put what becomes pretty involved. I've also dropped
support for Apache versions that use ApacheModulePerl.dll as
the name of the mod_perl library, rather than mod_perl.so -
these are quite old Apache versions, and shouldn't be used
especially on Win32 due to security holes. If this patch is
OK, I'll make sure to specify these in the Changes and
INSTALL.win32 files.

Steve, if you get a chance, could you try this patch
out to see if it works for you? Thanks.
=============================================================
Index: Makefile.PL
===================================================================
RCS file: /home/cvs/modperl/Makefile.PL,v
retrieving revision 1.216
diff -u -r1.216 Makefile.PL
--- Makefile.PL	19 Aug 2003 05:07:44 -0000	1.216
+++ Makefile.PL	13 Sep 2003 02:52:21 -0000
@@ -367,9 +367,8 @@
 if ($vcpp and $win32_args{APACHE_SRC}) {
   $EVERYTHING = 1;
   my $fixed_apsrc = win32_fix_path($win32_args{APACHE_SRC});
-  $APACHE_SRC =  -d "$fixed_apsrc/include" ? $fixed_apsrc  :
-    (-d "$fixed_apsrc/src/include" ? $fixed_apsrc . '/src' :
-     die "Cannot find the Apache include directory under $fixed_apsrc");
+  $APACHE_SRC =  -d "$fixed_apsrc/include" ? $fixed_apsrc  :
+      die "Cannot find the Apache include directory under $fixed_apsrc";
   $win32_auto = 1;
   unless ($win32_args{INSTALL_DLL}) {
     my $w32_ap_mod = $fixed_apsrc . '/modules';
@@ -1369,9 +1368,7 @@
       if ($win32_args{INSTALL_DLL}) {
 	$string .= sprintf qq{\namp_install:\n\t\$(CP) "%s" "%s"},
 	"$win32_path{MODPERL_LIB}/mod_perl.so",
-	$win32_args{INSTALL_DLL} .
-	  ($win32_args{APACHE_VERS} < 1315 ?
-	   '/ApacheModulePerl.dll' : '/mod_perl.so');
+	$win32_args{INSTALL_DLL} . '/mod_perl.so';
         if (-d "$win32_args{APACHE_SRC}/libexec") {
           my $libexec = win32_fix_path($win32_args{APACHE_SRC}) . '/libexec';
           $string .= sprintf qq{\n\t\$(CP) "%s" "%s"},
@@ -2059,10 +2056,11 @@
         }
     }
     if ($win32_auto) {
-        for (qw(APACHE_INC APACHE_LIB MODPERL_INC MODPERL_LIB)) {
-            $my_config{$_} = $win32_path{$_};
-        }
 	$my_config{APACHE_SRC} = $APACHE_SRC;
+        $my_config{MODPERL_INC} = Apache::src->new->inc;
+        $my_config{APACHE_INC} = '-I' . $win32_path{APACHE_INC};
+        $my_config{MODPERL_LIB} = $my_config{APACHE_LIB} =
+            $win32_path{APACHE_LIB};
     }

     #need this alias for Apache::src backwards compat
@@ -2118,41 +2116,21 @@
 # obtain the Apache and mod_perl lib and include directories for Win32
 sub win32_inc_and_lib {

-  my $modperl_src = win32_fix_path(cwd) . '/src';
-  $win32_path{MODPERL_INC} = $modperl_src . '/modules/perl';
-  $win32_path{MODPERL_LIB} = ($win32_args{DEBUG} == 1) ?
-    $modperl_src . '/modules/win32/Debug' :
-      $modperl_src . '/modules/win32/Release';
-
-  unless ( -d $win32_args{APACHE_SRC}) {
-    opendir(DIR, '../') or die "Cannot read parent directory: $!\n";
-    my @dirs = map {"../$_"}
-      grep {/apache/ and -d "../$_"} readdir DIR;
-    closedir DIR or die "Cannot close parent directory: $!\n";
-    die "Cannot find the apache sources\n"
-      unless ($win32_args{APACHE_SRC} = find_dir(\@dirs, 'apache source'));
-  }
+  my $modperl_src = win32_fix_path(cwd) . '/src/modules/';
   $win32_args{APACHE_SRC} = win32_fix_path($win32_args{APACHE_SRC});
   if (-d "$win32_args{APACHE_SRC}/libexec") {
     $win32_path{APACHE_LIB} = $win32_args{APACHE_SRC} . '/libexec';
     $win32_path{APACHE_INC} = $win32_args{APACHE_SRC} . '/include';
-    $win32_args{APACHE_VERS} = httpd_version($win32_path{APACHE_INC}, 1);
-  }
-  else {
-    $win32_args{APACHE_SRC} .= '/src' unless $win32_args{APACHE_SRC} =~ /src$/;
-    $win32_path{APACHE_INC} = $win32_args{APACHE_SRC} . '/include';
-    $win32_args{APACHE_VERS} = httpd_version($win32_path{APACHE_INC}, 1);
-    $win32_path{APACHE_LIB} = ($win32_args{DEBUG} == 1) ?
-      $win32_args{APACHE_SRC} .
-	($win32_args{APACHE_VERS} < 1315 ? '/CoreD' : '/Debug') :
-	  $win32_args{APACHE_SRC} .
-	    ($win32_args{APACHE_VERS} < 1315 ? '/CoreR' : '/Release');
   }
+  $win32_path{MODPERL_INC} = $modperl_src . 'perl';
+  $win32_path{MODPERL_LIB} = $modperl_src . 'win32/' .
+      ($win32_args{DEBUG} == 1 ? 'Debug' : 'Release');
+
   die "Cannot find ApacheCore.lib under $win32_path{APACHE_LIB}\n"
     unless -f "$win32_path{APACHE_LIB}/ApacheCore.lib";
   die "Cannot find httpd.h under $win32_path{APACHE_INC}\n"
     unless -f "$win32_path{APACHE_INC}/httpd.h";
-
+
   if ($win32_args{INSTALL_DLL} ) {
     $win32_args{INSTALL_DLL} =
 	win32_fix_path($win32_args{INSTALL_DLL});
@@ -2202,7 +2180,7 @@
     }
     elsif (/ADD CPP/) {
       my $apache_inc = win32_fix_path_dsp($win32_path{APACHE_INC});
-      s!(/D "WIN32")!/I "$apache_inc"  /I "$apache_inc/../os/win32" /I "$perl_inc" $1!;
+      s!(/D "WIN32")!/I "$apache_inc"  /I "$perl_inc" $1!;
       s!(/D "WIN32")!$1 /D "EAPI" ! if $win32_args{EAPI};
       print NEWDSP $_;
     }
========================================================================
-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message