Ok so I have progressed the layout control further but now I 
have a conceptual problem I need help with.

In principle, the layout is a set of directories specified
as absolute path names (and perhaps some data files as well).

That's the fine grained specification of a layout.

However no one wants to specify all those files.

So there are some high level control variables like

        FLX_INSTALL_DIR

you can use instead. If you set that variable it sets

        FLX_SHARE_DIR = FLX_INSTALL_DIR/ "share"

and then something like:

        FLX_LIB_DIR = FLX_SHARE_DIR/"lib"

etc. In other words, there is a cascade of settings. You can then
override one of the lower levels variables, but the ORDER matters:
if you set FLX_LIB_DIR then FLX_INSTALL_DIR the latter would cascade
down and clobber the former.

Now the problem starts. Initially, FLX_INSTALL_DIR is defaulted
to /usr/local/lib/felix/felix-latest and the cascade is done, however
there are TWO ways at least to change this:

1. with an environment variable FLX_INSTALL_DIR
2. with an entry in a control file (HOME/.felix/config/felix.fpc)

At present, the environment variable is applied in the first cascade:

        FLX_INSTALL_DIR = getenv ("FLX_INSTALL_DIR", "/usr/local ...);

and then the control file is read.

I hope that's OK. However now things get tricky!

By default the target subdirectory of FLX_INSTALL_DIR is "host".
But suppose you want to use a different target.
So in your control file you can say:

        FLX_TARGET_DIR: /home/skaller/mytarget

OK, so now the problem is, when you use a different target,
you probably want to use a different cache. So when you compile
for two different targets the cache doesn't get rebuilt all the time.

So, we can look for

        FLX_TARGET_DIR/"config"/"felix.fpc"

and process that. So now, we've switched the config dir from

        HOME/.felix/config

to 

        TARGET/config

in effect. Things are looking a bit recursive now .. :)

It gets worse. This is just the global config processing.
"flx" will do this first, BEFORE applying command line switches.

So the command line switches act like another control file.
In particular

        flx --test=dir

current sets FLX_INSTALL_DIR and the cascade.

The problem is .. now the environment variables are irrelevant
because they're ALREADY been processed and overwritten,
not by setting a core layout directory, but by setting a cascade
variable.

that means, for example, that an attempt set the CACHE to somewhere
other than the default may fail if --test= cascades over it.
normally it won't, because the cache related to HOME and not the
installation point .. but a particular target CAN specify a target specific
cache .. if it does, environment variable will not override it
(because the env variable is applied before we even know the target).

the point is: the rules are so complicated I can't figure out how to do
it so it makes sense and leaves one in control .. other than demanding
each core variable be set and not allowing any default cascades.

that would be untenable on the command line of "flx": there are a LOT
of these variables to specify (about 15 I guess at the moment).


--
john skaller
skal...@users.sourceforge.net
http://felix-lang.org




------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to