You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucy.apache.org by "Nick Wellnhofer (JIRA)" <ji...@apache.org> on 2012/11/02 20:13:12 UTC

[lucy-issues] [jira] [Created] (LUCY-247) Make CFC use Charmonizer

Nick Wellnhofer created LUCY-247:
------------------------------------

             Summary: Make CFC use Charmonizer
                 Key: LUCY-247
                 URL: https://issues.apache.org/jira/browse/LUCY-247
             Project: Lucy
          Issue Type: Task
          Components: Clownfish
            Reporter: Nick Wellnhofer
            Assignee: Nick Wellnhofer


CFC should use Charmonizer to make the build platform-independent.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[lucy-issues] [jira] [Commented] (LUCY-247) Make CFC use Charmonizer

Posted by "Nick Wellnhofer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13489764#comment-13489764 ] 

Nick Wellnhofer commented on LUCY-247:
--------------------------------------

Created branch cfc_charmony:

https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=log;h=refs/heads/cfc_charmony
                
> Make CFC use Charmonizer
> ------------------------
>
>                 Key: LUCY-247
>                 URL: https://issues.apache.org/jira/browse/LUCY-247
>             Project: Lucy
>          Issue Type: Task
>          Components: Clownfish
>            Reporter: Nick Wellnhofer
>            Assignee: Nick Wellnhofer
>
> CFC should use Charmonizer to make the build platform-independent.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[lucy-issues] [jira] [Resolved] (LUCY-247) Make CFC use Charmonizer

Posted by "Nick Wellnhofer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCY-247?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nick Wellnhofer resolved LUCY-247.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 0.4.0

Merged branch cfc_charmony
                
> Make CFC use Charmonizer
> ------------------------
>
>                 Key: LUCY-247
>                 URL: https://issues.apache.org/jira/browse/LUCY-247
>             Project: Lucy
>          Issue Type: Task
>          Components: Clownfish
>            Reporter: Nick Wellnhofer
>            Assignee: Nick Wellnhofer
>             Fix For: 0.4.0
>
>
> CFC should use Charmonizer to make the build platform-independent.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[lucy-issues] [jira] [Commented] (LUCY-247) Make CFC use Charmonizer

Posted by "Marvin Humphrey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490112#comment-13490112 ] 

Marvin Humphrey commented on LUCY-247:
--------------------------------------

Having CFC take advantage of Charmonizer will be great -- it will make coding
CFC easier, and it will make CFC build more reliably across diverse
environments.

The patches currently in the cfc_charmony branch are valuable for identifying
and isolating some problems that we need to solve -- however, I think we might
try solving those problems a different way.

One challenge we face in porting Lucy and Clownfish to other dynamic languages
is that our build system is too elaborate and idiosyncratic.  It has not been
as easy as it should be to explain to would-be porters what they need to do.

The first two patches in the cfc_charmony branch consolidate the actions for
building, running and testing Charmonizer into a common Module::Build base
class.  This helps to avoid duplicating code within additional Perl projects
that might use Charmonizer -- particularly in-house ones like CFC.  However,
the code now in Clownfish::CFC::Perl::Build::Charmonic must still be ported to
other languages -- and users must still expend effort to learn the interface
and use it.

To simplify the build across **all** bindings instead, the actions which
build, run and test Charmonizer must be streamlined or eliminated rather than
consolidated.

The patch from chaz_namespacing identified as conflicting with the
cfc_charmony branch sets out on a path towards such simplification.  In it,
the two build targets "build_charmonize" and "run_charmonize" are replaced by
a single build target, "charmony".  Ultimately, it would be great if we could
shrink the "charmony" action down to this:

{noformat}
sub ACTION_charmony {
    my $self = shift;
    if ( !$self->up_to_date( $CHARMONIZER_C, $CHARMONIZER_EXE_PATH ) ) {
        my $cc = $self->config('cc');
        my $outflag = $cc =~ /cl\b/ ? "/Fe" : "-o ";
        system("$cc $CHARMONIZER_C $outflag$CHARMONIZER_EXE_PATH")
            and die "Failed to compile $CHARMONIZER_EXE_PATH";
    }
    if ( !$self->up_to_date( $CHARMONIZER_EXE_PATH, 
        [ $CHARMONY_H_PATH, $CHARMONY_PM_PATH, ] ) ) {
        my @command = (
            $CHARMONIZER_EXE_PATH,
            '--cc=' . _quotify( $self->config('cc') ),
            '--enable-c',
            '--enable-perl',
        );
        system(@command) and die "Failed to run $CHARMONIZER_EXE_PATH: $!";
    }
}
{noformat}

One of the ways the new "charmony" build target achieves simplicity is that it
now compiles a single, amalgamated C file which has been cached in version
control (akin to how many projects cache the "configure" script generated by
Autoconf in version control).  We no longer need to interact with Charmonizer's
makefiles during this phase -- in fact, we don't even need the charmonizer/
directory at all (except for Charmonizer's tests).

To integrate Charmonizer into CFC's build while taking advantage of the new,
simpler regime, we would perform the following steps:

#.  Copy common/charmonizer.main to
    clownfish/compiler/common/charmonizer.main.  It does more than CFC needs --
    because Charmonizer is supposed to be a la carte and I think CFC's only
    requirement is the Integers module for the time being -- but we can pare
    it down later.
#.  Add a few lines to devel/bin/regen_charmonizer.pl to build the amalgamated
    file clownfish/compiler/common/charmonizer.c
#   Cache the new amalgamated file in version control.
#.  Copy the current ACTION_charmony from Lucy::Build into Clownfish::Build
    and adapt it as necessary.

With regards to Charmonizer's tests, I would suggest omitting them from the
CFC build -- as that allows us to avoid dealing with Charmonizer's makefiles
entirely in the context of building CFC.  The tests are still going to get run
in the context of Lucy, so we won't be taken by surprise by unexpected
failures in the short term; in the medium-to-long-term, it might be nice to
build a mechanism analogous to the amalgamation process to make the
Charmonizer tests easier to integrate and run.

As a next step towards simiplifying the build, I think we should consider
using Charmonizer to generate the compiler flags we use when compiling our C
source files (as opposed to the XS binding files, which would continue to use
the compiler flags suggested by Perl).  This will allow us to rip a bunch more
code out of our binding-specific build scripts.  The logical home for this
code is the charmonizer.main file for each sub-project.

(As a matter of fact, I think I will go work on this task next so that I don't
have to duplicate the flag-probing logic in our Python bindings.)

                
> Make CFC use Charmonizer
> ------------------------
>
>                 Key: LUCY-247
>                 URL: https://issues.apache.org/jira/browse/LUCY-247
>             Project: Lucy
>          Issue Type: Task
>          Components: Clownfish
>            Reporter: Nick Wellnhofer
>            Assignee: Nick Wellnhofer
>             Fix For: 0.4.0
>
>
> CFC should use Charmonizer to make the build platform-independent.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

[lucy-issues] [jira] [Commented] (LUCY-247) Make CFC use Charmonizer

Posted by "Nick Wellnhofer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCY-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13490001#comment-13490001 ] 

Nick Wellnhofer commented on LUCY-247:
--------------------------------------

The following commit in chaz_namespacing clashes with the cfc_charmony branch:

https://git-wip-us.apache.org/repos/asf?p=lucy.git;a=commitdiff;h=23a381fb612a3e83b0ac3ea4a6c756b31d07b641

I think it's best to merge chaz_namespacing first and then rework Clownfish::CFC::Perl::Build::Charmonic.

                
> Make CFC use Charmonizer
> ------------------------
>
>                 Key: LUCY-247
>                 URL: https://issues.apache.org/jira/browse/LUCY-247
>             Project: Lucy
>          Issue Type: Task
>          Components: Clownfish
>            Reporter: Nick Wellnhofer
>            Assignee: Nick Wellnhofer
>
> CFC should use Charmonizer to make the build platform-independent.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira