| 1 |
;NSIS Modern User Interface |
| 2 |
;create the windows install exectuable |
| 3 |
;Piano Booster |
| 4 |
|
| 5 |
;-------------------------------- |
| 6 |
;Include Modern UI |
| 7 |
|
| 8 |
!include "MUI2.nsh" |
| 9 |
|
| 10 |
;-------------------------------- |
| 11 |
;Defines |
| 12 |
|
| 13 |
!cd "..\..\" |
| 14 |
|
| 15 |
!define PB_BUILT_DIR "release\build" |
| 16 |
!if ! /FileExists "${PB_BUILT_DIR}\pianobooster.exe" |
| 17 |
!error "the release file '${PB_BUILT_DIR}\pianobooster.exe' not found" |
| 18 |
!endif |
| 19 |
|
| 20 |
|
| 21 |
; The Env PB_INSTALL_FILES_PATH must be set to the path of all the addition release files |
| 22 |
; trick to see if at compile time an environment variable exists |
| 23 |
; see https://stackoverflow.com/questions/22149007/nsis-how-to-check-at-compile-time-if-an-environment-variable-exists |
| 24 |
!if "$%PB_INSTALL_FILES_PATH%" == "${U+24}%PB_INSTALL_FILES_PATH%" |
| 25 |
!error "the environmental variable PB_INSTALL_FILES_PATH is not set" |
| 26 |
!endif |
| 27 |
|
| 28 |
; Put file there |
| 29 |
|
| 30 |
!define FILES_FOR_RELEASE $%PB_INSTALL_FILES_PATH% |
| 31 |
!echo "The FILES_FOR_RELEASE path is ${FILES_FOR_RELEASE}" |
| 32 |
|
| 33 |
!if ! /FileExists "${FILES_FOR_RELEASE}\Qt5Core.dll" |
| 34 |
!error "File '${FILES_FOR_RELEASE}\Qt5Core.dll' not found" |
| 35 |
!endif |
| 36 |
|
| 37 |
|
| 38 |
;-------------------------------- |
| 39 |
;General |
| 40 |
|
| 41 |
; The name of the installer |
| 42 |
Name "Piano Booster" |
| 43 |
|
| 44 |
; The file to write |
| 45 |
OutFile "PianoBoosterInstall.exe" |
| 46 |
|
| 47 |
; The default installation directory |
| 48 |
InstallDir "$PROGRAMFILES\Piano Booster" |
| 49 |
|
| 50 |
; Registry key to check for directory (so if you install again, it will |
| 51 |
; overwrite the old one automatically) |
| 52 |
InstallDirRegKey HKCU "Software\NSIS_PianoBooster" "" |
| 53 |
|
| 54 |
|
| 55 |
;Request application privileges for Windows Vista |
| 56 |
RequestExecutionLevel admin |
| 57 |
|
| 58 |
;-------------------------------- |
| 59 |
;Variables |
| 60 |
|
| 61 |
Var StartMenuFolder |
| 62 |
|
| 63 |
;-------------------------------- |
| 64 |
;Interface Settings |
| 65 |
|
| 66 |
!define MUI_ABORTWARNING |
| 67 |
|
| 68 |
;-------------------------------- |
| 69 |
;Pages |
| 70 |
|
| 71 |
!insertmacro MUI_PAGE_WELCOME |
| 72 |
#!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt" |
| 73 |
#!insertmacro MUI_PAGE_COMPONENTS |
| 74 |
!insertmacro MUI_PAGE_DIRECTORY |
| 75 |
|
| 76 |
;Start Menu Folder Page Configuration |
| 77 |
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU" |
| 78 |
!define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\NSIS_PianoBooster" |
| 79 |
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "Start Menu Folder" |
| 80 |
|
| 81 |
!insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder |
| 82 |
|
| 83 |
!insertmacro MUI_PAGE_INSTFILES |
| 84 |
!insertmacro MUI_PAGE_FINISH |
| 85 |
|
| 86 |
!insertmacro MUI_UNPAGE_WELCOME |
| 87 |
!insertmacro MUI_UNPAGE_CONFIRM |
| 88 |
!insertmacro MUI_UNPAGE_INSTFILES |
| 89 |
!insertmacro MUI_UNPAGE_FINISH |
| 90 |
|
| 91 |
;-------------------------------- |
| 92 |
;Languages |
| 93 |
!insertmacro MUI_LANGUAGE "Afrikaans" |
| 94 |
!insertmacro MUI_LANGUAGE "Albanian" |
| 95 |
!insertmacro MUI_LANGUAGE "Arabic" |
| 96 |
!insertmacro MUI_LANGUAGE "Asturian" |
| 97 |
!insertmacro MUI_LANGUAGE "Basque" |
| 98 |
!insertmacro MUI_LANGUAGE "Belarusian" |
| 99 |
!insertmacro MUI_LANGUAGE "Bosnian" |
| 100 |
!insertmacro MUI_LANGUAGE "Breton" |
| 101 |
!insertmacro MUI_LANGUAGE "Bulgarian" |
| 102 |
!insertmacro MUI_LANGUAGE "Catalan" |
| 103 |
!insertmacro MUI_LANGUAGE "Corsican" |
| 104 |
!insertmacro MUI_LANGUAGE "Croatian" |
| 105 |
!insertmacro MUI_LANGUAGE "Czech" |
| 106 |
!insertmacro MUI_LANGUAGE "Danish" |
| 107 |
!insertmacro MUI_LANGUAGE "Dutch" |
| 108 |
!insertmacro MUI_LANGUAGE "English" |
| 109 |
!insertmacro MUI_LANGUAGE "Esperanto" |
| 110 |
!insertmacro MUI_LANGUAGE "Estonian" |
| 111 |
!insertmacro MUI_LANGUAGE "Farsi" |
| 112 |
!insertmacro MUI_LANGUAGE "Finnish" |
| 113 |
!insertmacro MUI_LANGUAGE "French" |
| 114 |
!insertmacro MUI_LANGUAGE "Galician" |
| 115 |
!insertmacro MUI_LANGUAGE "German" |
| 116 |
!insertmacro MUI_LANGUAGE "Greek" |
| 117 |
!insertmacro MUI_LANGUAGE "Hebrew" |
| 118 |
!insertmacro MUI_LANGUAGE "Hungarian" |
| 119 |
!insertmacro MUI_LANGUAGE "Icelandic" |
| 120 |
!insertmacro MUI_LANGUAGE "Indonesian" |
| 121 |
!insertmacro MUI_LANGUAGE "Irish" |
| 122 |
!insertmacro MUI_LANGUAGE "Italian" |
| 123 |
!insertmacro MUI_LANGUAGE "Japanese" |
| 124 |
!insertmacro MUI_LANGUAGE "Korean" |
| 125 |
!insertmacro MUI_LANGUAGE "Kurdish" |
| 126 |
!insertmacro MUI_LANGUAGE "Latvian" |
| 127 |
!insertmacro MUI_LANGUAGE "Lithuanian" |
| 128 |
!insertmacro MUI_LANGUAGE "Luxembourgish" |
| 129 |
!insertmacro MUI_LANGUAGE "Macedonian" |
| 130 |
!insertmacro MUI_LANGUAGE "Malay" |
| 131 |
!insertmacro MUI_LANGUAGE "Mongolian" |
| 132 |
!insertmacro MUI_LANGUAGE "Norwegian" |
| 133 |
!insertmacro MUI_LANGUAGE "NorwegianNynorsk" |
| 134 |
!insertmacro MUI_LANGUAGE "Pashto" |
| 135 |
!insertmacro MUI_LANGUAGE "Polish" |
| 136 |
!insertmacro MUI_LANGUAGE "Portuguese" |
| 137 |
!insertmacro MUI_LANGUAGE "PortugueseBR" |
| 138 |
!insertmacro MUI_LANGUAGE "Romanian" |
| 139 |
!insertmacro MUI_LANGUAGE "Russian" |
| 140 |
!insertmacro MUI_LANGUAGE "ScotsGaelic" |
| 141 |
!insertmacro MUI_LANGUAGE "Serbian" |
| 142 |
!insertmacro MUI_LANGUAGE "SerbianLatin" |
| 143 |
!insertmacro MUI_LANGUAGE "SimpChinese" |
| 144 |
!insertmacro MUI_LANGUAGE "Slovak" |
| 145 |
!insertmacro MUI_LANGUAGE "Slovenian" |
| 146 |
!insertmacro MUI_LANGUAGE "Spanish" |
| 147 |
!insertmacro MUI_LANGUAGE "SpanishInternational" |
| 148 |
!insertmacro MUI_LANGUAGE "Swedish" |
| 149 |
!insertmacro MUI_LANGUAGE "Tatar" |
| 150 |
!insertmacro MUI_LANGUAGE "Thai" |
| 151 |
!insertmacro MUI_LANGUAGE "TradChinese" |
| 152 |
!insertmacro MUI_LANGUAGE "Turkish" |
| 153 |
!insertmacro MUI_LANGUAGE "Ukrainian" |
| 154 |
!insertmacro MUI_LANGUAGE "Uzbek" |
| 155 |
!insertmacro MUI_LANGUAGE "Vietnamese" |
| 156 |
!insertmacro MUI_LANGUAGE "Welsh" |
| 157 |
;-------------------------------- |
| 158 |
;Installer Sections |
| 159 |
|
| 160 |
Section "Install Section" |
| 161 |
|
| 162 |
|
| 163 |
SetOutPath "$INSTDIR" |
| 164 |
|
| 165 |
SetOutPath $INSTDIR |
| 166 |
File "${PB_BUILT_DIR}\pianobooster.exe" |
| 167 |
File /r "${FILES_FOR_RELEASE}\*.*" |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
CreateDirectory $INSTDIR\translations |
| 172 |
SetOutPath $INSTDIR\translations |
| 173 |
File "${PB_BUILT_DIR}\translations\*.qm" |
| 174 |
File "${PB_BUILT_DIR}\translations\langs.json" |
| 175 |
|
| 176 |
CreateDirectory $INSTDIR\fonts |
| 177 |
SetOutPath $INSTDIR\fonts |
| 178 |
File "${PB_BUILT_DIR}\fonts\*.ttf" |
| 179 |
|
| 180 |
CreateDirectory $INSTDIR\doc |
| 181 |
SetOutPath $INSTDIR\doc |
| 182 |
File license.txt |
| 183 |
File gplv3.txt |
| 184 |
|
| 185 |
CreateDirectory "$DOCUMENTS\My Music" |
| 186 |
SetOutPath "$DOCUMENTS\My Music" |
| 187 |
; Temporary fix |
| 188 |
File /r "${PB_BUILT_DIR}\BoosterMusicBooks\BoosterMusicBooks4" |
| 189 |
|
| 190 |
SetOutPath $INSTDIR |
| 191 |
|
| 192 |
; Write the installation path into the registry |
| 193 |
WriteRegStr HKCU SOFTWARE\NSIS_PianoBooster "" "$INSTDIR" |
| 194 |
|
| 195 |
;Create uninstaller |
| 196 |
WriteUninstaller "$INSTDIR\Uninstall.exe" |
| 197 |
|
| 198 |
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application |
| 199 |
|
| 200 |
;Create shortcuts |
| 201 |
CreateDirectory "$SMPROGRAMS\$StartMenuFolder" |
| 202 |
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Piano Booster.lnk" "$INSTDIR\pianobooster.exe" "" "$INSTDIR\pianobooster.exe" 0 |
| 203 |
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe" |
| 204 |
|
| 205 |
!insertmacro MUI_STARTMENU_WRITE_END |
| 206 |
|
| 207 |
SectionEnd |
| 208 |
|
| 209 |
;-------------------------------- |
| 210 |
;Descriptions |
| 211 |
|
| 212 |
;Language strings |
| 213 |
; LangString DESC_SecDummy ${LANG_ENGLISH} "A test section." |
| 214 |
|
| 215 |
;Assign language strings to sections |
| 216 |
; !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN |
| 217 |
; !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy) |
| 218 |
; !insertmacro MUI_FUNCTION_DESCRIPTION_END |
| 219 |
|
| 220 |
;-------------------------------- |
| 221 |
;Uninstaller Section |
| 222 |
|
| 223 |
Section "Uninstall" |
| 224 |
|
| 225 |
|
| 226 |
; Remove files and uninstaller |
| 227 |
RMDir /r "$INSTDIR" |
| 228 |
|
| 229 |
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder |
| 230 |
|
| 231 |
; Remove shortcuts, if any |
| 232 |
Delete "$SMPROGRAMS\$StartMenuFolder\*.*" |
| 233 |
RMDir "$SMPROGRAMS\$StartMenuFolder" |
| 234 |
|
| 235 |
; Remove registry keys |
| 236 |
DeleteRegKey /ifempty HKCU "Software\NSIS_PianoBooster" |
| 237 |
|
| 238 |
SectionEnd |