source: trunk/game/packaging/windows_packaging.nsi @ 680

Revision 522, 8.7 KB checked in by barra_parpg, 10 years ago (diff)

Patch by mvbarracuda:

  • Updated README to reflect the actual techdemo release revision
  • We've made it :-) techdemo 1 is here
  • Todo: tag release, package release, upload packages, set svn external back to FIFE trunk (set to revision 3236 for the tagged release
Line 
1!define PRODUCT_NAME "PARPG Techdemo 1"
2!define PRODUCT_VERSION "SVN trunk r522"
3!define PRODUCT_PUBLISHER "PARPG Development Team"
4!define PRODUCT_WEB_SITE "http://www.parpg.net/"
5!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
6!define PRODUCT_UNINST_ROOT_KEY "HKLM"
7!define PARPG_DIR ".."
8
9; MUI 1.67 compatible ------
10!include "MUI.nsh"
11
12; MUI Settings
13!define MUI_ABORTWARNING
14!define MUI_ICON "${PARPG_DIR}\gui\icons\window_icon.ico"
15!define MUI_UNICON "${PARPG_DIR}\gui\icons\window_icon.ico"
16
17; Welcome page
18!insertmacro MUI_PAGE_WELCOME
19
20!insertmacro MUI_PAGE_COMPONENTS
21
22; License page
23!insertmacro MUI_PAGE_LICENSE "${PARPG_DIR}\license\gpl30.license"
24; Directory page
25!insertmacro MUI_PAGE_DIRECTORY
26; Instfiles page
27!insertmacro MUI_PAGE_INSTFILES
28; Finish page
29!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\game\README.txt"
30!insertmacro MUI_PAGE_FINISH
31
32; Uninstaller pages
33!insertmacro MUI_UNPAGE_INSTFILES
34
35; Language files
36!insertmacro MUI_LANGUAGE "English"
37
38; MUI end ------
39
40RequestExecutionLevel admin ;For Vista. Admin is needed to install in program files directory
41
42Name "${PRODUCT_NAME}"
43OutFile "parpg_td1_r522_win32.exe"
44InstallDir "$PROGRAMFILES\PARPG"
45ShowInstDetails show
46ShowUnInstDetails show
47
48;------------ Main. Packages PARPG code --------------
49Section "PARPG" PARPG
50  SectionIn RO
51  SetOutPath "$INSTDIR\game"
52  SetOverwrite try
53 
54  ;Get all the core PARPG files
55  FILE /r "${PARPG_DIR}\*.ttf"
56  FILE /r "${PARPG_DIR}\*.py"
57  FILE /r "${PARPG_DIR}\*.yaml"
58  FILE /r /x "settings.xml" "${PARPG_DIR}\*.xml"
59  FILE /r "${PARPG_DIR}\*.png"
60  FILE /r "${PARPG_DIR}\*.ico"
61  FILE /r "${PARPG_DIR}\*.ogg"
62  FILE /r "${PARPG_DIR}\*.license"
63 
64  FILE "${PARPG_DIR}\README"
65  FILE "${PARPG_DIR}\log_parpg.bat"
66
67  RENAME "settings-dist.xml" "settings.xml"
68  RENAME "README" "README.txt"
69 
70  CreateDirectory "$INSTDIR\game\saves" 
71 
72  SetAutoClose true
73SectionEnd
74
75Section -Tools
76  SetOutPath "$INSTDIR\tools\map_editor"
77  SetOverwrite try
78 
79  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.ttf"
80  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.py"
81  FILE /r /x "settings.xml" "${PARPG_DIR}\..\tools\map_editor\*.xml"
82  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.png"
83  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.txt"
84  RENAME "settings-dist.xml" "settings.xml"
85 
86SectionEnd
87
88Section -AdditionalIcons
89  ;avoid shortcuts headaches on vista by doing everything in the all users start menu
90  SetShellVarContext all
91  SetOutPath $INSTDIR
92  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
93  CreateDirectory "$SMPROGRAMS\PARPG"
94  CreateShortCut "$SMPROGRAMS\PARPG\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
95  CreateShortCut "$SMPROGRAMS\PARPG\Uninstall.lnk" "$INSTDIR\uninstall.exe"
96  SetOutPath "$INSTDIR\game" ;this makes the following shortcut run in the installed directory
97  CreateShortCut "$SMPROGRAMS\PARPG\PARPG.lnk" "$INSTDIR\game\run.py"
98  CreateShortCut "$SMPROGRAMS\PARPG\Editor.lnk" "$INSTDIR\game\parpg_editor.py"
99SectionEnd
100
101Section -Post
102  WriteUninstaller "$INSTDIR\uninstall.exe"
103  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
104  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
105  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\gui\icons\window_icon.ico"
106  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
107  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
108  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
109SectionEnd
110
111
112Function un.onUninstSuccess
113  HideWindow
114  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
115FunctionEnd
116
117Function un.onInit
118  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
119  Abort
120FunctionEnd
121
122Section Uninstall
123  ;avoid shortcuts headaches on vista by doing everything in the all users start menu
124  SetShellVarContext all
125 
126  ;Remove all the code
127  RMDir /r "$INSTDIR\game\dialogue"
128  RMDir /r "$INSTDIR\game\editor"
129  RMDir /r "$INSTDIR\game\fonts"
130  RMDir /r "$INSTDIR\game\gui"
131  RMDir /r "$INSTDIR\game\lib"
132  RMDir /r "$INSTDIR\game\local_loaders"
133  RMDir /r "$INSTDIR\game\maps"
134  RMDir /r "$INSTDIR\game\music"
135  RMDir /r "$INSTDIR\game\objects"
136  RMDir /r "$INSTDIR\game\quests"
137  RMDir "$INSTDIR\game\saves" ;Test if the directory will get deleted when it contains files. The expected behaviour is that it will not.
138  RMDir /r "$INSTDIR\game\scripts"
139  RMDir /r "$INSTDIR\game\tests"
140  RMDir /r "$INSTDIR\game\utilities"
141 
142  Delete "$INSTDIR\game\dialogue_demo.py"
143  Delete "$INSTDIR\game\dialogue_schema.yaml"
144  Delete "$INSTDIR\game\PARPG"
145  Delete "$INSTDIR\game\parpg_editor.py"
146  Delete "$INSTDIR\game\run.py"
147  Delete "$INSTDIR\game\run_tests.py"
148  Delete "$INSTDIR\game\settings.py"
149  Delete "$INSTDIR\game\settings.xml"
150  Delete "$INSTDIR\game\README.txt"
151  Delete "$INSTDIR\game\log_parpg.bat"
152  Delete "$INSTDIR\game\*.log"
153  Delete "$INSTDIR\game\*.pyc"
154  Delete "$INSTDIR\${PRODUCT_NAME}.url"
155  Delete "$INSTDIR\uninstall.exe"
156  RMDir "$INSTDIR\game"
157  RMDir /r "$INSTDIR\tools"
158 
159  RMDir "$INSTDIR"
160
161  ;Remove shortcuts
162  RMDir /r "$SMPROGRAMS\PARPG"
163 
164  ;Remove Registry keys
165  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
166  SetAutoClose true
167SectionEnd
168SectionGroup Externals
169;---------- DOWNLOAD PYTHON -------
170Section "ActivePython (required)" Python
171  SetDetailsPrint textonly
172
173  DetailPrint "Downloading Python"
174  NSISdl::download http://downloads.activestate.com/ActivePython/releases/2.6.4.10/ActivePython-2.6.4.10-win32-x86.msi $TEMP/pysetup.msi
175  Pop $R0 ;Get the return value
176    StrCmp $R0 "success" +3
177      MessageBox MB_OK "Failed to download Python installer: $R0"
178      Quit
179
180  DetailPrint "Installing Python"
181  ExecWait '"msiexec" /i "$TEMP\pysetup.msi"'
182
183  DetailPrint "Deleting Python installer"
184  Delete $TEMP\pysetup.msi
185SectionEnd
186;------------FIFE-------------------
187Section "FIFE (required)" FIFE
188  SetDetailsPrint textonly
189
190  SetOutPath "$TEMP"
191  ;Get all the core PARPG files
192  FILE /r "dependencies\fife_0.3.0_r3236_win32.exe"
193  DetailPrint "Installing FIFE"
194  ExecWait "$TEMP\fife_0.3.0_r3236_win32.exe"
195
196  DetailPrint "Deleting FIFE installer"
197  Delete "$TEMP\fife_0.3.0_r3236_win32.exe"
198SectionEnd
199;------------ PyYAML --------------
200Section "PyYAML (required)" PyYAML
201  SetDetailsPrint textonly
202
203  SetOutPath "$SYSDIR"        ;Some Systems need this DLL to install PyYAML properly
204  ;SetOverwrite ifnewer
205  ;File "requs\msvcr71.dll"
206  ;SetOverwrite on
207  NSISdl::download http://pyyaml.org/download/pyyaml/PyYAML-3.09.win32-py2.6.exe $TEMP\pyaml_setup.exe
208  Pop $R0 ;Get the return value
209    StrCmp $R0 "success" +3
210      MessageBox MB_OK "Failed to download PyYAML installer: $R0"
211      Quit
212
213 
214  SetOutPath "$TEMP"
215  DetailPrint "Installing PyYAML"
216  ExecWait "$TEMP\pyaml_setup.exe"
217
218  DetailPrint "Deleting PyYAML installer"
219  Delete "$TEMP\PyYAML_setup.exe"
220SectionEnd
221;----------- OPEN AL --------------
222Section "OpenAL (required)" OpenAL
223  SetDetailsPrint textonly
224
225  ;oalinst.exe must be downloaded seperately and put into the
226  ;dependencies directory for packaging to be successful
227  SetOutPath "$TEMP"
228  File ".\dependencies\oalinst.exe"
229  DetailPrint "Installing OpenAL"
230  ExecWait "$TEMP\oalinst.exe"
231
232  DetailPrint "Deleting OpenAL installer"
233  Delete "$TEMP\oalinst.exe"
234SectionEnd
235;--------- SECTION END ------------
236SectionGroupEnd
237LangString DESC_PARPG ${LANG_ENGLISH} "PARPG - Techdemo 1 SVN r522"
238LangString DESC_Python ${LANG_ENGLISH} "ActivePython 2.6.4.8 - Required to run PARPG. Requires an active internet connection to install."
239LangString DESC_FIFE ${LANG_ENGLISH} "FIFE 0.3.0 SVN trunk r3236 - Required to run PARPG."
240LangString DESC_PyYAML ${LANG_ENGLISH} "PyYAML 3.09 - Required Python Module. Requires an active internet connection to install."
241LangString DESC_OpenAL ${LANG_ENGLISH} "OpenAL - Required for sound effects and music playback."
242
243!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
244  !insertmacro MUI_DESCRIPTION_TEXT ${PARPG} $(DESC_PARPG)
245  !insertmacro MUI_DESCRIPTION_TEXT ${Python} $(DESC_Python)
246  !insertmacro MUI_DESCRIPTION_TEXT ${FIFE} $(DESC_FIFE)
247  !insertmacro MUI_DESCRIPTION_TEXT ${PyYAML} $(DESC_PyYAML)
248  !insertmacro MUI_DESCRIPTION_TEXT ${OpenAL} $(DESC_OpenAL)
249!insertmacro MUI_FUNCTION_DESCRIPTION_END
Note: See TracBrowser for help on using the repository browser.