lucy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marvin Humphrey <>
Subject Re: [lucy-dev] Header file installation
Date Tue, 28 Feb 2012 02:29:41 GMT
On Sat, Feb 25, 2012 at 11:29:47AM +0100, Nick Wellnhofer wrote:
> On 24/02/2012 21:54, Marvin Humphrey wrote:
>> We can provide similar functionality from  Here's how a build script
>> for a distro which extends Lucy might use it:
>>    eval "use Lucy;";
>>    if ($@) {
>>      warn "Can't load Lucy;
>>      exit(0);
>>    }
>>    my $include_dirs = Lucy->include_dirs;
>>    my $inc = "";
>>    $inc .= "-I$_ " for @$include_dirs;
>> At first, I imagine include_dirs() returning only a single directory.
>> However, in the future we may break out Clownfish, and perhaps include_dirs()
>> should return the include paths for recursive dependencies:
>>    package Lucy;
>>    use Clownfish;
>>    sub include_dirs {
>>      my $dirs = Clownfish->include_dirs;
>>      push @$dirs, _lucy_include_dir();
>>      return $dirs;
>>    }
> +1

I thought of a refinement we might consider.

It seems to me that having one include dir per distro is asking for trouble.
What happens when LucyX packages extend each other?  At best, we will start to
see very long compilation commands because of all the -I directives; at worst
we will lose track of an include dir and be in for some annoying debugging.

Better would be one dedicated include dir per *host language* which will house
headers for all Clownfish-related distros -- something analogous to
/usr/local/include, but one for /usr/local/bin/perl, one for /opt/myruby/,
etc.  So long as each header file must be named after a class it contains, we
shouldn't see distros clobbering each others' files.

>> For the actual header tree, how about a dedicated directory at the following
>> location?
>>      catdir( $ARCH_DIR, 'auto', 'Lucy', '_include' );
> Here are some other modules that I found that install header files:
> They don't put the .h files below 'auto' which makes sense, because  
> afaics 'auto' should only contain files used by AutoLoader.

Interesting.  After reviewing the Perl module load path mechanism, I concur --
we should follow your suggestion and not DBI's example.

> I like the idea of an '_include' directory, so I would propose:
> 	catdir( $ARCH_DIR, 'Lucy', '_include' );

+1 for dropping 'auto'.  Here's what I'd now suggest:

 catdir( $ARCH_DIR, 'Clownfish', '_include' )

Let's also consider what we mean by $ARCH_DIR.  Ordinarily it will be this:

  $ perl -V:installsitearch

The theoretical possibility exists that in the future it might be this:

  $ perl -V:installvendorarch

For more information, see the following:

The dir would actually be derived within Lucy::Build like so (note: $self is a
Lucy::Build object):

    my $arch_dir = $self->install_destination('arch');
    my $include_dir = catdir( $arch_dir, 'Clownfish', '_include' );

Marvin Humphrey

View raw message