This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: [PATCH] perlreguts.pod: use the unicode name for ß and show the codepoint
[perl5.git] / Porting / makerel
1 #!/usr/bin/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.
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
12 use ExtUtils::Manifest qw(fullcheck);
13
14 $|=1;
15 $relroot = "..";        # XXX make an option
16
17 die "Must be in root of the perl source tree.\n"
18         unless -f "./MANIFEST" and -f "patchlevel.h";
19
20 open PATCHLEVEL,"<patchlevel.h" or die;
21 my @patchlevel_h = <PATCHLEVEL>;
22 close PATCHLEVEL;
23 my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h;
24 print $patchlevel_h;
25 $revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/;
26 $patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/;
27 $subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/;
28 die "Unable to parse patchlevel.h" unless $subversion >= 0;
29 $vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion);
30
31 # fetch list of local patches
32 my (@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
38 $perl = "perl-$vers";
39 $reldir = "$perl";
40 $reldir .= "-$lpatch_tags" if $lpatch_tags;
41
42 print "\nMaking a release for $perl in $relroot/$reldir\n\n";
43
44 print "Cross-checking the MANIFEST...\n";
45 ($missfile, $missentry) = fullcheck();
46 warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
47 warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
48 if ("@$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 }
55 die "Aborted.\n" if @$missentry or @$missfile;
56 print "\n";
57
58 # VMS no longer has hardcoded version numbers descrip.mms
59
60 print "Creating $relroot/$reldir release directory...\n";
61 die "$relroot/$reldir release directory already exists\n"   if -e "$relroot/$reldir";
62 die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
63 mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
64 print "\n";
65
66
67 print "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";
70 system($cmd) == 0
71     or die "$cmd failed";
72 print "\n";
73
74 chdir "$relroot/$reldir" or die $!;
75
76 print "Setting file permissions...\n";
77 system("find . -type f -print     | xargs chmod 0444");
78 system("find . -type d -print     | xargs chmod 0755");
79 system("find t ext lib -name '*.t'     -print | xargs chmod +x");
80 system("find t ext lib -name 'test.pl' -print | xargs chmod +x");
81 my @exe = qw(
82     Configure
83     configpm
84     configure.gnu
85     embed.pl
86     installperl
87     installman
88     keywords.pl
89     opcode.pl
90     t/TEST
91     *.SH
92     vms/ext/Stdio/test.pl
93     vms/ext/filespec.t
94     x2p/*.SH
95     Porting/findrfuncs
96     Porting/genlog
97     Porting/makerel
98     Porting/p4genpatch
99     Porting/patchls
100     Porting/*.pl
101     mpeix/nm
102     mpeix/relink
103     Cross/generate_config_sh
104     Cross/warp
105 );
106 system("chmod +x @exe") == 0
107     or die "system: $!";
108
109 my @writables = qw(
110     NetWare/config_H.wc
111     NetWare/Makefile
112     keywords.h
113     opcode.h
114     opnames.h
115     pp_proto.h
116     pp.sym
117     proto.h
118     embed.h
119     embedvar.h
120     global.sym
121     pod/perlintern.pod
122     pod/perlapi.pod
123     perlapi.h
124     perlapi.c
125     ext/B/B/Asmdata.pm
126     ext/Devel/PPPort/PPPort.xs
127     ext/Devel/PPPort/module2.c
128     ext/Devel/PPPort/module3.c
129     regnodes.h
130     warnings.h
131     lib/warnings.pm
132     win32/Makefile
133     win32/Makefile.ce
134     win32/makefile.mk
135     win32/config_H.bc
136     win32/config_H.gc
137     win32/config_H.vc
138 );
139 system("chmod +w @writables") == 0
140     or die "system: $!";
141
142 print "Adding CRs to DOSish files...\n";
143 # This list is also in curliff.pl.
144 my @crlf = qw(
145     djgpp/configure.bat
146     README.ce
147     README.dos
148     README.symbian
149     README.win32
150     symbian/config.pl
151     symbian/makesis.pl
152     symbian/README
153     symbian/xsbuild.pl
154     win32/Makefile
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
160     win32/makefile.mk
161 );
162 system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0
163     or die "system: $!";
164 print "\n";
165
166 chdir ".." or die $!;
167
168 print "Creating and compressing the tar file...\n";
169 my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
170 $cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
171 system($cmd) == 0
172     or die "$cmd failed";
173 print "\n";
174
175 system("ls -ld $perl*");