This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove atomic.h pending resolution of licensing issues,
[perl5.git] / Porting / makerel
CommitLineData
08aa1457
PP
1#!/bin/env perl -w
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
PP
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
20$patchlevel_h = `grep '#define ' patchlevel.h`;
21print $patchlevel_h;
22$patchlevel = $1 if $patchlevel_h =~ /PATCHLEVEL\s+(\d+)/;
23$subversion = $1 if $patchlevel_h =~ /SUBVERSION\s+(\d+)/;
55d729e4 24die "Unable to parse patchlevel.h" unless $subversion >= 0;
08aa1457 25$vers = sprintf("5.%03d", $patchlevel);
55d729e4
GS
26$vms_vers = sprintf("5_%03d", $patchlevel);
27if ($subversion) {
28 $vers.= sprintf( "_%02d", $subversion);
29 $vms_vers.= sprintf( "%02d", $subversion);
30} else {
31 $vms_vers.= " ";
32}
08aa1457
PP
33
34$perl = "perl$vers";
f27ffc4a 35$reldir = "$perl";
fb73857a 36$reldir .= "-$ARGV[0]" if $ARGV[0];
08aa1457 37
f27ffc4a 38print "\nMaking a release for $perl in $relroot/$reldir\n\n";
08aa1457
PP
39
40
41print "Cross-checking the MANIFEST...\n";
42($missfile, $missentry) = fullcheck();
3e3baf6d
TB
43warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
44warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
90248788
TB
45if ("@$missentry" =~ m/\.orig\b/) {
46 # Handy listing of find command and .orig files from patching work.
47 # I tend to run 'xargs rm' and copy and paste the file list.
48 my $cmd = "find . -name '*.orig' -print";
49 print "$cmd\n";
50 system($cmd);
51}
3e3baf6d 52die "Aborted.\n" if @$missentry or @$missfile;
08aa1457
PP
53print "\n";
54
55
55d729e4
GS
56print "Updating VMS version specific files with $vms_vers...\n";
57system("perl -pi -e 's/^\QPERL_VERSION = \E\d\_\d+(\s*\#)/PERL_VERSION = $vms_vers$1/' vms/descrip.mms");
58
59
08aa1457 60print "Setting file permissions...\n";
fb73857a
PP
61system("find . -type f -print | xargs chmod -w");
62system("find . -type d -print | xargs chmod g-s");
63system("find t -name '*.t' -print | xargs chmod +x");
08aa1457
PP
64system("chmod +w configure"); # special case (see pumpkin.pod)
65@exe = qw(
66 Configure
67 configpm
68 configure
69 embed.pl
70 installperl
71 installman
72 keywords.pl
73 myconfig
74 opcode.pl
75 perly.fixer
76 t/TEST
77 t/*/*.t
78 *.SH
79 vms/ext/Stdio/test.pl
80 vms/ext/filespec.t
81 vms/fndvers.com
82 x2p/*.SH
83 Porting/patchls
84 Porting/makerel
85);
86system("chmod +x @exe");
87print "\n";
88
89
f27ffc4a
GS
90print "Creating $relroot/$reldir release directory...\n";
91die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir";
92die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
93mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
08aa1457
PP
94print "\n";
95
96
97print "Copying files to release directory...\n";
98# ExtUtils::Manifest maniread does not preserve the order
f27ffc4a 99$cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
08aa1457
PP
100system($cmd) == 0 or die "$cmd failed";
101print "\n";
102
103chdir $relroot or die $!;
104
105print "Creating and compressing the tar file...\n";
f27ffc4a
GS
106my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
107$cmd = "tar cf - $reldir | gzip --best > $perl.tar.gz";
08aa1457
PP
108system($cmd) == 0 or die "$cmd failed";
109print "\n";
110
111system("ls -ld $perl*");