You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Randy Kobes <ra...@theoryx5.uwinnipeg.ca> on 2003/09/13 05:07:18 UTC

[mp1] win32 Makefile.PL patch

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


Re: [mp1] win32 Makefile.PL patch

Posted by Steve Hay <st...@uk.radan.com>.
Randy Kobes wrote:

>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.
>
Yes, this patch works OK for me using the command-line:

    perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules EAPI

However, in the light of subsequent discussions I guess you'll be 
putting together a new patch?

- Steve


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


Re: [mp1] win32 Makefile.PL patch

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 15 Sep 2003, Steve Hay wrote:

> Randy Kobes wrote:
>
> >Having an APACHE_INST would be a good idea, as it's then
> >more intuitive of what it represents ... Perhaps a
> >combination of APACHE_INST and INSTALL_LIB would be
> >good, in order to keep the flavour of the current
> >build procedure:
> >
> >- APACHE_INST: the Apache install directory,
> >   or
> >- APACHE_SRC, which can be either the Apache build or
> >install directory,
> >
> >With this,
> >- INSTALL_DLL: where to put mod_perl.so. If not given,
> >defaults to APACHE_INST/modules, or to APACHE_SRC/modules,
> >if these exist;
> >- INSTALL_LIB: where to put mod_perl.lib. If not given,
> >defaults to APACHE_INST/libexec, or to APACHE_SRC/libexec,
> >if these exist;
> >
> >In Apache::MyConfig, the location of the mod_perl lib would
> >then be the value of INSTALL_LIB, if that exists or was set;
> >if not, then it would stay at the current value of the
> >mod_perl source location.
> >
> This all sounds excellent.
>
> >
> >As for the location of the mod_perl header files in
> >Apache::MyConfig, right now for Win32 they're set as
> >/Path/to/mod_perl/sources/src/modules/perl. One instead
> >could use Apache::src->new->inc, which gives the installed
> >path (under the Perl tree). However, this wouldn't be a
> >compatible change with the current behaviour, as
> >Apache::src->new->inc is a string including the '-I' before
> >the directories, so that it can be used directly in a $(CC)
> >command. But I think it would be more convenient to use
> >Apache::src->new->inc, for the same reason as specifying an
> >installed location for the mod_perl.lib - that way, people
> >can delete the mod_perl build directory after installation.
> >What does this sound like?
> >
> >
> Setting MODPERL_INC to the installed location rather than the build
> location certainly makes a lot of sense.  A definite thumbs-up to that.
>
> But I'm not so sure about introducing the '-I' if that breaks backwards
> compatibility.  Depends how much you think people would be affected by
> it; I don't really know.
>
> Would it be possible to play it safe, and set MODPERL_INC to the
> installed location, but without the '-I's?

That would be possible, and probably preferable; however,
there'd still be a change in what to expect for MODPERL_INC.
Right now, being the value of src/modules/perl in the
mod_perl source location, it's a single value, but if one
uses Apache::src->new->inc, it'd become multiple values.
So, even if we stripped off the '-I's, the syntax
   -I$Apache::MyConfig{MODPERL_INC}
(which works now) would break.

-- 
best regards,
randy

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


Re: [mp1] win32 Makefile.PL patch

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Fri, 26 Sep 2003, Stas Bekman wrote:
> 
> 
>>I fail to apply this patch because of the tabs. Randy, can
>>you please post it as an attachment? we need to get rid of
>>the tabs next.
> 
> 
> Sorry about that - it's attached here.

Thanks Randy. It's not your fault. There should have been no tabs in that file 
in first place. The perl source suffers from the same problem. And I always 
have to remember to inline and attach my perl patches ;( Hopefully we will 
keep the mp2 source nice and clean ;)

I tested that everything builds and passes the tests on linux (the usual set 
of about 10 or so perl builds), so go ahead and commit it. Though please 
remember to update Changes (usually it's a good idea to do that along with the 
patch, so you won't forget to update it ;). And I'm sure you will update the 
win32 docs as well, besides the INSTALL.win32 file ;)

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: [mp1] win32 Makefile.PL patch

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 26 Sep 2003, Stas Bekman wrote:

> I fail to apply this patch because of the tabs. Randy, can
> you please post it as an attachment? we need to get rid of
> the tabs next.

Sorry about that - it's attached here.

-- 
best regards,
randy

Re: [mp1] win32 Makefile.PL patch

Posted by Stas Bekman <st...@stason.org>.
I fail to apply this patch because of the tabs. Randy, can you please post it 
as an attachment? we need to get rid of the tabs next.

patch -p0 < ../d/patch
patching file Makefile.PL
Hunk #2 succeeded at 376 with fuzz 1.
Hunk #4 FAILED at 1378.
Hunk #5 FAILED at 2160.
2 out of 6 hunks FAILED -- saving rejects to file Makefile.PL.rej


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: [mp1] win32 Makefile.PL patch

Posted by Steve Hay <st...@uk.radan.com>.
Randy Kobes wrote:

>So, the patch below keeps backwards compatibility, and
>adds an INSTALL_LIB capability to 'perl Makefile.PL' to
>point to where to install mod_perl.lib, if it can't
>find the location in the installed Apache tree.
>
Sounds fair enough to me -- add the extra feature that we wanted, and 
just play it safe backwards-compatibility-wise.

I've test your patch (below) and it works a treat -- Perl 5.8.0 and 
5.8.1, with Apache 1.3.27 / mod_perl 1.28_01-dev.  Thanks!

There is one other installation oddity that I've noticed for a while now 
(it's not new), but never had time to look at properly.  I find that running

    perl Makefile.PL APACHE_SRC=C:/apache EAPI

(where C:/apache is my Apache installation directory) puts a 4kB file 
called "perl" into C:/apache/modules.  It looks like this is the typemap 
file from the mp1 build tree's "Apache" sub-directory, which also gets 
copied into src/modules/perl.

I think it is Makefile.PL's setup_for_static() that copies it there.  
Why does it do that?  We don't need it there do we?

- Steve

>================================================================
>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	25 Sep 2003 23:57:45 -0000
>@@ -330,7 +330,8 @@
>
> my $vcpp = ($Config{cc} =~ /^cl(\.exe)?$/);
> my %win32_args;
>-my %win32_accept = map {$_ => 1} qw(APACHE_SRC INSTALL_DLL DEBUG EAPI);
>+my %win32_accept = map {$_ => 1}
>+    qw(APACHE_SRC INSTALL_DLL INSTALL_LIB DEBUG EAPI);
>
> while($_ = shift) {
>     ($k,$v) = split /=/, $_, 2;
>@@ -375,6 +376,10 @@
>     my $w32_ap_mod = $fixed_apsrc . '/modules';
>     $win32_args{INSTALL_DLL} = $w32_ap_mod if -d $w32_ap_mod;
>   }
>+  unless ($win32_args{INSTALL_LIB}) {
>+    my $w32_ap_lib = $fixed_apsrc . '/libexec';
>+    $win32_args{INSTALL_LIB} = $w32_ap_lib if -d $w32_ap_lib;
>+  }
> }
>
> my %very_experimental = map {$_,1}
>@@ -1341,7 +1346,8 @@
>     if($USE_APXS) {
> 	$add = "apxs_install";
>     }
>-    elsif ($win32_auto and $win32_args{INSTALL_DLL}) {
>+    elsif ($win32_auto and
>+           ($win32_args{INSTALL_DLL} or $win32_args{INSTALL_LIB})) {
>       $add = 'amp_install';
>     }
>     elsif($USE_APACI) {
>@@ -1372,12 +1378,11 @@
> 	$win32_args{INSTALL_DLL} .
> 	  ($win32_args{APACHE_VERS} < 1315 ?
> 	   '/ApacheModulePerl.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"},
>-            "$win32_path{MODPERL_LIB}/mod_perl.lib",
>-              $libexec . '/mod_perl.lib';
>-        }
>+      }
>+      if ($win32_args{INSTALL_LIB}) {
>+        $string .= sprintf qq{\n\t\$(CP) "%s" "%s"},
>+          "$win32_path{MODPERL_LIB}/mod_perl.lib",
>+            $win32_args{INSTALL_LIB} . '/mod_perl.lib';
>       }
>       return $string;
>     }
>@@ -2155,7 +2160,7 @@
>
>   if ($win32_args{INSTALL_DLL} ) {
>     $win32_args{INSTALL_DLL} =
>-	win32_fix_path($win32_args{INSTALL_DLL});
>+      win32_fix_path($win32_args{INSTALL_DLL});
>     unless ( -d $win32_args{INSTALL_DLL}) {
>       my @dirs = grep {-d}
> 	('\Program Files\Apache Group\Apache\modules',
>@@ -2170,6 +2175,28 @@
>
> ****  The Apache/modules directory was not found.    *******
> ****      Please install mod_perl.so manually.       *******
>+
>+END
>+      }
>+    }
>+  }
>+  if ($win32_args{INSTALL_LIB} ) {
>+    $win32_args{INSTALL_LIB} =
>+      win32_fix_path($win32_args{INSTALL_LIB});
>+    unless ( -d $win32_args{INSTALL_LIB}) {
>+      my @dirs = grep {-d}
>+	('\Program Files\Apache Group\Apache\libexec',
>+	 '\Apache\libexec', '\Program Files\Apache\libexec');
>+      $win32_args{INSTALL_LIB} = find_dir(\@dirs, 'Apache/libexec');
>+      if ($win32_args{INSTALL_LIB} and -d $win32_args{INSTALL_LIB}) {
>+	$win32_args{INSTALL_LIB} =
>+	  win32_fix_path($win32_args{INSTALL_LIB});
>+      }
>+      else {
>+	print <<'END';
>+
>+****  The Apache/libexec directory was not found.    *******
>+****      Please install mod_perl.lib manually.       *******
>
> END
>       }
>Index: INSTALL.win32
>===================================================================
>RCS file: /home/cvs/modperl/INSTALL.win32,v
>retrieving revision 1.10
>diff -u -r1.10 INSTALL.win32
>--- INSTALL.win32	6 Jul 2003 13:42:56 -0000	1.10
>+++ INSTALL.win32	25 Sep 2003 23:57:45 -0000
>@@ -131,6 +131,12 @@
> (eg, \Apache\modules). If not given, a value of APACHE_SRC\modules
> will be used, if this directory exists.
>
>+=item INSTALL_LIB
>+
>+This gives the location of where to install mod_perl.lib
>+(eg, \Apache\libexec). If not given, a value of APACHE_SRC\libexec
>+will be used, if this directory exists.
>+
> =item DEBUG
>
> If true (DEBUG=1), a Debug version will be built (this assumes
>===================================================================
>  
>



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


Re: [mp1] win32 Makefile.PL patch

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 15 Sep 2003, Steve Hay wrote:

> Randy Kobes wrote:
>
> >Having an APACHE_INST would be a good idea, as it's then
> >more intuitive of what it represents ... Perhaps a
> >combination of APACHE_INST and INSTALL_LIB would be
> >good, in order to keep the flavour of the current
> >build procedure:
> >
> >- APACHE_INST: the Apache install directory,
> >   or
> >- APACHE_SRC, which can be either the Apache build or
> >install directory,
> >
> >With this,
> >- INSTALL_DLL: where to put mod_perl.so. If not given,
> >defaults to APACHE_INST/modules, or to APACHE_SRC/modules,
> >if these exist;
> >- INSTALL_LIB: where to put mod_perl.lib. If not given,
> >defaults to APACHE_INST/libexec, or to APACHE_SRC/libexec,
> >if these exist;

In the interests of not introducing another layer of
complexity, in the patch below I just added an INSTALL_LIB -
the INSTALL.win32 docs point out that APACHE_SRC can either
be the Apache source directory or the Apache install
directory, so APACHE_INST is a bit redundant (although
more descriptive). And like the installation of mod_perl.so,
which defaults to APACHE_SRC/modules (if this exists) if
INSTALL_DLL isn't given, mod_perl.lib will get installed
to APACHE_SRC/libexec (if this exists) if INSTALL_LIB isn't
given.

> >
> >In Apache::MyConfig, the location of the mod_perl lib would
> >then be the value of INSTALL_LIB, if that exists or was set;
> >if not, then it would stay at the current value of the
> >mod_perl source location.
> >
> This all sounds excellent.
> >
> >As for the location of the mod_perl header files in
> >Apache::MyConfig, right now for Win32 they're set as
> >/Path/to/mod_perl/sources/src/modules/perl. One instead
> >could use Apache::src->new->inc, which gives the installed
> >path (under the Perl tree). However, this wouldn't be a
> >compatible change with the current behaviour, as
> >Apache::src->new->inc is a string including the '-I' before
> >the directories, so that it can be used directly in a $(CC)
> >command. But I think it would be more convenient to use
> >Apache::src->new->inc, for the same reason as specifying an
> >installed location for the mod_perl.lib - that way, people
> >can delete the mod_perl build directory after installation.
> >What does this sound like?
> >
> >
> Setting MODPERL_INC to the installed location rather than the build
> location certainly makes a lot of sense.  A definite thumbs-up to that.
>
> But I'm not so sure about introducing the '-I' if that breaks backwards
> compatibility.  Depends how much you think people would be affected by
> it; I don't really know.
>
> Would it be possible to play it safe, and set MODPERL_INC to the
> installed location, but without the '-I's?

The values of MODPERL_LIB and MODPERL_INC in
Apache::MyConfig I ended up leaving alone, as changing them
now will break compatibility. Using Apache::src->new->inc
for MODPERL_INC (which would be the installed header
location) would be more convenient, but has the '-I'
switches already in it, and removing them would leave you
with a list of directories - both options would present
different behaviour to the current one. Changing MODPERL_LIB
to the installed directory, while more convenient, would
also break compatibility, as with the current MODPERL_LIB
both mod_perl.so and mod_perl.lib are present in that
directory, which isn't the case with the installed
directories.

If one wants to use the installed locations, one can use
Apache::src->new->inc, rather than MODPERL_INC from
Apache::MyConfig, for the headers, and then use
APACHE_LIB, rather than MODPERL_LIB, for the libraries.

So, the patch below keeps backwards compatibility, and
adds an INSTALL_LIB capability to 'perl Makefile.PL' to
point to where to install mod_perl.lib, if it can't
find the location in the installed Apache tree.
================================================================
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	25 Sep 2003 23:57:45 -0000
@@ -330,7 +330,8 @@

 my $vcpp = ($Config{cc} =~ /^cl(\.exe)?$/);
 my %win32_args;
-my %win32_accept = map {$_ => 1} qw(APACHE_SRC INSTALL_DLL DEBUG EAPI);
+my %win32_accept = map {$_ => 1}
+    qw(APACHE_SRC INSTALL_DLL INSTALL_LIB DEBUG EAPI);

 while($_ = shift) {
     ($k,$v) = split /=/, $_, 2;
@@ -375,6 +376,10 @@
     my $w32_ap_mod = $fixed_apsrc . '/modules';
     $win32_args{INSTALL_DLL} = $w32_ap_mod if -d $w32_ap_mod;
   }
+  unless ($win32_args{INSTALL_LIB}) {
+    my $w32_ap_lib = $fixed_apsrc . '/libexec';
+    $win32_args{INSTALL_LIB} = $w32_ap_lib if -d $w32_ap_lib;
+  }
 }

 my %very_experimental = map {$_,1}
@@ -1341,7 +1346,8 @@
     if($USE_APXS) {
 	$add = "apxs_install";
     }
-    elsif ($win32_auto and $win32_args{INSTALL_DLL}) {
+    elsif ($win32_auto and
+           ($win32_args{INSTALL_DLL} or $win32_args{INSTALL_LIB})) {
       $add = 'amp_install';
     }
     elsif($USE_APACI) {
@@ -1372,12 +1378,11 @@
 	$win32_args{INSTALL_DLL} .
 	  ($win32_args{APACHE_VERS} < 1315 ?
 	   '/ApacheModulePerl.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"},
-            "$win32_path{MODPERL_LIB}/mod_perl.lib",
-              $libexec . '/mod_perl.lib';
-        }
+      }
+      if ($win32_args{INSTALL_LIB}) {
+        $string .= sprintf qq{\n\t\$(CP) "%s" "%s"},
+          "$win32_path{MODPERL_LIB}/mod_perl.lib",
+            $win32_args{INSTALL_LIB} . '/mod_perl.lib';
       }
       return $string;
     }
@@ -2155,7 +2160,7 @@

   if ($win32_args{INSTALL_DLL} ) {
     $win32_args{INSTALL_DLL} =
-	win32_fix_path($win32_args{INSTALL_DLL});
+      win32_fix_path($win32_args{INSTALL_DLL});
     unless ( -d $win32_args{INSTALL_DLL}) {
       my @dirs = grep {-d}
 	('\Program Files\Apache Group\Apache\modules',
@@ -2170,6 +2175,28 @@

 ****  The Apache/modules directory was not found.    *******
 ****      Please install mod_perl.so manually.       *******
+
+END
+      }
+    }
+  }
+  if ($win32_args{INSTALL_LIB} ) {
+    $win32_args{INSTALL_LIB} =
+      win32_fix_path($win32_args{INSTALL_LIB});
+    unless ( -d $win32_args{INSTALL_LIB}) {
+      my @dirs = grep {-d}
+	('\Program Files\Apache Group\Apache\libexec',
+	 '\Apache\libexec', '\Program Files\Apache\libexec');
+      $win32_args{INSTALL_LIB} = find_dir(\@dirs, 'Apache/libexec');
+      if ($win32_args{INSTALL_LIB} and -d $win32_args{INSTALL_LIB}) {
+	$win32_args{INSTALL_LIB} =
+	  win32_fix_path($win32_args{INSTALL_LIB});
+      }
+      else {
+	print <<'END';
+
+****  The Apache/libexec directory was not found.    *******
+****      Please install mod_perl.lib manually.       *******

 END
       }
Index: INSTALL.win32
===================================================================
RCS file: /home/cvs/modperl/INSTALL.win32,v
retrieving revision 1.10
diff -u -r1.10 INSTALL.win32
--- INSTALL.win32	6 Jul 2003 13:42:56 -0000	1.10
+++ INSTALL.win32	25 Sep 2003 23:57:45 -0000
@@ -131,6 +131,12 @@
 (eg, \Apache\modules). If not given, a value of APACHE_SRC\modules
 will be used, if this directory exists.

+=item INSTALL_LIB
+
+This gives the location of where to install mod_perl.lib
+(eg, \Apache\libexec). If not given, a value of APACHE_SRC\libexec
+will be used, if this directory exists.
+
 =item DEBUG

 If true (DEBUG=1), a Debug version will be built (this assumes
===================================================================

-- 
best regards,
randy

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


Re: [mp1] win32 Makefile.PL patch

Posted by Steve Hay <st...@uk.radan.com>.
Randy Kobes wrote:

>Having an APACHE_INST would be a good idea, as it's then
>more intuitive of what it represents ... Perhaps a
>combination of APACHE_INST and INSTALL_LIB would be
>good, in order to keep the flavour of the current
>build procedure:
>
>- APACHE_INST: the Apache install directory,
>   or
>- APACHE_SRC, which can be either the Apache build or
>install directory,
>
>With this,
>- INSTALL_DLL: where to put mod_perl.so. If not given,
>defaults to APACHE_INST/modules, or to APACHE_SRC/modules,
>if these exist;
>- INSTALL_LIB: where to put mod_perl.lib. If not given,
>defaults to APACHE_INST/libexec, or to APACHE_SRC/libexec,
>if these exist;
>
>In Apache::MyConfig, the location of the mod_perl lib would
>then be the value of INSTALL_LIB, if that exists or was set;
>if not, then it would stay at the current value of the
>mod_perl source location.
>
This all sounds excellent.

>
>As for the location of the mod_perl header files in
>Apache::MyConfig, right now for Win32 they're set as
>/Path/to/mod_perl/sources/src/modules/perl. One instead
>could use Apache::src->new->inc, which gives the installed
>path (under the Perl tree). However, this wouldn't be a
>compatible change with the current behaviour, as
>Apache::src->new->inc is a string including the '-I' before
>the directories, so that it can be used directly in a $(CC)
>command. But I think it would be more convenient to use
>Apache::src->new->inc, for the same reason as specifying an
>installed location for the mod_perl.lib - that way, people
>can delete the mod_perl build directory after installation.
>What does this sound like?
>  
>
Setting MODPERL_INC to the installed location rather than the build 
location certainly makes a lot of sense.  A definite thumbs-up to that.

But I'm not so sure about introducing the '-I' if that breaks backwards 
compatibility.  Depends how much you think people would be affected by 
it; I don't really know.

Would it be possible to play it safe, and set MODPERL_INC to the 
installed location, but without the '-I's?

- Steve


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


Re: [mp1] win32 Makefile.PL patch

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Mon, 15 Sep 2003, Steve Hay wrote:

> Randy Kobes wrote:
>
> >On Sat, 13 Sep 2003, Stas Bekman wrote:
> >
> >[ ... ]
> >>So what I was saying is that we probably need to continue
> >>building *mod_perl* as before, however make mod_perl.lib
> >>and anything else needed available under the Apache source
> >>tree (or I think under the perl lib tree for mp1, since
> >>that's where we keep all our mp stuff). Does it make
> >>sense?
> >
> >Yes, that does ... We could put it under the perl tree
> >(that's where the mp1 header files go now), for example,
> >under $Config{installsitearch}/auto/mod_perl/, and then
> >record that in Apache::MyConfig. Alternatively, as with
> >mod_perl.so, we could let the user specify the location via
> >a Makefile.PL INSTALL_LIB flag (analagous to Win32's
> >INSTALL_DLL), and if this is not given, set it to be under
> >APACHE_SRC/libexec, if this exists (ie, the user has given
> >the Apache installation directory for APACHE_SRC).
> >Preferences?
> >
> I think installing mod_perl.lib somewhere under the Apache installation
> tree, rather than the Perl tree, makes more sense because it is the
> import library for mod_perl.so (aka mod_perl.dll), which, of course, is
> typically placed under the Apache tree (in the "modules"
> sub-directory).  Apache's "libexec" sub-directory, where other import
> libraries are located, seems the best place to put it.
>
> The command-line that I normally use is:
>
>     perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules EAPI
>
> (Where C:/apache is an *installed* Apache tree, which, after all,
> contains all the "source" necessary -- headers and libraries.)  So,
> using your suggestion above, I would just need to make that:
>
>     perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules
> INSTALL_LIB=C:/apache/libexec EAPI
>
> yes?
>
> It would be nice to be able to shortcut that to something like:
>
>     perl Makefile.PL APACHE_INST=C:/apache EAPI
>
> The Apache installation specified is used to find the necessary headers
> and libraries, and as the location to install things into (under
> "modules" and "libexec").
>
> If that's too radical, then just your APACHE_LIB would be fine.

Having an APACHE_INST would be a good idea, as it's then
more intuitive of what it represents ... Perhaps a
combination of APACHE_INST and INSTALL_LIB would be
good, in order to keep the flavour of the current
build procedure:

- APACHE_INST: the Apache install directory,
   or
- APACHE_SRC, which can be either the Apache build or
install directory,

With this,
- INSTALL_DLL: where to put mod_perl.so. If not given,
defaults to APACHE_INST/modules, or to APACHE_SRC/modules,
if these exist;
- INSTALL_LIB: where to put mod_perl.lib. If not given,
defaults to APACHE_INST/libexec, or to APACHE_SRC/libexec,
if these exist;

In Apache::MyConfig, the location of the mod_perl lib would
then be the value of INSTALL_LIB, if that exists or was set;
if not, then it would stay at the current value of the
mod_perl source location.

As for the location of the mod_perl header files in
Apache::MyConfig, right now for Win32 they're set as
/Path/to/mod_perl/sources/src/modules/perl. One instead
could use Apache::src->new->inc, which gives the installed
path (under the Perl tree). However, this wouldn't be a
compatible change with the current behaviour, as
Apache::src->new->inc is a string including the '-I' before
the directories, so that it can be used directly in a $(CC)
command. But I think it would be more convenient to use
Apache::src->new->inc, for the same reason as specifying an
installed location for the mod_perl.lib - that way, people
can delete the mod_perl build directory after installation.
What does this sound like?

-- 
best regards,
randy

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


Re: [mp1] win32 Makefile.PL patch

Posted by Steve Hay <st...@uk.radan.com>.
Randy Kobes wrote:

>On Sat, 13 Sep 2003, Stas Bekman wrote:
>
>[ ... ]
>  
>
>>So what I was saying is that we probably need to continue
>>building *mod_perl* as before, however make mod_perl.lib
>>and anything else needed available under the Apache source
>>tree (or I think under the perl lib tree for mp1, since
>>that's where we keep all our mp stuff). Does it make
>>sense?
>>    
>>
>
>Yes, that does ... We could put it under the perl tree
>(that's where the mp1 header files go now), for example,
>under $Config{installsitearch}/auto/mod_perl/, and then
>record that in Apache::MyConfig. Alternatively, as with
>mod_perl.so, we could let the user specify the location via
>a Makefile.PL INSTALL_LIB flag (analagous to Win32's
>INSTALL_DLL), and if this is not given, set it to be under
>APACHE_SRC/libexec, if this exists (ie, the user has given
>the Apache installation directory for APACHE_SRC).
>Preferences?
>
I think installing mod_perl.lib somewhere under the Apache installation 
tree, rather than the Perl tree, makes more sense because it is the 
import library for mod_perl.so (aka mod_perl.dll), which, of course, is 
typically placed under the Apache tree (in the "modules" 
sub-directory).  Apache's "libexec" sub-directory, where other import 
libraries are located, seems the best place to put it.

The command-line that I normally use is:

    perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules EAPI

(Where C:/apache is an *installed* Apache tree, which, after all, 
contains all the "source" necessary -- headers and libraries.)  So, 
using your suggestion above, I would just need to make that:

    perl Makefile.PL APACHE_SRC=C:/apache INSTALL_DLL=C:/apache/modules 
INSTALL_LIB=C:/apache/libexec EAPI

yes?

It would be nice to be able to shortcut that to something like:

    perl Makefile.PL APACHE_INST=C:/apache EAPI

The Apache installation specified is used to find the necessary headers 
and libraries, and as the location to install things into (under 
"modules" and "libexec").

If that's too radical, then just your APACHE_LIB would be fine.

- Steve


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


Re: [mp1] win32 Makefile.PL patch

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Sat, 13 Sep 2003, Stas Bekman wrote:
> 
> [ ... ]
> 
>>So what I was saying is that we probably need to continue
>>building *mod_perl* as before, however make mod_perl.lib
>>and anything else needed available under the Apache source
>>tree (or I think under the perl lib tree for mp1, since
>>that's where we keep all our mp stuff). Does it make
>>sense?
> 
> 
> Yes, that does ... We could put it under the perl tree
> (that's where the mp1 header files go now), for example,
> under $Config{installsitearch}/auto/mod_perl/, and then
> record that in Apache::MyConfig. Alternatively, as with
> mod_perl.so, we could let the user specify the location via
> a Makefile.PL INSTALL_LIB flag (analagous to Win32's
> INSTALL_DLL), and if this is not given, set it to be under
> APACHE_SRC/libexec, if this exists (ie, the user has given
> the Apache installation directory for APACHE_SRC).
> Preferences?

Either way is fine with me as long as things are working as before and even 
better ;)


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: [mp1] win32 Makefile.PL patch

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Sat, 13 Sep 2003, Stas Bekman wrote:

[ ... ]
> So what I was saying is that we probably need to continue
> building *mod_perl* as before, however make mod_perl.lib
> and anything else needed available under the Apache source
> tree (or I think under the perl lib tree for mp1, since
> that's where we keep all our mp stuff). Does it make
> sense?

Yes, that does ... We could put it under the perl tree
(that's where the mp1 header files go now), for example,
under $Config{installsitearch}/auto/mod_perl/, and then
record that in Apache::MyConfig. Alternatively, as with
mod_perl.so, we could let the user specify the location via
a Makefile.PL INSTALL_LIB flag (analagous to Win32's
INSTALL_DLL), and if this is not given, set it to be under
APACHE_SRC/libexec, if this exists (ie, the user has given
the Apache installation directory for APACHE_SRC).
Preferences?

-- 
best regards,
randy

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


Re: [mp1] win32 Makefile.PL patch

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> On Fri, 12 Sep 2003, Stas Bekman wrote:
> 
> 
>>Randy Kobes wrote:
>>
>>>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.
>>
>>Shooting in the dark: isn't that sort of late to do such
>>drastic changes like dropping builds against the source at
>>this point for mp1? All books out there document it as
>>working. Would it be too hard to keep it as before and fix
>>things that don't work? On the other hand it's quite
>>possible that nobody on win32 builds mp1 from source at
>>all. Just an idea...
> 
> 
> That is a good point ... The difficulties I was running into
> in installing mod_perl.lib, and subsequently make it useable
> for 3rd party modules, is that it's more useful when put
> into the installed Apache tree, rather than an Apache or
> mod_perl source tree, as a user may delete the sources after
> installation without realizing they may be used later for
> 3rd party modules. One could keep the option of building
> against an Apache source tree, and then prompt the user for
> an installation directory if the source directory is given,
> but then with the installation directory at hand, there's no
> use in principle for the source directory.

But now you are talking about a different thing. Above you said:

 >>>In order to do this, I dropped
 >>>support for being able to build mod_perl on Win32 using an
 >>>Apache source tree,

whereas your real problem is about building extensions. So what I was saying 
is that we probably need to continue building *mod_perl* as before, however 
make mod_perl.lib and anything else needed available under the Apache source 
tree (or I think under the perl lib tree for mp1, since that's where we keep 
all our mp stuff). Does it make sense?

> However, as you say, it may be better not to drop the source
> support - what I could do is, if an Apache source directory
> is given, try to make a guess where the installation
> directory is, and then prompt for confirmation, if a guess
> is found, or else just prompt for the installation
> directory.

If you copy it away, you don't need to do that.


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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


Re: [mp1] win32 Makefile.PL patch

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 12 Sep 2003, Stas Bekman wrote:

> Randy Kobes wrote:
> > 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.
>
> Shooting in the dark: isn't that sort of late to do such
> drastic changes like dropping builds against the source at
> this point for mp1? All books out there document it as
> working. Would it be too hard to keep it as before and fix
> things that don't work? On the other hand it's quite
> possible that nobody on win32 builds mp1 from source at
> all. Just an idea...

That is a good point ... The difficulties I was running into
in installing mod_perl.lib, and subsequently make it useable
for 3rd party modules, is that it's more useful when put
into the installed Apache tree, rather than an Apache or
mod_perl source tree, as a user may delete the sources after
installation without realizing they may be used later for
3rd party modules. One could keep the option of building
against an Apache source tree, and then prompt the user for
an installation directory if the source directory is given,
but then with the installation directory at hand, there's no
use in principle for the source directory.

However, as you say, it may be better not to drop the source
support - what I could do is, if an Apache source directory
is given, try to make a guess where the installation
directory is, and then prompt for confirmation, if a guess
is found, or else just prompt for the installation
directory.

-- 
best regards,
randy

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


Re: [mp1] win32 Makefile.PL patch

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
> 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.

Shooting in the dark: isn't that sort of late to do such drastic changes like 
dropping builds against the source at this point for mp1? All books out there 
document it as working. Would it be too hard to keep it as before and fix 
things that don't work? On the other hand it's quite possible that nobody on 
win32 builds mp1 from source at all. Just an idea...



__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


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