File: Makefile.PL

package info (click to toggle)
libtk-pod-perl 0.9943-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 456 kB
  • sloc: perl: 4,877; makefile: 14
file content (178 lines) | stat: -rw-r--r-- 5,344 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# -*- perl -*-

use ExtUtils::MakeMaker;

$DIST_VERSION = "0.9943";
$is_devel_host = defined $ENV{USER} && $ENV{USER} eq 'eserte' && $^O =~ /bsd/i && -f "../../perl.release.mk";
$min_eumm_version = 6.54;
$eumm_recent_enough = $ExtUtils::MakeMaker::VERSION >= $min_eumm_version;

if (!$eumm_recent_enough) {
    *MY::dist_core = sub {
	<<EOF;
dist :
	\$(NOECHO) \$(ECHO) "Sorry, use a newer EUMM, at least version $min_eumm_version!"

EOF
    };
}

if ($is_devel_host) {
    open(P, "Pod.pm") or die "Can't open Pod.pm: $!";
 SEARCH_FOR_DIST_VERSION: {
       while(<P>) {
           if (/DIST_VERSION\s*=\s*["'](.*)["']/) {
               if ($DIST_VERSION ne $1) {
                   die "Please adjust DIST_VERSION in Makefile.PL ($DIST_VERSION vs $1)";
               }
               last SEARCH_FOR_DIST_VERSION;
           }
       }
       die "Cannot find DIST_VERSION definition in Pod.pm";
    }
}

my %add_prereq_pm;
if (eval { require Tk::Tree; 1 } && $Tk::Tree::VERSION eq '4.6') {
    warn <<EOF;
**********************************************************************
* You have Tk::Tree $Tk::Tree::VERSION, which is broken.
**********************************************************************
EOF
    $add_prereq_pm{"Tk::Tree"} = "4.7";
}

if ($] < 5.009003) {
    warn <<EOF;
**********************************************************************
* Warnings looking like
*    Unknown escape E<0x107>
* are expected and may be ignored.
**********************************************************************
EOF
}

WriteMakefile(
	'PREREQ_PM'	=> { 'Tk'             => 800.004,
			     'Pod::Simple'    => 2.05, # there at least in 2.03 bugs when processing "-f ..." output
			     'File::Temp'     => 0,
			     'File::Spec'     => 0,
			     ## the following are only corequisites, see optional_features
	                     #'Text::English'  => 0,
			     #'Tk::HistEntry'  => 0.40,
			     ## very very optional corequisites, see optional_features
			     # 'Tk::WidgetDump' => 0,
			     # 'Module::Refresh' => 0,
			     %add_prereq_pm,
			   },
	'DISTNAME'	=> 'Tk-Pod',
	'NAME'		=> 'Tk::Pod',
	'VERSION'	=> $DIST_VERSION,
	'LICENSE'	=> 'perl',

	'DIR'		=> [],	# Tk-Pod dist build dir is ignored

	'EXE_FILES'	=> [ 'tkpod', 'tkmore' ],

	'dist' 		=> {'POSTOP'=>'-$(CHMOD) 644 $(DISTVNAME).tar$(SUFFIX)'},

	($eumm_recent_enough ?
          (ABSTRACT   => 'Pod browser widget for Tk',
           AUTHOR     => 'Slaven Rezic <srezic@cpan.org>',
	   META_MERGE => {
	    resources => { repository => 'git://github.com/eserte/tk-pod.git' },
	    optional_features => {
	      fulltext_search => {
		description => "Enable the full-text search",
		requires => {
		  'Text::English' => 0,
		},
	      },
	      nicer_gui => {
		description => "Provide a nicer GUI",
		requires => {
		  'Tk::HistEntry' => '0.4',
		  'Tk::ToolBar'   => 0,
		},
	      },
	      debugging => {
		description => "Debugging and development helper",
		requires => {
		  'Tk::WidgetDump' => 0,
		  'Module::Refresh' => 0,
		  'Devel::Hide' => 0,
		},
	      },
	      gzip_support => {
	        description => "gzip support in tkmore",
		requires => {
		  'PerlIO::gzip' => 0,
		},
	      },
	      external_links => {
	        description => "support for links using an external browser",
		requires => {
		  'URI::Escape' => 0,
		},
	      },
	    },
	  }) : ()),

);

# This rule ensures that we get UNKNOWN test results on Unix platforms
# if no X11 DISPLAY is available. This does not apply for cygwin/X11;
# the display test there is done in the test files using
# TkTest::display_test
sub MY::test_via_harness {
    my($self, $perl, $tests) = @_;
    qq{\t$perl "-It" "-MTkTest" }.
	qq{"-e" "check_display_test_harness(\$(TEST_VERBOSE), '\$(INST_LIB)', '\$(INST_ARCHLIB)')" $tests\n};
}

sub MY::postamble {
    my $postamble = <<'EOF';
demo :: pure_all
	$(FULLPERL) -w -Mblib $(INST_SCRIPT)$(DFSEP)tkpod -tree -nodebug

EOF

    if ($is_devel_host) {
	$postamble .= <<'EOF';

# Test::Distribution complains about Text::English (which is optional)
# and a number of Tk::* widgets which are part of Tk
#
# "use" fails if Text::English is not installed which is needed
# by Tk::Pod::Search_db (which is only optionally used)
#
# "version" automatically turns "use" on, so has to be turned off, too.
PERL_TEST_DISTRIBUTION_OPTS=not podcover,prereq,use,versions

.include "../../perl.release.mk"
.include "../../perl.git.mk"

update-WWWBrowser:
	perl -nle '\
	    BEGIN { print "# DO NOT EDIT\n# Created by the update-WWWBrowser makefile rule\n\n# DO NOT USE THIS MODULE IN YOUR PROJECTS\n# (That is, the module\047s code is OK, but don\047t rely on the package\n# name or the API of this module)" } \
	    s{package WWWBrowser}{package # hide from PAUSE indexer\n\tTk::Pod::WWWBrowser}; \
	    s{package Launcher::WWW}{package # hide from PAUSE indexer\n\tTk::Pod::Launcher::WWW}; \
	    if (m{#.*Forward compatibility}) { \
		$$skip_forward_compat++; \
	    } elsif ($$skip_forward_compat && m|^}|) { \
		$$skip_forward_compat = 0; next; \
	    } \
	    if (m{__END__}) { \
		$$do_not_print++; \
	    } \
	    print if (!$$do_not_print && !$$skip_forward_compat); \
	    ' \
	    < ../../perl/WWWBrowser/WWWBrowser.pm > Pod/WWWBrowser.pm~
	    perl -c Pod/WWWBrowser.pm~
	    mv Pod/WWWBrowser.pm~ Pod/WWWBrowser.pm

EOF
    }

    $postamble;
}