1 ; !define FASTBUILD ; uncomment for debugging this script
3 ;Accepted name defines:
5 ; USE_VisualCppExpress2008
6 ; USE_VisualCppExpress2008_x64
8 ;Accepted value defines:
9 ; OUTPUTFOLDER="Folder path"
10 ; BUILDVERSION="win32"
11 ; PRODUCT_VERSION="1.4"
12 ; PRODUCT_VERSIONx4=1.4.0.0
14 ; Script generated by the HM NIS Edit Script Wizard.
15 ; TODO: The MinGW version is unfinished...
17 !define MINGWBINDIR
"c:\qt\2009.03\mingw\bin"
18 !define QTBINDIR
"c:\qt\2009.03\qt\bin"
19 !define VTKBINDIR
"P:\VTK\bin"
21 !ifdef USE_VisualCppExpress2008
22 !define QTBINDIR
"${SRC_ROOT}\third_party\Qt\bin"
23 !define VTKBINDIR
"${SRC_ROOT}\third_party\VTK\bin"
24 !define VTKLIBDIR
"${SRC_ROOT}\third_party\VTK\lib"
27 !ifdef USE_VisualCppExpress2008_x64
28 !define QTBINDIR
"${SRC_ROOT}\third_party64\Qt\bin"
29 !define VTKBINDIR
"${SRC_ROOT}\third_party64\VTK\bin"
30 !define VTKLIBDIR
"${SRC_ROOT}\third_party64\VTK\lib"
31 !ifndef USE_VisualCppExpress2008
32 !define USE_VisualCppExpress2008
; useful for redundant operations!
37 ; FIXME: These two are to be dropped?
38 !define QWTLIBDIR
"c:\Libraries\qwt-5.3.0-svn\lib"
39 !define QWTPLOT3DLIBDIR
"c:\Libraries\qwtplot3d\lib"
43 !define OUTPUTFOLDER
"${SRC_ROOT}\windows"
47 !define BUILDVERSION
"win32"
50 !ifndef PRODUCT_VERSION
51 !define PRODUCT_VERSION
"1.4"
54 !ifndef PRODUCT_VERSIONx4
55 !define PRODUCT_VERSIONx4
1.4.0.0
58 ; Set up general options
61 SetCompressor
/SOLID lzma
; saves about 1.2MB
62 SetCompressorDictSize
128
67 RequestExecutionLevel user
76 ; Load headers for file functions
77 !include "FileFunc.nsh"
80 ; HM NIS Edit Wizard helper defines
81 !define SRC_ROOT
"..\"
82 !define PRODUCT_NAME
"enGrid"
83 ; PRODUCT_VERSION defined on the header part of this file
84 !define PRODUCT_PUBLISHER
"enGits GmbH"
85 !define PRODUCT_WEB_SITE
"http://www.engits.eu"
86 !define WIKI_WEB_SITE
"https://github.com/enGits/engrid/wiki"
87 !define PRODUCT_DIR_REGKEY
"Software\enGits\${PRODUCT_NAME}"
88 !define PRODUCT_UNINST_KEY
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
89 !define PRODUCT_UNINST_ROOT_KEY
"HKLM"
90 !define PRODUCT_STARTMENU_REGVAL
"NSIS:StartMenuDir"
92 ; MUI 1.67 compatible ------
96 !define MUI_ABORTWARNING
97 !define MUI_ICON
"${NSISDIR}\Contrib\Graphics\Icons\orange-install.ico"
98 !define MUI_UNICON
"${NSISDIR}\Contrib\Graphics\Icons\orange-uninstall.ico"
101 !insertmacro MUI_PAGE_WELCOME
103 !insertmacro MUI_PAGE_LICENSE
"..\licence_exe.txt"
106 !insertmacro MUI_PAGE_DIRECTORY
110 !define MUI_STARTMENUPAGE_NODISABLE
111 !define MUI_STARTMENUPAGE_DEFAULTFOLDER
"$ICONS_GROUP"
112 !define MUI_STARTMENUPAGE_REGISTRY_ROOT
"${PRODUCT_UNINST_ROOT_KEY}"
113 !define MUI_STARTMENUPAGE_REGISTRY_KEY
"${PRODUCT_UNINST_KEY}"
114 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME
"${PRODUCT_STARTMENU_REGVAL}"
115 !insertmacro MUI_PAGE_STARTMENU Application
$ICONS_GROUP
117 !insertmacro MUI_PAGE_INSTFILES
120 ; Overriding the execution of enGrid to be done as normal user.
122 Exec '$INSTDIR\engrid.exe'
126 !insertmacro UAC
.CallFunctionAsUser ExecAppFile
129 !define MUI_FINISHPAGE_RUN
130 !define MUI_FINISHPAGE_RUN_FUNCTION AppRunAs
132 Function finishpageaction
133 SetShellVarContext all
134 CreateShortCut "$DESKTOP\enGrid.lnk" "$INSTDIR\engrid.exe" " " "$INSTDIR\engrid.exe"
135 StrCpy $DESKTOP_ICON "1"
136 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_DIR_REGKEY}" "DesktopIcon" "$DESKTOP_ICON"
139 !define MUI_FINISHPAGE_SHOWREADME
""
140 !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
141 !define MUI_FINISHPAGE_SHOWREADME_TEXT
"Create Desktop Shortcut"
142 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION finishpageaction
144 !insertmacro MUI_PAGE_FINISH
147 !insertmacro MUI_UNPAGE_INSTFILES
150 !insertmacro MUI_LANGUAGE
"English"
154 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
155 OutFile "${OUTPUTFOLDER}\${PRODUCT_NAME}_${PRODUCT_VERSION}_setup_${BUILDVERSION}.exe"
157 InstallDir "$PROGRAMFILES64\enGits\enGrid"
159 InstallDir "$PROGRAMFILES\enGits\enGrid"
161 InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
163 ShowUnInstDetails show
165 Caption "${PRODUCT_NAME} ${PRODUCT_VERSION}"
166 VIProductVersion
${PRODUCT_VERSIONx4}
167 VIAddVersionKey ProductName
"${PRODUCT_NAME}"
168 VIAddVersionKey Comments
"Installer for ${PRODUCT_NAME} ${PRODUCT_VERSION}, build version ${BUILDVERSION}."
169 VIAddVersionKey CompanyName
"${PRODUCT_PUBLISHER}"
170 VIAddVersionKey LegalCopyright
"${PRODUCT_WEB_SITE}"
171 VIAddVersionKey FileDescription
"${PRODUCT_NAME} ${PRODUCT_VERSION} installer."
172 VIAddVersionKey FileVersion
${PRODUCT_VERSIONx4}
173 VIAddVersionKey ProductVersion
${PRODUCT_VERSIONx4}
174 VIAddVersionKey InternalName
"${PRODUCT_NAME} ${PRODUCT_VERSION} installer."
175 VIAddVersionKey LegalTrademarks
"enGrid is a Trademark of enGits, GmbH."
176 VIAddVersionKey OriginalFilename
"${PRODUCT_NAME}_${PRODUCT_VERSION}_setup_${BUILDVERSION}.exe"
182 ${DisableX64FSRedirection}
185 ${EnableX64FSRedirection}
187 MessageBox MB_OK "Sorry this application runs only on x64 machines"
192 ;Extract InstallOptions files
193 ;$PLUGINSDIR will automatically be removed when the installer closes
197 ; Initialize global variables
199 StrCpy $ICONS_GROUP "enGits\${PRODUCT_NAME} (x64)"
200 StrCpy $INSTDIR "$PROGRAMFILES64\enGits\enGrid"
202 StrCpy $ICONS_GROUP "enGits\${PRODUCT_NAME}"
204 StrCpy $DESKTOP_ICON "0"
206 ; Force installation as super-user
209 StrCmp 1223 $0 UAC_ElevationAborted
210 StrCmp 0 $0 0 UAC_Err
211 StrCmp 1 $1 0 UAC_Success
215 MessageBox mb_iconstop
"Unable to elevate, error $0"
218 UAC_ElevationAborted:
219 MessageBox mb_iconstop
"This installer requires admin access, aborting!"
224 StrCmp 3 $1 0 UAC_ElevationAborted
225 MessageBox mb_iconstop
"This installer requires admin access, try again"
228 ; if the application is already installed, then ask you one wants to uninstall it
229 ReadRegStr $R0 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
232 ReadRegStr $R1 ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion"
234 MessageBox MB_YESNO|
MB_ICONEXCLAMATION "The enGrid version $R1 is already installed. $\nDo you want to remove \
235 the previous version before installing $(^Name)?" IDNO done
240 ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
246 Function .OnInstFailed
251 !define SHCNE_ASSOCCHANGED
0x08000000
252 !define SHCNF_IDLIST
0
254 Function .OnInstSuccess
259 Section "MainSection" SEC01
260 InstallOptions::dialog
"$PLUGINSDIR\test.ini"
262 SetOutPath "$INSTDIR"
265 File "${SRC_ROOT}\release\engrid.exe"
266 File "${SRC_ROOT}\release\libengrid.dll"
267 File "${SRC_ROOT}\release\nglib.dll"
268 !else ifdef USE_VisualCppExpress2008_x64
269 File "${SRC_ROOT}\windows\VisualCppExpress2008\x64\Release\engrid.exe"
270 File "${SRC_ROOT}\windows\VisualCppExpress2008\x64\Release\libengrid.dll"
271 File "${SRC_ROOT}\windows\VisualCppExpress2008\x64\Release\nglib.dll"
272 !else ifdef USE_VisualCppExpress2008
273 File "${SRC_ROOT}\windows\VisualCppExpress2008\Release\engrid.exe"
274 File "${SRC_ROOT}\windows\VisualCppExpress2008\Release\libengrid.dll"
275 File "${SRC_ROOT}\windows\VisualCppExpress2008\Release\nglib.dll"
277 File "${SRC_ROOT}\licence.txt"
278 File "${SRC_ROOT}\license.txt"
279 File "${SRC_ROOT}\licence_exe.txt"
282 !include install_libraries
.nsh
284 !include install_files
.nsh
287 SetShellVarContext all
288 CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
289 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\enGrid.lnk" "$INSTDIR\engrid.exe" " " "$INSTDIR\engrid.exe"
293 Section -AdditionalIcons
294 SetShellVarContext all
295 WriteIniStr
"$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
296 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\enGits Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
298 WriteIniStr
"$INSTDIR\${PRODUCT_NAME}_wiki.url" "InternetShortcut" "URL" "${WIKI_WEB_SITE}"
299 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\enGrid Wiki.lnk" "$INSTDIR\${PRODUCT_NAME}_wiki.url"
301 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Browse Tutorials.lnk" "$INSTDIR\tutorials"
303 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Browse Scripts for Blender.lnk" "$INSTDIR\blender_scripts"
305 CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk" "$INSTDIR\uninst.exe"
310 WriteUninstaller "$INSTDIR\uninst.exe"
311 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\engrid.exe"
312 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
313 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
314 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\engrid.exe"
315 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
316 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
317 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
318 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DesktopIcon" "$DESKTOP_ICON"
319 WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "ProgramGroup" "$ICONS_GROUP"
320 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "InstallDir" "$INSTDIR"
321 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "Version" "${PRODUCT_VERSION}"
322 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "tmp_directory" "$TEMP"
323 WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "working_directory" "$DOCUMENTS"
327 Function un
.onUninstSuccess
330 Delete "$INSTDIR\UAC.dll"
331 MessageBox MB_ICONINFORMATION|
MB_OK "enGrid was successfully removed from your computer."
334 Function un
.OnUnInstFailed
342 ${DisableX64FSRedirection}
347 StrCmp 1223 $0 UAC_ElevationAborted
348 StrCmp 0 $0 0 UAC_Err
349 StrCmp 1 $1 0 UAC_Success
353 MessageBox mb_iconstop
"Unable to elevate, error $0"
356 UAC_ElevationAborted:
357 MessageBox mb_iconstop
"This installer requires admin access, aborting!"
362 StrCmp 3 $1 0 UAC_ElevationAborted
363 MessageBox mb_iconstop
"This installer requires admin access, try again"
366 MessageBox MB_ICONQUESTION|
MB_YESNO|MB_DEFBUTTON2
"Are you sure you want to completely remove enGrid and all of its components?" IDYES +2
373 SetShellVarContext all
376 !include uninstall_files
.nsh
378 !include uninstall_libraries
.nsh
380 Delete "$INSTDIR\${PRODUCT_NAME}.url"
381 Delete "$INSTDIR\${PRODUCT_NAME}_wiki.url"
382 Delete "$INSTDIR\uninst.exe"
383 Delete "$INSTDIR\engrid.exe"
384 Delete "$INSTDIR\libengrid.dll"
385 Delete "$INSTDIR\nglib.dll"
386 Delete "$INSTDIR\license.txt"
387 Delete "$INSTDIR\licence.txt"
388 Delete "$INSTDIR\licence_exe.txt"
390 ReadRegStr $DESKTOP_ICON ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DesktopIcon"
392 Delete "$DESKTOP\enGrid.lnk"
394 ReadRegStr $ICONS_GROUP ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "ProgramGroup"
396 Delete "$SMPROGRAMS\$ICONS_GROUP\Uninstall.lnk"
397 Delete "$SMPROGRAMS\$ICONS_GROUP\enGits Website.lnk"
398 Delete "$SMPROGRAMS\$ICONS_GROUP\enGrid.lnk"
399 Delete "$SMPROGRAMS\$ICONS_GROUP\enGrid Wiki.lnk"
400 Delete "$SMPROGRAMS\$ICONS_GROUP\Browse Tutorials.lnk"
401 RMDir "$SMPROGRAMS\$ICONS_GROUP"
403 ; Take care of the parent folder here as well
404 ${GetParent} "$ICONS_GROUP" $R0
405 StrCmp $R0 "enGits" 0 +3
406 IfFileExists "$SMPROGRAMS\enGits" 0 +2
407 RMDir "$SMPROGRAMS\enGits"
411 ; this is a "just in case" for Program Files only. It will not take care of other custom folders!
412 ${GetParent} "$INSTDIR" $R0
415 StrCmp $R0 "$PROGRAMFILES\enGits" 0 +3
416 IfFileExists "$PROGRAMFILES\enGits" 0 +2
417 RMDir "$PROGRAMFILES\enGits"
418 StrCmp $R0 "$PROGRAMFILES32\enGits" 0 +3
419 IfFileExists "$PROGRAMFILES32\enGits" 0 +2
420 RMDir "$PROGRAMFILES32\enGits"
422 StrCmp $R0 "$PROGRAMFILES64\enGits" 0 +3
423 IfFileExists "$PROGRAMFILES64\enGits" 0 +2
424 RMDir "$PROGRAMFILES64\enGits"
427 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
428 DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"