Mac OS X: tweak once again the installation directories.
[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);
30$vms_vers = sprintf("%d_%d_%d", $revision, $patchlevel, $subversion);
08aa1457 31
3ffabb8c 32# fetch list of local patches
33my (@local_patches, @lpatch_tags, $lpatch_tags);
34@local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h;
35@local_patches = grep { !/^\s*,?NULL/ } @local_patches;
36@lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches;
37$lpatch_tags = join "-", @lpatch_tags;
38
2a7df08c 39$perl = "perl-$vers";
f27ffc4a 40$reldir = "$perl";
3ffabb8c 41$reldir .= "-$lpatch_tags" if $lpatch_tags;
08aa1457 42
f27ffc4a 43print "\nMaking a release for $perl in $relroot/$reldir\n\n";
08aa1457 44
08aa1457 45print "Cross-checking the MANIFEST...\n";
46($missfile, $missentry) = fullcheck();
3e3baf6d 47warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
48warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
90248788 49if ("@$missentry" =~ m/\.orig\b/) {
50 # Handy listing of find command and .orig files from patching work.
51 # I tend to run 'xargs rm' and copy and paste the file list.
52 my $cmd = "find . -name '*.orig' -print";
53 print "$cmd\n";
54 system($cmd);
55}
3e3baf6d 56die "Aborted.\n" if @$missentry or @$missfile;
08aa1457 57print "\n";
58
b59922b7 59# VMS no longer has hardcoded version numbers descrip.mms
60#print "Updating VMS version specific files with $vms_vers...\n";
61#system("perl -pi -e 's/^\QPERL_VERSION = \E\d\_\d+(\s*\#)/PERL_VERSION = $vms_vers$1/' vms/descrip.mms");
55d729e4 62
63
48e117bb 64
65print "Creating $relroot/$reldir release directory...\n";
66die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir";
67die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
68mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
69print "\n";
70
71
72print "Copying files to release directory...\n";
73# ExtUtils::Manifest maniread does not preserve the order
74$cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
75system($cmd) == 0 or die "$cmd failed";
76print "\n";
77
6e24577b 78chdir "$relroot/$reldir" or die $!;
48e117bb 79
08aa1457 80print "Setting file permissions...\n";
bf955a65 81system("find . -type f -print | xargs chmod 0444");
82system("find . -type d -print | xargs chmod 0755");
e619572c 83system("find t ext lib -name '*.t' -print | xargs chmod +x");
84system("find t ext lib -name 'test.pl' -print | xargs chmod +x");
48e117bb 85my @exe = qw(
08aa1457 86 Configure
87 configpm
b907dc6d 88 configure.gnu
08aa1457 89 embed.pl
90 installperl
91 installman
92 keywords.pl
08aa1457 93 opcode.pl
94 perly.fixer
95 t/TEST
08aa1457 96 *.SH
97 vms/ext/Stdio/test.pl
98 vms/ext/filespec.t
08aa1457 99 x2p/*.SH
bb304ec8 100 Porting/findrfuncs
101 Porting/genlog
08aa1457 102 Porting/makerel
a619eb9e 103 Porting/p4genpatch
bb304ec8 104 Porting/patchls
105 Porting/*.pl
e619572c 106 mpeix/nm
107 mpeix/relink
08aa1457 108);
109system("chmod +x @exe");
6e24577b 110
f7f713ed 111my @writables = qw(
f3513db0 112 NetWare/config_H.wc
113 NetWare/Makefile
ac634a9a 114 keywords.h
115 opcode.h
116 opnames.h
117 pp_proto.h
118 pp.sym
119 proto.h
f7f713ed 120 embed.h
121 embedvar.h
f7f713ed 122 global.sym
ac634a9a 123 pod/perlintern.pod
124 pod/perlapi.pod
ac634a9a 125 perlapi.h
126 perlapi.c
127 ext/ByteLoader/byterun.h
128 ext/ByteLoader/byterun.c
129 ext/B/B/Asmdata.pm
799d3a59 130 ext/Devel/PPPort/PPPort.xs
131 ext/Devel/PPPort/module2.c
132 ext/Devel/PPPort/module3.c
f7f713ed 133 regnodes.h
0ebdc6d5 134 warnings.h
ac634a9a 135 lib/warnings.pm
136 vms/perly_c.vms
137 vms/perly_h.vms
138 win32/Makefile
139 win32/makefile.mk
140 win32/config_H.bc
f29c64d6 141 win32/config_H.gc
f7f713ed 142 win32/config_H.vc
f3513db0 143 wince/config_H.ce
144 wince/Makefile.ce
f7f713ed 145);
146system("chmod +w @writables");
147
6e24577b 148print "Adding CRs to DOSish files...\n";
48e117bb 149my @crlf = qw(
150 djgpp/configure.bat
f3513db0 151 README.ce
48e117bb 152 README.dos
153 README.win32
154 win32/Makefile
155 win32/makefile.mk
f3513db0 156 wince/Makefile.ce
3e786a10 157 wince/compile-all.bat
dd01ab47 158 wince/README.compile
159 wince/README.perlce
160 wince/registry.bat
48e117bb 161);
0ffbf418 162system("perl -pi -e 's/\015*\012/\015\012/' @crlf");
08aa1457 163print "\n";
164
6e24577b 165chdir ".." or die $!;
166
08aa1457 167print "Creating and compressing the tar file...\n";
f27ffc4a 168my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
3ffabb8c 169$cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
08aa1457 170system($cmd) == 0 or die "$cmd failed";
171print "\n";
172
173system("ls -ld $perl*");