line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VIM::Packager::MakeMaker; |
2
|
1
|
|
|
1
|
|
31426
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
3
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
28
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
348
|
use VIM::Packager; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
463
|
use VIM::Packager::MetaReader; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
7
|
1
|
|
|
1
|
|
489
|
use VIM::Packager::Utils qw(vim_rtp_home vim_inst_record_dir findbin); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
8
|
1
|
|
|
1
|
|
1047
|
use DateTime::Format::DateParse; |
|
1
|
|
|
|
|
193606
|
|
|
1
|
|
|
|
|
32
|
|
9
|
1
|
|
|
1
|
|
10
|
use YAML; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
10
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
11
|
1
|
|
|
1
|
|
5
|
use File::Path; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
41
|
|
12
|
1
|
|
|
1
|
|
5
|
use File::Find; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
13
|
1
|
|
|
1
|
|
372
|
use VIM::Packager::Record; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = 0.0.1; |
16
|
|
|
|
|
|
|
my $VERBOSE = 1; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$ vim-packager build |
21
|
|
|
|
|
|
|
$ make -f Makefile.vimp |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# auto install dependency |
24
|
|
|
|
|
|
|
$ make install -f Makefile.vimp |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 Constants |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
LIBPATH: F |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
use constant { |
33
|
1
|
|
|
|
|
4424
|
LIBPATH => 'vimlib', |
34
|
1
|
|
|
1
|
|
5
|
}; |
|
1
|
|
|
|
|
2
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 Makefile Helper Functions |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 multi_line Array:Lines |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 add_macro ArrayRef:Makefile Lines , String: Macro Name , String: Macro |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 new_section ArrayRef:Makefile Lines , String: Section Name , Array: Depended macro names |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 add_st ArrayRef:Makefile Lines , String: Statement , Array: Statement Arguments |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Statement Arguments is for Statement string, which is in sprintf format. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 add_noop_st ArrayRef:Makefile Lines |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub multi_line { |
53
|
0
|
|
|
0
|
1
|
0
|
my @items = @_; |
54
|
0
|
|
|
|
|
0
|
return join " \\\n\t", @items ; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub add_macro { |
58
|
0
|
|
|
0
|
1
|
0
|
my $ref = shift; |
59
|
0
|
|
|
|
|
0
|
my ( $name, $content ) = @_; |
60
|
0
|
|
|
|
|
0
|
push @{ $ref } , qq|$name = $content|; |
|
0
|
|
|
|
|
0
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub new_section { |
64
|
0
|
|
|
0
|
1
|
0
|
my $ref = shift; |
65
|
0
|
|
|
|
|
0
|
my ( $name , @deps ) = @_; |
66
|
0
|
|
|
|
|
0
|
push @{ $ref } , qq|| , qq|$name : | . join( " ", @deps ); |
|
0
|
|
|
|
|
0
|
|
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub add_st { |
70
|
0
|
|
|
0
|
1
|
0
|
my ($ref, $st , @args ) = @_; |
71
|
0
|
|
|
|
|
0
|
push @{ $ref } , qq|\t\t| . sprintf($st , @args); |
|
0
|
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub add_noop_st { |
75
|
0
|
|
|
0
|
1
|
0
|
add_st $_[0] => q|$(NOECHO) $(NOOP)|; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 Main Functions |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 new |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=cut |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub new { |
85
|
0
|
|
|
0
|
1
|
0
|
my $class = shift; |
86
|
0
|
|
|
|
|
0
|
my $cmd = shift; # command object |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
0
|
my $self = bless {}, $class; |
89
|
0
|
|
|
|
|
0
|
my $meta = VIM::Packager::MetaReader->new->read_metafile(); |
90
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
$self->{cmd} = $cmd; |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
|
|
0
|
YAML::DumpFile( "VIMMETA.yml" , $meta ); |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
0
|
$self->meta( $meta ); # save meta object |
96
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
0
|
my $makefile = {}; |
98
|
0
|
|
|
|
|
0
|
$makefile->{meta} = $meta; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
{ |
101
|
0
|
|
|
|
|
0
|
my $info = vim_version_info(); |
|
0
|
|
|
|
|
0
|
|
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
0
|
my $op = $meta->{vim_version}->{op} ; |
104
|
0
|
|
|
|
|
0
|
my $version = $meta->{vim_version}->{version} ; |
105
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
0
|
my $installed_vim_version = $info->{version}; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
0
|
print STDOUT "Found installed VIM, version $installed_vim_version\n"; |
109
|
|
|
|
|
|
|
|
110
|
0
|
0
|
|
|
|
0
|
unless( eval "$installed_vim_version $op $version" ) { |
111
|
0
|
|
|
|
|
0
|
print STDOUT "This distrubution needs a newer vim ( $version )\n"; |
112
|
0
|
|
|
|
|
0
|
die; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
0
|
print STDOUT "VIM::Packager::MakeMaker (v$VERSION)\n" if $VERBOSE; |
117
|
0
|
0
|
0
|
|
|
0
|
if (-f "MANIFEST" && ! -f "Makefile"){ |
118
|
0
|
|
|
|
|
0
|
check_manifest(); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
my $main = [ ]; |
122
|
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
0
|
push @$main, q|.PHONY: all install clean uninstall help upload link|; |
124
|
|
|
|
|
|
|
|
125
|
0
|
|
0
|
|
|
0
|
my $filelist = $self->make_filelist( $meta->{libpath} || LIBPATH ); |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
0
|
$makefile->{filelist} = $filelist; |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
0
|
my @meta_section = $self->meta_section( $meta ); |
130
|
0
|
|
|
|
|
0
|
my @config_section = $self->config_section(); |
131
|
0
|
|
|
|
|
0
|
my @file_section = $self->file_section( $filelist ); |
132
|
|
|
|
|
|
|
|
133
|
0
|
|
|
|
|
0
|
$self->section_all( $main ); |
134
|
0
|
|
|
|
|
0
|
$self->section_install( $main ); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
# main install section |
137
|
0
|
|
|
|
|
0
|
$self->section_pure_install( $main , $makefile ); |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
# dependency section |
140
|
0
|
|
|
|
|
0
|
$self->section_deps( $main ); |
141
|
0
|
|
|
|
|
0
|
$self->section_link( $main , $filelist ); |
142
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
0
|
new_section $main => 'manifest'; |
144
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(ECHO) ".git" > MANIFEST.SKIP|; |
145
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(ECHO) ".svn" >> MANIFEST.SKIP|; |
146
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(ECHO) ".*.tar.gz" >> MANIFEST.SKIP|; |
147
|
0
|
|
|
|
|
0
|
add_st $main => q|$(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Manifest=mkmanifest -e 'mkmanifest'|; |
148
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
0
|
new_section $main => 'dist' , qw(manifest); |
150
|
0
|
|
|
|
|
0
|
add_st $main => q|$(TAR) $(TARFLAGS) $(DISTNAME).tar.gz $(TO_INST_VIMS) $(META_FILE) $(README) `cat MANIFEST`|; |
151
|
0
|
|
|
|
|
0
|
add_noop_st $main; |
152
|
|
|
|
|
|
|
|
153
|
0
|
|
|
|
|
0
|
new_section $main => 'help'; |
154
|
0
|
|
|
|
|
0
|
add_st $main => q|perldoc VIM::Packager|; |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
0
|
new_section $main => 'uninstall'; |
157
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Installer=uninstall | |
158
|
|
|
|
|
|
|
. q| -e 'uninstall()' $(NAME)|; |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
# XXX: prompt user to uninstall depedencies |
161
|
0
|
|
|
|
|
0
|
new_section $main => 'reinstall' , qw(uninstall install); |
162
|
0
|
|
|
|
|
0
|
add_noop_st $main; |
163
|
|
|
|
|
|
|
|
164
|
0
|
|
|
|
|
0
|
new_section $main => 'upload' , qw(dist); |
165
|
0
|
|
|
|
|
0
|
add_st $main => q|$(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Uploader=upload -e 'upload()' | |
166
|
|
|
|
|
|
|
. multi_line qw|$(PWD)/$(DISTNAME).tar.gz $(VIM_VERSION) $(VERSION) $(SCRIPT_ID)|; |
167
|
|
|
|
|
|
|
|
168
|
0
|
|
|
|
|
0
|
new_section $main => 'clean'; |
169
|
0
|
|
|
|
|
0
|
add_st $main => q|$(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD)|; |
170
|
0
|
|
|
|
|
0
|
add_st $main => q|$(RM) *.tar.gz|; |
171
|
|
|
|
|
|
|
|
172
|
0
|
|
|
|
|
0
|
new_section $main => 'bump'; |
173
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Installer=bump_version -e 'bump_version()' |; |
174
|
0
|
|
|
|
|
0
|
add_st $main => q|sh -c 'vim-packager build'|; # rebuild |
175
|
0
|
|
|
|
|
0
|
add_st $main => q|sh -c 'make upload -f Makefile.vimp'|; |
176
|
|
|
|
|
|
|
|
177
|
0
|
|
|
|
|
0
|
new_section $main => 'release' , qw(bump); |
178
|
0
|
|
|
|
|
0
|
add_noop_st $main; |
179
|
|
|
|
|
|
|
|
180
|
0
|
|
|
|
|
0
|
$self->generate_makefile( [ |
181
|
|
|
|
|
|
|
{ meta => \@meta_section }, |
182
|
|
|
|
|
|
|
{ config => \@config_section }, |
183
|
|
|
|
|
|
|
{ file => \@file_section }, |
184
|
|
|
|
|
|
|
{ main => $main } ] ); |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head2 meta |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
return current meta object. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
=cut |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
sub meta { |
194
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
195
|
0
|
0
|
|
|
|
0
|
$self->{meta} = shift if @_; |
196
|
0
|
|
|
|
|
0
|
return $self->{meta}; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head2 section_all |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=cut |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
sub section_all { |
210
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
211
|
0
|
|
|
|
|
0
|
my $main = shift; |
212
|
0
|
|
|
|
|
0
|
new_section $main => "all" => qw(install-deps); |
213
|
0
|
|
|
|
|
0
|
add_noop_st $main; |
214
|
|
|
|
|
|
|
} |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=head2 section_install |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=cut |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
sub section_install { |
223
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
224
|
0
|
|
|
|
|
0
|
my $main = shift; |
225
|
0
|
|
|
|
|
0
|
new_section $main => "install" => qw(pure_install install-deps) ; |
226
|
0
|
|
|
|
|
0
|
add_noop_st $main; |
227
|
|
|
|
|
|
|
} |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head2 section_pure_install |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub section_pure_install { |
236
|
0
|
|
|
0
|
1
|
0
|
my ($self,$main,$makefile) = @_; |
237
|
|
|
|
|
|
|
|
238
|
0
|
|
|
|
|
0
|
new_section $main => "pure_install"; |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
# pure makefile option let |
241
|
|
|
|
|
|
|
# makefile doesnt depend on perl module. |
242
|
0
|
0
|
|
|
|
0
|
if ( $self->{cmd}->{pure} ) { |
243
|
0
|
|
|
|
|
0
|
print "Making pure makefile (not to depend on perl module)\n"; |
244
|
|
|
|
|
|
|
|
245
|
0
|
|
|
|
|
0
|
my %files = %{ $makefile->{filelist} }; |
|
0
|
|
|
|
|
0
|
|
246
|
|
|
|
|
|
|
|
247
|
0
|
|
|
|
|
0
|
while ( my ($from,$to) = each %files ) { |
248
|
0
|
|
|
|
|
0
|
add_st $main => sprintf( q|$(CP) %s %s| , $from , $to ); |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
else { |
252
|
0
|
|
|
|
|
0
|
add_st $main => |
253
|
|
|
|
|
|
|
q|$(NOECHO) $(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Installer=install| |
254
|
|
|
|
|
|
|
. q| -e 'install()' $(NAME) $(VIMS_TO_RUNT) $(BIN_TO_RUNT)|; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
=head2 section_deps |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
sub section_deps { |
265
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
266
|
0
|
|
|
|
|
0
|
my $main = shift; |
267
|
|
|
|
|
|
|
|
268
|
0
|
|
|
|
|
0
|
new_section $main => "install-deps"; |
269
|
|
|
|
|
|
|
|
270
|
0
|
0
|
|
|
|
0
|
if( $self->{cmd}->{pure} ) { |
271
|
0
|
|
|
|
|
0
|
print "You are making a pure makefile that doesn't depend on perl module.\n"; |
272
|
0
|
|
|
|
|
0
|
print "We are going to skip dependency section.\n"; |
273
|
0
|
|
|
|
|
0
|
add_noop_st $main; |
274
|
0
|
|
|
|
|
0
|
return; |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
0
|
|
|
|
|
0
|
my $requires = $self->check_dependency( $self->meta ); |
278
|
0
|
|
|
|
|
0
|
my %unsatisfied = %{ $requires->{unsat} }; |
|
0
|
|
|
|
|
0
|
|
279
|
0
|
|
|
|
|
0
|
my %nonversion_unsat = %{ $requires->{nonversion_unsat} }; |
|
0
|
|
|
|
|
0
|
|
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
# grep out the non-version package requires from those unsatisfied infomation |
282
|
|
|
|
|
|
|
# which is an array ref because it's a file list. |
283
|
0
|
|
|
|
|
0
|
my @pkgs_nonversion = keys %nonversion_unsat; |
284
|
0
|
|
|
|
|
0
|
for my $pkgname ( @pkgs_nonversion ) { |
285
|
0
|
|
|
|
|
0
|
my @nonversion_params = map { ( $_->{target} , $_->{from} ) } |
|
0
|
|
|
|
|
0
|
|
286
|
0
|
|
|
|
|
0
|
map { @{ $nonversion_unsat{ $_ } } } $pkgname ; |
|
0
|
|
|
|
|
0
|
|
287
|
|
|
|
|
|
|
|
288
|
0
|
|
|
|
|
0
|
add_st $main => multi_line q|$(NOECHO) $(FULLPERL) $(PERLFLAGS)| |
289
|
|
|
|
|
|
|
. qq| -MVIM::Packager::Installer=install_deps_remote | |
290
|
|
|
|
|
|
|
. qq| -e 'install_deps_remote()' $pkgname | |
291
|
|
|
|
|
|
|
, @nonversion_params ; |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
} |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
# XXX: grep git repo deps from upstream ... zzz |
296
|
|
|
|
|
|
|
# packages with version specified. |
297
|
0
|
|
|
|
|
0
|
my @pkgs_version = keys %unsatisfied; |
298
|
0
|
0
|
|
|
|
0
|
if( @pkgs_version > 0 ) { |
299
|
0
|
|
|
|
|
0
|
my @pkgs_git_repo = grep { $unsatisfied{ $_ }->{git_repo} } @pkgs_version; |
|
0
|
|
|
|
|
0
|
|
300
|
0
|
|
|
|
|
0
|
for my $pkg ( @pkgs_git_repo ) { |
301
|
0
|
|
|
|
|
0
|
my $dep = $unsatisfied{ $pkg }; |
302
|
|
|
|
|
|
|
|
303
|
0
|
|
|
|
|
0
|
my $v = $dep->{version}; |
304
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Installer=install_deps_from_git | |
305
|
0
|
|
|
|
|
0
|
. qq| -e 'install_deps_from_git()' @{[ $dep->{git_repo} ]} $v|; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
0
|
|
|
|
|
0
|
my @pkgs_version = grep { ! $unsatisfied{ $_ }->{git_repo} } @pkgs_version; |
|
0
|
|
|
|
|
0
|
|
309
|
|
|
|
|
|
|
|
310
|
0
|
0
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(FULLPERL) $(PERLFLAGS) -MVIM::Packager::Installer=install_deps | |
311
|
0
|
|
|
|
|
0
|
. qq| -e 'install_deps()' '@{[ join ",",@pkgs_version ]}' | |
312
|
|
|
|
|
|
|
if @pkgs_version > 0; |
313
|
|
|
|
|
|
|
} |
314
|
|
|
|
|
|
|
} |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=head2 section_link |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |
320
|
|
|
|
|
|
|
|
321
|
|
|
|
|
|
|
sub section_link { |
322
|
0
|
|
|
0
|
1
|
0
|
my ($self,$main , $filelist) = @_; |
323
|
0
|
|
|
|
|
0
|
new_section $main => 'link'; |
324
|
0
|
|
|
|
|
0
|
while( my ($src,$target) = each %$filelist ) { |
325
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(LN_S) | . File::Spec->join( '$(PWD)' , $src ) . " " . $target; |
326
|
|
|
|
|
|
|
} |
327
|
0
|
|
|
|
|
0
|
new_section $main => 'link-force'; |
328
|
0
|
|
|
|
|
0
|
while( my ($src,$target) = each %$filelist ) { |
329
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(LN_SF) | . File::Spec->join( '$(PWD)' , $src ) . " " . $target; |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
|
332
|
0
|
|
|
|
|
0
|
new_section $main => 'unlink'; |
333
|
0
|
|
|
|
|
0
|
while( my ($src,$target) = each %$filelist ) { |
334
|
0
|
|
|
|
|
0
|
add_st $main => q|$(NOECHO) $(RM) | . $target; |
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
} |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
|
339
|
|
|
|
|
|
|
sub generate_makefile { |
340
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
341
|
0
|
|
|
|
|
0
|
my $sections = shift; |
342
|
|
|
|
|
|
|
|
343
|
|
|
|
|
|
|
|
344
|
0
|
|
|
|
|
0
|
print "Write to Makefile.vimp\n"; |
345
|
|
|
|
|
|
|
|
346
|
0
|
|
|
|
|
0
|
open my $fh , ">" , 'Makefile.vimp'; |
347
|
0
|
|
|
|
|
0
|
print $fh <<'END'; |
348
|
|
|
|
|
|
|
# VIM::Packager::MakeMaker |
349
|
|
|
|
|
|
|
# |
350
|
|
|
|
|
|
|
# This Makefile is generated by VIM::Packager::MakeMaker version $VERSION from |
351
|
|
|
|
|
|
|
# the contents of META . don't edit this file, edit META file instead. |
352
|
|
|
|
|
|
|
# |
353
|
|
|
|
|
|
|
# Author: Cornelius |
354
|
|
|
|
|
|
|
# Email : cornelius.howl@gmail.com |
355
|
|
|
|
|
|
|
# |
356
|
|
|
|
|
|
|
|
357
|
|
|
|
|
|
|
END |
358
|
0
|
|
|
|
|
0
|
for my $s ( @$sections ) { |
359
|
0
|
|
|
|
|
0
|
my $n = (keys %$s)[0]; |
360
|
0
|
|
|
|
|
0
|
my $list = $s->{$n}; |
361
|
0
|
|
|
|
|
0
|
print $fh "\n" for ( 1 .. 3 ); |
362
|
0
|
|
|
|
|
0
|
print $fh sprintf("# -------- %s section ------\n" , $n ); |
363
|
0
|
|
|
|
|
0
|
print $fh join("\n", @$list ); |
364
|
0
|
|
|
|
|
0
|
print $fh "\n" for ( 1 .. 2 ); |
365
|
|
|
|
|
|
|
} |
366
|
0
|
|
|
|
|
0
|
close $fh; |
367
|
0
|
|
|
|
|
0
|
print "DONE\n"; |
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
sub meta_section { |
371
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
372
|
0
|
|
|
|
|
0
|
my $meta = shift; |
373
|
0
|
|
|
|
|
0
|
my @section = (); |
374
|
0
|
|
|
|
|
0
|
map { add_macro \@section, uc($_) => $meta->{$_} } grep { ! ref $meta->{$_} } keys %$meta; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
375
|
|
|
|
|
|
|
|
376
|
0
|
|
|
|
|
0
|
my $distname = $meta->{name}; |
377
|
0
|
|
|
|
|
0
|
$distname =~ tr/._/--/; |
378
|
0
|
|
|
|
|
0
|
$distname .= '-' . $meta->{version}; |
379
|
0
|
|
|
|
|
0
|
add_macro \@section , DISTNAME => $distname; |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
# XXX: op skipeed |
382
|
0
|
|
|
|
|
0
|
add_macro \@section , VIM_VERSION => $meta->{vim_version}->{version}; |
383
|
|
|
|
|
|
|
|
384
|
0
|
|
|
|
|
0
|
return @section; |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
sub config_section { |
388
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
389
|
|
|
|
|
|
|
|
390
|
0
|
|
|
|
|
0
|
my @section = (); |
391
|
|
|
|
|
|
|
|
392
|
0
|
|
|
|
|
0
|
my %configs = (); |
393
|
0
|
|
|
|
|
0
|
my %dir_configs = $self->init_vim_dir_macro(); |
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
|
|
0
|
my $perl = find_perl(); |
396
|
0
|
0
|
|
|
|
0
|
die "Can not found perl." unless $perl; |
397
|
|
|
|
|
|
|
|
398
|
0
|
|
0
|
|
|
0
|
$configs{FULLPERL} ||= $perl; |
399
|
0
|
|
0
|
|
|
0
|
$configs{NOECHO} ||= '@'; |
400
|
0
|
|
0
|
|
|
0
|
$configs{TOUCH} ||= 'touch'; |
401
|
0
|
|
0
|
|
|
0
|
$configs{ECHO} ||= 'echo'; |
402
|
0
|
|
0
|
|
|
0
|
$configs{ECHO_N} ||= 'echo -n'; |
403
|
0
|
|
0
|
|
|
0
|
$configs{RM_F} ||= "rm -vf"; |
404
|
0
|
|
0
|
|
|
0
|
$configs{RM_RF} ||= "rm -rf"; |
405
|
0
|
|
0
|
|
|
0
|
$configs{TEST_F} ||= "test -f"; |
406
|
0
|
|
0
|
|
|
0
|
$configs{CP} ||= "cp"; |
407
|
0
|
|
0
|
|
|
0
|
$configs{MV} ||= "mv"; |
408
|
0
|
|
0
|
|
|
0
|
$configs{CHMOD} ||= "chmod"; |
409
|
0
|
|
0
|
|
|
0
|
$configs{FALSE} ||= 'false'; |
410
|
0
|
|
0
|
|
|
0
|
$configs{TRUE} ||= 'true'; |
411
|
0
|
|
0
|
|
|
0
|
$configs{NOOP} ||= '$(TRUE)'; |
412
|
0
|
|
0
|
|
|
0
|
$configs{LN_S} ||= 'ln -sv'; |
413
|
0
|
|
0
|
|
|
0
|
$configs{LN_SF} ||= 'ln -svf'; |
414
|
0
|
|
0
|
|
|
0
|
$configs{PWD} ||= '`pwd`'; |
415
|
0
|
|
0
|
|
|
0
|
$configs{CP} ||= 'cp -v'; |
416
|
|
|
|
|
|
|
|
417
|
0
|
|
0
|
|
|
0
|
$configs{README} ||= ''; |
418
|
0
|
0
|
|
|
|
0
|
$configs{README} .= ' README' if -e 'README'; |
419
|
0
|
0
|
|
|
|
0
|
$configs{README} .= ' README.mkd' if -e 'README.mkd'; |
420
|
|
|
|
|
|
|
|
421
|
0
|
|
0
|
|
|
0
|
$configs{META_FILE} ||= VIM::Packager::MetaReader->find_meta_file(); |
422
|
|
|
|
|
|
|
|
423
|
0
|
|
0
|
|
|
0
|
$configs{FIRST_MAKEFILE} ||= 'Makefile'; |
424
|
0
|
|
0
|
|
|
0
|
$configs{MAKEFILE_OLD} ||= 'Makefile.old'; |
425
|
|
|
|
|
|
|
|
426
|
0
|
|
0
|
|
|
0
|
$configs{TAR} ||= 'COPY_EXTENDED_ATTRIBUTES_DISABLE=1 COPYFILE_DISABLE=1 tar'; |
427
|
0
|
|
0
|
|
|
0
|
$configs{TARFLAGS} ||= 'cvzf'; |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
0
|
|
|
0
|
$configs{PERLFLAGS} ||= ' -Ilib '; |
430
|
|
|
|
|
|
|
|
431
|
0
|
|
|
|
|
0
|
map { add_macro \@section, $_ => $configs{$_} } sort keys %configs; |
|
0
|
|
|
|
|
0
|
|
432
|
0
|
|
|
|
|
0
|
map { add_macro \@section, $_ => $dir_configs{$_} } sort keys %dir_configs; |
|
0
|
|
|
|
|
0
|
|
433
|
0
|
|
|
|
|
0
|
return @section; |
434
|
|
|
|
|
|
|
} |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
sub file_section { |
437
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
438
|
0
|
|
|
|
|
0
|
my $filelist = shift; |
439
|
0
|
|
|
|
|
0
|
my $meta = $self->meta; |
440
|
|
|
|
|
|
|
|
441
|
0
|
|
|
|
|
0
|
my @section = (); |
442
|
|
|
|
|
|
|
|
443
|
0
|
|
|
|
|
0
|
my @to_install = keys %$filelist; |
444
|
|
|
|
|
|
|
|
445
|
0
|
|
0
|
|
|
0
|
add_macro \@section , VIMLIB => $meta->{libpath} || LIBPATH; |
446
|
|
|
|
|
|
|
|
447
|
0
|
|
|
|
|
0
|
add_macro \@section , VIMMETA => VIM::Packager::MetaReader::find_meta_file(); |
448
|
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
0
|
add_macro \@section , TO_INST_VIMS => multi_line @to_install ; |
450
|
|
|
|
|
|
|
|
451
|
0
|
|
|
|
|
0
|
my @vims_to_runtime = %$filelist; |
452
|
0
|
|
|
|
|
0
|
add_macro \@section , VIMS_TO_RUNT => multi_line @vims_to_runtime ; |
453
|
|
|
|
|
|
|
|
454
|
0
|
|
|
|
|
0
|
my %bin_to_runtime = (); |
455
|
|
|
|
|
|
|
|
456
|
0
|
0
|
|
|
|
0
|
if( $meta->{script} ) { |
457
|
0
|
|
|
|
|
0
|
my @bin = @{ $meta->{script} }; |
|
0
|
|
|
|
|
0
|
|
458
|
0
|
|
|
|
|
0
|
for (@bin) { |
459
|
0
|
|
|
|
|
0
|
my ( $v, $d, $f ) = File::Spec->splitpath($_); |
460
|
|
|
|
|
|
|
# $bin_to_runtime{ $_ } = File::Spec->join( vim_rtp_home() , 'bin' , $f ); |
461
|
0
|
|
|
|
|
0
|
$bin_to_runtime{$_} = File::Spec->join( '$(VIM_BASEDIR)', 'bin', $f ); |
462
|
|
|
|
|
|
|
} |
463
|
0
|
|
|
|
|
0
|
add_macro \@section , TO_INST_BIN => multi_line keys %bin_to_runtime ; |
464
|
0
|
|
|
|
|
0
|
add_macro \@section , BIN_TO_RUNT => multi_line %bin_to_runtime ; |
465
|
|
|
|
|
|
|
} |
466
|
0
|
|
|
|
|
0
|
return @section; |
467
|
|
|
|
|
|
|
} |
468
|
|
|
|
|
|
|
|
469
|
|
|
|
|
|
|
=head2 get_installed_pkgs |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
=cut |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
sub get_installed_pkgs { |
474
|
2
|
|
|
2
|
1
|
849
|
my ($self, $dir ) = @_; |
475
|
|
|
|
|
|
|
|
476
|
2
|
100
|
|
|
|
67
|
unless( -e $dir ) { |
477
|
1
|
|
|
|
|
243
|
File::Path::mkpath [ $dir ]; |
478
|
1
|
|
|
|
|
5
|
return (); |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
1
|
|
|
|
|
3
|
my @pkg_record_files = (); |
482
|
|
|
|
|
|
|
my $closure = sub { |
483
|
3
|
|
|
3
|
|
6
|
my $file = $_; |
484
|
3
|
|
|
|
|
4
|
my $dir = $File::Find::dir; |
485
|
|
|
|
|
|
|
|
486
|
3
|
100
|
|
|
|
120
|
return unless -f $file; |
487
|
|
|
|
|
|
|
|
488
|
2
|
|
|
|
|
25
|
my $path = File::Spec->join($dir , $file ); |
489
|
2
|
|
|
|
|
36
|
push @pkg_record_files , $path; |
490
|
1
|
|
|
|
|
7
|
}; |
491
|
|
|
|
|
|
|
|
492
|
1
|
|
|
|
|
106
|
File::Find::find( \&$closure ,$dir ); |
493
|
1
|
|
|
|
|
7
|
return @pkg_record_files; |
494
|
|
|
|
|
|
|
} |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
=head2 check_dependency |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
pass meta object and check dependency. |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
=cut |
503
|
|
|
|
|
|
|
|
504
|
|
|
|
|
|
|
sub check_dependency { |
505
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
506
|
0
|
|
|
|
|
|
my $meta = shift; |
507
|
|
|
|
|
|
|
|
508
|
0
|
|
|
|
|
|
my $record_dir = $self->vim_inst_record_dir(); |
509
|
0
|
|
|
|
|
|
my @pkg_records = $self->get_installed_pkgs($record_dir); |
510
|
|
|
|
|
|
|
|
511
|
0
|
|
|
|
|
|
my %unsatisfied = (); |
512
|
0
|
|
|
|
|
|
my %nonversion_unsat = (); |
513
|
|
|
|
|
|
|
|
514
|
0
|
|
|
|
|
|
for my $dep ( @{ $meta->{dependency} } ) { |
|
0
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
|
516
|
0
|
0
|
|
|
|
|
if ( defined $dep->{version} ) { |
517
|
0
|
|
|
|
|
|
my ( $prereq, $required_version, $version_op , $git_repo ) |
518
|
|
|
|
|
|
|
= @$dep{qw(name version op git_repo)}; |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
# XXX: check if prerequire plugin is installed. |
521
|
|
|
|
|
|
|
# try to get installed package record |
522
|
|
|
|
|
|
|
# or just look into file and parse the version |
523
|
0
|
|
|
|
|
|
my $pr_version = undef ; |
524
|
|
|
|
|
|
|
|
525
|
0
|
|
|
|
|
|
my $found = VIM::Packager::Record->find( $prereq ); |
526
|
0
|
0
|
|
|
|
|
if( $found ) { |
527
|
0
|
|
|
|
|
|
my $r = VIM::Packager::Record->read( $found ); |
528
|
0
|
|
|
|
|
|
$pr_version = $r->{meta}->{version}; |
529
|
0
|
|
|
|
|
|
print "Found Installed Package: $prereq \n"; |
530
|
0
|
|
|
|
|
|
print "Version: $pr_version\n"; |
531
|
|
|
|
|
|
|
} |
532
|
|
|
|
|
|
|
else { |
533
|
0
|
|
|
|
|
|
my $installed_files; # get installed files here |
534
|
0
|
0
|
|
|
|
|
$pr_version = parse_version( $installed_files ) if( $installed_files ); |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
|
537
|
0
|
0
|
|
|
|
|
if( ! $pr_version ) { |
|
|
0
|
|
|
|
|
|
538
|
0
|
|
|
|
|
|
warn sprintf "Warning: prerequisite %s - %s not found.\n", |
539
|
|
|
|
|
|
|
$prereq, $required_version; |
540
|
0
|
|
|
|
|
|
$unsatisfied{ $prereq } = $dep; |
541
|
|
|
|
|
|
|
} |
542
|
|
|
|
|
|
|
elsif ( eval "$pr_version $version_op $required_version" ) { |
543
|
0
|
|
|
|
|
|
warn sprintf "Warning: prerequisite %s - %s not found. We have %s.\n", |
544
|
|
|
|
|
|
|
$prereq, $required_version, $pr_version; |
545
|
|
|
|
|
|
|
|
546
|
0
|
|
|
|
|
|
$unsatisfied{ $prereq } = $dep; |
547
|
|
|
|
|
|
|
} |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
} |
550
|
|
|
|
|
|
|
else { |
551
|
|
|
|
|
|
|
# if we can not detect installed package version |
552
|
|
|
|
|
|
|
# here is the other way to install dependencies. |
553
|
0
|
|
|
|
|
|
my ( $prereq , $require_files ) = ( $dep->{name} , $dep->{required_files} ); |
554
|
0
|
|
|
|
|
|
$nonversion_unsat{ $prereq } = $require_files; |
555
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
# XXX: grep out ? |
557
|
0
|
|
|
|
|
|
for ( @$require_files ) { |
558
|
|
|
|
|
|
|
# XXX: expand Makefile variable to support such things like: |
559
|
|
|
|
|
|
|
# $(VIM_BASEDIR)/path/to/ |
560
|
0
|
|
|
|
|
|
my $target_path = File::Spec->join( vim_rtp_home() , $_->{target} ) ; |
561
|
|
|
|
|
|
|
|
562
|
0
|
0
|
|
|
|
|
unless( -e $target_path ) { |
563
|
0
|
|
|
|
|
|
warn sprintf "Warning: prerequisite %s - %s not found.\n\tWill be retreived from %s\n", |
564
|
|
|
|
|
|
|
$prereq , $target_path , $_->{from} ; |
565
|
|
|
|
|
|
|
} |
566
|
|
|
|
|
|
|
else { |
567
|
0
|
|
|
|
|
|
printf "[ %s : %s ] .... OK\n" , $prereq , $_->{target} ; |
568
|
|
|
|
|
|
|
} |
569
|
|
|
|
|
|
|
} |
570
|
|
|
|
|
|
|
} |
571
|
|
|
|
|
|
|
|
572
|
|
|
|
|
|
|
} |
573
|
|
|
|
|
|
|
|
574
|
|
|
|
|
|
|
return { |
575
|
0
|
|
|
|
|
|
unsat => \%unsatisfied, |
576
|
|
|
|
|
|
|
nonversion_unsat => \%nonversion_unsat, |
577
|
|
|
|
|
|
|
}; |
578
|
|
|
|
|
|
|
} |
579
|
|
|
|
|
|
|
|
580
|
0
|
|
|
0
|
0
|
|
sub possible_runtime_dir { qw(autoload after syntax ftplugin ftdetect compiler plugin macros colors doc) } |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
=head2 init_vim_dir_macro |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
init vim dir macro |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=cut |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
sub init_vim_dir_macro { |
589
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
590
|
0
|
|
|
|
|
|
my %dir_configs = (); |
591
|
0
|
|
0
|
|
|
|
$dir_configs{ VIM_BASEDIR } = $ENV{VIM_BASEDIR} || vim_rtp_home(); |
592
|
0
|
|
0
|
|
|
|
$dir_configs{ VIM_AFTERBASE_DIR} = $ENV{VIM_AFTERBASE_DIR} || File::Spec->join( $dir_configs{VIM_BASEDIR} , 'after' ); |
593
|
|
|
|
|
|
|
|
594
|
0
|
|
|
|
|
|
for my $sub ( possible_runtime_dir() ) { |
595
|
0
|
|
|
|
|
|
my $path_name = 'VIM_' . uc($sub) . '_DIR'; |
596
|
0
|
|
|
|
|
|
my $after_path_name = 'VIM_AFTER_' . uc($sub) . '_DIR'; |
597
|
0
|
|
0
|
|
|
|
$dir_configs{$path_name} = $ENV{$path_name} |
598
|
|
|
|
|
|
|
|| File::Spec->join( $dir_configs{VIM_BASEDIR}, $sub ); |
599
|
|
|
|
|
|
|
|
600
|
0
|
|
0
|
|
|
|
$dir_configs{$after_path_name} = $ENV{$after_path_name} |
601
|
|
|
|
|
|
|
|| File::Spec->join( $dir_configs{VIM_BASEDIR}, $sub ); |
602
|
|
|
|
|
|
|
} |
603
|
0
|
|
|
|
|
|
return %dir_configs; |
604
|
|
|
|
|
|
|
} |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
=head2 make_filelist |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
if install_dirs is given , then we should record: |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
autoload/zzz.vim |
612
|
|
|
|
|
|
|
plugin/xxx.vim |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
if not , then we should find files from F |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
TO_INSTALL=$(VIM_BASEDIR)/plugin/xxx.vim |
617
|
|
|
|
|
|
|
\ $(VIM_BASEDIR)/autoload/zzz.vim |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=cut |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub make_filelist { |
622
|
0
|
|
|
0
|
1
|
|
my ( $self, $base_prefix ) = @_; |
623
|
|
|
|
|
|
|
|
624
|
0
|
|
|
|
|
|
my %install = (); |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
# my $prefix = File::Spec->join($ENV{HOME} , '.vim'); |
627
|
0
|
|
|
|
|
|
my $prefix = '$(VIM_BASEDIR)'; |
628
|
|
|
|
|
|
|
|
629
|
0
|
0
|
0
|
|
|
|
my @search_dir = ( ( $base_prefix eq '.' or $base_prefix eq './' ) |
630
|
|
|
|
|
|
|
? possible_runtime_dir() |
631
|
|
|
|
|
|
|
: $base_prefix ); |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
File::Find::find( sub { |
635
|
0
|
0
|
|
0
|
|
|
return unless -f $_; |
636
|
0
|
0
|
|
|
|
|
return if /\#/; |
637
|
0
|
0
|
|
|
|
|
return if /~$/; # emacs temp files |
638
|
0
|
0
|
|
|
|
|
return if /,v$/; # RCS files |
639
|
0
|
0
|
|
|
|
|
return if /\.(git|svn)/; # skip .git |
640
|
0
|
0
|
|
|
|
|
return if m{\.swp$}; # vim swap files |
641
|
|
|
|
|
|
|
|
642
|
0
|
|
|
|
|
|
my $src = File::Spec->catfile( $File::Find::dir , $_ ); |
643
|
|
|
|
|
|
|
|
644
|
0
|
|
|
|
|
|
my $target; |
645
|
0
|
|
|
|
|
|
( $target = $src ) =~ s{^$base_prefix/}{}; |
646
|
0
|
|
|
|
|
|
$target = File::Spec->catfile( $prefix , $target ); |
647
|
|
|
|
|
|
|
|
648
|
0
|
|
|
|
|
|
$install{ $src } = $target; |
649
|
0
|
|
|
|
|
|
print "Added $src to file list\n"; |
650
|
0
|
|
|
|
|
|
} , grep { -e $_ } @search_dir ); |
|
0
|
|
|
|
|
|
|
651
|
0
|
|
|
|
|
|
return \%install; |
652
|
|
|
|
|
|
|
} |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
# XXX: |
656
|
|
|
|
|
|
|
# parse version from vim runtime path files |
657
|
|
|
|
|
|
|
# neeed to find a way to do it |
658
|
0
|
|
|
0
|
0
|
|
sub parse_version { |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
} |
661
|
|
|
|
|
|
|
|
662
|
|
|
|
|
|
|
sub vim_version_info { |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
# check_vim_version |
665
|
0
|
|
|
0
|
0
|
|
my $where_is_vim = findbin('vim'); |
666
|
0
|
0
|
|
|
|
|
unless( $where_is_vim ) { |
667
|
0
|
|
|
|
|
|
print STDOUT "It seems you dont have vim installed."; |
668
|
0
|
|
|
|
|
|
die; |
669
|
|
|
|
|
|
|
} |
670
|
|
|
|
|
|
|
|
671
|
0
|
|
|
|
|
|
my $version_output = qx{$where_is_vim --version}; |
672
|
0
|
|
|
|
|
|
my @lines = split /\n/, $version_output; |
673
|
|
|
|
|
|
|
|
674
|
0
|
|
|
|
|
|
my ( $version, $date_string ) |
675
|
|
|
|
|
|
|
= $lines[ 0 ] =~ /^VIM - Vi IMproved ([0-9.]+) \((.*?)\)/; |
676
|
|
|
|
|
|
|
|
677
|
0
|
|
|
|
|
|
my ( $revision_date, $compiled_time ) = split /,/, $date_string; |
678
|
|
|
|
|
|
|
|
679
|
0
|
|
|
|
|
|
$compiled_time =~ s/\s*compiled\s*//; |
680
|
0
|
|
|
|
|
|
$compiled_time = DateTime::Format::DateParse->parse_datetime($compiled_time); |
681
|
|
|
|
|
|
|
|
682
|
0
|
|
|
|
|
|
my ($platform) = $lines[ 1 ] =~ /^(.*?) version/; |
683
|
|
|
|
|
|
|
|
684
|
|
|
|
|
|
|
# Included patches: 1-264 |
685
|
0
|
|
|
|
|
|
my ( $patch_from, $patch_to ) |
686
|
|
|
|
|
|
|
= $lines[ 2 ] =~ /^Included patches: (\d+)-(\d+)$/; |
687
|
|
|
|
|
|
|
|
688
|
|
|
|
|
|
|
# Compiled by [who] |
689
|
0
|
|
|
|
|
|
my ($compiled_by) = $lines[ 3 ] =~ /^Compiled by (.*?)$/; |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
return { |
692
|
0
|
|
|
|
|
|
version => $version, |
693
|
|
|
|
|
|
|
platform => $platform, |
694
|
|
|
|
|
|
|
compiled_on => $compiled_time, |
695
|
|
|
|
|
|
|
patch_from => $patch_from, |
696
|
|
|
|
|
|
|
patch_to => $patch_to, |
697
|
|
|
|
|
|
|
compiled_by => $compiled_by |
698
|
|
|
|
|
|
|
}; |
699
|
|
|
|
|
|
|
} |
700
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
sub check_manifest { |
702
|
0
|
|
|
0
|
0
|
|
print STDOUT "Checking if your kit is complete...\n"; |
703
|
0
|
|
|
|
|
|
require ExtUtils::Manifest; |
704
|
|
|
|
|
|
|
# avoid warning |
705
|
0
|
|
|
|
|
|
$ExtUtils::Manifest::Quiet = $ExtUtils::Manifest::Quiet = 1; |
706
|
0
|
|
|
|
|
|
my(@missed) = ExtUtils::Manifest::manicheck(); |
707
|
0
|
0
|
|
|
|
|
if (@missed) { |
708
|
0
|
|
|
|
|
|
print STDOUT "Warning: the following files are missing in your kit:\n"; |
709
|
0
|
|
|
|
|
|
print "\t", join "\n\t", @missed; |
710
|
0
|
|
|
|
|
|
print STDOUT "\n"; |
711
|
0
|
|
|
|
|
|
print STDOUT "Please inform the author.\n"; |
712
|
|
|
|
|
|
|
} else { |
713
|
0
|
|
|
|
|
|
print STDOUT "Looks good\n"; |
714
|
|
|
|
|
|
|
} |
715
|
|
|
|
|
|
|
} |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
sub prompt ($;$) { ## no critic |
718
|
0
|
|
|
0
|
0
|
|
my($mess, $def) = @_; |
719
|
0
|
0
|
|
|
|
|
Carp::confess("prompt function called without an argument") |
720
|
|
|
|
|
|
|
unless defined $mess; |
721
|
|
|
|
|
|
|
|
722
|
0
|
|
0
|
|
|
|
my $isa_tty = -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; |
723
|
|
|
|
|
|
|
|
724
|
0
|
0
|
|
|
|
|
my $dispdef = defined $def ? "[$def] " : " "; |
725
|
0
|
0
|
|
|
|
|
$def = defined $def ? $def : ""; |
726
|
|
|
|
|
|
|
|
727
|
0
|
|
|
|
|
|
local $|=1; |
728
|
0
|
|
|
|
|
|
local $\; |
729
|
0
|
|
|
|
|
|
print "$mess $dispdef"; |
730
|
|
|
|
|
|
|
|
731
|
0
|
|
|
|
|
|
my $ans; |
732
|
0
|
0
|
0
|
|
|
|
if ($ENV{PERL_MM_USE_DEFAULT} || (!$isa_tty && eof STDIN)) { |
|
|
|
0
|
|
|
|
|
733
|
0
|
|
|
|
|
|
print "$def\n"; |
734
|
|
|
|
|
|
|
} |
735
|
|
|
|
|
|
|
else { |
736
|
0
|
|
|
|
|
|
$ans = ; |
737
|
0
|
0
|
|
|
|
|
if( defined $ans ) { |
738
|
0
|
|
|
|
|
|
chomp $ans; |
739
|
|
|
|
|
|
|
} |
740
|
|
|
|
|
|
|
else { # user hit ctrl-D |
741
|
0
|
|
|
|
|
|
print "\n"; |
742
|
|
|
|
|
|
|
} |
743
|
|
|
|
|
|
|
} |
744
|
|
|
|
|
|
|
|
745
|
0
|
0
|
0
|
|
|
|
return (!defined $ans || $ans eq '') ? $def : $ans; |
746
|
|
|
|
|
|
|
} |
747
|
|
|
|
|
|
|
|
748
|
1
|
|
|
1
|
|
13
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
112
|
|
749
|
|
|
|
|
|
|
sub find_perl { |
750
|
0
|
|
|
0
|
0
|
|
my @paths = split /:/,$ENV{PATH}; |
751
|
0
|
|
|
|
|
|
my @names = qw(perl); |
752
|
0
|
|
|
|
|
|
for my $path ( @paths ) { |
753
|
0
|
|
|
|
|
|
for my $name ( @names ) { |
754
|
0
|
|
|
|
|
|
my $abspath = File::Spec->join( $path , $name ); |
755
|
0
|
0
|
|
|
|
|
return $abspath if -e $abspath; |
756
|
|
|
|
|
|
|
} |
757
|
|
|
|
|
|
|
} |
758
|
0
|
|
|
|
|
|
return undef; |
759
|
|
|
|
|
|
|
} |
760
|
|
|
|
|
|
|
|
761
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
1; |