perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick *** <doink...@abv.bg>
Subject [PATCH] Dynamic linking on Cygwin
Date Wed, 27 Apr 2005 09:35:57 GMT
Note that this patch doesn't fix the dynamic linking entirely, but does 75% of the job.
The problem with cygwin is that it behaves like windows (it's a posix layer over windows after
all). 
That's why we need to supply all symbols during linking time just like on win32, by adding
-lapr-0 -laprutil-0 and -lhttpd. On windows, Apache supplies all the three libraries and it's
easy to link, but on cygwin apache doesn't play nice and doesn't supply libhttpd.
My patch adds libapr and libaprutil. Also, I have a workaround for libhttpd, but currently
I'm thinking on how to implement it.


Index: lib/Apache2/Build.pm
===================================================================
--- lib/Apache2/Build.pm	(revision 164962)
+++ lib/Apache2/Build.pm	(working copy)
@@ -464,6 +464,12 @@
         $ldopts .= $self->gtop_ldopts;
     }

+    if (CYGWIN && $self->is_dynamic) {
+        foreach ($self->apru_link_flags) {
+            $ldopts .= $_ . ' ';
+        }
+    }
+
     $config->{ldflags} = $ldflags; #reset

     # on Irix mod_perl.so needs to see the libperl.so symbols, which
@@ -1050,7 +1056,9 @@

     return @apru_link_flags if @apru_link_flags;

-    for ($self->apr_config_path, $self->apu_config_path) {
+    # first use apu_config_path and then apr_config_path in order to
+    # resolve the symbols right during linking
+    for ($self->apu_config_path, $self->apr_config_path) {
         if (my $link = $_ && -x $_ && qx{$_ --link-ld --libs}) {
             chomp $link;
             if ($self->httpd_is_source_tree) {
@@ -1801,6 +1809,22 @@
     $flags;
 }

+sub otherldflags_cygwin {
+    my $self = shift;
+    my $flags = $self->otherldflags_default;
+
+    unless ($self->{MP_STATIC_EXTS}) {
+
+        foreach ($self->apru_link_flags) {
+            $flags .= $_ . ' ';
+        }
+
+        $flags .= ' -L' . $self->file_path('src/modules/perl') . ' -lmod_perl ';
+    }
+
+    $flags;
+}
+
 sub typemaps {
     my $self = shift;
     my @typemaps = ();


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