shithub: puzzles

Download patch

ref: 3cf09c261591b939df53c5357ab471c5b3076d22
parent: ee8ea9b9785964694cb2b3ad77c3fb2460f49510
author: Simon Tatham <anakin@pobox.com>
date: Sun Nov 26 15:12:15 EST 2017

Reinstate 32-bit Windows builds of Puzzles.

I've built a set of 32-bit binaries, a 32-bit zip file and a 32-bit
MSI, all delivered into a 'w32' output directory.

--- a/Buildscr
+++ b/Buildscr
@@ -55,30 +55,31 @@
 in puzzles do mason.pl --args '{"version":"$(Version)","descfile":"gamedesc.txt"}' winwix.mc > puzzles.wxs
 in puzzles do perl winiss.pl $(Version) gamedesc.txt > puzzles.iss
 ifneq "$(VISUAL_STUDIO)" "yes" then
-  in puzzles with clangcl64 do Platform=x64 make -f Makefile.clangcl clean
-  in puzzles with clangcl64 do Platform=x64 make -f Makefile.clangcl VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror'
+  in puzzles with clangcl64 do mkdir win64 && Platform=x64 make -f Makefile.clangcl BUILDDIR=win64/ VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror'
+  in puzzles with clangcl32 do mkdir win32 && Platform=x86 make -f Makefile.clangcl BUILDDIR=win32/ VER=-DVER=$(Version) XFLAGS='-Wwrite-strings -Werror'
   # Code-sign the binaries, if the local bob config provides a script
   # to do so. We assume here that the script accepts an -i option to
   # provide a 'more info' URL, and an optional -n option to provide a
   # program name, and that it can take multiple .exe filename
   # arguments and sign them all in place.
-  ifneq "$(cross_winsigncode)" "" in puzzles do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ *.exe
+  ifneq "$(cross_winsigncode)" "" in puzzles do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ win64/*.exe win32/*.exe
   # Build installers.
-  in puzzles with wixonlinux do candle -arch x64 puzzles.wxs && light -ext WixUIExtension -sval puzzles.wixobj
-  ifneq "$(cross_winsigncode)" "" in puzzles do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ -n "Simon Tatham's Portable Puzzle Collection Installer" puzzles.msi
+  in puzzles with wixonlinux do candle -arch x64 puzzles.wxs -dWin64=yes -dBindir=win64/ && light -ext WixUIExtension -sval puzzles.wixobj
+  in puzzles with wixonlinux do candle -arch x86 puzzles.wxs -dWin64=no -dBindir=win32/ && light -ext WixUIExtension -sval puzzles.wixobj -o puzzles32.msi
+  ifneq "$(cross_winsigncode)" "" in puzzles do $(cross_winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ -n "Simon Tatham's Portable Puzzle Collection Installer" puzzles.msi puzzles32.msi
 else
   delegate windows
     in puzzles with visualstudio do/win nmake -f Makefile.vc clean
     in puzzles with visualstudio do/win nmake -f Makefile.vc VER=-DVER=$(Version)
-    ifneq "$(winsigncode)" "" in puzzles do $(winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ *.exe
+    ifneq "$(winsigncode)" "" in puzzles do $(winsigncode) -i https://www.chiark.greenend.org.uk/~sgtatham/puzzles/ win64/*.exe
     # Build installers.
-    in puzzles with wix do/win candle puzzles.wxs && light -ext WixUIExtension -sval puzzles.wixobj
+    in puzzles with wix do/win candle puzzles.wxs -dWin64=yes -dBindir=win64/  && light -ext WixUIExtension -sval puzzles.wixobj
     in puzzles with innosetup do/win iscc puzzles.iss
-    return puzzles/*.exe
+    return puzzles/win64/*.exe
     return puzzles/puzzles.msi
   enddelegate
 endif
-in puzzles do chmod +x *.exe
+in puzzles do chmod +x win32/*.exe win64/*.exe
 
 # Build the Pocket PC binaries and CAB.
 #
@@ -125,11 +126,13 @@
 # gamedesc.txt, which is generated by mkfiles.pl and helpfully
 # excludes the command-line auxiliary utilities such as solosolver,
 # and nullgame.exe) into a subdirectory for easy access.
-in puzzles do mkdir winbin
-in puzzles do mv `cut -f2 -d: gamedesc.txt` winbin
+in puzzles do mkdir winbin64 winbin32
+in puzzles/win64 do mv `cut -f2 -d: ../gamedesc.txt` ../winbin64
+in puzzles/win32 do mv `cut -f2 -d: ../gamedesc.txt` ../winbin32
 
 # Make a zip file of the Windows binaries and help files.
-in puzzles do zip -j puzzles.zip winbin/*.exe puzzles.chm puzzles.hlp puzzles.cnt
+in puzzles do zip -j puzzles.zip winbin64/*.exe puzzles.chm puzzles.hlp puzzles.cnt
+in puzzles do zip -j puzzles32.zip winbin32/*.exe puzzles.chm puzzles.hlp puzzles.cnt
 
 # Create the source archive. (That writes the archive into the
 # _parent_ directory, so be careful when we deliver it.)
@@ -177,7 +180,8 @@
 
 # Phew, we're done. Deliver everything!
 deliver puzzles/icons/*-web.png $@
-deliver puzzles/winbin/*.exe $@
+deliver puzzles/winbin64/*.exe $@
+deliver puzzles/winbin32/*.exe w32/$@
 deliver puzzles/.htaccess $@
 deliver puzzles/doc/*.html doc/$@
 deliver puzzles/devel/*.html devel/$@
@@ -186,7 +190,9 @@
 deliver puzzles/puzzles.hlp $@
 deliver puzzles/puzzles.cnt $@
 deliver puzzles/puzzles.zip $@
+deliver puzzles/puzzles32.zip w32/$@
 deliver puzzles/puzzles.msi puzzles-$(Version)-installer.msi
+deliver puzzles/puzzles32.msi w32/puzzles-$(Version)-32bit-installer.msi
 deliver puzzles/*.jar java/$@
 deliver puzzles/js/*.js js/$@
 deliver puzzles/jstest/*.html jstest/$@
--- a/mkfiles.pl
+++ b/mkfiles.pl
@@ -638,7 +638,7 @@
             print "\t\$(RC) \$(RCFLAGS) ".$d->{deps}->[0]." -o ".$d->{obj}."\n\n";
 	} else {
 	    $deflist = join "", map { " /D$_" } @{$d->{defs}};
-            print "\t\$(CC) /Fo\$(BUILDDIR)".$d->{obj}." \$(COMPAT) \$(CFLAGS) \$(XFLAGS)$deflist /c \$<\n\n";
+            print "\t\$(CC) /Fo".$d->{obj}." \$(COMPAT) \$(CFLAGS) \$(XFLAGS)$deflist /c \$<\n\n";
         }
     }
     print "\nclean:\n".
--- a/winwix.mc
+++ b/winwix.mc
@@ -12,6 +12,12 @@
 
 <?xml version="1.0" encoding="utf-8"?>
 
+<?if $(var.Win64) = yes ?>
+  <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
+<?else ?>
+  <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
+<?endif ?>
+
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
 
 % # Product tag. The Id component is set to "*", which causes WiX to
@@ -61,7 +67,7 @@
 % # (individual files or shortcuts or additions to PATH) that are
 % # installed.
     <Directory Id="TARGETDIR" Name="SourceDir">
-      <Directory Id="ProgramFiles64Folder" Name="PFiles">
+      <Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
         <Directory Id="INSTALLDIR" Name="Simon Tatham's Portable Puzzle Collection">
 
 % # The following components all install things in the main
@@ -71,12 +77,12 @@
 % # the more obscure things like LICENCE are just there for
 % # the sake of being _somewhere_ and don't rate a shortcut.
 
-<%method file_component ($filename, $shortcutname)>
+<%method file_component ($prefix, $filename, $shortcutname)>
 % my $filename_id = file_component_name($filename);
 <Component Id="File_Component_<% $filename_id %>"
     Guid="<% invent_guid('file:' . $filename) %>">
   <File Id="File_<% $filename_id %>"
-        Source="<% $filename %>" KeyPath="yes">
+        Source="<% $prefix %><% $filename %>" KeyPath="yes">
 % if (defined $shortcutname) {
     <Shortcut Id="startmenu_<% $filename_id %>"
               Directory="ProgramMenuDir" WorkingDirectory="INSTALLDIR"
@@ -87,12 +93,12 @@
 </%method>
 
 % for my $exe (@exes) {
-<% $.file_component($exe, $names{$exe}) %>
+<% $.file_component('$(var.Bindir)', $exe, $names{$exe}) %>
 % }
 
-<% $.file_component("puzzles.chm", "Puzzles Manual") %>
-<% $.file_component("website.url", "Puzzles Web Site") %>
-<% $.file_component("LICENCE") %>
+<% $.file_component('', "puzzles.chm", "Puzzles Manual") %>
+<% $.file_component('', "website.url", "Puzzles Web Site") %>
+<% $.file_component('', "LICENCE") %>
 
         </Directory>
       </Directory>