forked from gitpan/Tk-TableMatrix
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile.PL
209 lines (175 loc) · 4.4 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
use 5.00404;
use Cwd;
use Config;
no lib '.';
BEGIN
{
warn("### Note: 'Building Outside of Tk itself' Messages are Expected Here ####\n");
$IsWin32 = ($^O eq 'MSWin32' || $Config{'ccflags'} =~ /-D_?WIN32_?/);
$VERSION = '1.29';
$win_arch = shift @ARGV if @ARGV and $ARGV[0] =~ /^(open32|pm|x|MSWin32)$/;
require('fix_4_os2.pl'), OS2_massage() if $^O eq 'os2';
$win_arch = ($IsWin32) ? 'MSWin32' : 'x'
if not defined $win_arch; # Currently 'x', 'pm', 'open32', 'MSWin32'
require "./myConfig";
# use lib ($Tk::MMutil::dir=getcwd);
}
use Tk::MMutil;
# Get existing tk version for figuring
$tkversion = eval 'use Tk; $Tk::VERSION;';
#print "################tkversion = $tkversion\n";
my $mydefine ='';
if( $tkversion < 804.000 ){
# Tk 800 and below need the old-style XSTkCommand call
# in TableMatrix.xs
$mydefine .= " -DTK800XSTK";
}
if ($IsWin32)
{
*MY::makeaperl = \&makeWin32perl;
if ($Config{cc} =~ /^gcc/i)
{
@libs = ('');
}
}
else
{
my $plibs = $Config{'libs'};
my $libs = "$xlib -lX11"; # Used to have -lpt in here as well.
my @try = qw(-lsocket -lnsl -lm);
push(@try,'-lc') if $^O eq 'svr4';
my $lib;
# perl needs sockets and math library too
# so only include these if they made it through perl's Configure
foreach $lib (@try)
{
$libs .= " $lib" if ($plibs =~ /$lib\b/);
}
@libs = ("$libs");
}
my $dir = Tk::MMutil::find_subdir();
delete $dir->{'pTk'};
# Find path to existing pTk include files
my $ptkPath = Tk::MMutil::findINC('Tk/pTk/Lang.h');
$ptkPath =~ s/\/Lang\.h$//g;
Tk::MMutil::TkExtMakefile(
'VERSION' => $VERSION,
'XS_VERSION' => $VERSION,
'EXE_FILES' => [],
'NAME' => 'Tk::TableMatrix',
'DIR' => ['pTk',reverse(sort(keys %$dir))],
'DISTNAME' => "Tk-TableMatrix",
'DEFINE' => $mydefine,
'MYEXTLIB' => 'pTk/libpTk$(LIB_EXT)' . ($win_arch =~ /^(open32|pm)$/
? ' pTk/dllInit$(LIB_EXT)'
: ''),
'INC' => "-I$ptkPath",
'LIBS' => \@libs,
'OBJECT' => '$(O_FILES)',
'clean' => { FILES => 'pTk/tkConfig.h ' },
'PREREQ_PM' => {
Tk => 800.022,
},
'CONFIGURE_REQUIRES' => {
"ExtUtils::MakeMaker" => 6.52,
"Tk::MMutil" => 0,
},
'META_MERGE' => {
"meta-spec" => { version => 2 },
resources => {
repository => {
type => 'git',
url => 'https://github.com/asb-capfan/Tk-TableMatrix.git',
web => 'https://github.com/asb-capfan/Tk-TableMatrix',
},
bugtracker => {
web => 'https://github.com/asb-capfan/Tk-TableMatrix/issues',
},
},
},
@macro
);
sub MY::top_targets
{
my ($self) = @_;
my $str = $self->MM::top_targets;
$str =~ s/\bmanifypods\b/html/g;
return $str;
}
sub MY::post_initialize
{
my ($self) = @_;
my ($ret) = '';
my %files = ();
my $dir = $self->catdir('$(INST_ARCHLIBDIR)','Tk');
my $name;
foreach $name (grep /(%|\.q4|\.bck|\.old)$/,keys %{$self->{PM}})
{
delete $self->{PM}->{$name};
}
# delete $self->{PM}->{'Tk/Config.pm'};
# $self->{PM}->{'Tk/Config.pm'} = $self->catfile($dir,'Config.pm');
# $files{'typemap'} = 1;
foreach $name ($self->lsdir("."))
{
next if ($name =~ /^\./);
next unless (-f $name);
$files{$name} = 1 if ($name =~ /\.[tm]$/);
$files{$name} = 1 if ($name =~ /\.def$/);
}
foreach $name (sort(@{$self->{H}},keys %files))
{
$self->{PM}->{$name} = $self->catfile($dir,$name);
}
$ret;
}
sub needs_Test
{
my $file = shift;
local $_;
unless (open(TFILE,"$file"))
{
warn "Cannot open $file:$!";
return 1;
}
my $code = 0;
while (<TFILE>)
{
last if ($code = m/^\s*(use|require)\s+Test\b/);
}
close(TFILE);
warn "Skipping test $file needs 'Test.pm':$_" if $code;
return $code;
}
sub MY::test
{
my ($self,%attrib) = @_;
my @tests = sort glob($self->catfile('t','*.t'));
eval { require Test };
if ($@)
{
@tests = grep(!needs_Test($_),@tests);
}
$attrib{'TESTS'} = join(' ',@tests);
# Temporarily remove sub-dirs from $self as we 'know'
# there are no tests down there
my $dir = delete $self->{'DIR'};
my $str = $self->MM::test(%attrib);
# Put sub-dirs back
$self->{'DIR'} = $dir;
return $str;
}
sub MY::postamble {
'
html : subdirs manifypods
@cd pod && $(MAKE) html $(PASTHRU)
Makefile : myConfig
$(MYEXTLIB) : config FORCE
cd pTk && $(MAKE)
perlmain.c : config Makefile
pTk/tk.res : $(MYEXTLIB)
basic : $(INST_DYNAMIC) pm_to_blib
MANIFEST : MANIFEST.SKIP $(FIRST_MAKEFILE)
$(MAKE) manifest
';
}