This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
MakeMaker is first-come in Maintainers.pl.
[perl5.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
GS
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
GS
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
GS
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();
37d29c6f
NC
46@$missentry
47 = grep {$_ !~ m!^\.git/! and $_ !~ m!(?:/|^)\.gitignore!} @$missentry;
3e3baf6d
TB
48warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
49warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
90248788
TB
50if ("@$missentry" =~ m/\.orig\b/) {
51 # Handy listing of find command and .orig files from patching work.
52 # I tend to run 'xargs rm' and copy and paste the file list.
53 my $cmd = "find . -name '*.orig' -print";
54 print "$cmd\n";
55 system($cmd);
56}
3e3baf6d 57die "Aborted.\n" if @$missentry or @$missfile;
08aa1457 58print "\n";
59
b59922b7 60# VMS no longer has hardcoded version numbers descrip.mms
48e117bb
GS
61
62print "Creating $relroot/$reldir release directory...\n";
63die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir";
64die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
65mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
66print "\n";
67
68
69print "Copying files to release directory...\n";
70# ExtUtils::Manifest maniread does not preserve the order
71$cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
86cd7d77
JH
72system($cmd) == 0
73 or die "$cmd failed";
48e117bb
GS
74print "\n";
75
6e24577b 76chdir "$relroot/$reldir" or die $!;
48e117bb 77
08aa1457 78print "Setting file permissions...\n";
bf955a65
GS
79system("find . -type f -print | xargs chmod 0444");
80system("find . -type d -print | xargs chmod 0755");
e619572c
JH
81system("find t ext lib -name '*.t' -print | xargs chmod +x");
82system("find t ext lib -name 'test.pl' -print | xargs chmod +x");
48e117bb 83my @exe = qw(
08aa1457 84 Configure
85 configpm
b907dc6d 86 configure.gnu
08aa1457 87 embed.pl
88 installperl
89 installman
90 keywords.pl
08aa1457 91 opcode.pl
08aa1457 92 t/TEST
08aa1457 93 *.SH
94 vms/ext/Stdio/test.pl
95 vms/ext/filespec.t
08aa1457 96 x2p/*.SH
bb304ec8
JH
97 Porting/findrfuncs
98 Porting/genlog
08aa1457 99 Porting/makerel
bb304ec8 100 Porting/*.pl
e619572c
JH
101 mpeix/nm
102 mpeix/relink
26e23ede
JH
103 Cross/generate_config_sh
104 Cross/warp
08aa1457 105);
86cd7d77
JH
106system("chmod +x @exe") == 0
107 or die "system: $!";
6e24577b 108
f7f713ed 109my @writables = qw(
f3513db0
JH
110 NetWare/config_H.wc
111 NetWare/Makefile
ac634a9a
JH
112 keywords.h
113 opcode.h
114 opnames.h
115 pp_proto.h
116 pp.sym
117 proto.h
f7f713ed
GS
118 embed.h
119 embedvar.h
f7f713ed 120 global.sym
e9e0c7d0
NC
121 overload.c
122 overload.h
ac634a9a
JH
123 pod/perlintern.pod
124 pod/perlapi.pod
e9e0c7d0 125 pod/perltoc.pod
ac634a9a
JH
126 perlapi.h
127 perlapi.c
0ff33da8
NC
128 ext/Devel-PPPort/module2.c
129 ext/Devel-PPPort/module3.c
e9e0c7d0
NC
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
JH
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
JH
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
GS
150my @crlf = qw(
151 djgpp/configure.bat
f3513db0 152 README.ce
48e117bb 153 README.dos
27da23d5 154 README.symbian
48e117bb 155 README.win32
27da23d5
JH
156 symbian/config.pl
157 symbian/makesis.pl
158 symbian/README
159 symbian/xsbuild.pl
48e117bb 160 win32/Makefile
f78a30ba
NC
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
GS
166 win32/makefile.mk
167);
86cd7d77
JH
168system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0
169 or die "system: $!";
08aa1457 170print "\n";
171
6e24577b
GS
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
JH
177system($cmd) == 0
178 or die "$cmd failed";
08aa1457 179print "\n";
180
181system("ls -ld $perl*");