a $PREFIX question...
chris# at 1command.com
Mon Sep 15 01:50:41 UTC 2008
Hello Dmitry, and thank you for your response.
Quoting Dmitry Marakasov <amdmi3/@\amdmi3.ru>:
> * Chris H (chris#/@\1command.com) wrote:
> JFYI, I'm not php user, but I have more than enough experience of
> ports hacking, so I may miss something php-specific, though I have
> some thoughts.
Understood. Thank you.
>>> For jail there's DESTDIR.
>> Ahh. That's good to know. I had thought to look to the BIND port as a
>> model for a jail. But, since I'm really just trying to get both PHP4 and
>> PHP5 to install in such a manner as to prevent symbol collisions, I
>> thought that simply keeping the configure/install the same as it is
>> now, but substituting php, for php5 would be the most efficient, and
>> tidy approach. It appears that all I'm dealing with is:
>> /usr/local/etc/php && php.conf
>> /usr/local/bin/php || pgp-cgi
> Ah, sorry. Actually I wasn't aware that php installs stuff into */php
> directories. In this case maybe changing /php to /php5 may really be
> more convenient.
>> Which - if I have a reasonable understanding of all this, translates to:
>> $PREFIX || $LOCALBASE/php no?
> No. Now I finally understand your question :)
Just for the record, I read Mk/bsd.port.mk and /intended/ to infer:
$LOCALBASE == /usr/local
$PREFIX if undefined == $LOCALBASE
else $PREFIX == $PREFIX
if $PREFIX != $PREFIX, $PREFIX == $LOCALBASE
Sorry for not being clearer. :)
> LOCALBASE (/usr/local by default) is a place where all software
> installed through ports will go. It is also where ports search for
> libraries, includes etc. installed by other ports.
> PREFIX (LOCALBASE by default, thus /usr/local as well) is where the
> currently installed port goes.
> No one should really redefine LOCALBASE, but you may change prefix to
> install a specific port to some nondefault location.
> Those have nothing to do with /php dirs. It seems to be php-specific
> feature to install it's files under /php subdirs everywhere. So, by
> default (prefix=/usr/local) e.g. php cli binary will be installed as
Actually the php binary, and php-cgi are installed in local/bin/
But local/include, local/lib, and local/etc have a php directory appended,
and php.conf is dumped into the local/etc/ directory.
> and if you change PREFIX to /usr/local/php5 that'll be
> If you change PREFIX to /newphp, that'll be
> As you can see, changing PREFIX allows php4&5 to coexist, but some extra
> directory hierarchy is introduced.
>> So I figured that ultimately both php versions & the destination system
>> is /greatly/ appreciated here :)) Maybe the ultimate solution would be
>> to simply go the
>> $PREFIX/php && $PREFIX/php5 route. Thereby dropping (isolating) both
>> versions into their own trees. But if I understand any of this correctly,
>> I'll need to modify the system' environment to include these directories:
>> ($PREFIX/php/bin $PREFIX/php/lib $PREFIX/php/include &&
>> $PREFIX/php5/bin $PREFIX/php5/lib $PREFIX/php5/include)
>> Does this make any sense?
> Just a quick flashback to possible solutions:
> Solution 1: change PREFIX
> Solution 2: hack port to use */php5 dirs instead of */php
> Other than changing all paths in the port's Makefile and pkg-plist,
> you'll need to hack configure to use different directories.
> What you need is to look into php's configure.in, all paths you'll
> need should be there. Since the port has USE_AUTOTOOLS=autoconf:262,
> configure will be generated from configure.in when you build the
> port automatically. There may be many caveats and other places to change
> paths, or there may not be.
Huge insight, thank you!
OK. Looks like this will be the path I'll need to pursue to accomplish
my ultimate goal - eg;
# for PHP4
# for PHP5
/usr/local/etc/php5.conf (probably better)
My understanding thus far for the php.conf file seems to indicate that
in the Makefile to:
will create and use /usr/local/etc/php5/php.conf
which may be fine, but I'm going to look closer at the source(s) to
see if using /usr/local/etc/php5.conf will be a better choice or not.
> Yes, you'll need to `modify the system environment' to include paths to
> both php versions.
> This is where the problems start.
Also understood. But my initial findings don't seem to indicate this
will pose a big problem - with possible/probable exception(s) being
adding ports depending on different php versions. But I figure if I
use/install php4 as the "base version" and install any modules/extensions
/before/ installing the php5 cgi and any additional php5 modules/extensions,
it should go pretty smoothly (fingers crossed) ;)
> Both php4 and php5 install equally named files, so if you need an app to
> use php5, you'll have to change PATH to include /usr/local/bin/php5/ or
> NEW_PHP_PREFIX/bin/php (depending on which way you chose); if an app
> needs php's includes, you'll also need to add /usr/loca/include/php5/ or
> NEW_PHP_PREFIX/include/php; same for lib/ and likely etc/. I believe
> that'd be hell. Even more problems if you intend to install something
> from ports which depend on php.
Also understood (see just above).
> Thus, if you really need both versions, I'd just install the version you
> need for more apps as default, and another version with changed PREFIX,
> period. No port hacking, just change path to php in some marginal apps.
Maybe when I've managed all of this successfully and also reverse this
in the same way (php5 as base and php4 as additional), I can introduce
a PHPSWITCH knob that will bring up a configure dialog that allows for
a choice for the chosen base, and additional php version choices. :)
I've whipped up a box especially for all this hackery with a 7.0-RELEASE
install. So I'm pretty committed to a /working/ version of all this. :)
Dmitry, I can't thank you enough for all the time you continue to
extend me on all of this! Thank you, thank you, thank you. :)
> Dmitry Marakasov . 55B5 0596 FF1E 8D84 5F56 9510 D35A 80DD F9D2 F77D
> amdmi3 at amdmi3.ru ..: jabber: amdmi3 at jabber.ru http://www.amdmi3.ru
More information about the freebsd-ports