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.
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.
10 # Tim Bunce, June 1997
12 use ExtUtils::Manifest qw(fullcheck);
13 $ExtUtils::Manifest::Quiet = 1;
18 sub usage { die <<EOF; }
19 usage: $0 [ -r rootdir ] [-s suffix ]
20 -r rootdir directory under which to create the build dir and tarball
22 -s suffix suffix to append to to the perl-x.y.z dir and tarball name
23 defaults to the concatenaion of the local_patches entry
24 in patchlevel.h (or blank, if none)
28 getopts('r:s:', \%opts) or usage;
31 $relroot = defined $opts{r} ? $opts{r} : "..";
33 die "Must be in root of the perl source tree.\n"
34 unless -f "./MANIFEST" and -f "patchlevel.h";
36 open PATCHLEVEL,"<patchlevel.h" or die;
37 my @patchlevel_h = <PATCHLEVEL>;
39 my $patchlevel_h = join "", grep { /^#\s*define/ } @patchlevel_h;
41 $revision = $1 if $patchlevel_h =~ /PERL_REVISION\s+(\d+)/;
42 $patchlevel = $1 if $patchlevel_h =~ /PERL_VERSION\s+(\d+)/;
43 $subversion = $1 if $patchlevel_h =~ /PERL_SUBVERSION\s+(\d+)/;
44 die "Unable to parse patchlevel.h" unless $subversion >= 0;
45 $vers = sprintf("%d.%d.%d", $revision, $patchlevel, $subversion);
47 # fetch list of local patches
48 my (@local_patches, @lpatch_tags, $lpatch_tags);
49 @local_patches = grep { /^static.*local_patches/../^};/ } @patchlevel_h;
50 @local_patches = grep { !/^\s*,?NULL/ } @local_patches;
51 @lpatch_tags = map { /^\s*,"(\w+)/ } @local_patches;
52 $lpatch_tags = join "-", @lpatch_tags;
57 $lpatch_tags = $opts{s} if defined $opts{s};
58 $reldir .= "-$lpatch_tags" if $lpatch_tags;
60 print "\nMaking a release for $perl in $relroot/$reldir\n\n";
62 print "Cross-checking the MANIFEST...\n";
63 ($missfile, $missentry) = fullcheck();
65 = grep {$_ !~ m!^\.git/! and $_ !~ m!(?:/|^)\.gitignore!} @$missentry;
66 warn "Can't make a release with MANIFEST files missing.\n" if @$missfile;
67 warn "Can't make a release with files not listed in MANIFEST.\n" if @$missentry;
68 if ("@$missentry" =~ m/\.orig\b/) {
69 # Handy listing of find command and .orig files from patching work.
70 # I tend to run 'xargs rm' and copy and paste the file list.
71 my $cmd = "find . -name '*.orig' -print";
75 die "Aborted.\n" if @$missentry or @$missfile;
78 # VMS no longer has hardcoded version numbers descrip.mms
80 print "Creating $relroot/$reldir release directory...\n";
81 die "$relroot/$reldir release directory already exists\n" if -e "$relroot/$reldir";
82 die "$relroot/$reldir.tar.gz release file already exists\n" if -e "$relroot/$reldir.tar.gz";
83 mkdir("$relroot/$reldir", 0755) or die "mkdir $relroot/$reldir: $!\n";
87 print "Copying files to release directory...\n";
88 # ExtUtils::Manifest maniread does not preserve the order
89 $cmd = "awk '{print \$1}' MANIFEST | cpio -pdm $relroot/$reldir";
94 chdir "$relroot/$reldir" or die $!;
96 print "Setting file permissions...\n";
97 system("find . -type f -print | xargs chmod 0444");
98 system("find . -type d -print | xargs chmod 0755");
99 system("find t ext lib -name '*.t' -print | xargs chmod +x");
100 system("find t ext lib -name 'test.pl' -print | xargs chmod +x");
112 vms/ext/Stdio/test.pl
121 Cross/generate_config_sh
124 system("chmod +x @exe") == 0
143 ext/Devel-PPPort/module2.c
144 ext/Devel-PPPort/module3.c
160 system("chmod +w @writables") == 0
163 print "Adding CRs to DOSish files...\n";
164 # This list is also in curliff.pl.
177 win32/ce-helpers/compile-all.bat
178 win32/ce-helpers/compile.bat
179 win32/ce-helpers/registry.bat
183 system("perl -pi -e 's/\\015*\\012/\\015\\012/' @crlf") == 0
187 chdir ".." or die $!;
189 print "Creating and compressing the tar file...\n";
190 my $src = (-e $perl) ? $perl : 'perl'; # 'perl' in maint branch
191 $cmd = "tar cf - $reldir | gzip --best > $reldir.tar.gz";
193 or die "$cmd failed";
196 system("ls -ld $perl*");