On 21/01/2014 10:13, Nathan Kurz wrote:
On Mon, Jan 20, 2014 at 12:09 PM, Nick Wellnhofer <[email protected]> wrote:
Now that we’re about to build Clownfish and Lucy separately, we have to find a 
way to point Lucy to the Clownfish .cfh files. I can see the following options:

Does the Lucy build process really need to know where they are, or can
the CFC executable just have that knowledge internally?   I suppose it
would be useful in odd cases to tell CFC to use alternate base
headers, but this seems like a fairly rare issue.

Clownfish can be installed in different directories so we can't hardcode the exact location of the .cfh files. Maybe we could install a config file together with Clownfish which contains the location of the .cfh files. But then the question is how to find the config file. For UNIX systems, I think it should be enough to hardcode some locations in /usr and /usr/local.

I'd also like to find a solution which works for more complex dependency chains, for example a Lucy extension which has to find the Lucy and Clownfish headers.

 From the point of view of the interface to CFC, a well-known location
plus a command-line override seems sufficient.  I suppose CFC could
allow an environment variable to override the compiled default
location in the absence of a command line arg, but feels like
overkill.   Is there a frequent case where the command line wouldn't
be adequate?

For development, I'd like to make it easy to include .cfh files from an external source tree which hasn't been installed yet. I think an environment variable would be ideal for this use case. I'd like to have a shell script like devel/bin/setup_clownfish_env.sh in the Lucy source tree which can be called like this:

    devel/bin/setup_clownfish_env.sh /path/to/cfish/source

This script would add the Clownfish compiler/c directory to PATH, the Clownfish runtime/c directory to LIBRARY_PATH (and LD_LIBRARY_PATH on ELF systems), and the Clownfish core directory to CLOWNFISH_INCLUDE. Then you can hack on Lucy pretty much like before without having to care about the location of the Clownfish source tree.

But for my own version of overkill, you might consider adding a
"well-known name" within the current working directory or the
executable's directory at the head of the list of places that CFC
searches.  It's often nice for new users to be able to test things
from a single directory before they are required to install them.

This would make sense for the .cfh files of the current project which we call "source directories". For example, we could always search "core" and "../core". But I can't think of a relative path that would make sense for "include directories".

Nick

Reply via email to