+use warnings;
+use Time::Local;
+
+$ver = shift @ARGV;
+
+# Parse the date out of $ver, and convert it into an integer number of
+# days since an arbitrary epoch. This number is used for the Windows
+# version resource (which wants a monotonic 16-bit integer). The epoch
+# is chosen so that the first build using this date-based mechanism
+# has a higher number than the last build in which that number was
+# derived from a Subversion revision.
+die "bad date format" if $ver !~ /^(\d{4})(\d{2})(\d{2})/;
+$date = timegm(0,0,0,$3,$2-1,$1);
+$integer_date = int($date / 86400) - 6000;
+
+$desc = shift @ARGV;
+open DESC, "<", $desc;
+while (<DESC>) {