1#!/bin/perl5
2# -*- perl -*-
3
4$src = '
5	Makefile
6	COPYING
7	ChangeLog
8	docs/*
9	lib/*.gif
10	lib/*.h
11	lib/Makefile
12	lib/[abd-t]*.c
13	tests/*.c
14	tests/*.gif
15	tests/Makefile
16	games/*.gif
17	games/*.html
18	games/*.c
19	games/*.h
20	games/*.tp
21	games/split-tiles
22	games/Makefile
23	games/t/*
24';
25
26$src =~ s/[\n\t\r\s]+/ /g;
27
28$pwd = `pwd`;
29$pwd =~ s/[\r\n]+$//;
30$pwd =~ s@.*/@@;
31
32open(LS, "ls -1 $src | sort |");
33chdir "..";
34open(TAR, "| tar cvf - -T - | gzip -9 > $pwd/$pwd.tar.gz");
35
36
37while (<LS>) {
38    s/[\r\n]+$//;
39    next if /-(help|img)\.c/;
40    next if /[\~\#]/;
41    print TAR "$pwd/$_\n";
42}
43close(LS);
44close(TAR);
45