7 use ExtUtils::MakeMaker 5.16 ;
10 $WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
11 my $USE_PPPORT_H = ($ENV{PERL_CORE}) ? '' : '-DUSE_PPPORT_H';
14 my $BUILD_BZIP2 = defined($ENV{BUILD_BZIP2}) ? $ENV{BUILD_BZIP2} : 1;
15 my $BZIP2_LIB = defined($ENV{BZIP2_LIB}) ? $ENV{BZIP2_LIB} : 'bzip2-src';
16 my $BZIP2_INCLUDE = defined($ENV{BZIP2_INCLUDE}) ? $ENV{BZIP2_INCLUDE} : '.';
20 UpDowngrade(getPerlFiles('MANIFEST'))
21 unless $ENV{PERL_CORE};
24 NAME => 'Compress::Raw::Bzip2',
25 VERSION_FROM => 'lib/Compress/Raw/Bzip2.pm',
26 INC => "-I$BZIP2_INCLUDE" ,
27 DEFINE => "$WALL -DBZ_NO_STDIO $USE_PPPORT_H" ,
28 XS => { 'Bzip2.xs' => 'Bzip2.c'},
29 'clean' => { FILES => '*.c bzip2.h bzlib.h bzlib_private.h constants.h constants.xs' },
30 #'depend' => { 'Makefile' => 'config.in' },
31 'dist' => { COMPRESS => 'gzip',
34 DIST_DEFAULT => 'MyTrebleCheck tardist',
39 ? bzip2_files($BZIP2_LIB)
40 : (LIBS => [ "-L$BZIP2_LIB -lbz2 " ])
45 ? (ABSTRACT_FROM => 'lib/Compress/Raw/Bzip2.pm',
46 AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
50 INSTALLDIRS => ($] > 5.010 ? 'perl' : 'site'),
52 ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
53 ('LICENSE' => 'perl') : ()),
78 if (eval {require ExtUtils::Constant; 1}) {
79 # Check the constants above all appear in @EXPORT in Bzip2.pm
80 my %names = map { $_, 1} @names ; #, 'BZ_VERSION';
81 open F, "<lib/Compress/Raw/Bzip2.pm" or die "Cannot open Bzip2.pm: $!\n";
84 last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
91 delete $names{$1} if defined $1 ;
97 my $missing = join ("\n\t", sort keys %names) ;
98 die "The following names are missing from \@EXPORT in Bzip2.pm\n" .
102 #push @names, {name => 'BZ_VERSION', type => 'PV' };
104 ExtUtils::Constant::WriteConstants(
107 C_FILE => 'constants.h',
108 XS_FILE => 'constants.xs',
113 foreach my $name (qw( constants.h constants.xs ))
115 my $from = catfile('fallback', $name);
117 or die "Can't copy $from to $name: $!";
136 my @h_files = qw( bzlib.h bzlib_private.h );
138 foreach my $file (@c_files, @h_files)
139 { copy(catfile($dir, $file), '.') }
142 @h_files = map { catfile($dir, $_) } @h_files ;
143 my @o_files = map { "$_\$(OBJ_EXT)" } 'Bzip2', @c_files;
144 push @c_files, 'Bzip2.c' ;
147 #'H' => [ @h_files ],
148 'C' => [ @c_files ] ,
149 #'OBJECT' => qq[ @o_files ],
150 'OBJECT' => q[ $(O_FILES) ],