Alien-SDL

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

  # avoid using 'share' name as M::B doe not handle well paths like /xx/yy/share/zz/ww/share/xx
);

my $choice;
my %have_libs = ();
my %perl_libs = ();

if (defined $sdl_config) {
  # handle --with-sdl-config (without params)
  $sdl_config = 'sdl-config' if $sdl_config eq '';
  # Don't prompt; just use specified location:
  $choice = check_config_script($sdl_config)
      or warn "###ERROR### Unable to use config script $sdl_config\n";
}
else {
  $| = 1;

  if( $My::Utility::cc eq 'cl' && $^O eq 'MSWin32' ) {
    print "checking INCLUDE and LIB... ";
    if( !$ENV{INCLUDE} || !$ENV{LIB} ) {
      my @set = `\@vcvars32 & set`;

Build.PL  view on Meta::CPAN

        }
      }
      push @candidates, $rv if scalar( @{ $rv->{members} } );
    }
  };

  push @candidates, { title => 'Quit installation', buildtype => '' };

  #### ask user what way to go
  my $i                     = 1;
  my $prompt_string         = "\nYou have the following options:\n";
  my $recommended_candidate = 1;
  foreach my $c (@candidates) {
    $recommended_candidate = $i if $c->{buildtype} eq 'build_from_sources';

    if( $c->{buildtype} eq 'use_config_script' ) {
      $c->{title} .= "\n    ";
      for(qw(SDL SDL_image SDL_mixer SDL_ttf SDL_gfx SDL_Pango)) {
        $c->{title} .= "$_(v$have_libs{$_}->[0]) " if $have_libs{$_}[0];
      }
    }

    $prompt_string .= "[" . $i++ . "] " . $c->{title} . "\n";
  }

  # select option '1' for travis
  if ( defined $travis and $travis == 1 ) {
    $ans = 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];
  }

  $| = 0;
} # end else search and prompt for build method

#### store build params into 'notes'
if($choice) {
  print "Using \l$choice->{title}\n";
  $build->notes('build_params', $choice);
  $build->notes('env_include', $ENV{INCLUDE}) if $ENV{INCLUDE};
  $build->notes('env_lib',     $ENV{LIB})     if $ENV{LIB};
  $build->notes('have_libs',   \%have_libs);
  $build->notes('perl_libs',   \%perl_libs);
  $build->create_build_script();

README  view on Meta::CPAN


    * When given `--with-sdl-config' option use specified sdl-config script
    to locate SDL libs.
         perl Build.PL --with-sdl-config=/opt/sdl/bin/sdl-config

        or using default script name 'sdl-config' by running:

         perl Build.PL --with-sdl-config

        IMPORTANT NOTE: Using --with-sdl-config avoids considering any other
        build methods; no prompt with other available build options.

    * Locate an already installed SDL via 'sdl-config' script.
    * Check for SDL libs in directory specified by SDL_INST_DIR variable. In
    this case the module performs SDL library detection via
    '$SDL_INST_DIR/bin/sdl-config' script.
         SDL_INST_DIR=/opt/sdl perl ./Build.PL

    * Download prebuilt SDL binaries (if available for your platform).
    * Build SDL binaries from source codes (if possible on your system).

README.md  view on Meta::CPAN


    * When given `--with-sdl-config' option use specified sdl-config script
    to locate SDL libs.
         perl Build.PL --with-sdl-config=/opt/sdl/bin/sdl-config

        or using default script name 'sdl-config' by running:

         perl Build.PL --with-sdl-config

        IMPORTANT NOTE: Using --with-sdl-config avoids considering any other
        build methods; no prompt with other available build options.

    * Locate an already installed SDL via 'sdl-config' script.
    * Check for SDL libs in directory specified by SDL_INST_DIR variable. In
    this case the module performs SDL library detection via
    '$SDL_INST_DIR/bin/sdl-config' script.
         SDL_INST_DIR=/opt/sdl perl ./Build.PL

    * Download prebuilt SDL binaries (if available for your platform).
    * Build SDL binaries from source codes (if possible on your system).

inc/My/Builder.pm  view on Meta::CPAN

    cp( catfile('patches', 'SDL_config_win32.h'), catfile($incdir, 'SDL', 'SDL_config.h') );
  }
}

sub extract_sources {
  my ($self, $download, $patches, $build_src) = @_;
  my $bp = $self->notes('build_params');
  foreach my $pack (@{$bp->{members}}) {
    my $srcdir = catfile($build_src, $pack->{dirname});
    my $unpack = 'y';
    $unpack = $self->prompt("Dir '$srcdir' exists, wanna replace with clean sources?", "y") if (-d $srcdir);
    if (lc($unpack) eq 'y') {
      my $archive = catfile($download, File::Fetch->new(uri => @{$pack->{url}}[0])->file);
      print "Extracting $pack->{pack}...\n";
      my $ae = Archive::Extract->new( archive => $archive );
      die "###ERROR###: cannot extract $pack ", $ae->error unless $ae->extract(to => $build_src);
      foreach my $i (@{$pack->{patches}}) {
        chdir $srcdir;
        my $patch_file = File::Spec->abs2rel( catfile($patches, $i), $srcdir );
        print "Applying patch '$i'\n";
        foreach my $k ($self->patch_get_affected_files($patch_file)) {

inc/My/Builder/Unix.pm  view on Meta::CPAN

        # otherwise we get "false cru build/libSDLmain.a build/SDL_dummy_main.o"
        # see http://fixunix.com/ntp/245613-false-cru-libs-libopts-libopts_la-libopts-o.html#post661558
        for (qw[/usr/ccs/bin /usr/xpg4/bin /usr/sfw/bin /usr/xpg6/bin /usr/gnu/bin /opt/gnu/bin /usr/bin]) {
          $extra_PATH .= ":$_" if -d $_;
        }
      }
      $ENV{PATH} = "$prefixdir/bin:$ENV{PATH}$extra_PATH";

      # do './configure ...'
      my $run_configure = 'y';
      $run_configure    = $self->prompt("Run ./configure for '$pack->{pack}' again?", "y") if (-f "config.status");
      if (lc($run_configure) eq 'y') {
        my $cmd = $self->_get_configure_cmd($pack->{pack}, $prefixdir);
        print "Configuring package '$pack->{pack}'...\n";
        print "(cmd: $cmd)\n";
        unless($self->do_system($cmd)) {
          if(-f "config.log" && open(CONFIGLOG, "<config.log")) {
            print "config.log:\n";
            print while <CONFIGLOG>;
            close(CONFIGLOG);
          }

lib/Alien/SDL.pm  view on Meta::CPAN

=item * When given C<--with-sdl-config> option use specified sdl-config
script to locate SDL libs.

 perl Build.PL --with-sdl-config=/opt/sdl/bin/sdl-config

or using default script name 'sdl-config' by running:

 perl Build.PL --with-sdl-config

B<IMPORTANT NOTE:> Using --with-sdl-config avoids considering any other
build methods; no prompt with other available build options.

=item * Locate an already installed SDL via 'sdl-config' script.

=item * Check for SDL libs in directory specified by SDL_INST_DIR variable.
In this case the module performs SDL library detection via
'$SDL_INST_DIR/bin/sdl-config' script.

 SDL_INST_DIR=/opt/sdl perl ./Build.PL

=item * Download prebuilt SDL binaries (if available for your platform).



( run in 1.189 second using v1.01-cache-2.11-cpan-0b5f733616e )