Alien-libtermkey

 view release on metacpan or  search on metacpan

inc/Alien/make/Module/Build.pm  view on Meta::CPAN

   # When 'cpan> test Foo' is testing an entire tree of dependent modules, it
   # never installs them, instead adding each of them to the PERL5LIB in turn
   # so later ones can find them. We needed the path to be "correct" at that
   # point so that dependent modules can at least find something to link and
   # test against.

   my $buildlibdir = File::Spec->catdir( $self->base_dir, "blib", "arch" );
   my $instlibdir  = $self->install_destination( "arch" );

   my $pkgconfig_module = $self->pkgconfig_module;

   my $pcfile = "$instlibdir/pkgconfig/$pkgconfig_module.pc";
   if( -f $pcfile ) {
      print "Relocating $pcfile";

      open my $in, "<", $pcfile or die "Cannot open $pcfile for reading - $!";
      open my $out, ">", "$pcfile.new" or die "Cannot open $pcfile.new for writing - $!";

      print { $out } join "\n",
         "# pkg-config paths rewritten by Alien::make::Module::Build",
         "# buildlibdir=$buildlibdir",
         "# instlibdir=$instlibdir",
         "";

      while( <$in> ) {
         s{\Q$buildlibdir\E}{$instlibdir}g;
         print { $out } $_;
      }

      # Cygwin/Windows doesn't like it when you delete open files
      close $in;
      close $out;

      unlink $pcfile;
      rename "$pcfile.new", $pcfile;
   }
}

sub ACTION_clean
{
   my $self = shift;

   if( $self->notes( 'use_bundled' ) ) {
      $self->apply_extra_pkgconfig_paths;

      if( -d $self->_srcdir ) {
         $self->make_in_srcdir( "clean" );
      }

      unlink( $self->_stampfile( "build" ) );
   }

   $self->SUPER::ACTION_clean;
}

sub ACTION_realclean
{
   my $self = shift;

   if( -d $self->_srcdir ) {
      system( "rm", "-rf", $self->_srcdir ); # best effort; ignore failure
   }

   $self->SUPER::ACTION_realclean;
}

0x55AA;



( run in 1.237 second using v1.01-cache-2.11-cpan-02777c243ea )