6483b0377d8ffbfdfdb2c865772835624af1409b
[catagits/Task-Catalyst.git] / inc / Module / Install / Win32.pm
1 #line 1
2 package Module::Install::Win32;
3
4 use strict;
5 use Module::Install::Base;
6
7 use vars qw{$VERSION @ISA};
8 BEGIN {
9         $VERSION = '0.61';
10         @ISA     = qw{Module::Install::Base};
11 }
12
13 # determine if the user needs nmake, and download it if needed
14 sub check_nmake {
15         my $self = shift;
16         $self->load('can_run');
17         $self->load('get_file');
18         
19         require Config;
20         return unless (
21                 $^O eq 'MSWin32'                     and
22                 $Config::Config{make}                and
23                 $Config::Config{make} =~ /^nmake\b/i and
24                 ! $self->can_run('nmake')
25         );
26
27         print "The required 'nmake' executable not found, fetching it...\n";
28
29         require File::Basename;
30         my $rv = $self->get_file(
31                 url       => 'http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe',
32                 ftp_url   => 'ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe',
33                 local_dir => File::Basename::dirname($^X),
34                 size      => 51928,
35                 run       => 'Nmake15.exe /o > nul',
36                 check_for => 'Nmake.exe',
37                 remove    => 1,
38         );
39
40         if (!$rv) {
41         die <<'END_MESSAGE';
42
43 -------------------------------------------------------------------------------
44
45 Since you are using Microsoft Windows, you will need the 'nmake' utility
46 before installation. It's available at:
47
48   http://download.microsoft.com/download/vc15/Patch/1.52/W95/EN-US/Nmake15.exe
49       or
50   ftp://ftp.microsoft.com/Softlib/MSLFILES/Nmake15.exe
51
52 Please download the file manually, save it to a directory in %PATH% (e.g.
53 C:\WINDOWS\COMMAND\), then launch the MS-DOS command line shell, "cd" to
54 that directory, and run "Nmake15.exe" from there; that will create the
55 'nmake.exe' file needed by this module.
56
57 You may then resume the installation process described in README.
58
59 -------------------------------------------------------------------------------
60 END_MESSAGE
61         }
62 }
63
64 1;