Author: stas Date: Wed May 4 22:38:22 2005 New Revision: 168275 URL: http://svn.apache.org/viewcvs?rev=168275&view=rev Log: link Apache2::* and ModPerl::* to mod_perl.a and DynaLoader.a, but -lmod_perl and -lDynaLoader don't work, and we can't supply the full paths, because MakeMaker doesn't allow this. I workaround this by making a symlink to mod_perl.a (called libmod_perl.a) and copy DynaLoader.a to libDynaLoader.a (I don't create a symlink, because, when running make clean, the real DynaLoader.a may get deleted). The APR::* extensions are not affected, because in both cases we link them against aprext. Also other small fixes are added
Modified: perl/modperl/trunk/Changes perl/modperl/trunk/lib/Apache2/Build.pm Modified: perl/modperl/trunk/Changes URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/Changes?rev=168275&r1=168274&r2=168275&view=diff ============================================================================== --- perl/modperl/trunk/Changes (original) +++ perl/modperl/trunk/Changes Wed May 4 22:38:22 2005 @@ -12,6 +12,15 @@ =item 1.999_24-dev +link Apache2::* and ModPerl::* to mod_perl.a and DynaLoader.a, but +-lmod_perl and -lDynaLoader don't work, and we can't supply the full +paths, because MakeMaker doesn't allow this. I workaround this by +making a symlink to mod_perl.a (called libmod_perl.a) and copy +DynaLoader.a to libDynaLoader.a (I don't create a symlink, because, +when running make clean, the real DynaLoader.a may get deleted). The +APR::* extensions are not affected, because in both cases we link them +against aprext. Also other small fixes are added. [Nick *** +<[EMAIL PROTECTED]>] Modified: perl/modperl/trunk/lib/Apache2/Build.pm URL: http://svn.apache.org/viewcvs/perl/modperl/trunk/lib/Apache2/Build.pm?rev=168275&r1=168274&r2=168275&view=diff ============================================================================== --- perl/modperl/trunk/lib/Apache2/Build.pm (original) +++ perl/modperl/trunk/lib/Apache2/Build.pm Wed May 4 22:38:22 2005 @@ -1059,6 +1059,12 @@ for ($self->apu_config_path, $self->apr_config_path) { if (my $link = $_ && -x $_ && qx{$_ --link-ld --libs}) { chomp $link; + + # Change '/path/to/libanything.la' to '-L/path/to -lanything' + if (CYGWIN) { + $link =~ s|(\S*)/lib([^.\s]+)\.\S+|-L$1 -l$2|g; + } + if ($self->httpd_is_source_tree) { my @libs; while ($link =~ m/-L(\S+)/g) { @@ -1546,7 +1552,9 @@ sub modperl_libs_cygwin { my $self = shift; - "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}"; + return $self->is_dynamic + ? "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}" + : $self->modperl_static_libs_cygwin; } sub modperl_libs { @@ -1556,6 +1564,33 @@ $libs->($self); } +my $modperl_static_libs_cygwin = ''; +sub modperl_static_libs_cygwin { + my $self = shift; + + return $modperl_static_libs_cygwin if $modperl_static_libs_cygwin; + + my $dyna_filepath = catdir $self->perl_config('archlibexp'), + 'auto/DynaLoader/DynaLoader.a'; + my $modperl_path = "$self->{cwd}/src/modules/perl"; + # Create symlink to mod_perl.a, but copy DynaLoader.a, because + # when running make clean the real DynaLoader.a may get deleted. + my $src = catfile $modperl_path, "$self->{MP_LIBNAME}.a"; + my $dst = catfile $modperl_path, "lib$self->{MP_LIBNAME}.a"; + qx{ln -s $src $dst}; + qx{cp $dyna_filepath $modperl_path/libDynaLoader.a}; + + $modperl_static_libs_cygwin = join ' ', + "-L$modperl_path", + "-l$self->{MP_LIBNAME}", + '-lDynaLoader', + $self->apru_link_flags, + '-L' . catdir($self->perl_config('archlibexp'), 'CORE'), + '-lperl'; + + $modperl_static_libs_cygwin; +} + # returns the directory and name of the aprext lib built under blib/ sub mp_apr_blib { my $self = shift; @@ -1831,7 +1866,7 @@ my $flags = $self->otherldflags_default; unless ($self->{MP_STATIC_EXTS}) { - $flags .= join ' ', $self->apru_link_flags; + $flags .= join ' ', '', $self->apru_link_flags; } $flags;