Some escapes were mentioned twice, although they're not qr//-specific
[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
ac634a9a 121 pod/perlintern.pod
122 pod/perlapi.pod
ac634a9a 123 perlapi.h
124 perlapi.c
ac634a9a 125 ext/B/B/Asmdata.pm
799d3a59 126 ext/Devel/PPPort/PPPort.xs
127 ext/Devel/PPPort/module2.c
128 ext/Devel/PPPort/module3.c
f7f713ed 129 regnodes.h
0ebdc6d5 130 warnings.h
ac634a9a 131 lib/warnings.pm
ac634a9a 132 win32/Makefile
f78a30ba 133 win32/Makefile.ce
ac634a9a 134 win32/makefile.mk
135 win32/config_H.bc
f29c64d6 136 win32/config_H.gc
f7f713ed 137 win32/config_H.vc
138);
86cd7d77 139system("chmod +w @writables") == 0
140 or die "system: $!";
f7f713ed 141
6e24577b 142print "Adding CRs to DOSish files...\n";
27da23d5 143# This list is also in curliff.pl.
48e117bb 144my @crlf = qw(
145 djgpp/configure.bat
f3513db0 146 README.ce
48e117bb 147 README.dos
27da23d5 148 README.symbian
48e117bb 149 README.win32
27da23d5 150 symbian/config.pl
151 symbian/makesis.pl
152 symbian/README
153 symbian/xsbuild.pl
48e117bb 154 win32/Makefile
f78a30ba 155 win32/Makefile.ce
156 win32/ce-helpers/compile-all.bat
157 win32/ce-helpers/compile.bat
158 win32/ce-helpers/registry.bat
159 win32/distclean.bat
48e117bb 160 win32/makefile.mk
161);
86cd7d77 162system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0
163 or die "system: $!";
08aa1457 164print "\n";
165
6e24577b 166chdir ".." or die $!;
167
08aa1457 168print "Creating and compressing the tar file...\n";
f27ffc4a 169my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
3ffabb8c 170$cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
86cd7d77 171system($cmd) == 0
172 or die "$cmd failed";
08aa1457 173print "\n";
174
175system("ls -ld $perl*");