-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile.PL
360 lines (287 loc) · 7.93 KB
/
Makefile.PL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
#! perl -w
use strict ;
require 5.006 ;
use lib '.';
use private::MakeUtil;
use ExtUtils::MakeMaker 5.16 ;
my $WALL= '';
$WALL = ' -Wall -Wno-comment ' if $Config{'cc'} =~ /gcc/ ;
my $LIBLZMA_LIB ;
my $LIBLZMA_INCLUDE ;
my $LIBS = '-llzma';
ParseCONFIG() ;
UpDowngrade(getPerlFiles('MANIFEST'))
unless $ENV{PERL_CORE};
WriteMakefile(
NAME => 'Compress::Raw::Lzma',
VERSION_FROM => 'lib/Compress/Raw/Lzma.pm',
INC => "-I$LIBLZMA_INCLUDE" ,
LIBS => ["-L${LIBLZMA_LIB} $LIBS"],
DEFINE => "$WALL " ,
XS => { 'Lzma.xs' => 'Lzma.c'},
depend => { Makefile => 'config.in',
manifypods => 'READMEmd'
},
postamble => { name => 'Lzma' },
dist => { COMPRESS => 'gzip',
TARFLAGS => '-chvf',
SUFFIX => 'gz',
DIST_DEFAULT => 'MyTrebleCheck tardist',
},
(
$ENV{SKIP_FOR_CORE}
? (MAN3PODS => {})
: ()
),
(
$] >= 5.005
? (ABSTRACT_FROM => 'lib/Compress/Raw/Lzma.pm',
AUTHOR => 'Paul Marquess <pmqs@cpan.org>')
: ()
),
( eval { ExtUtils::MakeMaker->VERSION(6.46) }
? ( META_MERGE => {
"meta-spec" => { version => 2 },
no_index => {
directory => [ 't', 'private' ],
},
resources => {
bugtracker => {
web => 'https://github.com/pmqs/Compress-Raw-Lzma/issues'
},
homepage => 'https://github.com/pmqs/Compress-Raw-Lzma',
repository => {
type => 'git',
url => 'git://github.com/pmqs/Compress-Raw-Lzma.git',
web => 'https://github.com/pmqs/Compress-Raw-Lzma',
},
},
}
)
: ()
),
((ExtUtils::MakeMaker->VERSION() gt '6.55_03')
? ('BUILD_REQUIRES' => {
"ExtUtils::MakeMaker" => 0,
'Pod::Markdown' => 0,
}
)
: ()),
((ExtUtils::MakeMaker->VERSION() gt '6.30') ?
('LICENSE' => 'perl') : ()),
) ;
my @names;
while (<DATA>)
{
chomp;
s/^\s*//;
s/\s*$//;
next if /^[^A-Z]/i || /^$/;
my ($name, $type) = split /\s+/, $_;
if (defined $type && $type =~ /enum/i)
{ push @names, { name => $name, macro => ["#if 1\n", "#endif\n"] } }
elsif (defined $type && $type =~ /string/i)
{ push @names, { name => $name, type => "PV", macro => ["#ifdef $name \n", "#endif\n"] } }
elsif (defined $type && $type =~ /int/i)
{ push @names, { name => $name, type => "IV", macro => ["#if 1\n", "#endif\n"] } }
else
{ push @names, { name => $name } }
}
if (eval {require ExtUtils::Constant; 1}) {
# Check the constants above all appear in @EXPORT in Lzma.pm
my %names = map { $_ => 1 }
map { $_->{name} }
@names ;
open F, "<lib/Compress/Raw/Lzma.pm" or die "Cannot open Lzma.pm: $!\n";
while (<F>)
{
last if /^\s*\@EXPORT\s+=\s+qw\(/ ;
}
while (<F>)
{
last if /^\s*\)/ ;
/(\S+)/ ;
delete $names{$1} if defined $1 ;
}
close F ;
if ( keys %names )
{
my $missing = join ("\n\t", sort keys %names) ;
die "The following names are missing from \@EXPORT in Lzma.pm\n" .
"\t$missing\n" ;
}
ExtUtils::Constant::WriteConstants(
NAME => 'Lzma',
NAMES => \@names,
C_FILE => 'constants.h',
XS_FILE => 'constants.xs',
);
}
else {
foreach my $name (qw( constants.h constants.xs ))
{
my $from = catfile('fallback', $name);
copy ($from, $name)
or die "Can't copy $from to $name: $!";
}
}
sub ParseCONFIG
{
my ($k, $v) ;
my @badkey = () ;
my %Info = () ;
my @Options = qw( INCLUDE LIB ) ;
my %ValidOption = map {$_, 1} @Options ;
my %Parsed = %ValidOption ;
my $CONFIG = 'config.in' ;
print "Parsing $CONFIG...\n" ;
open(F, "<$CONFIG") or die "Cannot open file $CONFIG: $!\n" ;
while (<F>) {
s/^\s*|\s*$//g ;
next if /^\s*$/ or /^\s*#/ ;
s/\s*#\s*$// ;
($k, $v) = split(/\s+=\s+/, $_, 2) ;
$k = uc $k ;
if ($ValidOption{$k}) {
delete $Parsed{$k} ;
$Info{$k} = $v ;
}
else {
push(@badkey, $k) ;
}
}
close F ;
print "Unknown keys in $CONFIG ignored [@badkey]\n"
if @badkey ;
# check parsed values
my @missing = () ;
die "The following keys are missing from $CONFIG [@missing]\n"
if @missing = keys %Parsed ;
$LIBLZMA_INCLUDE = defined $ENV{'LIBLZMA_INCLUDE'}
? $ENV{'LIBLZMA_INCLUDE'}
: $Info{'INCLUDE'} ;
$LIBLZMA_LIB = defined $ENV{'LIBLZMA_LIB'}
? $ENV{'LIBLZMA_LIB'}
: $Info{'LIB'} ;
if ($^O eq 'VMS') {
$LIBLZMA_INCLUDE = VMS::Filespec::vmspath($LIBLZMA_INCLUDE);
$LIBLZMA_LIB = VMS::Filespec::vmspath($LIBLZMA_LIB);
}
print <<EOM if 0 ;
INCLUDE [$LIBLZMA_INCLUDE]
LIB [$LIBLZMA_LIB]
EOM
print "Looks Good.\n" ;
}
__DATA__
# base.h
########
# lzma-ret Return values used by several functions in liblzma
LZMA_OK enum
LZMA_STREAM_END enum
LZMA_NO_CHECK enum
LZMA_UNSUPPORTED_CHECK enum
LZMA_GET_CHECK enum
LZMA_MEM_ERROR enum
LZMA_MEMLIMIT_ERROR enum
LZMA_FORMAT_ERROR enum
LZMA_OPTIONS_ERROR enum
LZMA_DATA_ERROR enum
LZMA_BUF_ERROR enum
LZMA_PROG_ERROR enum
# lzma_action: The `action' argument for lzma_code()
LZMA_RUN enum
LZMA_SYNC_FLUSH enum
LZMA_FULL_FLUSH enum
LZMA_FINISH enum
# bcj.h
#########
LZMA_FILTER_X86
LZMA_FILTER_POWERPC
LZMA_FILTER_IA64
LZMA_FILTER_ARM
LZMA_FILTER_ARMTHUMB
LZMA_FILTER_SPARC
# block.h
#########
LZMA_BLOCK_HEADER_SIZE_MIN
LZMA_BLOCK_HEADER_SIZE_MAX
# check.h
# lzma_check_typ: Type of the Check
LZMA_CHECK_NONE enum
LZMA_CHECK_CRC32 enum
LZMA_CHECK_CRC64 enum
LZMA_CHECK_SHA256 enum
LZMA_CHECK_ID_MAX
LZMA_CHECK_SIZE_MAX
# container.h
#############
LZMA_PRESET_DEFAULT
LZMA_PRESET_LEVEL_MASK
LZMA_PRESET_EXTREME
LZMA_TELL_NO_CHECK
LZMA_TELL_UNSUPPORTED_CHECK
LZMA_TELL_ANY_CHECK
LZMA_CONCATENATED
# delta.h
#########
LZMA_FILTER_DELTA
LZMA_DELTA_DIST_MIN
LZMA_DELTA_DIST_MAX
LZMA_DELTA_TYPE_BYTE enum
# filter.h
##########
LZMA_FILTERS_MAX
# index.h
##########
# Below supported from 5.0.0 onwards
#LZMA_INDEX_ITER_ANY enum
#LZMA_INDEX_ITER_STREAM enum
#LZMA_INDEX_ITER_BLOCK enum
#LZMA_INDEX_ITER_NONEMPTY_BLOCK enum
# index_hash.h
##############
# lzma.h
#########
#LZMA_FILTER_LZMA1
LZMA_FILTER_LZMA2
# lzma_match_finder: Match finders
LZMA_MF_HC3 enum
LZMA_MF_HC4 enum
LZMA_MF_BT2 enum
LZMA_MF_BT3 enum
LZMA_MF_BT4 enum
# lzma_mode: LZMA compression modes
LZMA_MODE_FAST enum
LZMA_MODE_NORMAL enum
LZMA_DICT_SIZE_MIN
LZMA_DICT_SIZE_DEFAULT
LZMA_LCLP_MIN
LZMA_LCLP_MAX
LZMA_LC_DEFAULT
LZMA_LP_DEFAULT
LZMA_PB_MIN
LZMA_PB_MAX
LZMA_PB_DEFAULT
# stream_flags.h
################
LZMA_STREAM_HEADER_SIZE
LZMA_BACKWARD_SIZE_MIN
#LZMA_BACKWARD_SIZE_MAX
# version.h
###########
LZMA_VERSION
LZMA_VERSION_MAJOR
LZMA_VERSION_MINOR
LZMA_VERSION_PATCH
LZMA_VERSION_STABILITY
LZMA_VERSION_STABILITY_STRING string
LZMA_VERSION_STRING string
#lzma_version_number int
#lzma_version_string string
# vli.h
#######
#LZMA_VLI_MAX
#LZMA_VLI_UNKNOWN
#LZMA_VLI_BYTES_MAX
# End of file