| 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 wingames.lst |
| 5 | # and automatically adjust to the current available set of puzzles. |
| 6 | |
| 7 | # Usage: |
| 8 | # |
| 9 | # $ ./winiss.pl 1234 wingames.lst > puzzles.iss |
| 10 | # |
| 11 | # where `1234' is the revision number which will be encoded in the |
| 12 | # installer's version indicators. |
| 13 | |
| 14 | $rev = shift @ARGV; |
| 15 | ($revclean=$rev) =~ s/M$//; |
| 16 | $lst = shift @ARGV; |
| 17 | open LST, "<", $lst; |
| 18 | while (<LST>) { |
| 19 | chomp; |
| 20 | split /:/; |
| 21 | push @exes, $_[0]; |
| 22 | $names{$_[0]} = $_[1]; |
| 23 | } |
| 24 | close LST; |
| 25 | |
| 26 | print '; -*- no -*-'."\n"; |
| 27 | print ';'."\n"; |
| 28 | print '; -- Inno Setup installer script for Puzzles.'."\n"; |
| 29 | print ''."\n"; |
| 30 | print '[Setup]'."\n"; |
| 31 | print 'AppName=Simon Tatham\'s Portable Puzzle Collection'."\n"; |
| 32 | print 'AppVerName=Puzzles revision '.$rev."\n"; |
| 33 | print 'VersionInfoTextVersion=Revision '.$rev."\n"; |
| 34 | print 'AppVersion=r'.$rev."\n"; |
| 35 | print 'VersionInfoVersion=0.0.'.$revclean.'.0'."\n"; |
| 36 | print 'AppPublisher=Simon Tatham'."\n"; |
| 37 | print 'AppPublisherURL=http://www.chiark.greenend.org.uk/~sgtatham/puzzles/'."\n"; |
| 38 | print 'DefaultDirName={pf}\Simon Tatham\'s Portable Puzzle Collection'."\n"; |
| 39 | print 'DefaultGroupName=Simon Tatham\'s Puzzles'."\n"; |
| 40 | # print 'SetupIconFile=fixmethinkoneup.ico'."\n"; |
| 41 | # print 'UninstallDisplayIcon={app}\fixmethinkoneup.exe'."\n"; |
| 42 | print 'ChangesAssociations=no'."\n"; |
| 43 | print 'Compression=zip/9'."\n"; |
| 44 | print 'AllowNoIcons=yes'."\n"; |
| 45 | print ''."\n"; |
| 46 | print '[Files]'."\n"; |
| 47 | for $exe (@exes) { |
| 48 | print 'Source: "'.$exe.'"; DestDir: "{app}"; Flags: promptifolder replacesameversion uninsrestartdelete'."\n"; |
| 49 | } |
| 50 | print 'Source: "website.url"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n"; |
| 51 | print 'Source: "puzzles.chm"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n"; |
| 52 | print 'Source: "puzzles.hlp"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n"; |
| 53 | print 'Source: "puzzles.cnt"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n"; |
| 54 | print 'Source: "LICENCE"; DestDir: "{app}"; Flags: uninsrestartdelete'."\n"; |
| 55 | print ''."\n"; |
| 56 | print '[Icons]'."\n"; |
| 57 | for $exe (@exes) { |
| 58 | print 'Name: "{group}\\'.$names{$exe}.'"; Filename: "{app}\\'.$exe.'"'."\n"; |
| 59 | } |
| 60 | print '; We have to fall back from the .chm to the older .hlp file on some Windows'."\n"; |
| 61 | print '; versions.'."\n"; |
| 62 | print 'Name: "{group}\Puzzles Manual"; Filename: "{app}\puzzles.chm"; MinVersion: 4.1,5.0'."\n"; |
| 63 | print 'Name: "{group}\Puzzles Manual"; Filename: "{app}\puzzles.hlp"; OnlyBelowVersion: 4.1,5.0'."\n"; |
| 64 | print 'Name: "{group}\Puzzles Web Site"; Filename: "{app}\website.url"'."\n"; |