Re: [svn:PHP-Sandwich] r12056 - PHP-Sandwich/trunk

[email protected] ("David E. Wheeler") Sun, 9 Nov 2008 15:04:21 -0800
Newsgroups perl.php.sandwich.dev
Message-ID <[email protected]>
On Nov 7, 2008, at 12:22 AM, [email protected] wrote:

> +# Get prefix. Use script argument as prefix, otherwise use value from
> +# 'php-config'
> +my $prefix = shift @ARGV || ($conf{prefix});
> +die "Failed to find php prefix" if (!defined($prefix) or !-d  
> $prefix);
> +print "using prefix $prefix\n";

I don't think that this is the way to do it, because  
ExtUtils::MakeMaker supports other options to be passed on the command- 
line, like LDFLAGS and LIB. This gets in the way of that by  
potentially shifting off such commands. For example, when I go to  
build on Mac OS X, I have to tell EU::MM where to find libphp5.so:

   % perl Makefile.PL LIBS=-L/usr/libexec/apache2
   using php version 5.2.6
   Failed to find php prefix at Makefile.PL line 72.

I should not get that error, but I do, because $prefix is populated  
with "LIBS=-L/usr/libexec/apache2", and it should not be. I think that  
a better approach would be to use environment variables, such as  
DBD::Pg does.

   http://search.cpan.org/src/TURNSTEP/DBD-Pg-2.11.3/Makefile.PL

That way you stay out of the way of EU::MM processing. So then users  
would be able to do something like this:

   % PHPHOME=/path/to/php perl Makefile.PL LIBS=-L/usr/libexec/apache2

Thanks,

David