source: trunk/game/packaging/windows_packaging_exe.nsi @ 645

Revision 645, 6.2 KB checked in by beliar, 9 years ago (diff)

Patch by Beliar

  • Added a nsis script that creates an installer for the binary file create with py2exe.
  • Updated packaging_instructions_win32.txt.
  • Added AdvUninstLog2.nsh that is needed for the nsis script
Line 
1!define PRODUCT_NAME "PARPG"
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 INSTDIR_REG_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
6!define INSTDIR_REG_ROOT "HKLM"
7!define PARPG_DIR ".."
8
9; MUI 1.67 compatible ------
10!include "MUI.nsh"
11
12;include the Uninstall log header
13!include "AdvUninstLog2.nsh"
14
15; MUI Settings
16!define MUI_ABORTWARNING
17!define MUI_ICON "${PARPG_DIR}\gui\icons\window_icon.ico"
18!define MUI_UNICON "${PARPG_DIR}\gui\icons\window_icon.ico"
19
20; Welcome page
21!insertmacro MUI_PAGE_WELCOME
22
23!insertmacro MUI_PAGE_COMPONENTS
24
25; License page
26!insertmacro MUI_PAGE_LICENSE "${PARPG_DIR}\license\gpl30.license"
27; Directory page
28!insertmacro MUI_PAGE_DIRECTORY
29; Instfiles page
30!insertmacro MUI_PAGE_INSTFILES
31; Finish page
32!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\game\README.txt"
33!insertmacro MUI_PAGE_FINISH
34
35; Uninstaller pages
36!insertmacro MUI_UNPAGE_INSTFILES
37
38; Language files
39!insertmacro MUI_LANGUAGE "English"
40
41; MUI end ------
42
43RequestExecutionLevel admin ;For Vista. Admin is needed to install in program files directory
44
45Name "${PRODUCT_NAME}"
46OutFile "parpg_td1_r522_win32.exe"
47InstallDir "$PROGRAMFILES\PARPG"
48InstallDirRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "InstallDir"
49ShowInstDetails show
50ShowUnInstDetails show
51
52!insertmacro UNATTENDED_UNINSTALL
53
54;------------ Main. Packages PARPG code --------------
55Section "PARPG" PARPG
56  SectionIn RO
57  SetOverwrite try
58 
59  ;Get all the core PARPG files
60  SetOutPath "$INSTDIR\game\dialogue\"
61  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
62  FILE /r /x ".svn" "${PARPG_DIR}\dialogue\"
63  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
64  SetOutPath "$INSTDIR\game\fonts\"
65  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
66  FILE /r /x ".svn" "${PARPG_DIR}\fonts\"
67  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
68  SetOutPath "$INSTDIR\game\gui\"
69  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
70  FILE /r /x ".svn" "${PARPG_DIR}\gui\"
71  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
72  SetOutPath "$INSTDIR\game\maps\"
73  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
74  FILE /r /x ".svn" "${PARPG_DIR}\maps\"
75  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
76  SetOutPath "$INSTDIR\game\music\"
77  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
78  FILE /r /x ".svn" "${PARPG_DIR}\music\"
79  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
80  SetOutPath "$INSTDIR\game\objects\"
81  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
82  FILE /r /x ".svn" "${PARPG_DIR}\objects\"
83  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
84  SetOutPath "$INSTDIR\game\quests\"
85  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
86  FILE /r /x ".svn" "${PARPG_DIR}\quests\"
87  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
88  SetOutPath "$INSTDIR\game"
89  !insertmacro UNINSTALL.LOG_OPEN_INSTALL
90  FILE "${PARPG_DIR}\dist\*"
91  FILE "${PARPG_DIR}\settings-dist.xml"
92 
93  FILE "${PARPG_DIR}\README"
94
95  RENAME "settings-dist.xml" "settings.xml"
96  RENAME "README" "README.txt"
97 
98  CreateDirectory "$INSTDIR\game\saves" 
99  CreateDirectory "$INSTDIR\game\screenshots" 
100  !insertmacro UNINSTALL.LOG_CLOSE_INSTALL
101 
102  SetAutoClose true
103SectionEnd
104/*
105Section -Tools
106  SetOutPath "$INSTDIR\tools\map_editor"
107  SetOverwrite try
108 
109  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.ttf"
110  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.py"
111  FILE /r /x "settings.xml" "${PARPG_DIR}\..\tools\map_editor\*.xml"
112  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.png"
113  FILE /r "${PARPG_DIR}\..\tools\map_editor\*.txt"
114  RENAME "settings-dist.xml" "settings.xml"
115 
116SectionEnd
117*/
118Section -AdditionalIcons
119  ;avoid shortcuts headaches on vista by doing everything in the all users start menu
120  SetShellVarContext all
121  SetOutPath $INSTDIR
122  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
123  CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
124  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
125  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk" "${UNINST_EXE}"
126  SetOutPath "$INSTDIR\game" ;this makes the following shortcut run in the installed directory
127  CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\game\Parpg.exe"
128  ;CreateShortCut "$SMPROGRAMS\PARPG\Editor.lnk" "$INSTDIR\game\parpg_editor.py"
129SectionEnd
130
131Section -Post
132  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayName" "$(^Name)"
133  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
134  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayIcon" "$INSTDIR\gui\icons\window_icon.ico"
135  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
136  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
137  WriteRegStr ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
138SectionEnd
139
140Function .onInit
141
142        ;prepare log always within .onInit function
143        !insertmacro UNINSTALL.LOG_PREPARE_INSTALL
144
145FunctionEnd
146
147
148Function .onInstSuccess
149
150         ;create/update log always within .onInstSuccess function
151         !insertmacro UNINSTALL.LOG_UPDATE_INSTALL
152
153FunctionEnd
154
155Function un.onUninstSuccess
156  HideWindow
157  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
158FunctionEnd
159
160Function un.onInit
161  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
162  Abort
163FunctionEnd
164
165Section UnInstall
166    ;Remove files
167    Delete "$INSTDIR\${PRODUCT_NAME}.url"
168    !insertmacro UNINSTALL.NEW_UNINSTALL "$OUTDIR"
169    ;Remove shortcuts   
170    Delete "$SMPROGRAMS\${PRODUCT_NAME}\Website.lnk"
171    Delete "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall.lnk"
172    Delete "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk"
173    RmDir "$SMPROGRAMS\${PRODUCT_NAME}"
174    ;Remove Registry keys
175    DeleteRegKey ${INSTDIR_REG_ROOT} "${INSTDIR_REG_KEY}"
176    SetAutoClose true
177
178SectionEnd
179
180LangString DESC_PARPG ${LANG_ENGLISH} "PARPG - Techdemo 1 SVN r522"
181
182!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
183  !insertmacro MUI_DESCRIPTION_TEXT ${PARPG} $(DESC_PARPG)
184!insertmacro MUI_FUNCTION_DESCRIPTION_END
Note: See TracBrowser for help on using the repository browser.