1use ExtUtils::MakeMaker;
2# See lib/ExtUtils/MakeMaker.pm for details of how to influence
3# the contents of the Makefile that is written.
4print "###############################################################\n";
5print "# This update is NOT compatible with version 0.9 or earlier!! #\n";
6print "###############################################################\n";
7if ($^O =~ /linux/) {
8        print "OS: $^O, copying XS file: ";
9        system("cp FreeDB.xs.linux FreeDB.xs") && die "Copying failed\n";
10        print "1 file copied\n";
11} elsif ($^O =~ /freebsd/) {
12        print "OS: $^O, copying XS file: ";
13        system("cp FreeDB.xs.linux FreeDB.xs") && die "Copying failed\n";
14        print "1 file copied\n";
15} elsif ($^O =~ /dragonfly/) {
16        print "OS: $^O, copying XS file: ";
17        system("cp FreeDB.xs.linux FreeDB.xs") && die "Copying failed\n";
18        print "1 file copied\n";
19} elsif ($^O =~ /MSWin32/) {
20        print "OS: $^O, copying XS file:";
21        system("copy FreeDB.xs.win32 FreeDB.xs") && die "Copying failed\n";
22} else {
23        print "Unable to determine OS, Exiting\n";
24        exit(0);
25}
26
27#--- MY package
28
29sub MY::libscan
30{
31 my($self,$path) = @_;
32
33 return ''
34        if($path =~ m:/(RCS|CVS|SCCS)/: ||
35           $path =~ m:[~%]$: ||
36           $path =~ m:\.(orig|rej|nfs|h)$:
37          );
38 $path;
39}
40
41#--- Installation check
42
43sub chk_version
44{
45 my($pkg,$wanted,$msg) = @_;
46
47 local($|) = 1;
48 print "Checking for $pkg...";
49
50 eval { my $p; ($p = $pkg . ".pm") =~ s#::#/#g; require $p; };
51
52 my $vstr = ${"${pkg}::VERSION"} ? "found v" . ${"${pkg}::VERSION"}
53                                 : "not found";
54 my $vnum = ${"${pkg}::VERSION"} || 0;
55
56 print $vnum >= $wanted ? "ok\n" : " " . $vstr . "\n";
57
58 $vnum >= $wanted;
59}
60
61sub MY::post_initialize
62{
63 my ($self) = @_;
64}
65
66#--- Check for Socket
67
68chk_version(Net::Cmd => '2.12') or
69  warn  "\n"
70  . "*** For Net::FreeDB to work you require version 2.12, or later,\n"
71  . "    of Net::Cmd available on CPAN\n\n";
72
73chk_version(CDDB::File => '1.01') or
74  warn "\n"
75  . "*** For Net::FreeDB to work you require version 1.01, or later,\n"
76  . "    of CDDB::File available on CPAN\n\n";
77#--- Write the Makefile
78
79WriteMakefile(
80    'NAME'              => 'Net::FreeDB',
81    'VERSION_FROM'      => 'FreeDB.pm', # finds $VERSION
82    'PREREQ_PM'         => {
83			    Moo              => 0,
84			    CDDB::File       => 1.01,
85			    File::Temp       => 0.05,
86                IO::Socket::INET => 0,
87                Net::Cmd         => 2.12,
88			   }, # e.g., Module::Name => 1.1
89    ($] >= 5.005 ?    ## Add these new keywords supported since 5.005
90      (AUTHOR     => 'David Shultz <dshultz@cpan.org>, Peter Pentchev <roam@ringlet.net>',
91       ABSTRACT   => 'OOP Interface to FreeDB Server(s)'
92      ) : ()),
93    'LIBS'              => [''], # e.g., '-lm'
94    'DEFINE'            => '', # e.g., '-DHAVE_SOMETHING'
95        # Insert -I. if you add *.h files later:
96    'INC'               => '-Ilib', # e.g., '-I/usr/include/other'
97        # Un-comment this if you add C files to link with later:
98    # 'OBJECT'          => '$(O_FILES)', # link all the C files too
99    'clean'		=> { 'FILES' => 'FreeDB.xs' },
100);
101