Make Power MachTen use vfork and perl's malloc
[p5sagit/p5-mst-13.2.git] / Porting / makerel
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.
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 $patchlevel_h = `grep '#define ' patchlevel.h`;
21 print $patchlevel_h;
22 $patchlevel = $1 if $patchlevel_h =~ /PATCHLEVEL\s+(\d+)/;
23 $subversion = $1 if $patchlevel_h =~ /SUBVERSION\s+(\d+)/;
24 die "Unable to parse patchlevel.h" unless $subversion >= 0;
25 $vers = sprintf("5.%03d", $patchlevel);
26 $vms_vers = sprintf("5_%03d", $patchlevel);
27 if ($subversion) {
28     $vers.= sprintf( "_%02d", $subversion);
29     $vms_vers.= sprintf( "%02d", $subversion);
30 } else {
31     $vms_vers.= "  ";
32 }
33
34 $perl = "perl$vers";
35 $reldir = "$perl";
36 $reldir .= "-$ARGV[0]" if $ARGV[0];
37
38 print "\nMaking a release for $perl in $relroot/$reldir\n\n";
39
40
41 print "Cross-checking the MANIFEST...\n";
42 ($missfile, $missentry) = fullcheck();
43 warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
44 warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
45 if ("@$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 }
52 die "Aborted.\n" if @$missentry or @$missfile;
53 print "\n";
54
55 # VMS no longer has hardcoded version numbers descrip.mms
56 #print "Updating VMS version specific files with $vms_vers...\n";
57 #system("perl -pi -e 's/^\QPERL_VERSION = \E\d\_\d+(\s*\#)/PERL_VERSION = $vms_vers$1/' vms/descrip.mms");
58
59
60 print "Setting file permissions...\n";
61 system("find . -type f -print     | xargs chmod -w");
62 system("find . -type d -print     | xargs chmod g-s");
63 system("find t -name '*.t' -print | xargs chmod +x");
64 @exe = qw(
65     Configure
66     configpm
67     embed.pl
68     installperl
69     installman
70     keywords.pl
71     myconfig
72     opcode.pl
73     perly.fixer
74     t/TEST
75     t/*/*.t
76     *.SH
77     vms/ext/Stdio/test.pl
78     vms/ext/filespec.t
79     x2p/*.SH
80     Porting/patchls
81     Porting/makerel
82 );
83 system("chmod +x @exe");
84 print "\n";
85
86
87 print "Creating $relroot/$reldir release directory...\n";
88 die "$relroot/$reldir release directory already exists\n"   if -e "$relroot/$reldir";
89 die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
90 mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
91 print "\n";
92
93
94 print "Copying files to release directory...\n";
95 # ExtUtils::Manifest maniread does not preserve the order
96 $cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
97 system($cmd) == 0 or die "$cmd failed";
98 print "\n";
99
100 chdir $relroot or die $!;
101
102 print "Creating and compressing the tar file...\n";
103 my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
104 $cmd = "tar cf - $reldir | gzip --best > $perl.tar.gz";
105 system($cmd) == 0 or die "$cmd failed";
106 print "\n";
107
108 system("ls -ld $perl*");