Branch
Hash :
94046104
Author :
Thomas de Grivel
Date :
2020-02-24T15:19:27
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248
;------ patchwork13.nsi ------
;--------------------------------
;General
!include "MUI.nsh"
OutFile "patchwork13-0.1b.exe"
;Name and file
Name "Patchwork13! version 0.1b"
;Default installation folder
InstallDir "$PROGRAMFILES\Patchwork13"
;Get installation folder from registry if available
InstallDirRegKey HKCU "Software\Patchwork13" ""
;--------------------------------
;Variables
Var MUI_TEMP
Var STARTMENU_FOLDER
;--------------------------------
;Interface Settings
!define MUI_ABORTWARNING
;--------------------------------
;Pages
!insertmacro MUI_PAGE_LICENSE "License.txt"
!insertmacro MUI_PAGE_DIRECTORY
;Start Menu Folder Page Configuration
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Patchwork13"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder"
!insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
;--------------------------------
;Languages
!insertmacro MUI_LANGUAGE "English"
;--------------------------------
;Installer functions
Function .onInit
;Prevent multiple instances
System::Call 'kernel32::CreateMutexA(i 0, i 0, t "Patchwork13SetupMutex") i .r1 ?e'
Pop $R0
StrCmp $R0 0 +3
MessageBox MB_OK|MB_ICONEXCLAMATION "Patchwork13! Setup is already running"
Abort
FunctionEnd
;--------------------------------
;Installer Sections
Section "pw13" Sec_pw13
SetDetailsPrint textonly
DetailPrint "Installing pw13 ..."
SetDetailsPrint listonly
;Store installation folder
WriteRegStr HKCU "Software\Patchwork13" "" $INSTDIR
SetOutPath "$INSTDIR\bin"
SetOverwrite on
!include "pw13.i.dll.nsh"
File "libs\libxml2-2.dll"
SectionEnd
Section "pw13_std" Sec_pw13_std
SectionIn 1
SetDetailsPrint textonly
DetailPrint "Installing pw13_std ..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR\lib"
!include "pw13_std.i.dll.nsh"
SectionEnd
Section "pw13_sdl" Sec_pw13_sdl
SectionIn 2
SetDetailsPrint textonly
DetailPrint "Installing pw13_sdl ..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR\bin"
File "libs\SDL.dll"
SetOutPath "$INSTDIR\lib"
!include "pw13_sdl.i.dll.nsh"
SectionEnd
Section "pw13_sound" Sec_pw13_sound
SectionIn 2
SetDetailsPrint textonly
DetailPrint "Installing pw13_sound ..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR\lib"
!include "pw13_sound.i.dll.nsh"
SectionEnd
Section "cluster" Sec_cluster
SectionIn 3
SetDetailsPrint textonly
DetailPrint "Installing cluster ..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR\bin"
File "libs\pthreadGC2.dll"
!include "cluster.i.dll.nsh"
SectionEnd
Section "pw13_gtk" Sec_pw13_gtk
SectionIn 4
SetDetailsPrint textonly
DetailPrint "Installing pw13_gtk ..."
SetDetailsPrint listonly
SetOutPath "$INSTDIR"
File "..\pw13_gtk\pw13_toolbox.glade"
File "..\pw13_gtk\pw13_quit.glade"
File "..\pw13_gtk\pw13_tb_cluster_pref.glade"
File "..\pw13_gtk\pw13_cluster_servers.glade"
File "..\pw13_gtk\pw13_patchwork.glade"
File "..\pw13_gtk\pw13_pw_close.glade"
File "..\pw13_gtk\pw13_patch.glade"
SetOutPath "$INSTDIR\bin"
File "..\pw13_gtk\src\pw13_gtk.exe"
File "libs\libglade-2.0-0.dll"
File "libs\libxml2.dll"
SetOutPath "$INSTDIR\lib"
!include "pw13_gtk.i.dll.nsh"
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
;Create shortcuts
CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Patchwork13.lnk" "$INSTDIR\bin\pw13_gtk.exe"
CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
;Create uninstaller
WriteUninstaller "$INSTDIR\Uninstall.exe"
SectionEnd
Section "" SecEnd
SetDetailsPrint textonly
DetailPrint "Finished !"
SetDetailsPrint listonly
SectionEnd
;--------------------------------
;Uninstaller Section
Section "Uninstall"
; pw13
!include "pw13.u.dll.nsh"
Delete "$INSTDIR\bin\libxml2-2.dll"
; pw13_std
!include "pw13_std.u.dll.nsh"
; pw13_sdl
!include "pw13_sdl.u.dll.nsh"
Delete "$INSTDIR\bin\SDL.dll"
; pw13_sound
!include "pw13_sound.u.dll.nsh"
; cluster
!include "cluster.u.dll.nsh"
Delete "$INSTDIR\bin\pthreadGC2.dll"
; pw13_gtk
!include "pw13_sdl.u.dll.nsh"
Delete "$INSTDIR\bin\pw13_gtk.exe"
Delete "$INSTDIR\bin\libglade-2.0-0.dll"
Delete "$INSTDIR\bin\libxml2.dll"
RMDir "$INSTDIR\bin"
Delete "$INSTDIR\pw13_toolbox.glade"
Delete "$INSTDIR\pw13_quit.glade"
Delete "$INSTDIR\pw13_tb_cluster_pref.glade"
Delete "$INSTDIR\pw13_cluster_servers.glade"
Delete "$INSTDIR\pw13_patchwork.glade"
Delete "$INSTDIR\pw13_pw_close.glade"
Delete "$INSTDIR\pw13_patch.glade"
RMDir "$INSTDIR\lib"
Delete "$INSTDIR\Uninstall.exe"
RMDir "$INSTDIR"
!insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
Delete "$SMPROGRAMS\$MUI_TEMP\Sequence 3D.lnk"
Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk"
;Delete empty start menu parent diretories
StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP"
startMenuDeleteLoop:
ClearErrors
RMDir $MUI_TEMP
GetFullPathName $MUI_TEMP "$MUI_TEMP\.."
IfErrors startMenuDeleteLoopDone
StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop
startMenuDeleteLoopDone:
DeleteRegKey /ifempty HKCU "Software\Sequence3D"
SectionEnd