Skip to content

Commit

Permalink
Packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Kegler authored and Jeffrey Kegler committed Feb 17, 2012
1 parent 9710551 commit 79769c1
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 16 deletions.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -24,8 +24,9 @@ full_test: etc_make
(cd r2/etc && make) 2>&1 | tee full_test.out

install:
(cd r2 && perl etc/copy_from_stage)
(cd r2 && perl Build.PL)
(cd r2 && ./Build code --from-stage)
(cd r2 && ./Build code)

fullinstall: install
-mkdir r2/libmarpa/test/dev/m4
Expand Down
47 changes: 47 additions & 0 deletions r2/etc/copy_from_stage
@@ -0,0 +1,47 @@
# Copyright 2012 Jeffrey Kegler
# This file is part of Marpa::R2. Marpa::R2 is free software: you can
# redistribute it and/or modify it under the terms of the GNU Lesser
# General Public License as published by the Free Software Foundation,
# either version 3 of the License, or (at your option) any later version.
#
# Marpa::R2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser
# General Public License along with Marpa::R2. If not, see
# http://www.gnu.org/licenses/.

use 5.010;
use strict;
use warnings;

use ExtUtils::Manifest;
use File::Copy;
use Cwd;
use Fatal qw(open close chdir chmod utime);
use English qw( -no_match_vars );

# Assumes CPAN directory is cwd
my $manifest_hash = ExtUtils::Manifest::maniread();
my @build_dir = qw(libmarpa build);
my $build_dir = File::Spec->catdir(@build_dir);
my $build_m4_dir = File::Spec->catdir(@build_dir, 'm4');
my @stage_dir = qw(libmarpa stage);
my $stage_dir = File::Spec->catdir(@stage_dir);
-d $build_dir or mkdir $build_dir;
-d $build_m4_dir or mkdir $build_m4_dir;

BUILD_FILE: for my $build_file ( keys %{$manifest_hash} ) {

# names in MANIFEST are always UNIX-style
my $stage_relative = $build_file;
next BUILD_FILE if not $stage_relative =~ s{ \A libmarpa / build / }{}xms;
my @stage_relative = split m{/}xms, $stage_relative;
my $from_file = File::Spec->catfile( @stage_dir, @stage_relative );
my $to_file = File::Spec->catfile( @build_dir, @stage_relative );
File::Copy::copy( $from_file, $to_file )
or die "Cannot copy '$from_file' to '$to_file': $!";

} ## end for my $build_file ( keys %{$manifest_hash} )
15 changes: 0 additions & 15 deletions r2/inc/Marpa/R2/Build_Me.pm
Expand Up @@ -258,23 +258,8 @@ sub do_libmarpa {
my $cwd = $self->cwd();
my $base_dir = $self->base_dir();

# read MANIFEST before chdir
my $manifest_hash = ExtUtils::Manifest::maniread();
my $build_dir = File::Spec->catdir( $base_dir, qw(libmarpa build) );
my $stage_dir = File::Spec->catdir( $base_dir, qw(libmarpa stage) );
-d $build_dir or mkdir $build_dir;
if ( defined $self->args('from-stage') ) {
chdir $stage_dir;
BUILD_FILE: for my $build_file ( keys %{$manifest_hash} ) {

# names in MANIFEST are always UNIX-style
$build_file =~ s{ \A libmarpa / build / }{}xms or next BUILD_FILE;
my $localized_file =
File::Spec->catfile( split m{/}xms, $build_file );
$self->copy_if_modified( $localized_file, $build_dir );
} ## end for my $build_file ( keys %{$manifest_hash} )
} ## end if ( defined $self->args('from-stage') )
chdir $cwd;
chdir $build_dir;

my $configure_script = 'configure';
Expand Down

0 comments on commit 79769c1

Please sign in to comment.