Alien-PNG

 view release on metacpan or  search on metacpan

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

    elsif ($f =~ /^(lib)?(tiff|jpeg|png)[^a-zA-Z]/) {
      $shlib_map{$2} = $full unless $shlib_map{$2};
    }
  };
  $cfg->{ld_paths} = [ keys %tmp ];
  $cfg->{ld_shlib_map} = \%shlib_map;

  # write config
  $self->config_data('additional_cflags', '-I' . $self->get_path('@PrEfIx@/include') . ' ' .
                                          $self->get_additional_cflags);
  $self->config_data('additional_libs', $self->get_additional_libs);
  $self->config_data('config', $cfg);
}

sub can_build_binaries_from_sources {
  # this needs to be overriden in My::Builder::<platform>
  my $self = shift;
  return 0; # no
}

sub build_binaries {
  # this needs to be overriden in My::Builder::<platform>
  my ($self, $build_out, $build_src) = @_;
  die "###ERROR### My::Builder cannot build PNG from sources, use rather My::Builder::<platform>";
}

sub get_additional_cflags {
  # this needs to be overriden in My::Builder::<platform>
  my $self = shift;
  return '';
}

sub get_additional_libs {
  # this needs to be overriden in My::Builder::<platform>
  my $self = shift;
  return '';
}

sub get_path {
  # this needs to be overriden in My::Builder::<platform>
  my ( $self, $path ) = @_;
  return $path;
}

sub clean_dir {
  my( $self, $dir ) = @_;
  if (-d $dir) {
    remove_tree($dir);
    make_path($dir);
  }
}

sub check_build_done_marker {
  my $self = shift;
  return (-e 'build_done');
}

sub touch_build_done_marker {
  my $self = shift;
  require ExtUtils::Command;
  local @ARGV = ('build_done');
  ExtUtils::Command::touch();
  $self->add_to_cleanup('build_done');
}

sub clean_build_done_marker {
  my $self = shift;
  unlink 'build_done' if (-e 'build_done');
}

sub check_sha1sum {
  my( $self, $file, $sha1sum ) = @_;
  my $sha1 = Digest::SHA->new;
  my $fh;
  open($fh, $file) or die "###ERROR## Cannot check checksum for '$file'\n";
  binmode($fh);
  $sha1->addfile($fh);
  close($fh);
  return ($sha1->hexdigest eq $sha1sum) ? 1 : 0
}

sub patch_command {
  my( $self, $base_dir, $patch_file ) = @_;
  
  print("patch_command: $base_dir, $patch_file\n");
  
  my $devnull = File::Spec->devnull();
  my $patch_rv = system("patch -v > $devnull 2>&1");
  if ($patch_rv == 0) {
    $patch_file = File::Spec->abs2rel( $patch_file, $base_dir );
    # the patches are expected with UNIX newlines
    # the following command works on both UNIX+Windows
	return qq("$^X" -pe0 -- "$patch_file" | patch -p1); # paths of files to patch should be relative to build_src
  }
  warn "###WARN### patch not available";
  return '';
}

sub patch_get_affected_files {
  my( $self, $base_dir, $patch_file ) = @_;
  $patch_file = File::Spec->abs2rel( $patch_file, $base_dir );
  open(DAT, $patch_file) or die "###ERROR### Cannot open file: '$patch_file'\n";
  my @affected_files = map{$_ =~ /^---\s*([\S]+)/} <DAT>;
  close(DAT);
  return @affected_files;
}

1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.349 second using v1.00-cache-2.02-grep-82fe00e-cpan-9e6bc14194b6 )