8 use ExtUtils::MakeMaker 5.16 ;
11 $WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
12 my $USE_PPPORT_H = ($ENV{PERL_CORE}) ? '' : '-DUSE_PPPORT_H';
15 my $BUILD_BZIP2 = defined($ENV{BUILD_BZIP2}) ? $ENV{BUILD_BZIP2} : 1;
16 my $BZIP2_LIB = defined($ENV{BZIP2_LIB}) ? $ENV{BZIP2_LIB} : 'bzip2-src';
17 my $BZIP2_INCLUDE = defined($ENV{BZIP2_INCLUDE}) ? $ENV{BZIP2_INCLUDE} : '.';
21 UpDowngrade(getPerlFiles('MANIFEST'))
22 unless $ENV{PERL_CORE};
25 NAME => 'Compress::Raw::Bzip2',
26 VERSION_FROM => 'lib/Compress/Raw/Bzip2.pm',
27 INC => "-I$BZIP2_INCLUDE" ,
28 DEFINE => "$WALL -DBZ_NO_STDIO $USE_PPPORT_H" ,
29 XS => { 'Bzip2.xs' => 'Bzip2.c'},
30 'clean' => { FILES => '*.c bzip2.h bzlib.h bzlib_private.h constants.h constants.xs' },
31 #'depend' => { 'Makefile' => 'config.in' },
32 'dist' => { COMPRESS => 'gzip',
35 DIST_DEFAULT => 'MyTrebleCheck tardist',
40 ? bzip2_files($BZIP2_LIB)
41 : (LIBS => [ "-L$BZIP2_LIB -lbz2 " ])
46 ? (ABSTRACT_FROM => 'lib/Compress/Raw/Bzip2.pm',
47 AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
51 INSTALLDIRS => ($] > 5.010 && $] < 5.011 ? 'perl' : 'site'),
55 directory => [ 't', 'private' ],
59 ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
60 ('LICENSE' => 'perl') : ()),
85 if (eval {require ExtUtils::Constant; 1}) {
86 # Check the constants above all appear in @EXPORT in Bzip2.pm
87 my %names = map { $_, 1} @names ; #, 'BZ_VERSION';
88 open F, "<lib/Compress/Raw/Bzip2.pm" or die "Cannot open Bzip2.pm: $!\n";
91 last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
98 delete $names{$1} if defined $1 ;
104 my $missing = join ("\n\t", sort keys %names) ;
105 die "The following names are missing from \@EXPORT in Bzip2.pm\n" .
109 #push @names, {name => 'BZ_VERSION', type => 'PV' };
111 ExtUtils::Constant::WriteConstants(
114 C_FILE => 'constants.h',
115 XS_FILE => 'constants.xs',
120 foreach my $name (qw( constants.h constants.xs ))
122 my $from = catfile('fallback', $name);
124 or die "Can't copy $from to $name: $!";
143 my @h_files = qw( bzlib.h bzlib_private.h );
145 foreach my $file (@c_files, @h_files)
146 { copy(catfile($dir, $file), '.') }
149 @h_files = map { catfile($dir, $_) } @h_files ;
150 my @o_files = map { "$_\$(OBJ_EXT)" } 'Bzip2', @c_files;
151 push @c_files, 'Bzip2.c' ;
154 #'H' => [ @h_files ],
155 'C' => [ @c_files ] ,
156 #'OBJECT' => qq[ @o_files ],
157 'OBJECT' => q[ $(O_FILES) ],