Skip to content

Commit

Permalink
fix Build.PL script to take --travis arg
Browse files Browse the repository at this point in the history
  • Loading branch information
KohaAloha committed Aug 13, 2013
1 parent c83314a commit 44d6d13
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 14 deletions.
7 changes: 5 additions & 2 deletions .travis.yml
Expand Up @@ -8,6 +8,9 @@ perl:

before_install:
# install tiff
- sudo updatedb
- sudo locate zlib > /tmp/aa
- sudo cat /tmp/aa
- sudo apt-get install automake
# - wget ftp://ftp.remotesensing.org/pub/libtiff/tiff-4.0.3.tar.gz
# - tar xvfz tiff-4.0.3.tar.gz
Expand All @@ -23,12 +26,12 @@ before_install:
- dpkg -l

install:
- perl ./Build.PL --default
- perl ./Build.PL --travis
- ./Build
- sudo ./Build install
# - ./Build install

script:
script:
- prove -v
- prove

Expand Down
24 changes: 16 additions & 8 deletions Build.PL
Expand Up @@ -6,12 +6,9 @@ use File::Spec::Functions qw(catdir catfile);
use Config;
use My::Utility qw(check_config_script check_prebuilt_binaries check_prereqs_libs check_prereqs_tools $source_packs);



use Getopt::Long;
my $ans = '';
GetOptions ( "default" => \$ans) ;

my ($ans, $travis) = '';
GetOptions ( "travis" => \$travis) ;

print "Welcome to Alien::SDL2 module installation\n";
print "------------------------------------------\n";
Expand Down Expand Up @@ -193,11 +190,22 @@ else {

$prompt_string .= "[" . $i++ . "] " . $c->{title} . "\n";
}
$prompt_string .= "\nWhat way do you wanna go?";
$ans = $build->prompt($prompt_string, $recommended_candidate) unless $ans;

# select option '1' for travis
if ($travis == 1) {
$ans = 1;
#set 'travis' var for inc/My/Builder.pm
$build->notes( 'travis', '1' );
}

# or prompt user for build option
else {
$prompt_string .= "\nWhat way do you wanna go?";
$ans = $build->prompt( $prompt_string, $recommended_candidate );
}

if($ans > 0 && $ans < scalar(@candidates)) {
$choice = $candidates[$ans - 1];
$choice = $candidates[$ans - 1];
}

$| = 0;
Expand Down
1 change: 1 addition & 0 deletions cpan-deps
Expand Up @@ -13,6 +13,7 @@ File::ShareDir
File::Spec
File::Spec::Functions
File::Which
File::Temp
Getopt::Long
Module::Build
Test::More
Expand Down
17 changes: 13 additions & 4 deletions inc/My/Builder.pm
Expand Up @@ -40,7 +40,6 @@ sub ACTION_build {
$self->SUPER::ACTION_build;
}


sub ACTION_install
{
my $self = shift;
Expand Down Expand Up @@ -106,9 +105,19 @@ sub ACTION_code {
$self->set_config_data($build_out);
$self->set_ld_config($build_out);
}
elsif($bp->{buildtype} eq 'build_from_sources' ) {
# my $m = $self->prompt("\nDo you want to see all messages during configure/make (y/n)?", 'n');
my $m = 1;
elsif ( $bp->{buildtype} eq 'build_from_sources' ) {

my $m = undef;
if ( $self->notes('travis') == 1 ) {
$m = 1;
}
else {
$m = $self->prompt(
"\nDo you want to see all messages during configure/make (y/n)?",
'n'
);
}

$self->notes('build_msgs', lc($m) eq 'y' ? 1 : 0);
# all the following functions die on error, no need to test ret values
$self->fetch_sources($download);
Expand Down

0 comments on commit 44d6d13

Please sign in to comment.