perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philippe M. Chiasson" <go...@ectoplasm.org>
Subject Re: The final patch needed for mp2 to build on Cygwin
Date Thu, 23 Jun 2005 23:56:05 GMT
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 ??

>                      '$(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;
> +
> +}

Is caching ($apache_corelib_cygwin) all necessary in this case, since it's only
returning a string ?

>  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

This line is starting to be quite long (>78 chars)

>           : $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';

--------------------------------------------------------------------------------
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/     F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5

Mime
View raw message