You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2012/04/09 15:43:51 UTC

[lucy-commits] svn commit: r1311234 - /lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm

Author: nwellnhof
Date: Mon Apr  9 13:43:51 2012
New Revision: 1311234

URL: http://svn.apache.org/viewvc?rev=1311234&view=rev
Log:
LUCY-215 Document Clownfish::CFC::Perl::Build

Modified:
    lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm

Modified: lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm
URL: http://svn.apache.org/viewvc/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm?rev=1311234&r1=1311233&r2=1311234&view=diff
==============================================================================
--- lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm (original)
+++ lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm Mon Apr  9 13:43:51 2012
@@ -463,3 +463,97 @@ sub ACTION_code {
 1;
 
 __END__
+
+=head1 NAME
+
+Clownfish::CFC::Perl::Build - Build Clownfish modules
+
+=head1 DESCRIPTION
+
+Clownfish::CFC::Perl::Build is a subclass of L<Module::Build> which builds
+the Perl bindings for Clownfish modules.
+
+=head1 SYNOPSIS
+
+    use Clownfish::CFC::Perl::Build;
+
+    my @cf_sys_includes = Clownfish::CFC::Perl::Build->cf_system_include_dirs;
+    my $other_lib = Clownfish::CFC::Perl::Build->cf_system_library_file(
+        'Other::Module',
+    );
+
+    my $builder = Clownfish::CFC::Perl::Build->new(
+        module_name        => 'My::Module',
+        dist_abstract      => 'Do something with this and that',
+        dist_author        => 'The Author <au...@example.com>',
+        dist_version       => '0.1.0',
+        include_dirs       => [ @cf_sys_includes ],
+        extra_linker_flags => $other_lib,
+        clownfish_params => {
+            include => [ @cf_sys_includes ],
+        },
+        requires => {
+            'Other::Module' => '0.3.0',
+        },
+        configure_requires => {
+            'Clownfish::CFC::Perl::Build' => 0.01,
+        },
+        build_requires => {
+            'Clownfish::CFC::Perl::Build' => 0.01,
+        },
+    );
+
+    $builder->create_build_script();
+
+=head1 CONSTRUCTOR
+
+=head2 my $builder = Clownfish::CFC::Perl::Build->new(%args);
+
+Creates a new Clownfish::CFC::Perl::Build object. %args can contain all
+arguments that can be passed to L<Module::Build/new>. It accepts an additional
+argument 'clownfish_params', which is a hashref with the following params:
+
+=head3 source
+
+An arrayref of source directories containing the .cfh and .c files of the
+module. Defaults to [ 'core' ] or to [ '../core' ] if 'core' can't
+be found.
+
+=head3 include
+
+An arrayref of include directories containing .cfh files from other Clownfish
+modules needed by the module. Empty by default. Should contain the Clownfish
+system include directories if needed.
+
+=head3 autogen_header
+
+A string that will be prepended to the files generated by the Clownfish
+compiler.
+
+=head1 METHODS
+
+=head2 my @dirs = Clownfish::CFC::Perl::Build->cf_system_include_dirs();
+
+Returns a list of Clownfish include directories of system-wide installations
+of Clownfish modules.
+
+=head2 my $path = Clownfish::CFC::Perl::Build->cf_system_library_file($module_name);
+
+Returns the path to the C library of system-wide installed Clownfish module
+named $module_name. Should be added to extra_linker_flags for all module
+dependencies.
+
+=head2 my $value = $builder->clownfish_params($key);
+
+=head2 $builder->clownfish_params($key => $value);
+
+Get or set a Clownfish build param. Supports all the parameters that can be
+passed to L</new>.
+
+=head1 COPYRIGHT
+
+Clownfish is distributed under the Apache License, Version 2.0, as
+described in the file C<LICENSE> included with the distribution.
+
+=cut
+



Re: [lucy-dev] Re: [lucy-commits] svn commit: r1311234 - /lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm

Posted by Nick Wellnhofer <we...@aevum.de>.
On 10/04/2012 02:01, Marvin Humphrey wrote:
> On Mon, Apr 9, 2012 at 6:43 AM,<nw...@apache.org>  wrote:
>
>> +    my $other_lib = Clownfish::CFC::Perl::Build->cf_system_library_file(
>> +        'Other::Module',
>> +    );
>
>> +        extra_linker_flags =>  $other_lib,
>
> Does just supplying a path to a dll work as an "extra_linker_flag"?

It did work for me on Linux.

>> +=head3 source
>> +
>> +An arrayref of source directories containing the .cfh and .c files of the
>> +module. Defaults to [ 'core' ] or to [ '../core' ] if 'core' can't
>> +be found.
>
> I'm not sure that potential users will be enthusiastic about that default.
> The use case for "core" or "../core" is pretty specific to Lucy.

I think the directory structure with "core", "perl" and "ruby" dirs, and 
the "core" dir copied into "perl" for distributions is also useful for 
extensions. I'd even like to add a method to C::C::P::B that returns the 
base dir of the source tree.

> Would you object if I changed that parameter to have no default, then changed
> either perl/buildlib/Lucy/Build.pm or perl/Build.PL to supply the appropriate
> dir?

I'm OK with setting the default to an empty array. Lucy::Build doesn't 
rely on the default anyway at the moment. It resets the whole "source" 
parameter.

Nick

[lucy-dev] Re: [lucy-commits] svn commit: r1311234 - /lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Perl/Build.pm

Posted by Marvin Humphrey <ma...@rectangular.com>.
On Mon, Apr 9, 2012 at 6:43 AM,  <nw...@apache.org> wrote:

> +    my $other_lib = Clownfish::CFC::Perl::Build->cf_system_library_file(
> +        'Other::Module',
> +    );

> +        extra_linker_flags => $other_lib,

Does just supplying a path to a dll work as an "extra_linker_flag"?

> +=head3 source
> +
> +An arrayref of source directories containing the .cfh and .c files of the
> +module. Defaults to [ 'core' ] or to [ '../core' ] if 'core' can't
> +be found.

I'm not sure that potential users will be enthusiastic about that default.
The use case for "core" or "../core" is pretty specific to Lucy.

Would you object if I changed that parameter to have no default, then changed
either perl/buildlib/Lucy/Build.pm or perl/Build.PL to supply the appropriate
dir?

Marvin Humphrey