-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathMakefile.PL
148 lines (133 loc) · 5.16 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
use ExtUtils::MakeMaker;
use strict;
use Getopt::Std;
use Config;
my $opt = {};
getopts( 'nd', $opt );
unless( $] >= 5.005_03 ) {
die qq[Archive::Tar requires perl version 5.005_03 or higher to run\n];
}
if( !eval { require IO::Compress::Bzip2; 1 } and !$opt->{n} ) {
warn qq[You do not have IO::Compress::Bzip2 installed. This means you can ].
qq[not read or write bzip2 compressed archives!\n] .
qq[Note: you can disable this warning (and the prerequisite) ].
qq[by invoking Makefile.PL with '-n'\n];
}
if( !$opt->{d} and not eval { require Text::Diff; 1 } ) {
print qq[\nArchive::Tar comes with a utility called 'ptardiff' which ].
qq[lets you run diffs against tar archives.\n\nHowever, this ].
qq[utility requires you to have Text::Diff installed.\n\n].
qq[To add Text::Diff as a prerequisite, please supply the ].
qq['-d' option when invoking this Makefile.PL.\n\n];
}
my $prereqs = {
'Test::More' => 0,
'File::Spec' => 0.82,
'Test::Harness' => 2.26, # bug in older versions
'IO::Zlib' => 1.01,
# All these should be the same version, or breakage may occurr. See:
# http://www.nntp.perl.org/group/perl.cpan.testers/2008/08/msg2083310.html
# Requires at least 2.015, to address: #43609: Memory problem with A::T.
# Turns out 2.012 was leaking memory.
'IO::Compress::Base' => 2.015, # base class
'Compress::Zlib' => 2.015, # zlib
'IO::Compress::Gzip' => 2.015, # c::z needs this
'IO::Compress::Bzip2' => 2.015, # bzip2 support
};
unless ($Config{useperlio}) {
$prereqs->{'IO::String'} = 0; # for better 'return stringified archive'
}
### ok, you didn't want IO::Zlib ###
delete $prereqs->{'IO::Compress::Bzip2'} if $opt->{n};
### so you want text::diff ###
$prereqs->{'Text::Diff'} = 0 if $opt->{d};
WriteMakefile1(
LICENSE => 'perl',
MIN_PERL_VERSION => '5.00503',
META_MERGE => {
"meta-spec" => { version => 2 },
resources => {
repository => {
type => 'git',
url => 'https://github.com/jib/archive-tar-new.git',
web => 'https://github.com/jib/archive-tar-new',
},
},
prereqs => {
runtime => {
recommends => {
'IO::Compress::Xz' => 0,
'IO::Uncompress::UnXz' => 0,
},
},
},
},
#BUILD_REQUIRES => {
#},
NAME => 'Archive::Tar',
VERSION_FROM => 'lib/Archive/Tar.pm', # finds $VERSION
dist => { COMPRESS => 'gzip -9f', SUFFIX => 'gz' },
#EXE_FILES => ['bin/ptar', 'bin/ptardiff'],
EXE_FILES => [ _scripts() ],
PREREQ_PM => $prereqs,
INSTALLDIRS => ( $] >= 5.009003 && $] < 5.012 ? 'perl' : 'site' ),
AUTHOR => 'Jos Boumans <kane[at]cpan.org>',
ABSTRACT => 'Manipulates TAR archives',
);
sub _scripts {
my @scripts = glob('bin/*');
if ( $] >= 5.009003 ) {
require Config;
my $version = sprintf("%vd",$^V);
if ( $Config::Config{versiononly} and
$Config::Config{startperl} =~ /\Q$version\E$/ ) {
require File::Copy;
File::Copy::copy( $_, "$_$version" ) for @scripts;
@scripts = glob("bin/*$version");
}
if ( $] >= 5.012 && $Config::Config{installscript} ne $Config::Config{installsitescript} ) {
my $script = $Config::Config{installscript};
my $site = $Config::Config{installsitescript};
warn <<"WARNING";
###############################################################
##
## Hi! Your script and sitescript locations are different
##
## As your perl is v5.12.0 or greater the script included
## in this distribution will be installed into sitescript
##
## You might want to check that the following location is
## in your PATH environment variable:
##
## '$site'
##
## Many thanks.
##
###############################################################
WARNING
sleep 10;
}
}
return @scripts;
}
sub WriteMakefile1 { #Written by Alexandr Ciornii, version 0.21. Added by eumm-upgrade.
my %params=@_;
my $eumm_version=$ExtUtils::MakeMaker::VERSION;
$eumm_version=eval $eumm_version;
die "EXTRA_META is deprecated" if exists $params{EXTRA_META};
die "License not specified" if not exists $params{LICENSE};
if ($params{BUILD_REQUIRES} and $eumm_version < 6.5503) {
#EUMM 6.5502 has problems with BUILD_REQUIRES
$params{PREREQ_PM}={ %{$params{PREREQ_PM} || {}} , %{$params{BUILD_REQUIRES}} };
delete $params{BUILD_REQUIRES};
}
delete $params{CONFIGURE_REQUIRES} if $eumm_version < 6.52;
delete $params{MIN_PERL_VERSION} if $eumm_version < 6.48;
delete $params{META_MERGE} if $eumm_version < 6.46;
delete $params{META_ADD} if $eumm_version < 6.46;
delete $params{LICENSE} if $eumm_version < 6.31;
delete $params{AUTHOR} if $] < 5.005;
delete $params{ABSTRACT_FROM} if $] < 5.005;
delete $params{BINARY_LOCATION} if $] < 5.005;
WriteMakefile(%params);
}