perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick *** <doink...@abv.bg>
Subject The final patch needed for mp2 to build on Cygwin
Date Thu, 23 Jun 2005 22:02:09 GMT
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.
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.


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,
                     '$(FULLPERL) -I$(INST_LIB) ' .
                     "-I$apache_test_dir -MModPerl::BuildMM " .
                     "-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,20 @@
     $libs->($self);
 }

+# 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;
+
+}
+
 sub modperl_libs_MSWin32 {
     my $self = shift;
     # mod_perl.lib will be installed into MP_AP_PREFIX/lib
@@ -1568,7 +1592,7 @@
 sub modperl_libs_cygwin {
      my $self = shift;
      return $self->is_dynamic
-         ? "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}"
+         ? join ' ', "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}", $self->apache_corelib_cygwin
          : $self->modperl_static_libs_cygwin;
 }

@@ -1603,6 +1627,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';


-----------------------------------------------------------------
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