Let's see if cpantesters picks this up...
[sepia.git] / Makefile.PL
blob4d46feb613c9cdfabfdee31231d97bad2782855e
1 use ExtUtils::MakeMaker qw(WriteMakefile prompt);
2 use 5.006;                      # for "no warnings" -- sorry!
3 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
4 # the contents of the Makefile that is written.
6 my %prereq = (
7     'Data::Dumper'    => 0,
8     'Scalar::Util'    => 0,
9 );
11 ## Poor man's optional deps.
12 sub test_for
14     my $mod = shift;
15     eval "require $mod";
16     if ($@) {
17         my $resp = prompt("@_.  Install $mod (y/n)? ", 'n');
18         $prereq{$mod} = 0 if $resp =~ /^y/i;
19     }
22 test_for 'Devel::Peek', 'Printing internals requires Devel::Peek';
23 test_for 'Devel::Size', 'Printing variable sizes requires Devel::Size';
24 test_for 'IO::Scalar', 'Printing internals requires IO::Scalar because Devel::Peek sucks.';
25 test_for 'Lexical::Persistence', 'Strict mode requires Lexical::Persistence';
26 test_for 'LWP::Simple', 'CPAN documentation browsing requires LWP::Simple';
27 test_for 'Module::CoreList', 'sepia-core-version requires Module::CoreList';
28 test_for 'Module::Info', 'Required for some Emacs functions';
29 test_for 'PadWalker', 'Stack/lexical inspection requires PadWalker >= 1.0';
30 test_for 'BSD::Resource', 'Detailed command timing.';
31 test_for 'Time::HiRes', 'Basic command timing.';
32 # test_for 'Pod::Webserver', 'Pod::Webserver creates nice documentation.';
33 # test_for 'Scope::Upper', 'Required for return-from-context';
35 # try to compile and install Elisp files, but don't die if we can't.
36 $install_el = 0;
37 $emacs = quotemeta prompt("What is your emacs? ", $ENV{EMACS} || 'emacs');
38 $lp = `$emacs --batch --eval '(message "\%s" load-path)' 2>&1`;
39 $lp =~ s/^.*\(//s;
40 $lp =~ s/\).*$//s;
41 for (split ' ', $lp) {
42     if (/site-lisp$/ && -d $_) {
43         $site_lisp = $_;
44         last;
45     }
47 $site_lisp = quotemeta prompt("Elisp install directory?", $site_lisp);
48 if (-d $site_lisp) {
49     $install_el = 1;
50 } else {
51     warn "$site_lisp is not a directory.\n";
54 # Also try to install texinfo documentation.
55 $install_info = quotemeta prompt("install-info program?", 'install-info');
56 $info_dir = `$emacs --batch --eval '(progn (require (quote info)) (message "\%s" (car Info-default-directory-list)))' 2>&1`;
57 chomp $info_dir;
58 $info_dir = quotemeta prompt("Info directory?", $info_dir);
59 if (!-d $info_dir) {
60     warn "Not installing info files.\n";
61     undef $install_info;
64 sub MY::postamble
66     my $ret;
67     if ($install_info) {
68         $ret = <<EOS;
69         \$(CP) sepia.info $info_dir
70         $install_info $info_dir/sepia.info $info_dir/dir
71 EOS
72     }
73     if ($install_el) {
74         $ret .= <<EOS;
75 install ::
76         \@echo Compiling Elisp files.
77         $emacs -L '$ENV{PWD}' --batch -f batch-byte-compile *.el 2>/dev/null
78         \$(CP) *.el *.elc $site_lisp
79 EOS
80     } else {
81         print <<EOS;
82 NOTE:
83     To actually use this package, you need to move the Emacs Lisp files
84     somewhere Emacs will find them.
86     You may also want to install the HTML documentation somewhere
87     appropriate to your system.
88 EOS
89     }
90     $ret;
93 WriteMakefile(
94     'NAME'              => 'Sepia',
95     'VERSION_FROM'      => 'lib/Sepia.pm', # finds $VERSION
96     'PREREQ_PM'         => \%prereq,
97     AUTHOR     => "Sean O'Rourke <seano\@cpan.org>",
98     ABSTRACT => 'Simple Emacs-Perl InterAction',