perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [mp2] linking APR::* against APR
Date Sat, 19 Jun 2004 20:01:52 GMT
Randy Kobes wrote:
> In the current cvs, there's a couple of things needed to be
> done to link APR::* against the APR lib. The problem
> existing now (for Win32) is that the APR::* link against
> mod_perl.lib, so that mod_perl.so needs always to be
> available. We can get around this by removing the linking
> against mod_perl.lib, and instead link against APR.lib. This
> is relatively straightforward - the diff is below, and also
> attached, as it involves some tabs to be used within a
> Makefile. This is done (for Win32) for APR::Table,
> APR::UUID, APR::Pool, and APR::Pool. 

I think that should be the case for all APR::*. It just so happens that only 
the ones listed above are tested w/o mod_perl. I hope that eventually it won't 
be hardcoded, so if a new module is added it'll be automatically picked up.

> Note also that for this
> to work, APR.lib must be built before APR::*, so that the
> symbols ger resolved at link time. The default behaviour for
> me is to build APR::* first, so this diff also involves
> introduction of an apr_lib target (xs/APR/APR) to be built
> just after mod_perl.lib. This subsequently involves a trick
> within the top-level Makefile.PL (as is done for
> src/modules/perl/mod_perl.lib) to create a dummy APR.lib to
> fool MakeMaker into thinking the lib exists - otherwise, if
> it doesn't find it, the linking against the library is
> ignored.

Whatever it takes, Randy... there is just one style nit

> Index: lib/ModPerl/BuildMM.pm
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v
> retrieving revision 1.15
> diff -u -r1.15 BuildMM.pm
> --- lib/ModPerl/BuildMM.pm	4 Mar 2004 06:01:06 -0000	1.15
> +++ lib/ModPerl/BuildMM.pm	19 Jun 2004 00:37:36 -0000
> @@ -77,7 +77,25 @@
>          }
>      }
> 
> -    my $libs = join ' ', $build->apache_libs, $build->modperl_libs;
> +    my $libs;
> +    if (Apache::Build::WIN32) {
> +        my %standalone = map {$_ => 1 }
> +            qw(APR APR::Table APR::UUID APR::Pool APR::PerlIO);
> +        my $apr_blib_lib = catfile $build->{cwd},
> +            qw(blib arch Apache2 auto APR APR.lib);
> +        if ($standalone{$args{NAME}}) {
> +            $libs = $args{NAME} eq 'APR' ?
> +                join ' ', $build->apache_libs :
> +                    join ' ', $build->apache_libs, $apr_blib_lib;

Please always align ?: on the signs:

+            $libs = $args{NAME} eq 'APR'
+                ? join ' ', $build->apache_libs
+                : join ' ', $build->apache_libs, $apr_blib_lib;

as it reads so much better.

> +        }
> +        else {
> +            $libs = join ' ', $build->apache_libs, $build->modperl_libs;
> +        }
> +    }
> +    else {
> +        $libs = join ' ', $build->apache_libs, $build->modperl_libs;
> +    }
> +

And since you repeat a similar join line 4 times, it's probably better just to 
use the branching to populate a var like @libs, and at the end to do only one 
join.

-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

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


Mime
View raw message