perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick *** <doink...@abv.bg>
Subject Re: The final patch needed for mp2 to build on Cygwin
Date Fri, 24 Jun 2005 09:05:28 GMT
 >-------- Оригинално писмо --------
 >От:  "Philippe M. Chiasson" <gozer@ectoplasm.org>
 >Относно: Re: The final patch needed for mp2 to build on Cygwin
 >До: Nick *** <doink123@abv.bg>
 >Изпратено на: Петък, 2005, Юни 24 02:56:05 EEST
 >----------------------------------
 >
 >Nick *** wrote:
 >> Yesterday, Apache-2.0.54 binary was finally released for Cygwin, which exposes the
httpd core. This was the last thing mp2 needed to successfuly link.
 >
 >Positively excellent news!
 >
 >> Also, my patch fixes some other small issues and tweaks one of my earlier patches,
which detects whether "--with-apr=" configure argument is a file or a directory.
 >
 >It's a big patch ;-) I'll try and give it a spin tomorrow.
 >
 >> Index: lib/ModPerl/BuildMM.pm
 >> ===================================================================
 >> --- lib/ModPerl/BuildMM.pm	(revision 193150)
 >> +++ lib/ModPerl/BuildMM.pm	(working copy)
 >> @@ -26,6 +26,7 @@
 >>  use Apache2::Build ();
 >>  use ModPerl::MM;
 >>  use constant WIN32 => Apache2::Build::WIN32;
 >> +use constant CYGWIN => Apache2::Build::CYGWIN;
 >> 
 >>  our %PM; #add files to installation
 >> 
 >> @@ -244,13 +245,14 @@
 >>                  my $podpath = catfile $doc_root, $pod;
 >>                  next unless -r $podpath;
 >> 
 >> -                push @target,
 >> +                push @target,
 >
 >All whitespace change ??

At first, I thought this is a bug in my svn, but I didn't fix the patch
manualy, because I didn't want to corrupt it. 
Today, I did some research and found that this happens because my editor
trims the white spaces. It's fixed now.

 >
 >>[...]
 >> +# Returns the needed link info for the apache shared core library
 >> +my $apache_corelib_cygwin;
 >> +sub apache_corelib_cygwin {
 >> +    return $apache_corelib_cygwin if $apache_corelib_cygwin;
 >> +    my $self = shift;
 >> +    # XXX: Check whether apxs supplies info for httpd2core.
 >> +    #      There is a chance that CORE_IMPLIB and/or CORE_IMPLIB_FILE vars
 >> +    #      (in config_vars.mk) my contain something useful.
 >> +
 >> +    $apache_corelib_cygwin = '-lhttpd2core';
 >> +    $apache_corelib_cygwin;
 >> +
 >> +}
 >
 >Is caching ($apache_corelib_cygwin) all necessary in this case, since it's only
 >returning a string ?

Well, it's nice to have it, because later we might need some checking 
or guessing for httpd2core's path (when it's not installed in the default location). Currently
we don't need it, so I guess you are right.
I'm removing it.

This is the modified patch:

Index: lib/ModPerl/BuildMM.pm
===================================================================
--- lib/ModPerl/BuildMM.pm	(revision 201582)
+++ lib/ModPerl/BuildMM.pm	(working copy)
@@ -26,6 +26,7 @@
 use Apache2::Build ();
 use ModPerl::MM;
 use constant WIN32 => Apache2::Build::WIN32;
+use constant CYGWIN => Apache2::Build::CYGWIN;
 
 our %PM; #add files to installation
 
@@ -250,7 +251,8 @@
                     "-e ModPerl::BuildMM::glue_pod $pm $podpath $blib";
 
                 # Win32 doesn't normally install man pages
-                next if WIN32;
+                # and Cygwin doesn't allow '::' in file names
+                next if WIN32 || CYGWIN;
 
                 # manify while we're at it
                 my (undef, $man, undef) = $blib =~ m!(blib/lib/)(.*)(\.pm)!;
Index: lib/Apache2/Build.pm
===================================================================
--- lib/Apache2/Build.pm	(revision 193150)
+++ lib/Apache2/Build.pm	(working copy)
@@ -470,7 +470,7 @@
     }
 
     if (CYGWIN && $self->is_dynamic) {
-        $ldopts .= join ' ', '', $self->apru_link_flags;
+        $ldopts .= join ' ', '', $self->apache_corelib_cygwin, $self->apru_link_flags;
     }
 
     $config->{ldflags} = $ldflags; #reset
@@ -1122,7 +1122,7 @@
             if ($self->{MP_AP_CONFIGURE} &&
                 $self->{MP_AP_CONFIGURE} =~ /--with-${what_long}=(\S+)/) {
                 my $dir = $1;
-                $dir =~ s/$config$// unless -d $dir;
+                $dir = dirname $dir if -f $dir;
                 push @tries, grep -d $_, $dir, catdir $dir, 'bin';
             }
         }
@@ -1537,6 +1537,16 @@
         "\t" . '$(MODPERL_RANLIB) $@';
 }
 
+sub dynamic_link_cygwin {
+    my $self = shift;
+    my $link = $self->dynamic_link_default;
+
+    # On cygwin, we have a problem with ld2, which creates mod_perl.dll
+    # although we supply mod_perl.so as an argument.
+    # Workaround this by renaming mod_perl.dll to mod_perl.so.
+    $link .= "\tmv $self->{MP_LIBNAME}.dll \$\@\n";
+}
+
 sub dynamic_link {
     my $self = shift;
     my $link = \&{"dynamic_link_$^O"};
@@ -1558,6 +1568,15 @@
     $libs->($self);
 }
 
+# Returns the needed link info for the apache shared core library
+sub apache_corelib_cygwin {
+    # XXX: Check whether apxs supplies info for httpd2core.
+    #      There is a chance that CORE_IMPLIB and/or CORE_IMPLIB_FILE vars
+    #      (in config_vars.mk) my contain something useful.
+
+    '-lhttpd2core';
+}
+
 sub modperl_libs_MSWin32 {
     my $self = shift;
     # mod_perl.lib will be installed into MP_AP_PREFIX/lib
@@ -1567,9 +1586,10 @@
 
 sub modperl_libs_cygwin {
      my $self = shift;
-     return $self->is_dynamic
-         ? "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}"
-         : $self->modperl_static_libs_cygwin;
+     return join ' ', "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}",
+        $self->apache_corelib_cygwin if $self->is_dynamic;
+
+     $self->modperl_static_libs_cygwin;
 }
 
 sub modperl_libs {
@@ -1603,6 +1623,7 @@
         "-L$modperl_path",
         "-l$self->{MP_LIBNAME}",
         '-lDynaLoader',
+        $self->apache_corelib_cygwin,
         $self->apru_link_flags,
         '-L' . catdir($self->perl_config('archlibexp'), 'CORE'),
         '-lperl';



Note for the archive: If you get a warning or an error for
missing -lresolv, just install the minires-devel package (it's in the Devel category).

-----------------------------------------------------------------
http://bg.sportingbet.com - Залагайте на Wimbledon на живо!

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


Mime
View raw message