Alien-Tidyp

 view release on metacpan or  search on metacpan

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

}


sub ACTION_code {
  my $self = shift;

  unless (-e 'build_done') {
    $self->add_to_cleanup('build_done');
    my $inst = $self->notes('installed_tidyp');
    if (defined $inst) {
      $self->config_data('config', { LIBS   => $inst->{lflags},
                                     INC    => $inst->{cflags},
                                   });
    }
    else {
      # important directories
      my $download = 'download';
      my $patches = 'patches';
      my $build_src = 'build_src';
      # we are deriving the subdir name from VERSION as we want to prevent
      # troubles when user reinstalls the newer version of Alien::Tidyp
      my $build_out = catfile('sharedir', $self->{properties}->{dist_version});

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


  my $tdir = $ENV{TIDYP_DIR} || '';
  my @candidates;
  push(@candidates, { L => "$tdir/lib", I => "$tdir/include/tidyp" }) if -d $tdir;
  push(@candidates, { L => '/usr/local/lib', I => '/usr/local/include/tidyp' });
  push(@candidates, { L => '/usr/lib', I => '/usr/include/tidyp' });
  push(@candidates, { L => '', I => "$Config{usrinc}/tidyp" });

  print STDERR "Gonna detect tidyp already installed on your system:\n";
  foreach my $i (@candidates) {
    my $lflags = $i->{L} ? '-L'.$self->quote_literal($i->{L}).' -ltidyp' : '-ltidyp';
    my $cflags = $i->{I} ? '-I'.$self->quote_literal($i->{I}) : '';
    print STDERR "- testing: $cflags $lflags ...\n";
    $lflags = ExtUtils::Liblist->ext($lflags) if($Config{make} =~ /nmake/ && $Config{cc} =~ /cl/); # MSVC compiler hack
    my ($obj, $exe);
    open(my $olderr, '>&', STDERR);
    open(STDERR, '>', File::Spec->devnull());
    $obj = eval { $cb->compile( source => $src, extra_compiler_flags => $cflags ) };
    $exe = eval { $cb->link_executable( objects => $obj, extra_linker_flags => $lflags ) } if $obj;
    open(STDERR, '>&', $olderr);
    next unless $exe;
    print STDERR "- TIDYP FOUND!\n";
    $self->notes('installed_tidyp', { lflags => $lflags, cflags => $cflags } );
    return 1;
  }
  print STDERR "- tidyp not found (we have to build it from sources)!\n";
  return 0;
}

1;

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


  chdir $srcdir;

  # do './configure ...'
  my $run_configure = 'y';
  $run_configure = $self->prompt("Run ./configure again? (y/n)", "n") if (-f "config.status");
  if (lc($run_configure) eq 'y') {
    my @cmd = ( './configure', '--enable-shared=no', '--disable-dependency-tracking', "--prefix=$prefixdir");
    if ($^O eq 'darwin') {
      #this is fix for https://rt.cpan.org/Ticket/Display.html?id=66382
      push @cmd, "CFLAGS=$Config{ccflags} -fPIC";
      push @cmd, "LDFLAGS=$Config{ldflags}";
    }
    else {
      #FIXME maybe use %Config values for all UNIX systems (not now, maybe in the future)
      push @cmd, 'CFLAGS=-fPIC';
    }    
    #On solaris, some tools like 'ar' are not in the default PATH, but in /usr/???/bin
    #see failure http://www.cpantesters.org/cpan/report/138b45f2-4b6f-11e0-afaf-8138785ebe45
    if ($^O eq 'solaris' && system('arx -V') < 0) {    
      for (qw[/usr/ccs/bin /usr/xpg4/bin /usr/sfw/bin /usr/xpg6/bin /usr/gnu/bin /opt/gnu/bin /usr/bin]) {
        if (-x "$_/ar") {

t/20-compile.t  view on Meta::CPAN

#include <tidyp.h>
int main() { tidyVersion(); return 0; }

MARKER
close($fs);

my $i = Alien::Tidyp->config('INC');
my $l = Alien::Tidyp->config('LIBS');
$l = ExtUtils::Liblist->ext($l) if($Config{make} =~ /nmake/ && $Config{cc} =~ /cl/); # MSVC compiler hack

my $obj = $cb->compile( source => $src, extra_compiler_flags => $i );
isnt( $obj, undef, 'Testing compilation' );

my $exe = $cb->link_executable( objects => $obj, extra_linker_flags => $l );
isnt( $exe, undef, 'Testing linking' );



( run in 1.076 second using v1.01-cache-2.11-cpan-94b05bcf43c )