Why can I not override make's environment variables in FreeBSD's apache port?

I'm trying to configure Apache 2.2 from ports (in FreeBSD). I've written my own makefile with my desired compile options and as far as I can tell, everything seems to check out. I.e.:

make -V <env_var> __MAKE_CONF=~/mk/make.apache22.conf

returns what I expect except for PERL5 and USE_PERL5. I've tried setting both variables in make.apache22.conf as well as setting the environment in every combination there is:

export PERL5=/usr/local/bin/perl
export USE_PERL5=5.12+

and yet

make -e -V USE_PERL5 -V PERL5



(i've also tried overriding with -E.) The other thing is that I only have Perl 5.12.1 installed, so the version is clearly coming from either the Perl port and/or bsd.perl.mk, but the way I'm grokking bsd.perl.mk and the make utility itself I don't understand why my methods aren't working.

What am I missing?


So, in short, the answer lies within the ports system. From /usr/ports/Mk/bsd.port.mk:

Note: the distinction between the USE_* and WANT_* variables, and the
WITH_* and WITHOUT_* variables, are that the former are restricted to
usage inside the ports framework, and the latter are reserved for user-
settable options.  (Setting USE_* in /etc/make.conf is always wrong).

Usually, when installing from a port, the Makefile will recursively include a chain of files which at some point brings in:


and this file evaluates all the USE_PERL* and PERL* variables defined the port's Makefile. In particular, bsd.perl.mk hard-codes the required Perl version and will install the Perl port if it isn't already on the system.

The ports system is pretty cool, but I find this sort of thing frustrating as there doesn't appear to be any straightforward way to configure a port to build and/or run using pre-existing software.

UPDATE Aug 8, 2010:

The bottom line is you either use ports or you don't. If you don't, you have to manually configure and track everything yourself but you also get the latest and (hopefully) greatest. The ports system is good, especially since each port can be configured as necessary and you get the advantages of easy upgrading and package management. (For, say, making custom compiled packages to install into jails--especially using a tool like ezjail.) The downside is that sometimes you have to wait a bit before a port is updated to the latest version. This isn't a big deal for common software, but you might be waiting a little while for more obscure items.

Ultimately, the solution here is to install the Perl 5.12 port and go from there.

Need Your Help

Mulitple elements for a single function

javascript jquery ajax

I have multiple product images which share the same "base" class (.billede_wrapper1, .billede_wrapper2), and a single JQuery function.

Animating list items that are partially hidden or at the end of the currently visible views in a ListView

java android listview animation android-listview

I'm currently implementing my own custom listview. I idea is that a longclick on a list item will scale the surrounding visible views to a smaller value scale and leave the the current view normal,