Merged silc_1_0_branch to trunk.
[silc.git] / win32 / clean_dist.pl
diff --git a/win32/clean_dist.pl b/win32/clean_dist.pl
new file mode 100644 (file)
index 0000000..fe10fba
--- /dev/null
@@ -0,0 +1,165 @@
+#!/usr/bin/perl\r
+\r
+$p = `pwd`;\r
+\r
+if($p =~ /.*(\/win32)/)\r
+{\r
+       @dirents = split('/', $p);\r
+       if(@dirents > 2)\r
+       {\r
+               # check dependencies\r
+               print "Checking dependencies\n";\r
+               @statLibSilcDllDebug = stat("libsilc/Debug/libsilc.dll");\r
+               @statLibSilcExpDebug = stat("libsilc/Debug/libsilc.exp");\r
+               @statLibSilcLibDebug = stat("libsilc/Debug/libsilc.lib");\r
+               if(! @statLibSilcDllDebug || ! @statLibSilcExpDebug || ! @statLibSilcLibDebug)\r
+               {\r
+                       die "Please rebuild libsilc Debug before creating the distribution\n";\r
+               }\r
+               \r
+               @statLibSilcDllRelease = stat("libsilc/Release/libsilc.dll");\r
+               @statLibSilcExpRelease = stat("libsilc/Release/libsilc.exp");\r
+               @statLibSilcLibRelease = stat("libsilc/Release/libsilc.lib");\r
+               if(! @statLibSilcDllRelease || ! @statLibSilcExpRelease || ! @statLibSilcLibRelease)\r
+               {\r
+                       die "Please rebuild libsilc Release before creating the distribution\n";\r
+               }\r
+               \r
+               @statLibSilcClientDllDebug = stat("libsilcclient/Debug/libsilcclient.dll");\r
+               @statLibSilcClientExpDebug = stat("libsilcclient/Debug/libsilcclient.exp");\r
+               @statLibSilcClientLibDebug = stat("libsilcclient/Debug/libsilcclient.lib");\r
+               if(! @statLibSilcClientDllDebug || \r
+                       ! @statLibSilcClientExpDebug || \r
+                       ! @statLibSilcClientLibDebug || \r
+                       (@statLibSilcClientDllDebug[9] < @statLibSilcDllDebug[9]) ||\r
+                       (@statLibSilcClientExpDebug[9] < @statLibSilcExpDebug[9]) ||\r
+                       (@statLibSilcClientLibDebug[9] < @statLibSilcLibDebug[9])\r
+                       )\r
+               {                       \r
+                       die "Please rebuild libsilcclient Debug before creating the distribution\n";\r
+               }\r
+\r
+               @statLibSilcClientDllRelease = stat("libsilcclient/Release/libsilcclient.dll");\r
+               @statLibSilcClientExpRelease = stat("libsilcclient/Release/libsilcclient.exp");\r
+               @statLibSilcClientLibRelease = stat("libsilcclient/Release/libsilcclient.lib");\r
+               if(! @statLibSilcClientDllRelease || \r
+                       ! @statLibSilcClientExpRelease || \r
+                       ! @statLibSilcClientLibRelease ||\r
+                       (@statLibSilcClientDllRelease[9] < @statLibSilcDllRelease[9]) ||\r
+                       (@statLibSilcClientExpRelease[9] < @statLibSilcExpRelease[9]) ||\r
+                       (@statLibSilcClientLibRelease[9] < @statLibSilcLibRelease[9])\r
+                       )\r
+               {\r
+                       die "Please rebuild libsilcclient Release before creating the distribution\n";\r
+               }\r
+\r
+               @statLibSilcStaticLibDebug = stat("libsilc_static/Debug/libsilc_static.lib");\r
+               if(! @statLibSilcStaticLibDebug)\r
+               {\r
+                       die "Please rebuild libsilc_static Debug before creating the distribution\n";\r
+               }\r
+               \r
+               @statLibSilcStaticLibRelease = stat("libsilc_static/Release/libsilc_static.lib");\r
+               if(! @statLibSilcStaticLibRelease)\r
+               {\r
+                       die "Please rebuild libsilc_static Release before creating the distribution\n";\r
+               }\r
+               \r
+               @statLibSilcClientStaticLibDebug = stat("libsilcclient_static/Debug/libsilcclient_static.lib");\r
+               if(! @statLibSilcClientStaticLibDebug || (@statLibSilcClientStaticLibDebug[9] < @statLibSilcStaticLibDebug[9]))\r
+               {                       \r
+                       die "Please rebuild libsilcclient_static Debug before creating the distribution\n";\r
+               }\r
+\r
+               @statLibSilcClientStaticLibRelease = stat("libsilcclient_static/Release/libsilcclient_static.lib");\r
+               if(! @statLibSilcClientStaticLibRelease || (@statLibSilcClientStaticLibRelease[9] < @statLibSilcStaticLibRelease[9]))\r
+               {                       \r
+                       die "Please rebuild libsilcclient_static Release before creating the distribution\n";\r
+               }\r
+\r
+               $index = @dirents - 2;\r
+               $top = @dirents[$index];\r
+               `find . -name \"*.obj\" -exec rm -f \\{} \\;`;\r
+               `find . -name \"*.idb\" -exec rm -f \\{} \\;`;\r
+               `find . -name \"*.pdb\" -exec rm -f \\{} \\;`;\r
+               `find . -name \"*.pch\" -exec rm -f \\{} \\;`;\r
+               `find ../ -name \"*.o\" -exec rm -f \\{} \\;`;\r
+               `find ../ -name \"*.lo\" -exec rm -f \\{} \\;`;\r
+               `find ../ -name \"*.a\" -exec rm -f \\{} \\;`;\r
+               `find ../ -name \"*.la\" -exec rm -f \\{} \\;`;\r
+               `find ../ -name \"*.lai\" -exec rm -f \\{} \\;`;\r
+\r
+               push(@excludeList, "--exclude $top/win32/Debug");\r
+               push(@excludeList, "--exclude $top/win32/libsilc/CVS");\r
+               push(@excludeList, "--exclude $top/win32/libsilc/libsilc.plg");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient/CVS");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient/libsilcclient.plg");\r
+               push(@excludeList, "--exclude $top/win32/libsilc_static/CVS");\r
+               push(@excludeList, "--exclude $top/win32/libsilc_static/libsilc_static.plg");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient_static/CVS");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient_static/libsilcclient_static.plg");\r
+               push(@excludeList, "--exclude $top/win32/silc.ncb");\r
+               push(@excludeList, "--exclude $top/includes/CVS");\r
+               push(@excludeList, "--exclude $top/lib/silcutil/win32/.cvsignore");\r
+               push(@excludeList, "--exclude $top/lib/silcutil/win32/CVS");\r
+               push(@excludeList, "--exclude $top/win32/all.plg");\r
+               push(@excludeList, "--exclude $top/win32/buildDistAfterAllReleaseAndDebug.plg");\r
+               push(@excludeList, "--exclude $top/win32/CVS");\r
+               push(@excludeList, "--exclude $top/win32/tests/CVS");\r
+               push(@excludeList, "--exclude $top/win32/libsilc/Debug/libsilc.ilk");\r
+               push(@excludeList, "--exclude $top/win32/libsilc/Debug/libsilc.pdb");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient/Debug/libsilcclient.ilk");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient/Debug/libsilcclient.pdb");\r
+               push(@excludeList, "--exclude $top/win32/libsilc/Release/libsilc.ilk");\r
+               push(@excludeList, "--exclude $top/win32/libsilc/Release/libsilc.pdb");\r
+               push(@excludeList, "--exclude $top/win32/libsilcclient/Release/libsilcclient.ilk");\r
+               push(@excludeList, "--exclude $top/win32/silc.opt");\r
+               push(@excludeList, "--exclude $top/irssi");\r
+               push(@excludeList, "--exclude $top/doc/CVS");\r
+               push(@excludeList, "--exclude $top/doc/examples/CVS");\r
+               push(@excludeList, "--exclude $top/lib/doc/CVS");\r
+               push(@excludeList, "--exclude $top/lib/silcclient/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silccore/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silccore/tests/CVS");\r
+               push(@excludeList, "--exclude $top/lib/silccrypt/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silccrypt/tests/CVS");\r
+               push(@excludeList, "--exclude $top/lib/silcmath/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silcmath/mpi/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silcsftp/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silcsftp/tests/CVS");\r
+               push(@excludeList, "--exclude $top/lib/silcsim/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silcske/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silcutil/.libs");\r
+               push(@excludeList, "--exclude $top/lib/silcutil/win32/.libs");\r
+               push(@excludeList, "--exclude $top/silcer/CVS");\r
+               push(@excludeList, "--exclude $top/silcer/intl/CVS");\r
+               push(@excludeList, "--exclude $top/silcer/macros/CVS");\r
+               push(@excludeList, "--exclude $top/silcer/pixmaps/CVS");\r
+               push(@excludeList, "--exclude $top/silcer/po/CVS");\r
+               push(@excludeList, "--exclude $top/silcer/src/CVS");\r
+               push(@excludeList, "--exclude $top/silcer/ui/CVS");\r
+               push(@excludeList, "--exclude $top/tutorial/CVS");\r
+               push(@excludeList, "--exclude $top/tutorial/mybot/CVS");\r
+\r
+\r
+\r
+               $excludes = "";\r
+               foreach $entry(@excludeList)\r
+               {\r
+                       $excludes = sprintf("%s%s ", $excludes, $entry);\r
+               }\r
+               \r
+               print "Copying headers\n";\r
+               `rm -rf include`;\r
+               `mkdir -p include`;\r
+               `find ../includes -name \"*.h\" -exec cp \\{} include \\;`;\r
+               `find ../lib -name \"*.h\" -exec cp \\{} include \\;`;\r
+               print "Creating distribution archive.\n";\r
+               `cd ../.. ; tar $excludes -zcvf $top-win32.tgz $top/*` || die "Failed to create distribution\n";        \r
+       }\r
+}\r
+else\r
+{\r
+       die "Please run $0 from the win32 directory of the silc distribution\n";\r
+}\r
+\r