You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2011/01/20 03:29:56 UTC

[lucy-commits] svn commit: r1061102 - in /incubator/lucy/trunk: clownfish/Build.PL perl/buildlib/Lucy/Build.pm

Author: marvin
Date: Thu Jan 20 02:29:56 2011
New Revision: 1061102

URL: http://svn.apache.org/viewvc?rev=1061102&view=rev
Log:
Add a Build.PL for building Clownfish, and use the built files in
clownfish/blib rather than the raw files in clownfish/lib when building Lucy.
This is a prerequisite for adding C and XS code to the Clownfish compiler.

Added:
    incubator/lucy/trunk/clownfish/Build.PL
Modified:
    incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm

Added: incubator/lucy/trunk/clownfish/Build.PL
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/Build.PL?rev=1061102&view=auto
==============================================================================
--- incubator/lucy/trunk/clownfish/Build.PL (added)
+++ incubator/lucy/trunk/clownfish/Build.PL Thu Jan 20 02:29:56 2011
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+use 5.008003;
+use strict;
+use warnings;
+use Module::Build;
+
+my $builder = Module::Build->new(
+    module_name => 'Clownfish',
+    license     => 'apache',
+    dist_author =>
+        'The Apache Lucy Project <lucy-dev at incubator dot apache dot org>',
+    dist_version   => '0.001',
+    requires       => { 'Parse::RecDescent' => 0, },
+    build_requires => {
+        'ExtUtils::CBuilder' => 0.18,
+        'ExtUtils::ParseXS'  => 2.16,
+        'Devel::PPPort'      => 3.13,
+    },
+    add_to_cleanup => [
+        qw(
+            MANIFEST.bak
+            perltidy.ERR
+            *.pdb
+            *.manifest
+            ),
+    ],
+);
+
+$builder->create_build_script();
+

Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=1061102&r1=1061101&r2=1061102&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build.pm Thu Jan 20 02:29:56 2011
@@ -16,8 +16,10 @@
 use strict;
 use warnings;
 
-use lib '../clownfish/lib';
-use lib 'clownfish/lib';
+use lib '../clownfish/blib/arch';
+use lib '../clownfish/blib/lib';
+use lib 'clownfish/blib/arch';
+use lib 'clownfish/blib/lib';
 
 package Lucy::Build::CBuilder;
 BEGIN { our @ISA = "ExtUtils::CBuilder"; }
@@ -71,6 +73,7 @@ use Config;
 use Env qw( @PATH );
 use Fcntl;
 use Carp;
+use Cwd qw( getcwd );
 
 BEGIN { unshift @PATH, curdir() }
 
@@ -141,6 +144,7 @@ my $SNOWSTEM_SRC_DIR     = catdir( $base
 my $SNOWSTEM_INC_DIR     = catdir( $SNOWSTEM_SRC_DIR, 'include' );
 my $SNOWSTOP_SRC_DIR     = catdir( $base_dir, qw( modules analysis snowstop source ) );
 my $CORE_SOURCE_DIR      = catdir( $base_dir, 'core' );
+my $CLOWNFISH_DIR        = catdir( $base_dir, 'clownfish' );
 my $AUTOGEN_DIR          = 'autogen';
 my $XS_SOURCE_DIR        = 'xs';
 my $LIB_DIR              = 'lib';
@@ -283,10 +287,24 @@ sub _write_pod {
     }
 }
 
+sub ACTION_build_clownfish {
+    my $self    = shift;
+    my $old_dir = getcwd();
+    chdir($CLOWNFISH_DIR);
+    if ( !-f 'Build' ) {
+        print "\nBuilding Clownfish compiler... \n";
+        system("$^X Build.PL");
+        system("$^X Build code");
+        print "\nFinished building Clownfish compiler.\n\n";
+    }
+    chdir($old_dir);
+}
+
 sub ACTION_clownfish {
     my $self = shift;
 
     $self->dispatch('charmony');
+    $self->dispatch('build_clownfish');
 
     # Create destination dir, copy xs helper files.
     if ( !-d $AUTOGEN_DIR ) {