From 7fac68a044a3bbceaef589a18e35d930fde9bc34 Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Wed, 3 Mar 2010 22:42:53 +1300 Subject: [PATCH 1/7] NSIS script --- packaging/windows/OpenRA.nsi | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 packaging/windows/OpenRA.nsi diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi new file mode 100644 index 0000000000..ad8758a175 --- /dev/null +++ b/packaging/windows/OpenRA.nsi @@ -0,0 +1,54 @@ +!include "MUI2.nsh" + +Name "OpenRA" +OutFile "OpenRA.exe" + +InstallDir $PROGRAMFILES\OpenRA +SetCompressor lzma + +!insertmacro MUI_PAGE_WELCOME +!insertmacro MUI_PAGE_LICENSE "..\..\COPYING" +!insertmacro MUI_PAGE_COMPONENTS +!insertmacro MUI_PAGE_INSTFILES + +!insertmacro MUI_LANGUAGE "English" + +Section "Client" Client + SetOutPath "$INSTDIR" + File "..\..\OpenRA.Game\bin\Debug\OpenRA.Game.exe" + File "..\..\OpenRA.Game\bin\Debug\OpenRA.FileFormats.dll" + File "..\..\OpenRA.Gl.dll" + File "..\..\COPYING" + File "..\..\HACKING" + File "..\..\INSTALL" + File "..\..\settings-netplay-cnc.ini" + File "..\..\settings-netplay-ra.ini" + File "..\..\FreeSans.ttf" + File "..\..\FreeSansBold.ttf" + + File /r "..\..\thirdparty\Tao\*.dll" + + SetOutPath "$INSTDIR\shaders" + File /r "..\..\shaders\*.fx" +SectionEnd + +SectionGroup /e "Mods" + Section "Red Alert" RA + SetOutPath "$INSTDIR\mods\ra" + File /r "..\..\mods\ra\*.*" + SectionEnd + Section "Command & Conquer" CNC + SetOutPath "$INSTDIR\mods\cnc" + File /r "..\..\mods\cnc\*.*" + SectionEnd +SectionGroupEnd + +Section "Server" Server + SetOutPath "$INSTDIR" + File "..\..\OpenRA.Server\bin\Debug\OpenRA.Server.exe" +SectionEnd + +Function .onInit + IntOp $0 ${SF_SELECTED} | ${SF_RO} + SectionSetFlags ${Client} $0 +FunctionEnd From 49908be1c15577803feaafe299ca4ae2c5ee0c11 Mon Sep 17 00:00:00 2001 From: Matthew Date: Thu, 4 Mar 2010 12:33:33 +1300 Subject: [PATCH 2/7] Mods all in NSIS script. --- packaging/windows/OpenRA.nsi | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index ad8758a175..c8d3943d4e 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -40,6 +40,14 @@ SectionGroup /e "Mods" Section "Command & Conquer" CNC SetOutPath "$INSTDIR\mods\cnc" File /r "..\..\mods\cnc\*.*" + SectionEnd + Section "Red Alert: Aftermath" Aftermath + SetOutPath "$INSTDIR\mods\aftermath" + File /r "..\..\mods\aftermath\*.*" + SectionEnd + Section "Red Alert: Next Generation" RA_NG + SetOutPath "$INSTDIR\mods\ra-ng" + File /r "..\..\mods\ra-ng\*.*" SectionEnd SectionGroupEnd @@ -47,8 +55,31 @@ Section "Server" Server SetOutPath "$INSTDIR" File "..\..\OpenRA.Server\bin\Debug\OpenRA.Server.exe" SectionEnd + +Var previousSelection Function .onInit IntOp $0 ${SF_SELECTED} | ${SF_RO} - SectionSetFlags ${Client} $0 + SectionSetFlags ${Client} $0 + + IntOp $previousSelection ${SF_SELECTED} + 0 +FunctionEnd + +Function .onSelChange + SectionGetFlags ${RA} $0 + IntOp $1 ${SF_SELECTED} & $0 + IntCmp $1 $previousSelection done + + IntCmp 0 $1 deselected selected + deselected: + SectionSetFlags ${Aftermath} ${SF_RO} + SectionSetFlags ${RA_NG} ${SF_RO} + Goto done + selected: + SectionSetFlags ${Aftermath} ${SF_SELECTED} + SectionSetFlags ${RA_NG} ${SF_SELECTED} + Goto done + + done: + IntOp $previousSelection $1 + 0 FunctionEnd From e195ac8f8264ddb394f6a312805b3b1ffdf3edc2 Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Thu, 4 Mar 2010 17:41:30 +1300 Subject: [PATCH 3/7] OpenAL is now downloaded and installed. --- packaging/windows/OpenRA.nsi | 98 ++++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 31 deletions(-) diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index c8d3943d4e..205070bc00 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -1,4 +1,5 @@ !include "MUI2.nsh" +!include "ZipDLL.nsh" Name "OpenRA" OutFile "OpenRA.exe" @@ -13,6 +14,9 @@ SetCompressor lzma !insertmacro MUI_LANGUAGE "English" +;*************************** +;Section Definitions +;*************************** Section "Client" Client SetOutPath "$INSTDIR" File "..\..\OpenRA.Game\bin\Debug\OpenRA.Game.exe" @@ -40,14 +44,14 @@ SectionGroup /e "Mods" Section "Command & Conquer" CNC SetOutPath "$INSTDIR\mods\cnc" File /r "..\..\mods\cnc\*.*" - SectionEnd - Section "Red Alert: Aftermath" Aftermath - SetOutPath "$INSTDIR\mods\aftermath" - File /r "..\..\mods\aftermath\*.*" - SectionEnd - Section "Red Alert: Next Generation" RA_NG - SetOutPath "$INSTDIR\mods\ra-ng" - File /r "..\..\mods\ra-ng\*.*" + SectionEnd + Section "Red Alert: Aftermath" Aftermath + SetOutPath "$INSTDIR\mods\aftermath" + File /r "..\..\mods\aftermath\*.*" + SectionEnd + Section "Red Alert: Next Generation" RA_NG + SetOutPath "$INSTDIR\mods\ra-ng" + File /r "..\..\mods\ra-ng\*.*" SectionEnd SectionGroupEnd @@ -55,31 +59,63 @@ Section "Server" Server SetOutPath "$INSTDIR" File "..\..\OpenRA.Server\bin\Debug\OpenRA.Server.exe" SectionEnd - -Var previousSelection + +;*************************** +;Dependency Sections +;*************************** +Section "-OpenAl" OpenAl + SetOutPath "$TEMP" + NSISdl::download http://connect.creativelabs.com/openal/Downloads/oalinst.zip oalinst.zip + !insertmacro ZIPDLL_EXTRACT oalinst.zip OpenAL oalinst.exe + ExecWait "$TEMP\OpenAL\oalinst.exe" +SectionEnd + +;*************************** +;Section Descriptions +;*************************** +LangString DESC_Client ${LANG_ENGLISH} "OpenRA client and dependencies" +LangString DESC_Server ${LANG_ENGLISH} "OpenRA server" +LangString DESC_RA ${LANG_ENGLISH} "Base Red Alert mod" +LangString DESC_CNC ${LANG_ENGLISH} "Base Command and Conquer mod" +LangString DESC_Aftermath ${LANG_ENGLISH} "Red Alert: Aftermath expansion mod (depends on base Red Alert mod)" +LangString DESC_RA_NG ${LANG_ENGLISH} "Next-gen Red Alert mod (depends on base Red Alert mod)" + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${Client} $(DESC_Client) + !insertmacro MUI_DESCRIPTION_TEXT ${Server} $(DESC_Server) + !insertmacro MUI_DESCRIPTION_TEXT ${RA} $(DESC_RA) + !insertmacro MUI_DESCRIPTION_TEXT ${CNC} $(DESC_CNC) + !insertmacro MUI_DESCRIPTION_TEXT ${Aftermath} $(DESC_Aftermath) + !insertmacro MUI_DESCRIPTION_TEXT ${RA_NG} $(DESC_RA_NG) +!insertmacro MUI_FUNCTION_DESCRIPTION_END + +;*************************** +;Functions +;*************************** +Var previousSelection Function .onInit IntOp $0 ${SF_SELECTED} | ${SF_RO} - SectionSetFlags ${Client} $0 - + SectionSetFlags ${Client} $0 + IntOp $previousSelection ${SF_SELECTED} + 0 -FunctionEnd - -Function .onSelChange - SectionGetFlags ${RA} $0 - IntOp $1 ${SF_SELECTED} & $0 - IntCmp $1 $previousSelection done - - IntCmp 0 $1 deselected selected - deselected: - SectionSetFlags ${Aftermath} ${SF_RO} - SectionSetFlags ${RA_NG} ${SF_RO} - Goto done - selected: - SectionSetFlags ${Aftermath} ${SF_SELECTED} - SectionSetFlags ${RA_NG} ${SF_SELECTED} - Goto done - - done: - IntOp $previousSelection $1 + 0 +FunctionEnd + +Function .onSelChange + SectionGetFlags ${RA} $0 + IntOp $1 ${SF_SELECTED} & $0 + IntCmp $1 $previousSelection done + + IntCmp 0 $1 deselected selected + deselected: + SectionSetFlags ${Aftermath} ${SF_RO} + SectionSetFlags ${RA_NG} ${SF_RO} + Goto done + selected: + SectionSetFlags ${Aftermath} ${SF_SELECTED} + SectionSetFlags ${RA_NG} ${SF_SELECTED} + Goto done + + done: + IntOp $previousSelection $1 + 0 FunctionEnd From c648a1ea70adf1f010684d1869ee559705539483 Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Thu, 4 Mar 2010 17:56:41 +1300 Subject: [PATCH 4/7] SDL now downloaded and installed. --- packaging/windows/OpenRA.nsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index 205070bc00..b897241f10 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -70,6 +70,12 @@ Section "-OpenAl" OpenAl ExecWait "$TEMP\OpenAL\oalinst.exe" SectionEnd +Section "-Sdl" SDL + SetOutPath "$TEMP" + NSISdl::download http://www.libsdl.org/release/SDL-1.2.14-win32.zip sdl.zip + !insertmacro ZIPDLL_EXTRACT sdl.zip $SYSDIR SDL.dll +SectionEnd + ;*************************** ;Section Descriptions ;*************************** From e6075105f4113eb17c0404f59136f591d30c355a Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Thu, 4 Mar 2010 22:28:33 +1300 Subject: [PATCH 5/7] Installer 50% done. Uninstall sections need to be written. --- OpenRA.FileFormats/Support/Log.cs | 3 +- packaging/windows/OpenRA.nsi | 48 ++++++++++++++++++++++++++----- 2 files changed, 43 insertions(+), 8 deletions(-) diff --git a/OpenRA.FileFormats/Support/Log.cs b/OpenRA.FileFormats/Support/Log.cs index 4bc5a54051..55a259cf29 100755 --- a/OpenRA.FileFormats/Support/Log.cs +++ b/OpenRA.FileFormats/Support/Log.cs @@ -19,12 +19,13 @@ #endregion using System.IO; +using System; namespace OpenRA { public static class Log { - static StreamWriter writer = File.CreateText("log.txt"); + static StreamWriter writer = File.CreateText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + Path.DirectorySeparatorChar + "openra.log.txt"); static Log() { diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index b897241f10..4d1e3db792 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -1,5 +1,6 @@ !include "MUI2.nsh" !include "ZipDLL.nsh" +!include "x64.nsh" Name "OpenRA" OutFile "OpenRA.exe" @@ -9,8 +10,10 @@ SetCompressor lzma !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_LICENSE "..\..\COPYING" +!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_INSTFILES +;!insertmacro MUI_PAGE_FINISH !insertmacro MUI_LANGUAGE "English" @@ -40,10 +43,20 @@ SectionGroup /e "Mods" Section "Red Alert" RA SetOutPath "$INSTDIR\mods\ra" File /r "..\..\mods\ra\*.*" + + SetOutPath "$OUTDIR\packages" + NSISdl::download http://open-ra.org/packages/ra-packages.zip ra-packages.zip + ZipDLL::extractall "ra-packages.zip" "$OUTDIR" + Delete ra-packages.zip SectionEnd Section "Command & Conquer" CNC SetOutPath "$INSTDIR\mods\cnc" File /r "..\..\mods\cnc\*.*" + + SetOutPath "$OUTDIR\packages" + NSISdl::download http://open-ra.org/packages/cnc-packages.zip cnc-packages.zip + ZipDLL::extractall "cnc-packages.zip" "$OUTDIR" + Delete cnc-packages.zip SectionEnd Section "Red Alert: Aftermath" Aftermath SetOutPath "$INSTDIR\mods\aftermath" @@ -64,16 +77,37 @@ SectionEnd ;Dependency Sections ;*************************** Section "-OpenAl" OpenAl - SetOutPath "$TEMP" - NSISdl::download http://connect.creativelabs.com/openal/Downloads/oalinst.zip oalinst.zip - !insertmacro ZIPDLL_EXTRACT oalinst.zip OpenAL oalinst.exe - ExecWait "$TEMP\OpenAL\oalinst.exe" + IfFileExists $SYSDIR\OpenAL32.dll done installal + installal: + SetOutPath "$TEMP" + NSISdl::download http://connect.creativelabs.com/openal/Downloads/oalinst.zip oalinst.zip + !insertmacro ZIPDLL_EXTRACT oalinst.zip OpenAL oalinst.exe + ExecWait "$TEMP\OpenAL\oalinst.exe" + done: SectionEnd Section "-Sdl" SDL - SetOutPath "$TEMP" - NSISdl::download http://www.libsdl.org/release/SDL-1.2.14-win32.zip sdl.zip - !insertmacro ZIPDLL_EXTRACT sdl.zip $SYSDIR SDL.dll + IfFileExists $SYSDIR\SDL.dll done installsdl + installsdl: + SetOutPath "$TEMP" + NSISdl::download http://www.libsdl.org/release/SDL-1.2.14-win32.zip sdl.zip + !insertmacro ZIPDLL_EXTRACT sdl.zip $SYSDIR SDL.dll + done: +SectionEnd + +Section "-Freetype" Freetype + IfFileExists $SYSDIR\freetype6.dll done installft + installft: + SetOutPath "$TEMP" + NSISdl::download http://downloads.sourceforge.net/project/gnuwin32/freetype/2.3.5-1/freetype-2.3.5-1-bin.zip freetype.zip + !insertmacro ZIPDLL_EXTRACT freetype.zip $OUTDIR bin\freetype6.dll + ;Epic hack to get around bug in CopyFiles + ${If} ${RunningX64} + CopyFiles "$OUTDIR\bin\freetype6.dll" $WINDIR\SysWOW64 + Goto done + ${EndIf} + CopyFiles "$OUTDIR\bin\freetype6.dll" $SYSDIR + done: SectionEnd ;*************************** From 0c4a91cd9794caccd3e42ac55894bafc47dfcc92 Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Thu, 4 Mar 2010 23:22:29 +1300 Subject: [PATCH 6/7] Now comes in new flavour with real Add/Remove Programs entry. --- packaging/windows/OpenRA.nsi | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index 4d1e3db792..c13d66531f 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -15,6 +15,11 @@ SetCompressor lzma !insertmacro MUI_PAGE_INSTFILES ;!insertmacro MUI_PAGE_FINISH +;!insertmacro MUI_UNPAGE_WELCOME +!insertmacro MUI_UNPAGE_CONFIRM +!insertmacro MUI_UNPAGE_INSTFILES +!insertmacro MUI_UNPAGE_FINISH + !insertmacro MUI_LANGUAGE "English" ;*************************** @@ -33,6 +38,8 @@ Section "Client" Client File "..\..\FreeSans.ttf" File "..\..\FreeSansBold.ttf" + File "..\..\OpenRA.Game\OpenRA.ico" + File /r "..\..\thirdparty\Tao\*.dll" SetOutPath "$INSTDIR\shaders" @@ -110,6 +117,39 @@ Section "-Freetype" Freetype done: SectionEnd +;*************************** +;Uninstaller Sections +;*************************** +Section "-Uninstaller" + WriteUninstaller $INSTDIR\uninstaller.exe + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "DisplayName" "OpenRA" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "UninstallString" "$INSTDIR\uninstaller.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "InstallLocation" "$INSTDIR" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "DisplayIcon" "$INSTDIR\OpenRA.ico" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "Publisher" "IJW Software (New Zealand)" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "URLInfoAbout" "http://open-ra.org" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "NoModify" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" "NoRepair" "1" +SectionEnd + +Section "Uninstall" + RMDir /r $INSTDIR\mods + RMDir /r $INSTDIR\shaders + Delete $INSTDIR\OpenRA.Game.exe + Delete $INSTDIR\OpenRA.Server.exe + Delete $INSTDIR\OpenRA.FileFormats.dll + Delete $INSTDIR\OpenRA.Gl.dll + Delete $INSTDIR\Tao.*.dll + Delete $INSTDIR\COPYING + Delete $INSTDIR\HACKING + Delete $INSTDIR\INSTALL + Delete $INSTDIR\OpenRA.ico + Delete $INSTDIR\*.ttf + Delete $INSTDIR\settings-netplay-*.ini + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" +SectionEnd + + ;*************************** ;Section Descriptions ;*************************** From 87ac578762dfe2837836b8a399c2349a01b1842a Mon Sep 17 00:00:00 2001 From: Matthew Bowra-Dean Date: Fri, 5 Mar 2010 17:47:49 +1300 Subject: [PATCH 7/7] Install SDL and Freetype into program directory. --- packaging/windows/OpenRA.nsi | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/packaging/windows/OpenRA.nsi b/packaging/windows/OpenRA.nsi index c13d66531f..c4ef3ddfac 100644 --- a/packaging/windows/OpenRA.nsi +++ b/packaging/windows/OpenRA.nsi @@ -1,6 +1,5 @@ !include "MUI2.nsh" !include "ZipDLL.nsh" -!include "x64.nsh" Name "OpenRA" OutFile "OpenRA.exe" @@ -94,27 +93,16 @@ Section "-OpenAl" OpenAl SectionEnd Section "-Sdl" SDL - IfFileExists $SYSDIR\SDL.dll done installsdl - installsdl: - SetOutPath "$TEMP" - NSISdl::download http://www.libsdl.org/release/SDL-1.2.14-win32.zip sdl.zip - !insertmacro ZIPDLL_EXTRACT sdl.zip $SYSDIR SDL.dll - done: + SetOutPath "$TEMP" + NSISdl::download http://www.libsdl.org/release/SDL-1.2.14-win32.zip sdl.zip + !insertmacro ZIPDLL_EXTRACT sdl.zip $INSTDIR SDL.dll SectionEnd Section "-Freetype" Freetype - IfFileExists $SYSDIR\freetype6.dll done installft - installft: - SetOutPath "$TEMP" - NSISdl::download http://downloads.sourceforge.net/project/gnuwin32/freetype/2.3.5-1/freetype-2.3.5-1-bin.zip freetype.zip - !insertmacro ZIPDLL_EXTRACT freetype.zip $OUTDIR bin\freetype6.dll - ;Epic hack to get around bug in CopyFiles - ${If} ${RunningX64} - CopyFiles "$OUTDIR\bin\freetype6.dll" $WINDIR\SysWOW64 - Goto done - ${EndIf} - CopyFiles "$OUTDIR\bin\freetype6.dll" $SYSDIR - done: + SetOutPath "$TEMP" + NSISdl::download http://downloads.sourceforge.net/project/gnuwin32/freetype/2.3.5-1/freetype-2.3.5-1-bin.zip freetype.zip + !insertmacro ZIPDLL_EXTRACT freetype.zip $OUTDIR bin\freetype6.dll + CopyFiles "$OUTDIR\bin\freetype6.dll" $INSTDIR SectionEnd ;*************************** @@ -146,6 +134,8 @@ Section "Uninstall" Delete $INSTDIR\OpenRA.ico Delete $INSTDIR\*.ttf Delete $INSTDIR\settings-netplay-*.ini + Delete $INSTDIR\freetype6.dll + Delete $INSTDIR\SDL.dll DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\OpenRA" SectionEnd