Fix previous patch. Actually it's written PAREN, not PARENT.
[p5sagit/p5-mst-13.2.git] / Porting / makerel
CommitLineData
23b3bd7f 1#!/usr/bin/perl -w
08aa1457 2
3# A first attempt at some automated support for making a perl release.
4# Very basic but functional - if you're on a unix system.
08aa1457 5#
6# No matter how automated this gets, you'll always need to read
7# and re-read pumpkin.pod checking for things to be done at various
8# stages of the process.
9#
10# Tim Bunce, June 1997
11
12use ExtUtils::Manifest qw(fullcheck);
13
14$|=1;
15$relroot = ".."; # XXX make an option
16
17die "Must be in root of the perl source tree.\n"
18 unless -f "./MANIFEST" and -f "patchlevel.h";
19
3ffabb8c 20open PATCHLEVEL,"<patchlevel.h" or die;
21my @patchlevel_h = <PATCHLEVEL>;
22close PATCHLEVEL;
d4257220 23my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h;
08aa1457 24print $patchlevel_h;
93136620 25$revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/;
d4257220 26$patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/;
27$subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/;
55d729e4 28die "Unable to parse patchlevel.h" unless $subversion >= 0;
93136620 29$vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion);
08aa1457 30
3ffabb8c 31# fetch list of local patches
32my (@local_patches, @lpatch_tags, $lpatch_tags);
33@local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h;
34@local_patches = grep { !/^\s*,?NULL/ } @local_patches;
35@lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches;
36$lpatch_tags = join "-", @lpatch_tags;
37
2a7df08c 38$perl = "perl-$vers";
f27ffc4a 39$reldir = "$perl";
3ffabb8c 40$reldir .= "-$lpatch_tags" if $lpatch_tags;
08aa1457 41
f27ffc4a 42print "\nMaking a release for $perl in $relroot/$reldir\n\n";
08aa1457 43
08aa1457 44print "Cross-checking the MANIFEST...\n";
45($missfile, $missentry) = fullcheck();
3e3baf6d 46warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
47warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
90248788 48if ("@$missentry" =~ m/\.orig\b/) {
49 # Handy listing of find command and .orig files from patching work.
50 # I tend to run 'xargs rm' and copy and paste the file list.
51 my $cmd = "find . -name '*.orig' -print";
52 print "$cmd\n";
53 system($cmd);
54}
3e3baf6d 55die "Aborted.\n" if @$missentry or @$missfile;
08aa1457 56print "\n";
57
b59922b7 58# VMS no longer has hardcoded version numbers descrip.mms
48e117bb 59
60print "Creating $relroot/$reldir release directory...\n";
61die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir";
62die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
63mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
64print "\n";
65
66
67print "Copying files to release directory...\n";
68# ExtUtils::Manifest maniread does not preserve the order
69$cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
86cd7d77 70system($cmd) == 0
71 or die "$cmd failed";
48e117bb 72print "\n";
73
6e24577b 74chdir "$relroot/$reldir" or die $!;
48e117bb 75
08aa1457 76print "Setting file permissions...\n";
bf955a65 77system("find . -type f -print | xargs chmod 0444");
78system("find . -type d -print | xargs chmod 0755");
e619572c 79system("find t ext lib -name '*.t' -print | xargs chmod +x");
80system("find t ext lib -name 'test.pl' -print | xargs chmod +x");
48e117bb 81my @exe = qw(
08aa1457 82 Configure
83 configpm
b907dc6d 84 configure.gnu
08aa1457 85 embed.pl
86 installperl
87 installman
88 keywords.pl
08aa1457 89 opcode.pl
08aa1457 90 t/TEST
08aa1457 91 *.SH
92 vms/ext/Stdio/test.pl
93 vms/ext/filespec.t
08aa1457 94 x2p/*.SH
bb304ec8 95 Porting/findrfuncs
96 Porting/genlog
08aa1457 97 Porting/makerel
a619eb9e 98 Porting/p4genpatch
bb304ec8 99 Porting/patchls
100 Porting/*.pl
e619572c 101 mpeix/nm
102 mpeix/relink
26e23ede 103 Cross/generate_config_sh
104 Cross/warp
08aa1457 105);
86cd7d77 106system("chmod +x @exe") == 0
107 or die "system: $!";
6e24577b 108
f7f713ed 109my @writables = qw(
f3513db0 110 NetWare/config_H.wc
111 NetWare/Makefile
ac634a9a 112 keywords.h
113 opcode.h
114 opnames.h
115 pp_proto.h
116 pp.sym
117 proto.h
f7f713ed 118 embed.h
119 embedvar.h
f7f713ed 120 global.sym
e9e0c7d0 121 overload.c
122 overload.h
ac634a9a 123 pod/perlintern.pod
124 pod/perlapi.pod
e9e0c7d0 125 pod/perltoc.pod
ac634a9a 126 perlapi.h
127 perlapi.c
0ff33da8 128 ext/Devel-PPPort/module2.c
129 ext/Devel-PPPort/module3.c
e9e0c7d0 130 reentr.c
131 reentr.h
132 regcharclass.h
f7f713ed 133 regnodes.h
0ebdc6d5 134 warnings.h
ac634a9a 135 lib/warnings.pm
ac634a9a 136 win32/Makefile
f78a30ba 137 win32/Makefile.ce
ac634a9a 138 win32/makefile.mk
139 win32/config_H.bc
f29c64d6 140 win32/config_H.gc
f7f713ed 141 win32/config_H.vc
61190116 142 utils/Makefile
18b94d96 143 uconfig.h
f7f713ed 144);
86cd7d77 145system("chmod +w @writables") == 0
146 or die "system: $!";
f7f713ed 147
6e24577b 148print "Adding CRs to DOSish files...\n";
27da23d5 149# This list is also in curliff.pl.
48e117bb 150my @crlf = qw(
151 djgpp/configure.bat
f3513db0 152 README.ce
48e117bb 153 README.dos
27da23d5 154 README.symbian
48e117bb 155 README.win32
27da23d5 156 symbian/config.pl
157 symbian/makesis.pl
158 symbian/README
159 symbian/xsbuild.pl
48e117bb 160 win32/Makefile
f78a30ba 161 win32/Makefile.ce
162 win32/ce-helpers/compile-all.bat
163 win32/ce-helpers/compile.bat
164 win32/ce-helpers/registry.bat
165 win32/distclean.bat
48e117bb 166 win32/makefile.mk
167);
86cd7d77 168system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0
169 or die "system: $!";
08aa1457 170print "\n";
171
6e24577b 172chdir ".." or die $!;
173
08aa1457 174print "Creating and compressing the tar file...\n";
f27ffc4a 175my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
3ffabb8c 176$cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
86cd7d77 177system($cmd) == 0
178 or die "$cmd failed";
08aa1457 179print "\n";
180
181system("ls -ld $perl*");