minor updates to release_managers_guide.pod
[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);
5f244db9 13$ExtUtils::Manifest::Quiet = 1;
14use Getopt::Std;
08aa1457 15
16$|=1;
5f244db9 17
18sub usage { die <<EOF; }
19usage: $0 [ -r rootdir ] [-s suffix ]
20 -r rootdir directory under which to create the build dir and tarball
21 defaults to '..'
22 -s suffix suffix to append to to the perl-x.y.z dir and tarball name
23 defaults to the concatenaion of the local_patches entry
24 in patchlevel.h (or blank, if none)
25EOF
26
27my %opts;
28getopts('r:s:', \%opts) or usage;
29@ARGV && usage;
30
31$relroot = defined $opts{r} ? $opts{r} : "..";
08aa1457 32
33die "Must be in root of the perl source tree.\n"
34 unless -f "./MANIFEST" and -f "patchlevel.h";
35
3ffabb8c 36open PATCHLEVEL,"<patchlevel.h" or die;
37my @patchlevel_h = <PATCHLEVEL>;
38close PATCHLEVEL;
d4257220 39my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h;
08aa1457 40print $patchlevel_h;
93136620 41$revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/;
d4257220 42$patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/;
43$subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/;
55d729e4 44die "Unable to parse patchlevel.h" unless $subversion >= 0;
93136620 45$vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion);
08aa1457 46
3ffabb8c 47# fetch list of local patches
48my (@local_patches, @lpatch_tags, $lpatch_tags);
49@local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h;
50@local_patches = grep { !/^\s*,?NULL/ } @local_patches;
51@lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches;
52$lpatch_tags = join "-", @lpatch_tags;
53
2a7df08c 54$perl = "perl-$vers";
f27ffc4a 55$reldir = "$perl";
5f244db9 56
57$lpatch_tags = $opts{s} if defined $opts{s};
3ffabb8c 58$reldir .= "-$lpatch_tags" if $lpatch_tags;
08aa1457 59
f27ffc4a 60print "\nMaking a release for $perl in $relroot/$reldir\n\n";
08aa1457 61
08aa1457 62print "Cross-checking the MANIFEST...\n";
63($missfile, $missentry) = fullcheck();
37d29c6f 64@$missentry
65 = grep {$_ !~ m!^\.git/! and $_ !~ m!(?:/|^)\.gitignore!} @$missentry;
3e3baf6d 66warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
67warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
90248788 68if ("@$missentry" =~ m/\.orig\b/) {
69 # Handy listing of find command and .orig files from patching work.
70 # I tend to run 'xargs rm' and copy and paste the file list.
71 my $cmd = "find . -name '*.orig' -print";
72 print "$cmd\n";
73 system($cmd);
74}
3e3baf6d 75die "Aborted.\n" if @$missentry or @$missfile;
08aa1457 76print "\n";
77
b59922b7 78# VMS no longer has hardcoded version numbers descrip.mms
48e117bb 79
80print "Creating $relroot/$reldir release directory...\n";
81die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir";
82die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
83mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
84print "\n";
85
86
87print "Copying files to release directory...\n";
88# ExtUtils::Manifest maniread does not preserve the order
89$cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
86cd7d77 90system($cmd) == 0
91 or die "$cmd failed";
48e117bb 92print "\n";
93
6e24577b 94chdir "$relroot/$reldir" or die $!;
48e117bb 95
08aa1457 96print "Setting file permissions...\n";
bf955a65 97system("find . -type f -print | xargs chmod 0444");
98system("find . -type d -print | xargs chmod 0755");
e619572c 99system("find t ext lib -name '*.t' -print | xargs chmod +x");
100system("find t ext lib -name 'test.pl' -print | xargs chmod +x");
48e117bb 101my @exe = qw(
08aa1457 102 Configure
103 configpm
b907dc6d 104 configure.gnu
08aa1457 105 embed.pl
106 installperl
107 installman
108 keywords.pl
08aa1457 109 opcode.pl
08aa1457 110 t/TEST
08aa1457 111 *.SH
112 vms/ext/Stdio/test.pl
113 vms/ext/filespec.t
08aa1457 114 x2p/*.SH
bb304ec8 115 Porting/findrfuncs
116 Porting/genlog
08aa1457 117 Porting/makerel
bb304ec8 118 Porting/*.pl
e619572c 119 mpeix/nm
120 mpeix/relink
26e23ede 121 Cross/generate_config_sh
122 Cross/warp
08aa1457 123);
86cd7d77 124system("chmod +x @exe") == 0
125 or die "system: $!";
6e24577b 126
f7f713ed 127my @writables = qw(
f3513db0 128 NetWare/config_H.wc
129 NetWare/Makefile
ac634a9a 130 keywords.h
131 opcode.h
132 opnames.h
133 pp_proto.h
134 pp.sym
135 proto.h
f7f713ed 136 embed.h
137 embedvar.h
f7f713ed 138 global.sym
e9e0c7d0 139 overload.c
140 overload.h
ac634a9a 141 perlapi.h
142 perlapi.c
0ff33da8 143 ext/Devel-PPPort/module2.c
144 ext/Devel-PPPort/module3.c
e9e0c7d0 145 reentr.c
146 reentr.h
147 regcharclass.h
f7f713ed 148 regnodes.h
0ebdc6d5 149 warnings.h
ac634a9a 150 lib/warnings.pm
ac634a9a 151 win32/Makefile
f78a30ba 152 win32/Makefile.ce
ac634a9a 153 win32/makefile.mk
154 win32/config_H.bc
f29c64d6 155 win32/config_H.gc
f7f713ed 156 win32/config_H.vc
61190116 157 utils/Makefile
18b94d96 158 uconfig.h
f7f713ed 159);
86cd7d77 160system("chmod +w @writables") == 0
161 or die "system: $!";
f7f713ed 162
6e24577b 163print "Adding CRs to DOSish files...\n";
27da23d5 164# This list is also in curliff.pl.
48e117bb 165my @crlf = qw(
166 djgpp/configure.bat
f3513db0 167 README.ce
48e117bb 168 README.dos
27da23d5 169 README.symbian
48e117bb 170 README.win32
27da23d5 171 symbian/config.pl
172 symbian/makesis.pl
173 symbian/README
174 symbian/xsbuild.pl
48e117bb 175 win32/Makefile
f78a30ba 176 win32/Makefile.ce
177 win32/ce-helpers/compile-all.bat
178 win32/ce-helpers/compile.bat
179 win32/ce-helpers/registry.bat
180 win32/distclean.bat
48e117bb 181 win32/makefile.mk
182);
86cd7d77 183system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0
184 or die "system: $!";
08aa1457 185print "\n";
186
6e24577b 187chdir ".." or die $!;
188
08aa1457 189print "Creating and compressing the tar file...\n";
f27ffc4a 190my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
3ffabb8c 191$cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
86cd7d77 192system($cmd) == 0
193 or die "$cmd failed";
08aa1457 194print "\n";
195
196system("ls -ld $perl*");