repair screenrc fuer analysis2022
[andk-cpan-tools.git] / Makefile.PL
blob6610050c91cdb513c049966eebc9e601414c969f
1 #!/usr/bin/perl -w -*- mode: cperl -*-
2 use strict;
3 use vars qw( $VERSION @ST_PREFS );
4 BEGIN {$CPAN::Config_loaded=1}
5 BEGIN {$CPAN::Config_loaded=1} # keep old perls with -w quiet
6 use ExtUtils::MakeMaker qw(:DEFAULT);
7 use File::Path;
8 eval { require File::Spec; };
9 my $HAVE_FILE_SPEC = !$@;
10 eval { require YAML::Syck; };
11 my $HAVE_YAML_SYCK = !$@;
12 use File::Basename qw(basename);
13 require Config;
14 my $HAVE_MAKE = basename($Config::Config{make}) eq "make"; # file-scoped!
16 @ST_PREFS = qw(
20 my $Id = q$Id: Makefile.PL 146 2005-08-09 04:25:21Z k $;
21 $VERSION = sprintf "%.3f", 1 + substr(q$Rev: 146 $,4)/1000;
23 my $version_diff = 0; # we'll have to die if this becomes true
25 local $^W;
26 $ExtUtils::MakeMaker::VERSION = eval $ExtUtils::MakeMaker::VERSION;
28 $main::SVN_RELEASE = 0;
29 if (-d ".svn") {
30 $main::SVN_RELEASE = 1;
31 } elsif ($ARGV[0] && $ARGV[0] =~ /setversion/) {
32 warn "!!!making release without .svn??? Take care!!!";
33 @ARGV = ();
34 sleep 2;
36 if ($HAVE_FILE_SPEC) {
37 my $version_set_manually = 1; # not by SVN
39 if ($ARGV[0] && $ARGV[0] eq "--setversion") {
40 die "Your perl is a bit dated[$]].\nDo not make a release with it\n" if $] < 5.008;
41 die "Your MakeMaker is a bit dated[$ExtUtils::MakeMaker::VERSION].\nDo not make a release with it\n"
42 if $ExtUtils::MakeMaker::VERSION < 6.4502;
43 die "Your MakeMaker doesn't do the sign woodoo" unless
44 MM->can("signature_target");
45 shift @ARGV;
46 my $st;
47 local $ENV{LANG} = "C";
48 open $st, "svn st -u|" or die;
49 my $dirty = 0;
50 while (<$st>) {
51 next if /^\?/;
52 next if /^Head revision:/;
53 next if /^Status against revision:/;
54 print;
55 $dirty++;
57 close $st;
58 die "Not everything checked in or out?" if $dirty;
60 # $re parses the upper boundary of the output of svnversion
61 my $re;
62 eval q{ $re = qr/(?:\d+:)?(\d+)[SM]*$/; };
63 die $@ if $@; # old perl
64 exit unless $version_diff;
68 # for 5.004_05 I installed all of them manually despite errors;
69 # version hints as of 2006-02
70 my $prereq_pm = {
71 'File::Spec' => 0, # KWILLIAMS; requires
72 # Scalar::Util;
73 # PathTools-3.16.tar.gz
74 'File::Temp' => 0, # TJENNESS; requires Test::More;
75 'Scalar::Util' => 0, # GBARR;
76 # Scalar-List-Utils-1.18.tar.gz;
77 'Test::Harness' => 2.62,
78 'Test::More' => 0, # MSCHWERN;
79 # Test-Simple-0.62.tar.gz;
81 if ($^O eq "darwin") {
82 $prereq_pm->{'File::HomeDir'} = 0.69;
85 my @sign = (MM->can("signature_target") ? (SIGN => 1) : ());
86 # warn "sign[@sign]";
87 WriteMakefile(
88 INSTALLDIRS => 'perl', # as it is coming with perl
89 NAME => 'CPAN',
90 VERSION => "0.0.1",
91 EXE_FILES => [qw(scripts/cpan)],
92 PREREQ_PM => $prereq_pm,
93 ($ExtUtils::MakeMaker::VERSION >= 6.3002 ?
94 (LICENSE => "perl") : (),
96 clean => {
97 FILES => "lib/CPAN/Config.pm t/dot-cpan/FTPstats.yml",
99 @sign,
100 ($] >= 5.005 ?
102 # ABSTRACT_FROM => 'lib/CPAN.pm', # retrieve abstract from module
103 AUTHOR => 'Andreas Koenig <andreas.koenig.gmwojprw@franz.ak.mind.de>') : (),
105 dist => {
106 DIST_DEFAULT => join(" ", # note: order matters!
107 "verify-no-subdir",
108 "verify-changes-date",
109 "verify-changes-version",
110 "kwalify-distroprefs",
111 "dd-prefs",
112 "Makefile",
113 "no_CR",
114 "META.yml",
115 "setversion",
116 "README",
117 "testdistros",
118 "all",
119 "chlog",
120 "tardist",
122 COMPRESS => 'gzip -9',
124 # I took it from RT-CPAN ticket 30098:
125 ($ExtUtils::MakeMaker::VERSION >= 6.4502 ?
126 (META_ADD => {
127 repository => "git://github.com/andk/cpanpm.git",
128 }) : ()),
131 if ($version_diff){
132 die "
133 ==> I had to update some \$VERSIONs <==
134 ==> Your Makefile has been rebuilt. <==
135 ==> Please rerun the make command. <==
139 package MY;
141 sub macro {
142 my @m = q{
144 LC_ALL_noexport=en_GB.utf8
146 ALL_PERLS = /usr/bin/perl \
147 /usr/local/bin/perl \
148 /usr/local/perl-5.004_05/bin/perl \
149 /usr/local/perl-5.005_04/bin/perl \
150 /usr/local/perl-5.6.2/bin/perl \
151 /usr/local/perl-5.8.0/bin/perl \
152 /usr/local/perl-5.8.4/bin/perl \
155 # not sorted because order matters
156 MEGA_BASE = \
157 Bundle::CPANxxl \
158 CPAN::DistnameInfo \
159 DBD::SQLite \
160 Test::Simple \
161 /home/src/perl/tk/SVN/. \
162 /home/src/graphics/magick/ImageMagick-6.3.5/PerlMagick/. \
165 # define a random one
166 MEGA_XML=logs/megainstall.20070412T1450.d/RJRAY!RPC-XML-0.59.xml
168 YAML_MODULE=YAML::Syck
170 my $mylang;
171 my %map = map {($_ => 1)} qw(en_US.utf8 en_US.UTF-8);
172 open my $fh, "locale -a|" or die;
173 while (<$fh>){
174 chomp;
175 if (exists $map{$_}){
176 $mylang = $_;
177 last;
180 $mylang ||= "C";
181 push @m, qq{
182 MYLANG = $mylang
184 return join "", @m;
187 sub postamble {
188 return "" unless $HAVE_MAKE; # dmake has unknown issues with my Makefile
189 my @m;
190 push @m, q{
191 .SUFFIXES: .rnc .rng
193 .rnc.rng:
194 trang -I rnc -O rng $*.rnc $*.rng
196 Makefile: Makefile.PL
198 svn-update:
199 svn up
201 update: svn-update dd-prefs
203 mega-validate: bin/colorout-to-dir.rng
204 xmllint -relaxng bin/colorout-to-dir.rng -noout $(MEGA_XML)
206 # the subdirs on MY OWN BOX are allowed here (only used for make dist!)
207 OKDIRS=CPAN|DIST|bin|blib|cover_db|\
208 distroprefs|eg|inc|lib|logs|patches|perlbug|\
209 protocols|related|release-lib|scripts|t|talks
211 verify-no-subdir:
212 @$(PERL) -e 'my$$s=join",",grep{!/^($(OKDIRS))\z/x&&-d($$_)}glob"*";' \
213 -e 'die"unexpected dir:$$s"if$$s'
215 verify-changes-date:
216 @$(PERL) -ne 'BEGIN{my@t=(localtime)[5,4,3];$$t[0]+=1900;$$t[1]++;$$t=sprintf"%04d-%02d-%02d",@t}' \
217 -e '$$ok++,exit if /^$$t\s/; END{die "Alert: did not find <$$t> in Changes file" unless $$ok}' Changes
219 verify-changes-version:
220 @$(PERL) -ne '$$ok++,exit if /\b$(VERSION)\b/; END{die "Alert: did not find <$(VERSION)> in Changes file" unless $$ok}' Changes
222 kwalify-distroprefs:
223 `echo $(PERL) | sed -e 's/perl$$/slaymake/'` validate
225 setversion:
226 $(PERL) Makefile.PL --setversion
228 # http://ch.tudelft.nl/~arthur/svn2cl/
229 chlog-trad : ChangeLogTrad.svn
230 ChangeLogTrad.svn : Makefile lib/CPAN.pm MANIFEST
231 -/home/src/devel/svn/svn2cl/svn2cl-current/svn2cl.sh --strip-prefix trunk --group-by-day --stdout -r HEAD:2000 https://pause.perl.org:5460/svn/cpanpm/trunk > $@
233 # for debugging
234 chlog-xml :
235 svn log --xml --verbose > ChangeLog.xml
237 the-release-name :
238 $(NOECHO) $(ECHO) 'version ' $(VERSION)
239 $(NOECHO) $(ECHO) 'release-name ' $(DISTVNAME).tar$(SUFFIX)
241 release ::
242 /usr/bin/perl -Irelease-lib -S release $(DISTVNAME).tar$(SUFFIX)
243 rm -rf $(DISTVNAME)
244 svn cp -m 'This is $(VERSION)' https://pause.perl.org:5460/svn/cpanpm/trunk https://pause.perl.org:5460/svn/cpanpm/tags/$(VERSION)
246 showmylang:
247 echo LANG=$(MYLANG)
249 # 16=Distribution; 1024=Shell; 32768=Queue
250 # $$CPAN::DEBUG|=16;$$CPAN::DEBUG|=1024;$$CPAN::DEBUG|=32768;
251 megainstall: logs/.exists
252 for DATE in `date +%Y%m%dT%H%M`; do \
253 nohup $(PERL) -Ilib -MCPAN -e 'install(qw(Term::ReadKey))' < /dev/null > logs/megainstall.$$DATE.out 2>&1; \
254 LANG=$(MYLANG) $(PERL) -Ilib -MCPAN -MPOSIX -e 'sub intime {POSIX::strftime("%FT%T",localtime()) lt "2008-09-30T23:59:59"}; \
255 CPAN::HandleConfig->load; \
256 open FH, "megainstall.txt" or die; chomp(@MEGA = grep {!/^#/} <FH>); \
257 install(grep {!m[/]||-e$$_} qw($(MEGA_BASE))); \
258 CPAN::Shell->reload("cpan"); \
259 install(map {$$_->[0]} sort {$$a->[1]<=>$$b->[1]} map {[$$_,rand(1)]} @MEGA); \
260 CPAN::Shell->failed' >> logs/megainstall.$$DATE.out 2>&1; \
261 $(PERL) bin/colorout-to-dir-2.pl logs/megainstall.$$DATE.out; \
262 `pwd`/bin/dir-to-jifty.pl logs; \
263 done
265 # 16=Distribution; 32=Bundle; 32768=Queue
266 depefails:
267 $(PERL) -Ilib -MCPAN -e 'CPAN::HandleConfig->load;$$CPAN::DEBUG|=16;$$CPAN::DEBUG|=32;$$CPAN::DEBUG|=32768;install(qw(CPAN::Test::Dummy::Perl5::Build::DepeFails));'
269 logs/.exists :
270 mkdir -p logs
271 touch $@
273 run :
274 $(PERL) -MCPAN -eshell
276 run_testenv_db :
277 $(PERL) -Ilib -It -MCPAN::MyConfig -MCPAN -deshell
279 record-session :
280 $(PERL) -Ilib -MCPAN -e '$$CPAN::Suppress_readline=$$CPAN::Echo_readline=1;shell' | tee ttt.out
282 run-with-sqlite :
283 $(PERL) -I$$HOME/.cpan -Ilib -MCPAN::SQLite -MCPAN::MyConfig -MCPAN -e '$$CPAN::Config->{use_sqlite}++; $$CPAN::Config->{sqlite_dbname}="cpandb-sqlite"; shell'
285 testrun_very_offline : rm_mirrored_by run_emu_offline
287 testrun_emu_offline :
288 $(PERL) -I$$HOME/.cpan -Ilib -MCPAN::MyConfig -MCPAN -e '@CPAN::Defaultsites = qw(file:///dev/null); $$CPAN::Config->{urllist} = []; shell'
290 rm_mirrored_by :
291 rm -f $$HOME/.cpan/sources/MIRRORED.BY*
293 testrun_http_only :
294 $(PERL) -I$$HOME/.cpan -Ilib -MCPAN::MyConfig -MCPAN -e '$$CPAN::Config->{urllist} = [qw(http://www.planet-elektronik.de/CPAN/)]; shell'
296 urllist :
297 $(PERL) -Ilib -MCPAN -MCPAN::FirstTime -e 'CPAN::FirstTime::init("$$ENV{HOME}/.cpan/CPAN/MyConfig", args => [qw(urllist)])'
299 runadmin :
300 $(PERL) -Ilib -MCPAN::Admin -eshell
302 rundb :
303 $(PERL) -Ilib -MCPAN -deshell
305 sign:
306 cpansign -s
308 show-batch-signing-keys:
309 for f in PAUSE*.pub; do echo "++++$$f++++"; gpg --verbose --with-colons $$f; done
311 show-imported:
312 gpg --list-sigs --with-colons 450F89EC
314 # seems to need at least gnupg 1.4.2:
315 upload-batch-signing-key:
316 gpg --send-key 450F89EC
318 diff::
319 svn diff | less
321 mymirmon:
322 $(PERL) bin/mymirmon
324 howto-release:
325 @$(ECHO) make ci dist \&\& make release
327 META.yml: metafile
328 $(CP) $(DISTVNAME)/META.yml ./META.yml
330 install-devel-cover-unless-uptodate:
331 $(PERL) -Ilib -MCPAN -e 'CPAN::Shell->install("/home/src/perl/devel-cover/SVN/.") unless CPAN::Shell->expand("Module","Devel::Cover")->uptodate'
333 install-devel-cover-unconditionally:
334 $(PERL) -Ilib -MCPAN -e 'CPAN::Shell->install("/home/src/perl/devel-cover/SVN/.")'
336 testcover: testdistros install-devel-cover-unless-uptodate
337 :>SIGNATURE
338 $(PERL) -MDevel::Cover -e 0
339 `dirname $(PERL)`/cover -delete
340 HARNESS_PERL_SWITCHES=-MDevel::Cover $(MAKE) test
341 `dirname $(PERL)`/cover
343 man:
344 $(PERL)doc -F lib/CPAN.pm
346 testallperls :
347 :>SIGNATURE
348 for p in $(ALL_PERLS); do $$p -v && $$p Makefile.PL && $(MAKE) test; done
350 clean ::
351 $(RM) t/CPAN/authors/id/A/AN/ANDK/*/Build \
352 t/CPAN/authors/id/A/AN/ANDK/*/Makefile.old
353 $(RM_RF) t/CPAN/authors/id/A/AN/ANDK/*/_build
355 no_CR : ChangeLog META.yml
356 $(PERL) bin/no_CR.pl MANIFEST
358 foreign-prefs : dd-prefs st-prefs
360 dd-prefs ::
361 `echo $(PERL) | sed -e 's/perl$$/slaymake/'` dd-prefs
363 st-prefs ::
366 if ($main::SVN_RELEASE) {
367 push @m, qq{
368 chlog :: chlog-trad
370 ChangeLog : ChangeLogTrad.svn
371 \$(CP) ChangeLogTrad.svn ChangeLog
373 } else {
374 push @m, qq{
375 chlog ::
380 for my $base (@main::ST_PREFS) {
381 push @m, qq{
382 st-prefs :: $base.st
385 if ($HAVE_YAML_SYCK) {
386 push @m, qq{$base.st : Makefile
387 \$(PERL) -MYAML::Syck=LoadFile -MStorable=nstore -e '\$\$x=shift; \@y=LoadFile("\$\$x.yml"); nstore(\\\@y, "\$\$x.st")' $base
393 join "", @m;
396 sub dist_ci {
397 return qq{ci :
398 svn ci
402 sub dist_test {
403 return q{
404 # if we depend on $(DISTVNAME).tar$(SUFFIX), then the rest of the
405 # Makefile breaks our intent to NOT remake dist
406 disttest :
407 rm -rf $(DISTVNAME)
408 tar xvzf $(DISTVNAME).tar$(SUFFIX)
409 cd $(DISTVNAME) && $(ABSPERLRUN) Makefile.PL
410 cd $(DISTVNAME) && $(MAKE) $(PASTHRU)
411 cd $(DISTVNAME) && $(MAKE) test $(PASTHRU)
413 distdir ::
414 touch $(DISTVNAME)/SIGNATURE && $(CP) $(DISTVNAME)/SIGNATURE ./SIGNATURE
415 $(CP) $(DISTVNAME)/META.yml ./META.yml
416 $(CP) $(DISTVNAME)/MANIFEST ./MANIFEST
421 sub distdir {
422 my $self = shift;
423 my $out = $self->SUPER::distdir;
424 $out =~ s/distdir :/distdir ::/g;
425 return $out;
428 # dist_dir was the name in very old MakeMaker as of 5.005_04
429 sub dist_dir {
430 my $self = shift;
431 my $out = $self->SUPER::dist_dir;
432 $out =~ s/distdir :/distdir ::/g;
433 return $out;