Merged silc_1_0_branch to trunk.
[silc.git] / win32 / clean_dist.pl
1 #!/usr/bin/perl\r
2 \r
3 $p = `pwd`;\r
4 \r
5 if($p =~ /.*(\/win32)/)\r
6 {\r
7         @dirents = split('/', $p);\r
8         if(@dirents > 2)\r
9         {\r
10                 # check dependencies\r
11                 print "Checking dependencies\n";\r
12                 @statLibSilcDllDebug = stat("libsilc/Debug/libsilc.dll");\r
13                 @statLibSilcExpDebug = stat("libsilc/Debug/libsilc.exp");\r
14                 @statLibSilcLibDebug = stat("libsilc/Debug/libsilc.lib");\r
15                 if(! @statLibSilcDllDebug || ! @statLibSilcExpDebug || ! @statLibSilcLibDebug)\r
16                 {\r
17                         die "Please rebuild libsilc Debug before creating the distribution\n";\r
18                 }\r
19                 \r
20                 @statLibSilcDllRelease = stat("libsilc/Release/libsilc.dll");\r
21                 @statLibSilcExpRelease = stat("libsilc/Release/libsilc.exp");\r
22                 @statLibSilcLibRelease = stat("libsilc/Release/libsilc.lib");\r
23                 if(! @statLibSilcDllRelease || ! @statLibSilcExpRelease || ! @statLibSilcLibRelease)\r
24                 {\r
25                         die "Please rebuild libsilc Release before creating the distribution\n";\r
26                 }\r
27                 \r
28                 @statLibSilcClientDllDebug = stat("libsilcclient/Debug/libsilcclient.dll");\r
29                 @statLibSilcClientExpDebug = stat("libsilcclient/Debug/libsilcclient.exp");\r
30                 @statLibSilcClientLibDebug = stat("libsilcclient/Debug/libsilcclient.lib");\r
31                 if(! @statLibSilcClientDllDebug || \r
32                         ! @statLibSilcClientExpDebug || \r
33                         ! @statLibSilcClientLibDebug || \r
34                         (@statLibSilcClientDllDebug[9] < @statLibSilcDllDebug[9]) ||\r
35                         (@statLibSilcClientExpDebug[9] < @statLibSilcExpDebug[9]) ||\r
36                         (@statLibSilcClientLibDebug[9] < @statLibSilcLibDebug[9])\r
37                         )\r
38                 {                       \r
39                         die "Please rebuild libsilcclient Debug before creating the distribution\n";\r
40                 }\r
41 \r
42                 @statLibSilcClientDllRelease = stat("libsilcclient/Release/libsilcclient.dll");\r
43                 @statLibSilcClientExpRelease = stat("libsilcclient/Release/libsilcclient.exp");\r
44                 @statLibSilcClientLibRelease = stat("libsilcclient/Release/libsilcclient.lib");\r
45                 if(! @statLibSilcClientDllRelease || \r
46                         ! @statLibSilcClientExpRelease || \r
47                         ! @statLibSilcClientLibRelease ||\r
48                         (@statLibSilcClientDllRelease[9] < @statLibSilcDllRelease[9]) ||\r
49                         (@statLibSilcClientExpRelease[9] < @statLibSilcExpRelease[9]) ||\r
50                         (@statLibSilcClientLibRelease[9] < @statLibSilcLibRelease[9])\r
51                         )\r
52                 {\r
53                         die "Please rebuild libsilcclient Release before creating the distribution\n";\r
54                 }\r
55 \r
56                 @statLibSilcStaticLibDebug = stat("libsilc_static/Debug/libsilc_static.lib");\r
57                 if(! @statLibSilcStaticLibDebug)\r
58                 {\r
59                         die "Please rebuild libsilc_static Debug before creating the distribution\n";\r
60                 }\r
61                 \r
62                 @statLibSilcStaticLibRelease = stat("libsilc_static/Release/libsilc_static.lib");\r
63                 if(! @statLibSilcStaticLibRelease)\r
64                 {\r
65                         die "Please rebuild libsilc_static Release before creating the distribution\n";\r
66                 }\r
67                 \r
68                 @statLibSilcClientStaticLibDebug = stat("libsilcclient_static/Debug/libsilcclient_static.lib");\r
69                 if(! @statLibSilcClientStaticLibDebug || (@statLibSilcClientStaticLibDebug[9] < @statLibSilcStaticLibDebug[9]))\r
70                 {                       \r
71                         die "Please rebuild libsilcclient_static Debug before creating the distribution\n";\r
72                 }\r
73 \r
74                 @statLibSilcClientStaticLibRelease = stat("libsilcclient_static/Release/libsilcclient_static.lib");\r
75                 if(! @statLibSilcClientStaticLibRelease || (@statLibSilcClientStaticLibRelease[9] < @statLibSilcStaticLibRelease[9]))\r
76                 {                       \r
77                         die "Please rebuild libsilcclient_static Release before creating the distribution\n";\r
78                 }\r
79 \r
80                 $index = @dirents - 2;\r
81                 $top = @dirents[$index];\r
82                 `find . -name \"*.obj\" -exec rm -f \\{} \\;`;\r
83                 `find . -name \"*.idb\" -exec rm -f \\{} \\;`;\r
84                 `find . -name \"*.pdb\" -exec rm -f \\{} \\;`;\r
85                 `find . -name \"*.pch\" -exec rm -f \\{} \\;`;\r
86                 `find ../ -name \"*.o\" -exec rm -f \\{} \\;`;\r
87                 `find ../ -name \"*.lo\" -exec rm -f \\{} \\;`;\r
88                 `find ../ -name \"*.a\" -exec rm -f \\{} \\;`;\r
89                 `find ../ -name \"*.la\" -exec rm -f \\{} \\;`;\r
90                 `find ../ -name \"*.lai\" -exec rm -f \\{} \\;`;\r
91 \r
92                 push(@excludeList, "--exclude $top/win32/Debug");\r
93                 push(@excludeList, "--exclude $top/win32/libsilc/CVS");\r
94                 push(@excludeList, "--exclude $top/win32/libsilc/libsilc.plg");\r
95                 push(@excludeList, "--exclude $top/win32/libsilcclient/CVS");\r
96                 push(@excludeList, "--exclude $top/win32/libsilcclient/libsilcclient.plg");\r
97                 push(@excludeList, "--exclude $top/win32/libsilc_static/CVS");\r
98                 push(@excludeList, "--exclude $top/win32/libsilc_static/libsilc_static.plg");\r
99                 push(@excludeList, "--exclude $top/win32/libsilcclient_static/CVS");\r
100                 push(@excludeList, "--exclude $top/win32/libsilcclient_static/libsilcclient_static.plg");\r
101                 push(@excludeList, "--exclude $top/win32/silc.ncb");\r
102                 push(@excludeList, "--exclude $top/includes/CVS");\r
103                 push(@excludeList, "--exclude $top/lib/silcutil/win32/.cvsignore");\r
104                 push(@excludeList, "--exclude $top/lib/silcutil/win32/CVS");\r
105                 push(@excludeList, "--exclude $top/win32/all.plg");\r
106                 push(@excludeList, "--exclude $top/win32/buildDistAfterAllReleaseAndDebug.plg");\r
107                 push(@excludeList, "--exclude $top/win32/CVS");\r
108                 push(@excludeList, "--exclude $top/win32/tests/CVS");\r
109                 push(@excludeList, "--exclude $top/win32/libsilc/Debug/libsilc.ilk");\r
110                 push(@excludeList, "--exclude $top/win32/libsilc/Debug/libsilc.pdb");\r
111                 push(@excludeList, "--exclude $top/win32/libsilcclient/Debug/libsilcclient.ilk");\r
112                 push(@excludeList, "--exclude $top/win32/libsilcclient/Debug/libsilcclient.pdb");\r
113                 push(@excludeList, "--exclude $top/win32/libsilc/Release/libsilc.ilk");\r
114                 push(@excludeList, "--exclude $top/win32/libsilc/Release/libsilc.pdb");\r
115                 push(@excludeList, "--exclude $top/win32/libsilcclient/Release/libsilcclient.ilk");\r
116                 push(@excludeList, "--exclude $top/win32/silc.opt");\r
117                 push(@excludeList, "--exclude $top/irssi");\r
118                 push(@excludeList, "--exclude $top/doc/CVS");\r
119                 push(@excludeList, "--exclude $top/doc/examples/CVS");\r
120                 push(@excludeList, "--exclude $top/lib/doc/CVS");\r
121                 push(@excludeList, "--exclude $top/lib/silcclient/.libs");\r
122                 push(@excludeList, "--exclude $top/lib/silccore/.libs");\r
123                 push(@excludeList, "--exclude $top/lib/silccore/tests/CVS");\r
124                 push(@excludeList, "--exclude $top/lib/silccrypt/.libs");\r
125                 push(@excludeList, "--exclude $top/lib/silccrypt/tests/CVS");\r
126                 push(@excludeList, "--exclude $top/lib/silcmath/.libs");\r
127                 push(@excludeList, "--exclude $top/lib/silcmath/mpi/.libs");\r
128                 push(@excludeList, "--exclude $top/lib/silcsftp/.libs");\r
129                 push(@excludeList, "--exclude $top/lib/silcsftp/tests/CVS");\r
130                 push(@excludeList, "--exclude $top/lib/silcsim/.libs");\r
131                 push(@excludeList, "--exclude $top/lib/silcske/.libs");\r
132                 push(@excludeList, "--exclude $top/lib/silcutil/.libs");\r
133                 push(@excludeList, "--exclude $top/lib/silcutil/win32/.libs");\r
134                 push(@excludeList, "--exclude $top/silcer/CVS");\r
135                 push(@excludeList, "--exclude $top/silcer/intl/CVS");\r
136                 push(@excludeList, "--exclude $top/silcer/macros/CVS");\r
137                 push(@excludeList, "--exclude $top/silcer/pixmaps/CVS");\r
138                 push(@excludeList, "--exclude $top/silcer/po/CVS");\r
139                 push(@excludeList, "--exclude $top/silcer/src/CVS");\r
140                 push(@excludeList, "--exclude $top/silcer/ui/CVS");\r
141                 push(@excludeList, "--exclude $top/tutorial/CVS");\r
142                 push(@excludeList, "--exclude $top/tutorial/mybot/CVS");\r
143 \r
144 \r
145 \r
146                 $excludes = "";\r
147                 foreach $entry(@excludeList)\r
148                 {\r
149                         $excludes = sprintf("%s%s ", $excludes, $entry);\r
150                 }\r
151                 \r
152                 print "Copying headers\n";\r
153                 `rm -rf include`;\r
154                 `mkdir -p include`;\r
155                 `find ../includes -name \"*.h\" -exec cp \\{} include \\;`;\r
156                 `find ../lib -name \"*.h\" -exec cp \\{} include \\;`;\r
157                 print "Creating distribution archive.\n";\r
158                 `cd ../.. ; tar $excludes -zcvf $top-win32.tgz $top/*` || die "Failed to create distribution\n";        \r
159         }\r
160 }\r
161 else\r
162 {\r
163         die "Please run $0 from the win32 directory of the silc distribution\n";\r
164 }\r
165 \r