summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/winiss.pl
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/puzzles/src/winiss.pl')
-rwxr-xr-xapps/plugins/puzzles/src/winiss.pl79
1 files changed, 79 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/winiss.pl b/apps/plugins/puzzles/src/winiss.pl
new file mode 100755
index 0000000000..eca02d3b15
--- /dev/null
+++ b/apps/plugins/puzzles/src/winiss.pl
@@ -0,0 +1,79 @@
1#!/usr/bin/perl
2
3# Perl script to generate an Inno Setup installer script for
4# Puzzles. This has to be scripted so that it can read gamedesc.txt
5# and automatically adjust to the current available set of puzzles.
6
7# Usage:
8#
9# $ ./winiss.pl 20140922.sdfsdf gamedesc.txt > puzzles.iss
10#
11# where the first argument is the version number which will be encoded
12# in the installer's version indicators. The first component of that
13# version number will be expected to be a YYYYMMDD-format date.
14
15use warnings;
16use Time::Local;
17
18$ver = shift @ARGV;
19
20# Parse the date out of $ver, and convert it into an integer number of
21# days since an arbitrary epoch. This number is used for the Windows
22# version resource (which wants a monotonic 16-bit integer). The epoch
23# is chosen so that the first build using this date-based mechanism
24# has a higher number than the last build in which that number was
25# derived from a Subversion revision.
26die "bad date format" if $ver !~ /^(\d{4})(\d{2})(\d{2})/;
27$date = timegm(0,0,0,$3,$2-1,$1);
28$integer_date = int($date / 86400) - 6000;
29
30$desc = shift @ARGV;
31open DESC, "<", $desc;
32while (<DESC>) {
33 chomp;
34 @_ = split /:/;
35 push @exes, $_[1];
36 $names{$_[1]} = $_[2];
37}
38close DESC;
39
40print '; -*- no -*-'."\n";
41print ';'."\n";
42print '; -- Inno Setup installer script for Puzzles.'."\n";
43print ''."\n";
44print '[Setup]'."\n";
45print 'AppName=Simon Tatham\'s Portable Puzzle Collection'."\n";
46print 'AppVerName=Puzzles version '.$ver."\n";
47print 'VersionInfoTextVersion=Version '.$ver."\n";
48print 'AppVersion=r'.$ver."\n";
49print 'VersionInfoVersion=0.0.'.$integer_date.'.0'."\n";
50print 'AppPublisher=Simon Tatham'."\n";
51print 'AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n";
52print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n";
53print 'DefaultGroupName=Simon Tatham\'s Puzzles'."\n";
54# print 'SetupIconFile=fixmethinkoneup.ico'."\n";
55# print 'UninstallDisplayIcon={app}\fixmethinkoneup.exe'."\n";
56print 'ChangesAssociations=no'."\n";
57print 'Compression=zip/9'."\n";
58print 'AllowNoIcons=yes'."\n";
59print 'OutputBaseFilename=installer'."\n";
60print ''."\n";
61print '[Files]'."\n";
62for $exe (@exes) {
63 print 'Source: "'.$exe.'"; DestDir: "{app}"; Flags: promptifolder replacesameversion uninsrestartdelete'."\n";
64}
65print 'Source: "website.url"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n";
66print 'Source: "puzzles.chm"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n";
67print 'Source: "puzzles.hlp"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n";
68print 'Source: "puzzles.cnt"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n";
69print 'Source: "LICENCE"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n";
70print ''."\n";
71print '[Icons]'."\n";
72for $exe (@exes) {
73 print 'Name: "{group}\\'.$names{$exe}.'"; Filename: "{app}\\'.$exe.'"'."\n";
74}
75print '; We have to fall back from the .chm to the older .hlp file on some Windows'."\n";
76print '; versions.'."\n";
77print 'Name: "{group}\Puzzles Manual"; Filename: "{app}\puzzles.chm"; MinVersion: 4.1,5.0'."\n";
78print 'Name: "{group}\Puzzles Manual"; Filename: "{app}\puzzles.hlp"; OnlyBelowVersion: 4.1,5.0'."\n";
79print 'Name: "{group}\Puzzles Web Site"; Filename: "{app}\website.url"'."\n";