This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #82854] utf8, $SIG{__DIE__}, syntax errors and Carp
[perl5.git] / cpan / Compress-Raw-Bzip2 / Makefile.PL
CommitLineData
bdb7fd9f
RGS
1#! perl -w
2
3use strict ;
4require 5.004 ;
5
6use private::MakeUtil;
7use ExtUtils::MakeMaker 5.16 ;
8
9my $WALL= '';
10$WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
11my $USE_PPPORT_H = ($ENV{PERL_CORE}) ? '' : '-DUSE_PPPORT_H';
12
13
14my $BUILD_BZIP2 = defined($ENV{BUILD_BZIP2}) ? $ENV{BUILD_BZIP2} : 1;
15my $BZIP2_LIB = defined($ENV{BZIP2_LIB}) ? $ENV{BZIP2_LIB} : 'bzip2-src';
16my $BZIP2_INCLUDE = defined($ENV{BZIP2_INCLUDE}) ? $ENV{BZIP2_INCLUDE} : '.';
17
18#ParseCONFIG() ;
19
20UpDowngrade(getPerlFiles('MANIFEST'))
21 unless $ENV{PERL_CORE};
22
23WriteMakefile(
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',
32 TARFLAGS => '-chvf',
33 SUFFIX => 'gz',
34 DIST_DEFAULT => 'MyTrebleCheck tardist',
35 },
36
37 (
bdb7fd9f
RGS
38 $BUILD_BZIP2
39 ? bzip2_files($BZIP2_LIB)
40 : (LIBS => [ "-L$BZIP2_LIB -lbz2 " ])
41 ),
42
43 (
44 $] >= 5.005
45 ? (ABSTRACT_FROM => 'lib/Compress/Raw/Bzip2.pm',
46 AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
47 : ()
48 ),
49
dc82791d
PM
50 INSTALLDIRS => ($] > 5.010 ? 'perl' : 'site'),
51
bdb7fd9f
RGS
52 ((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
53 ('LICENSE' => 'perl') : ()),
54
55) ;
56
57my @names = qw(
58 BZ_RUN
59 BZ_FLUSH
60 BZ_FINISH
61
62 BZ_OK
63 BZ_RUN_OK
64 BZ_FLUSH_OK
65 BZ_FINISH_OK
66 BZ_STREAM_END
67 BZ_SEQUENCE_ERROR
68 BZ_PARAM_ERROR
69 BZ_MEM_ERROR
70 BZ_DATA_ERROR
71 BZ_DATA_ERROR_MAGIC
72 BZ_IO_ERROR
73 BZ_UNEXPECTED_EOF
74 BZ_OUTBUFF_FULL
75 BZ_CONFIG_ERROR
76 );
77
78if (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";
82 while (<F>)
83 {
84 last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
85 }
86
87 while (<F>)
88 {
89 last if /^\s*\)/ ;
90 /(\S+)/ ;
91 delete $names{$1} if defined $1 ;
92 }
93 close F ;
94
95 if ( keys %names )
96 {
97 my $missing = join ("\n\t", sort keys %names) ;
98 die "The following names are missing from \@EXPORT in Bzip2.pm\n" .
99 "\t$missing\n" ;
100 }
101
102 #push @names, {name => 'BZ_VERSION', type => 'PV' };
103
104 ExtUtils::Constant::WriteConstants(
105 NAME => 'Bzip2',
106 NAMES => \@names,
107 C_FILE => 'constants.h',
108 XS_FILE => 'constants.xs',
109
110 );
111}
112else {
113 foreach my $name (qw( constants.h constants.xs ))
114 {
115 my $from = catfile('fallback', $name);
116 copy ($from, $name)
117 or die "Can't copy $from to $name: $!";
118 }
119}
120
121
122sub bzip2_files
123{
124 my $dir = shift ;
125
126 my @c_files = qw(
127 blocksort.c
128 huffman.c
129 crctable.c
130 randtable.c
131 compress.c
132 decompress.c
133 bzlib.c
134 );
135
136 my @h_files = qw( bzlib.h bzlib_private.h );
137
138 foreach my $file (@c_files, @h_files)
139 { copy(catfile($dir, $file), '.') }
140
141
142 @h_files = map { catfile($dir, $_) } @h_files ;
143 my @o_files = map { "$_\$(OBJ_EXT)" } 'Bzip2', @c_files;
144 push @c_files, 'Bzip2.c' ;
145
146 return (
147 #'H' => [ @h_files ],
148 'C' => [ @c_files ] ,
149 #'OBJECT' => qq[ @o_files ],
150 'OBJECT' => q[ $(O_FILES) ],
151
152
153 ) ;
154}
155
156
157