perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick *** <doink...@abv.bg>
Subject Re: [PATCH] Dynamic linking on Cygwin
Date Wed, 04 May 2005 08:58:50 GMT
 >It changes apru_link_flags(). Now I don't know whether this won't create 
 >problems on other platforms/compilers. So if you can make that CYGWIN 
 >specific change, I'll gladly put it in.
 >
 >Thanks Nick.
 >

Yes Stas, you are right. I did some research an it seems like this can break something on
OpenVMS. 
I'm sorry for this mistake. Here is the new patch:


Index: lib/Apache2/Build.pm
===================================================================
--- lib/Apache2/Build.pm	(revision 167901)
+++ lib/Apache2/Build.pm	(working copy)
@@ -1059,6 +1059,10 @@
     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'
+            $link =~ s|(\S*)/lib([^.\s]+)\.\S+|-L$1 -l$2|g if CYGWIN;
+
             if ($self->httpd_is_source_tree) {
                 my @libs;
                 while ($link =~ m/-L(\S+)/g) {
@@ -1546,7 +1550,8 @@

 sub modperl_libs_cygwin {
      my $self = shift;
-     "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}";
+     return "-L$self->{cwd}/src/modules/perl -l$self->{MP_LIBNAME}" if $self->is_dynamic;
+     $self->modperl_static_libs_cygwin;
 }

 sub modperl_libs {
@@ -1556,7 +1561,31 @@
     $libs->($self);
 }

-# returns the directory and name of the aprext lib built under blib/
+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	= $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.
+    qx{ln -s $modperl_path/$self->{MP_LIBNAME}.a $modperl_path/lib$self->{MP_LIBNAME}.a};
+    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;
     return unless (my $mp_apr_lib = $self->{MP_APR_LIB});
@@ -1831,7 +1860,7 @@
     my $flags = $self->otherldflags_default;

     unless ($self->{MP_STATIC_EXTS}) {
-        $flags .= join ' ', $self->apru_link_flags;
+        $flags .= join ' ', '', $self->apru_link_flags;
     }

     $flags;



-----------------------------------------------------------------
http://host.GBG.bg - лидер в Уеб Хостинг решения и регистрация
на Домейн имена

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


Mime
View raw message