Makefile.PL revision 1.4
1use strict;
2use warnings;
3
4use ExtUtils::MakeMaker;
5use Carp;
6
7my $mm_version = $ExtUtils::MakeMaker::VERSION;
8if ( $mm_version < 6.58 ) {
9    croak("Sorry, but MakeMaker 6.58 or better is needed to build this package.");
10}
11
12WriteMakefile(
13    NAME       => 'Term::ReadKey',
14    DISTNAME   => 'TermReadKey',
15    LICENSE    => 'perl',
16    ABSTRACT   => 'Change terminal modes, and perform non-blocking reads.',
17    AUTHOR     => ['Kenneth Albanowski','Jonathan Stowe'],
18    CONFIGURE_REQUIRES => {
19        'ExtUtils::MakeMaker' => 6.58,
20    },
21    BUILD_REQUIRES  =>  {
22        'ExtUtils::MakeMaker' => 6.58,
23    },
24    META_ADD => { # needs to _ADD because I want over-ride the dynamic_config
25        dynamic_config => 1,
26        no_index  => {
27            file     => [ qw(Configure.pm) ],
28            package  => [ qw(Configure) ],
29        },
30        provides  => {
31            'Term::ReadKey' => {
32                file    => 'ReadKey.pm.PL',
33                version => '2.38',
34            },
35        },
36        'meta-spec' => { version => 2 },
37        resources => {
38            repository => {
39                type => 'git',
40                url  => 'https://github.com/jonathanstowe/TermReadKey.git',
41                web  => 'https://github.com/jonathanstowe/TermReadKey',
42            },
43        },
44    },
45    VERSION_FROM    => 'ReadKey.pm.PL',
46    XSPROTOARG      => '-noprototypes',
47    PL_FILES	    => { 'ReadKey.pm.PL' => 'ReadKey.pm' },
48    PM              => { 'ReadKey.pm' => '$(INST_ARCHLIBDIR)/ReadKey.pm' },
49    clean           => { FILES => 'cchars.h ReadKey.pm' },
50    SIGN            => 1,
51
52    # Uncomment these to allow testing of sgtty under Linux. Not needed normally.
53    # INC => "-I/usr/include/bsd",
54    # LIBS => "-lbsd"
55);
56
57sub MY::top_targets {
58    my $self = shift;
59    $_ = $self->MM::top_targets();
60    # ensure that the XS is built before the PM
61    s/pure_all :: config pm_to_blib (.* )linkext/pure_all :: config linkext pm_to_blib $1/;
62
63    $_ .= "
64
65sgtty cchars.h: genchars.pl
66	\$(PERLRUN) genchars.pl
67
68distcc: genchars.pl
69	\$(PERLRUN) genchars.pl dist
70
71ReadKey\$(OBJ_EXT): ReadKey.c cchars.h
72
73";
74    return $_;
75}
76
77# The template needs DynaLoader. don't use miniperl (dual-life only)
78sub MY::processPL {
79    my $self = shift;
80    $_ = $self->MM::processPL();
81    s/ReadKey.pm :: ReadKey.pm.PL/ReadKey.pm :: ReadKey.pm.PL dynamic/;
82    s/\$\(PERLRUN\)/\$(FULLPERLRUNINST)/;
83    return $_;
84}
85
86sub MY::test {
87    my $self = shift;
88    $_ = $self->MM::test();
89    s#example/test.pl#-w example/test.pl#;
90    return $_;
91}
92
93sub MY::test_interactive {
94    return "Fooo";
95}
96
97sub MY::pure_site_install {
98    my $self = shift;
99    my $new = $self->MM::test();
100
101    $new .= "\n\t./register_module Term::ReadKey";
102    return $new;
103}
104