Compress-Bzip2

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

#! perl -w

use strict;
use 5.008001;

use ExtUtils::MakeMaker;
use Config ;
use File::Copy ;

BEGIN {
  eval { require File::Spec::Functions ; File::Spec::Functions->import( catfile rel2abs ) } ;
  *catfile = sub { return join( '/', @_ ) } if $@;
}

require VMS::Filespec if $^O eq 'VMS';

my $BZLIB_BIN ;
my $BZLIB_LIB ;
my $BZLIB_INCLUDE ;
my $BUILD_BZLIB = 0; # override with env BUILD_BZLIB=1

ParseCONFIG() ;

my %Bzip2 = ( pm => catfile( qw( lib Compress Bzip2.pm ) ),
	      lib => catfile( 'bzlib-src', 'libbz2'.$Config{_a} ) );

my $dlflags = $Config{ccdlflags}; # RT 105096
if ($Config{ld} ne $Config{cc} and $Config{ld} =~ m{^(.*/)?\w*ld\w*$}) {
  my @flags;
  for (split m/\s+/ => $dlflags) {
    s/^-Wl,(-+[-\w]+),/$1 / or s/^-Wl,//;
    push @flags, $_;
  }
  $dlflags = join " " => @flags;
}

# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.
WriteMakefile(
  NAME              => 'Compress::Bzip2',
  VERSION_FROM      => $Bzip2{pm},
  PREREQ_PM         => {
    'constant'   => 1.04, # for constant => {}
    'Test::More' => 0,
    'File::Spec' => 0,
    'File::Copy' => 0,
    'Config'     => 0,
    'Carp'       => 0,
    'Getopt::Std'=> 0,
    'Fcntl'      => 0,
  },
  XS	 	=> { 'Bzip2.xs'    => 'Bzip2.c' },
  ($] >= 5.005 ?
   (ABSTRACT_FROM  => $Bzip2{pm},
    AUTHOR         => 'Rob Janes <arjay@cpan.org>') : ()),
  LIBS             => $BUILD_BZLIB ? [] : [ $BZLIB_LIB ? "-L$BZLIB_LIB -lbz2" : '-lbz2' ],
  # ccdlflags needed for -R [cpan #68572, #105096]
  LDDLFLAGS         => $Config{lddlflags} . " " . $dlflags,
  INC               => $BUILD_BZLIB ? '-Ibzlib-src' : $BZLIB_INCLUDE ? "-I$BZLIB_INCLUDE" : '',
  clean             => {
    FILES=>
      join(' ',
	   map { catfile( split( /\//, $_ ) ) }
	   qw( const-c.inc const-xs.inc junk* bztest show_bzversion t/???-tmp-* ))
  },
  depend            => { 'Makefile'	  => 'config.in' },
  NORECURS          => $BUILD_BZLIB ? 0 : 1,
  ($BUILD_BZLIB ? ( MYEXTLIB       => $Bzip2{lib} ) : ()),
  ($ExtUtils::MakeMaker::VERSION gt '6.46' ?
   ('LICENSE'     => 'perl',
    'META_MERGE'  =>
    {"recommends" =>
     {
       'Compress::Zlib'       => '1.19',
       'IO::Compress::Bzip2'  => '2.094',
       'Compress::Raw::Bzip2' => '2.094',
     },
     resources =>
     {
       license     => 'http://dev.perl.org/licenses/',
       repository  => 'https://github.com/rurban/Compress-Bzip2',
     },
    }
   ) : ()),
  SIGN  => 1,
);

if  (eval {require ExtUtils::Constant; 1}) {
  # If you edit these definitions to change the constants used by this module,
  # you will need to use the generated const-c.inc and const-xs.inc



( run in 1.151 second using v1.01-cache-2.11-cpan-483215c6ad5 )