Revert 6357c4f1 (wtf was I thinking?)
[screen-lua.git] / mktar.pl
blob79b1731f4d81b7087ac6131f88ac458f464ae21e
1 #! /usr/bin/perl -w
2 #
3 # create a tar ball snapshot from cvs repository.
5 # 2005-12-15, jw
8 use Data::Dumper;
10 my $srcdir = 'src';
11 my $version_file = "$srcdir/patchlevel.h";
12 my %symlinks =
14 'FAQ' => 'doc/FAQ',
15 'doc/install.sh' => '../install.sh'
18 for my $l (keys %symlinks)
20 my $ll = "$srcdir/$l";
21 next if -l $ll;
22 print "replacing $ll with a symlink to $symlinks{$l}\n";
23 unlink $ll;
24 symlink $symlinks{$l}, $ll;
27 my %version;
28 open IN, "<", $version_file or die "unable to read $version_file: $!";
29 while (defined(my $line = <IN>))
31 $version{$1} = (defined $3) ? $3 : $4 if $line =~ m{^#\s*define\s+(\w+)\s+("([^"]*)"|(\S+))};
33 close IN;
35 my $version = "$version{REV}.$version{VERS}.$version{PATCHLEVEL}";
36 my $tmpdir = "/tmp/mktar-$^T";
37 mkdir $tmpdir or die "cannot mkdir $tmpdir: $!";
38 system "cp -a $srcdir $tmpdir" and die "'cp -a $srcdir $tmpdir' failed: $!";
39 rename "$tmpdir/$srcdir", "$tmpdir/screen-$version" or die "rename to screen-$version failed: $!";
41 system "tar zcf - -C $tmpdir > screen-$version.tar.gz screen-$version";
42 system "rm -rf $tmpdir";
44 print "screen-$version.tar.gz written.\n";