/CMakeModules/NSIS.template.in

http://github.com/tomahawk-player/tomahawk · Autoconf · 813 lines · 651 code · 127 blank · 35 comment · 13 complexity · e63dc861d781de7f6c9d6995d49f1294 MD5 · raw file

  1. ;Tomahawk installer script.
  2. ;-----------------------------------------------------------------------------
  3. ; Some installer script options (comment-out options not required)
  4. ;-----------------------------------------------------------------------------
  5. ;!define OPTION_LICENSE_AGREEMENT
  6. !define OPTION_UAC_PLUGIN_ENHANCED
  7. !define OPTION_SECTION_SC_START_MENU
  8. !define OPTION_SECTION_SC_DESKTOP
  9. !define OPTION_SECTION_SC_QUICK_LAUNCH
  10. !define OPTION_FINISHPAGE
  11. !define OPTION_FINISHPAGE_LAUNCHER
  12. !define OPTION_FINISHPAGE_RELEASE_NOTES
  13. ;-----------------------------------------------------------------------------
  14. ; Some paths.
  15. ;-----------------------------------------------------------------------------
  16. !ifndef MINGW_ROOT
  17. !define MINGW_ROOT "/usr/i686-w64-mingw32/sys-root/mingw"
  18. !endif
  19. !define APPLICATION_NAME "@CPACK_PACKAGE_NAME@"
  20. !define TARGET_NAME "@CPACK_PACKAGE_TARGET_NAME@"
  21. ;define app id needed for Windows 8 notifications
  22. !define AppUserModelId "@TOMAHAWK_APPLICATION_PACKAGE_NAME@"
  23. !define MINGW_BIN "${MINGW_ROOT}/bin"
  24. !define MINGW_LIB "${MINGW_ROOT}/lib"
  25. !define MINGW_SHARE "${MINGW_ROOT}/share"
  26. !define BUILD_PATH "@CMAKE_BINARY_DIR@"
  27. !define SOURCE_PATH "@CMAKE_SOURCE_DIR@"
  28. !define QT_DLL_PATH "${MINGW_BIN}"
  29. !define QT_QML_PATH "${MINGW_SHARE}/qt5/qml"
  30. !define SQLITE_DLL_PATH "${MINGW_LIB}/qt5/plugins/sqldrivers"
  31. !define IMAGEFORMATS_DLL_PATH "${MINGW_LIB}/qt5/plugins/imageformats"
  32. ; We use official release plugins
  33. ; mingw32-vlc from obs misses a lot and has even broken ones probably
  34. !define VLC_PATH "${SOURCE_PATH}\admin\win\vlc\" ; SIC! ^
  35. !define VLC_BIN "${VLC_PATH}"
  36. !define VLC_PLUGIN_PATH "${VLC_BIN}\plugins"
  37. !define NSI_PATH "${SOURCE_PATH}/admin/win/nsi"
  38. ;-----------------------------------------------------------------------------
  39. ; Installer version
  40. ;-----------------------------------------------------------------------------
  41. !define VER_MAJOR "@CPACK_PACKAGE_VERSION_MAJOR@"
  42. !define VER_MINOR "@CPACK_PACKAGE_VERSION_MINOR@"
  43. !define VER_BUILD "@CPACK_PACKAGE_VERSION_PATCH@"
  44. !define VERSION "@CPACK_PACKAGE_VERSION@"
  45. ;-----------------------------------------------------------------------------
  46. ; Installer build timestamp.
  47. ;-----------------------------------------------------------------------------
  48. !define /date BUILD_TIME "built on %Y/%m/%d at %I:%M %p"
  49. ;-----------------------------------------------------------------------------
  50. ; Initial installer setup and definitions.
  51. ;-----------------------------------------------------------------------------
  52. Name "@CPACK_NSIS_PACKAGE_NAME@"
  53. Caption "${APPLICATION_NAME} Installer"
  54. BrandingText "${APPLICATION_NAME} ${VERSION} -- ${BUILD_TIME}"
  55. OutFile "@CPACK_TOPLEVEL_DIRECTORY@/@CPACK_OUTPUT_FILE_NAME@"
  56. InstallDir "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
  57. InstallDirRegKey HKCU "Software\{APPLICATION_NAME}" ""
  58. InstType Standard
  59. InstType Full
  60. InstType Minimal
  61. CRCCheck On
  62. SetCompressor @CPACK_NSIS_COMPRESSOR@
  63. RequestExecutionLevel user ;Now using the UAC plugin.
  64. ReserveFile NSIS.InstallOptions.ini
  65. ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
  66. @CPACK_NSIS_SECTION_SELECTED_VARS@
  67. ;-----------------------------------------------------------------------------
  68. ; Include some required header files.
  69. ;-----------------------------------------------------------------------------
  70. !include LogicLib.nsh ;Used by APPDATA uninstaller.
  71. !include nsDialogs.nsh ;Used by APPDATA uninstaller.
  72. !include MUI2.nsh ;Used by APPDATA uninstaller.
  73. !include InstallOptions.nsh ;Required by MUI2 to support old MUI_INSTALLOPTIONS.
  74. !include Memento.nsh ;Remember user selections.
  75. !include WinVer.nsh ;Windows version detection.
  76. !include WordFunc.nsh ;Used by VersionCompare macro function.
  77. !include UAC.nsh ;Used by the UAC elevation to install as user or admin.
  78. !include ${NSI_PATH}\SnoreNotify.nsh ; Macro for creation of a shortcut with a AppUserModelId.
  79. ;-----------------------------------------------------------------------------
  80. ; Memento selections stored in registry.
  81. ;-----------------------------------------------------------------------------
  82. !define MEMENTO_REGISTRY_ROOT HKLM
  83. !define MEMENTO_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}"
  84. ;-----------------------------------------------------------------------------
  85. ; Setup macros for the creation of a shortcut supporting Windows 8 notifications.
  86. ;-----------------------------------------------------------------------------
  87. !define SnoreToastExe "$INSTDIR\SnoreToast.exe"
  88. ;-----------------------------------------------------------------------------
  89. ; Modern User Interface (MUI) defintions and setup.
  90. ;-----------------------------------------------------------------------------
  91. !define MUI_ABORTWARNING
  92. !define MUI_ICON ${NSI_PATH}\installer.ico
  93. !define MUI_UNICON ${NSI_PATH}\installer.ico
  94. !define MUI_WELCOMEFINISHPAGE_BITMAP ${NSI_PATH}\welcome.bmp
  95. !define MUI_WELCOMEPAGE_TITLE "@CPACK_PACKAGE_NAME@ ${VERSION} Setup$\r$\nInstaller"
  96. !define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation.$\r$\n$\r$\n$_CLICK"
  97. !define MUI_HEADERIMAGE
  98. !define MUI_HEADERIMAGE_BITMAP ${NSI_PATH}\page_header.bmp
  99. !define MUI_COMPONENTSPAGE_SMALLDESC
  100. !define MUI_FINISHPAGE_TITLE "@CPACK_PACKAGE_NAME@ Install Completed"
  101. !define MUI_FINISHPAGE_LINK "Click here to visit the @CPACK_PACKAGE_NAME@ website."
  102. !define MUI_FINISHPAGE_LINK_LOCATION "http://@TOMAHAWK_ORGANIZATION_DOMAIN@"
  103. !define MUI_FINISHPAGE_NOREBOOTSUPPORT
  104. !ifdef OPTION_FINISHPAGE_RELEASE_NOTES
  105. !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  106. !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\NOTES.txt"
  107. !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show release notes"
  108. !endif
  109. !ifdef OPTION_FINISHPAGE_LAUNCHER
  110. !define MUI_FINISHPAGE_NOAUTOCLOSE
  111. !define MUI_FINISHPAGE_RUN
  112. !define MUI_FINISHPAGE_RUN_FUNCTION "LaunchTomahawk"
  113. !endif
  114. ;-----------------------------------------------------------------------------
  115. ; Page macros.
  116. ;-----------------------------------------------------------------------------
  117. !insertmacro MUI_PAGE_WELCOME
  118. !ifdef OPTION_LICENSE_AGREEMENT
  119. !insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
  120. !endif
  121. Page custom PageReinstall PageLeaveReinstall
  122. !insertmacro MUI_PAGE_COMPONENTS
  123. !insertmacro MUI_PAGE_DIRECTORY
  124. !insertmacro MUI_PAGE_INSTFILES
  125. !ifdef OPTION_FINISHPAGE
  126. !insertmacro MUI_PAGE_FINISH
  127. !endif
  128. !insertmacro MUI_UNPAGE_CONFIRM
  129. UninstPage custom un.UnPageUserAppData un.UnPageUserAppDataLeave
  130. !insertmacro MUI_UNPAGE_INSTFILES
  131. ;-----------------------------------------------------------------------------
  132. ; Other MUI macros.
  133. ;-----------------------------------------------------------------------------
  134. !insertmacro MUI_LANGUAGE "English"
  135. ##############################################################################
  136. # #
  137. # FINISH PAGE LAUNCHER FUNCTIONS #
  138. # #
  139. ##############################################################################
  140. Function LaunchTomahawk
  141. ${UAC.CallFunctionAsUser} LaunchTomahawkAsUser
  142. FunctionEnd
  143. Function LaunchTomahawkAsUser
  144. Exec "$INSTDIR\${APPLICATION_NAME}.exe"
  145. FunctionEnd
  146. ##############################################################################
  147. # #
  148. # PROCESS HANDLING FUNCTIONS AND MACROS #
  149. # #
  150. ##############################################################################
  151. !macro CheckForProcess processName gotoWhenFound gotoWhenNotFound
  152. Processes::FindProcess "${processName}"
  153. StrCmp $R0 "0" "${gotoWhenNotFound}" "${gotoWhenFound}"
  154. !macroend
  155. !macro ConfirmEndProcess processTitle processName
  156. MessageBox MB_YESNO|MB_ICONEXCLAMATION \
  157. "Found ${processName} process(s) which need to be stopped.$\nDo you want the installer to stop these for you?" \
  158. IDYES "process_${processTitle}_kill" IDNO "process_${processTitle}_ended"
  159. process_${processTitle}_kill:
  160. DetailPrint "Killing ${processName} processes."
  161. Processes::KillProcess "${processName}"
  162. Sleep 1500
  163. StrCmp $R0 "1" "process_${processTitle}_ended"
  164. DetailPrint "Process to kill not found!"
  165. process_${processTitle}_ended:
  166. !macroend
  167. !macro CheckAndConfirmEndProcess processTitle processName
  168. !insertmacro CheckForProcess "${processName}" 0 "no_process_${processTitle}_to_end"
  169. !insertmacro ConfirmEndProcess "${processTitle}" "${processName}"
  170. no_process_${processTitle}_to_end:
  171. !macroend
  172. Function EnsureTomahawkShutdown
  173. !insertmacro CheckAndConfirmEndProcess "${TARGET_NAME}" "${APPLICATION_NAME}.exe"
  174. FunctionEnd
  175. ##############################################################################
  176. # #
  177. # RE-INSTALLER FUNCTIONS #
  178. # #
  179. ##############################################################################
  180. Function PageReinstall
  181. ReadRegStr $R0 HKLM "Software\${APPLICATION_NAME}" ""
  182. StrCmp $R0 "" 0 +2
  183. Abort
  184. ;Detect version
  185. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
  186. IntCmp $R0 ${VER_MAJOR} minor_check new_version older_version
  187. minor_check:
  188. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
  189. IntCmp $R0 ${VER_MINOR} build_check new_version older_version
  190. build_check:
  191. ReadRegDWORD $R0 HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
  192. IntCmp $R0 ${VER_BUILD} same_version new_version older_version
  193. new_version:
  194. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "An older version of ${APPLICATION_NAME} is installed on your system. It is recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
  195. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Uninstall before installing"
  196. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Do not uninstall"
  197. !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${APPLICATION_NAME}."
  198. StrCpy $R0 "1"
  199. Goto reinst_start
  200. older_version:
  201. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "A newer version of ${APPLICATION_NAME} is already installed! It is not recommended that you install an older version. If you really want to install this older version, it is better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
  202. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Uninstall before installing"
  203. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Do not uninstall"
  204. !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${APPLICATION_NAME}."
  205. StrCpy $R0 "1"
  206. Goto reinst_start
  207. same_version:
  208. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 1" "Text" "${APPLICATION_NAME} ${VERSION} is already installed.\r\nSelect the operation you want to perform and click Next to continue."
  209. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 2" "Text" "Add/Reinstall components"
  210. !insertmacro INSTALLOPTIONS_WRITE "NSIS.InstallOptions.ini" "Field 3" "Text" "Uninstall ${APPLICATION_NAME}"
  211. !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
  212. StrCpy $R0 "2"
  213. reinst_start:
  214. !insertmacro INSTALLOPTIONS_DISPLAY "NSIS.InstallOptions.ini"
  215. FunctionEnd
  216. Function PageLeaveReinstall
  217. !insertmacro INSTALLOPTIONS_READ $R1 "NSIS.InstallOptions.ini" "Field 2" "State"
  218. StrCmp $R0 "1" 0 +2
  219. StrCmp $R1 "1" reinst_uninstall reinst_done
  220. StrCmp $R0 "2" 0 +3
  221. StrCmp $R1 "1" reinst_done reinst_uninstall
  222. reinst_uninstall:
  223. ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "UninstallString"
  224. HideWindow
  225. ClearErrors
  226. ExecWait '$R1 _?=$INSTDIR'
  227. IfErrors no_remove_uninstaller
  228. IfFileExists "$INSTDIR\${APPLICATION_NAME}.exe" no_remove_uninstaller
  229. Delete $R1
  230. RMDir $INSTDIR
  231. no_remove_uninstaller:
  232. StrCmp $R0 "2" 0 +3
  233. UAC::Unload
  234. Quit
  235. BringToFront
  236. reinst_done:
  237. FunctionEnd
  238. ##############################################################################
  239. # #
  240. # INSTALLER SECTIONS #
  241. # #
  242. ##############################################################################
  243. Section "${APPLICATION_NAME}" SEC_TOMAHAWK_PLAYER
  244. SectionIn 1 2 3 RO
  245. SetDetailsPrint listonly
  246. SetDetailsPrint textonly
  247. DetailPrint "Installing ${APPLICATION_NAME} essentials."
  248. SetDetailsPrint listonly
  249. SetOutPath "$INSTDIR"
  250. !ifdef INSTALL_PATH
  251. ;Main executable.
  252. File "${INSTALL_PATH}\bin\${APPLICATION_NAME}.exe"
  253. File "${INSTALL_PATH}\bin\${TARGET_NAME}_crash_reporter.exe"
  254. File "${INSTALL_PATH}\bin\lib${TARGET_NAME}.dll"
  255. File "${INSTALL_PATH}\bin\lib${TARGET_NAME}-widgets.dll"
  256. File "${INSTALL_PATH}\bin\lib${TARGET_NAME}-playdarapi.dll"
  257. ; plugins
  258. File "${INSTALL_PATH}\lib\lib${TARGET_NAME}_*_*.dll"
  259. !endif
  260. !ifndef INSTALL_PATH
  261. ;Main executable.
  262. File "${BUILD_PATH}\${APPLICATION_NAME}.exe"
  263. File "${BUILD_PATH}\${TARGET_NAME}_crash_reporter.exe"
  264. File "${BUILD_PATH}\lib${TARGET_NAME}.dll"
  265. File "${BUILD_PATH}\lib${TARGET_NAME}-widgets.dll"
  266. File "${BUILD_PATH}\lib${TARGET_NAME}-playdarapi.dll"
  267. ; plugins
  268. File "${BUILD_PATH}\lib${TARGET_NAME}_*_*.dll"
  269. !endif
  270. ;License & release notes.
  271. File "@CPACK_RESOURCE_FILE_LICENSE@"
  272. File /oname=NOTES.txt ${NSI_PATH}\RELEASE_NOTES.txt
  273. ;QT stuff:
  274. File "${QT_DLL_PATH}\Qt5Network.dll"
  275. File "${QT_DLL_PATH}\Qt5Qml.dll"
  276. File "${QT_DLL_PATH}\Qt5Sql.dll"
  277. File "${QT_DLL_PATH}\Qt5Xml.dll"
  278. File "${QT_DLL_PATH}\Qt5Core.dll"
  279. File "${QT_DLL_PATH}\Qt5OpenGL.dll"
  280. File "${QT_DLL_PATH}\Qt5Quick.dll"
  281. File "${QT_DLL_PATH}\Qt5Svg.dll"
  282. File "${QT_DLL_PATH}\Qt5Widgets.dll"
  283. File "${QT_DLL_PATH}\Qt5Gui.dll"
  284. File "${QT_DLL_PATH}\Qt5PrintSupport.dll"
  285. File "${QT_DLL_PATH}\Qt5Sensors.dll"
  286. File "${QT_DLL_PATH}\Qt5WebKit.dll"
  287. File "${QT_DLL_PATH}\Qt5WinExtras.dll"
  288. File "${QT_DLL_PATH}\Qt5WebKit.dll"
  289. File "${QT_DLL_PATH}\Qt5WebKitWidgets.dll"
  290. File "${QT_DLL_PATH}\Qt5Multimedia.dll"
  291. File "${QT_DLL_PATH}\Qt5MultimediaWidgets.dll"
  292. File "${QT_DLL_PATH}\Qt5Positioning.dll"
  293. ;Qt deps
  294. File "${QT_DLL_PATH}\libpcre16-0.dll"
  295. File "${QT_DLL_PATH}\libxml2-2.dll"
  296. File "${QT_DLL_PATH}\libxslt-1.dll"
  297. File "${QT_DLL_PATH}\libEGL.dll"
  298. File "${QT_DLL_PATH}\libGLESv2.dll"
  299. File "${QT_DLL_PATH}\libwebp-5.dll"
  300. File "${QT_DLL_PATH}\icuuc56.dll"
  301. File "${QT_DLL_PATH}\icudata56.dll"
  302. File "${QT_DLL_PATH}\icui18n56.dll"
  303. ;SQLite driver
  304. SetOutPath "$INSTDIR\sqldrivers"
  305. File "${SQLITE_DLL_PATH}\qsqlite.dll"
  306. SetOutPath "$INSTDIR"
  307. File "${MINGW_BIN}\libsqlite3-0.dll"
  308. ;Qt platform plugins
  309. SetOutPath "$INSTDIR\platforms"
  310. File "${MINGW_LIB}/qt5/plugins/platforms/qwindows.dll"
  311. SetOutPath "$INSTDIR"
  312. ;Image plugins
  313. SetOutPath "$INSTDIR\imageformats"
  314. File "${IMAGEFORMATS_DLL_PATH}\qgif.dll"
  315. File "${IMAGEFORMATS_DLL_PATH}\qjpeg.dll"
  316. File "${IMAGEFORMATS_DLL_PATH}\qsvg.dll"
  317. SetOutPath "$INSTDIR"
  318. ;Qt qml plugins
  319. SetOutPath "$INSTDIR\QtQuick.2"
  320. File /r /x *.debug "${QT_QML_PATH}\QtQuick.2\*"
  321. SetOutPath "$INSTDIR\QtQuick\Window.2"
  322. File /r /x *.debug "${QT_QML_PATH}\QtQuick\Window.2\*"
  323. SetOutPath "$INSTDIR"
  324. ;Cygwin/c++ stuff
  325. File "${MINGW_BIN}\libgcc_s_sjlj-1.dll"
  326. File "${MINGW_BIN}\libstdc++-6.dll"
  327. ;VLC
  328. File "${VLC_BIN}\libvlc.dll"
  329. File "${VLC_BIN}\libvlccore.dll"
  330. SetOutPath "$INSTDIR\plugins"
  331. File /r "${VLC_PLUGIN_PATH}\*.dll"
  332. SetOutPath "$INSTDIR"
  333. ; Other
  334. File "${MINGW_BIN}\libtag.dll"
  335. File "${MINGW_BIN}\libpng16-16.dll"
  336. File "${MINGW_BIN}\libjpeg-8.dll"
  337. File "${MINGW_BIN}\zlib1.dll"
  338. File "${MINGW_BIN}\libfreetype-6.dll"
  339. File "${MINGW_BIN}\libglib-2.0-0.dll"
  340. File "${MINGW_BIN}\libharfbuzz-0.dll"
  341. ; ANGLE
  342. File "${MINGW_BIN}\D3DCompiler_43.dll"
  343. File "${MINGW_BIN}\libechonest5.dll"
  344. File "${MINGW_BIN}\liblastfm5.dll"
  345. File "${MINGW_BIN}\libquazip5.dll"
  346. File "${MINGW_BIN}\libqt5keychain.dll"
  347. ; GnuTLS
  348. File "${MINGW_BIN}\libgnutls-28.dll"
  349. File "${MINGW_BIN}\libtasn1-6.dll"
  350. File "${MINGW_BIN}\libgmp-10.dll"
  351. File "${MINGW_BIN}\libhogweed-4-1.dll"
  352. File "${MINGW_BIN}\libintl-8.dll"
  353. File "${MINGW_BIN}\libnettle-6-1.dll"
  354. File "${MINGW_BIN}\libp11-kit-0.dll"
  355. File "${MINGW_BIN}\libffi-6.dll"
  356. ; Snorenotify
  357. File "${MINGW_BIN}\SnoreToast.exe"
  358. File "${MINGW_BIN}\libsnore-qt5.dll"
  359. File "${MINGW_BIN}\libsnoresettings-qt5.dll"
  360. File "${MINGW_BIN}\snoresettings.exe"
  361. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_growl.dll"
  362. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_growl.dll"
  363. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_snarl.dll"
  364. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_snarl.dll"
  365. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_snore.dll"
  366. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_settings_backend_snore.dll"
  367. File "${MINGW_LIB}\plugins\libsnore-qt5\libsnore_backend_windowstoast.dll"
  368. ; Snoregrowl
  369. File "${MINGW_BIN}\libsnoregrowl++.dll"
  370. File "${MINGW_BIN}\libsnoregrowl.dll"
  371. ; Jabber
  372. File "${MINGW_BIN}\libjreen-qt5.dll"
  373. File "${MINGW_BIN}\libidn-11.dll"
  374. File "${MINGW_BIN}\libgsasl-7.dll"
  375. File "${MINGW_BIN}\libqca-qt5.dll"
  376. SetOutPath "$INSTDIR\crypto"
  377. File "${MINGW_LIB}\qca-qt5\crypto\libqca-ossl.dll"
  378. SetOutPath "$INSTDIR"
  379. File "${MINGW_BIN}\libssl-10.dll"
  380. File "${MINGW_BIN}\libcrypto-10.dll"
  381. ; LucenePlusPlus
  382. File "${MINGW_BIN}\liblucene++.dll"
  383. File "${MINGW_BIN}\libboost_system-mt.dll"
  384. File "${MINGW_BIN}\libboost_filesystem-mt.dll"
  385. File "${MINGW_BIN}\libboost_iostreams-mt.dll"
  386. File "${MINGW_BIN}\libboost_regex-mt.dll"
  387. File "${MINGW_BIN}\libboost_thread-mt.dll"
  388. File "${MINGW_BIN}\libbz2-1.dll"
  389. File "${MINGW_BIN}\libqtsparkle-qt5.dll"
  390. File "${MINGW_BIN}\libKF5Attica.dll"
  391. SectionEnd
  392. SectionGroup "Shortcuts"
  393. !ifdef OPTION_SECTION_SC_START_MENU
  394. ${MementoSection} "Start Menu Program Group" SEC_START_MENU
  395. SectionIn 1 2
  396. SetDetailsPrint textonly
  397. DetailPrint "Adding shortcuts for the ${APPLICATION_NAME} program group to the Start Menu."
  398. SetDetailsPrint listonly
  399. SetShellVarContext all
  400. RMDir /r "$SMPROGRAMS\${APPLICATION_NAME}"
  401. CreateDirectory "$SMPROGRAMS\${APPLICATION_NAME}"
  402. CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\LICENSE.lnk" "$INSTDIR\LICENSE.txt"
  403. CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Notification Settings.lnk" "$INSTDIR\snoresettings.exe" "-a ${APPLICATION_NAME}"
  404. !insertmacro SnoreShortcut "$SMPROGRAMS\${APPLICATION_NAME}\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_NAME}.exe" "${AppUserModelId}"
  405. CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Release notes.lnk" "$INSTDIR\NOTES.txt"
  406. CreateShortCut "$SMPROGRAMS\${APPLICATION_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
  407. SetShellVarContext current
  408. ${MementoSectionEnd}
  409. !endif
  410. !ifdef OPTION_SECTION_SC_DESKTOP
  411. ${MementoSection} "Desktop Shortcut" SEC_DESKTOP
  412. SectionIn 1 2
  413. SetDetailsPrint textonly
  414. DetailPrint "Creating Desktop Shortcuts"
  415. SetDetailsPrint listonly
  416. CreateShortCut "$DESKTOP\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_NAME}.exe"
  417. ${MementoSectionEnd}
  418. !endif
  419. !ifdef OPTION_SECTION_SC_QUICK_LAUNCH
  420. ${MementoSection} "Quick Launch Shortcut" SEC_QUICK_LAUNCH
  421. SectionIn 1 2
  422. SetDetailsPrint textonly
  423. DetailPrint "Creating Quick Launch Shortcut"
  424. SetDetailsPrint listonly
  425. CreateShortCut "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" "$INSTDIR\${APPLICATION_NAME}.exe"
  426. ${MementoSectionEnd}
  427. !endif
  428. SectionGroupEnd
  429. ${MementoSectionDone}
  430. ; Installer section descriptions
  431. ;--------------------------------
  432. !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  433. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_TOMAHAWK_PLAYER} "${APPLICATION_NAME} essentials."
  434. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_START_MENU} "${APPLICATION_NAME} program group."
  435. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} "Desktop shortcut for ${APPLICATION_NAME}."
  436. !insertmacro MUI_DESCRIPTION_TEXT ${SEC_QUICK_LAUNCH} "Quick Launch shortcut for ${APPLICATION_NAME}."
  437. !insertmacro MUI_FUNCTION_DESCRIPTION_END
  438. Section -post
  439. ;Uninstaller file.
  440. SetDetailsPrint textonly
  441. DetailPrint "Writing Uninstaller"
  442. SetDetailsPrint listonly
  443. WriteUninstaller $INSTDIR\uninstall.exe
  444. ;Registry keys required for installer version handling and uninstaller.
  445. SetDetailsPrint textonly
  446. DetailPrint "Writing Installer Registry Keys"
  447. SetDetailsPrint listonly
  448. ;Version numbers used to detect existing installation version for comparisson.
  449. WriteRegStr HKLM "Software\${APPLICATION_NAME}" "" $INSTDIR
  450. WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
  451. WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}"
  452. WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionRevision" "${REVISION}"
  453. WriteRegDWORD HKLM "Software\${APPLICATION_NAME}" "VersionBuild" "${VER_BUILD}"
  454. ;Add or Remove Programs entry.
  455. WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
  456. WriteRegExpandStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "InstallLocation" "$INSTDIR"
  457. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayName" "${APPLICATION_NAME}"
  458. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "Publisher" "@TOMAHAWK_ORGANIZATION_DOMAIN@"
  459. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayIcon" "$INSTDIR\Uninstall.exe,0"
  460. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "DisplayVersion" "${VERSION}"
  461. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "VersionMajor" "${VER_MAJOR}"
  462. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "VersionMinor" "${VER_MINOR}.${REVISION}"
  463. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "URLInfoAbout" "http://@TOMAHAWK_ORGANIZATION_DOMAIN@/"
  464. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "HelpLink" "http://@TOMAHAWK_ORGANIZATION_DOMAIN@/"
  465. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "NoModify" "1"
  466. WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "NoRepair" "1"
  467. ; Register tomahawk:// protocol handler
  468. WriteRegStr HKCR "tomahawk" "" "URL:Tomahawk Protocol"
  469. WriteRegStr HKCR "tomahawk" "URL Protocol" ""
  470. WriteRegStr HKCR "tomahawk\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  471. WriteRegStr HKCR "tomahawk\shell" "" "open"
  472. WriteRegStr HKCR "tomahawk\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  473. ; Register file associations
  474. WriteRegStr HKCR ".mp3" "" "MPEG Audio Layer 3"
  475. WriteRegStr HKCR ".mp3\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  476. WriteRegStr HKCR ".mp3\shell" "" "open"
  477. WriteRegStr HKCR ".mp3\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  478. WriteRegStr HKCR ".oga" "" "Ogg Audio File"
  479. WriteRegStr HKCR ".oga\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  480. WriteRegStr HKCR ".oga\shell" "" "open"
  481. WriteRegStr HKCR ".oga\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  482. WriteRegStr HKCR ".ogg" "" "Ogg Audio File"
  483. WriteRegStr HKCR ".ogg\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  484. WriteRegStr HKCR ".ogg\shell" "" "open"
  485. WriteRegStr HKCR ".ogg\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  486. WriteRegStr HKCR ".opus" "" "OPUS File"
  487. WriteRegStr HKCR ".opus\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  488. WriteRegStr HKCR ".opus\shell" "" "open"
  489. WriteRegStr HKCR ".opus\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  490. WriteRegStr HKCR ".mp4" "" "AAC File"
  491. WriteRegStr HKCR ".mp4\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  492. WriteRegStr HKCR ".mp4\shell" "" "open"
  493. WriteRegStr HKCR ".mp4\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  494. WriteRegStr HKCR ".aac" "" "AAC File"
  495. WriteRegStr HKCR ".aac\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  496. WriteRegStr HKCR ".aac\shell" "" "open"
  497. WriteRegStr HKCR ".aac\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  498. WriteRegStr HKCR ".m4a" "" "AAC File"
  499. WriteRegStr HKCR ".m4a\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  500. WriteRegStr HKCR ".m4a\shell" "" "open"
  501. WriteRegStr HKCR ".m4a\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  502. WriteRegStr HKCR ".mpc" "" "Musepack Audio File"
  503. WriteRegStr HKCR ".mpc\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  504. WriteRegStr HKCR ".mpc\shell" "" "open"
  505. WriteRegStr HKCR ".mpc\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  506. WriteRegStr HKCR ".wma" "" "Windows Media Audio"
  507. WriteRegStr HKCR ".wma\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  508. WriteRegStr HKCR ".wma\shell" "" "open"
  509. WriteRegStr HKCR ".wma\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  510. WriteRegStr HKCR ".aiff" "" "AIFF File"
  511. WriteRegStr HKCR ".aiff\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  512. WriteRegStr HKCR ".aiff\shell" "" "open"
  513. WriteRegStr HKCR ".aiff\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  514. WriteRegStr HKCR ".aif" "" "AIFF File"
  515. WriteRegStr HKCR ".aif\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  516. WriteRegStr HKCR ".aif\shell" "" "open"
  517. WriteRegStr HKCR ".aif\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  518. WriteRegStr HKCR ".wv" "" "WavePack Audio File"
  519. WriteRegStr HKCR ".wv\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  520. WriteRegStr HKCR ".wv\shell" "" "open"
  521. WriteRegStr HKCR ".wv\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  522. WriteRegStr HKCR ".flac" "" "FLAC Audio File"
  523. WriteRegStr HKCR ".flac\DefaultIcon" "" "$INSTDIR\${APPLICATION_NAME}.exe,1"
  524. WriteRegStr HKCR ".flac\shell" "" "open"
  525. WriteRegStr HKCR ".flac\shell\open\command" "" '"$INSTDIR\${APPLICATION_NAME}.exe" "%1"'
  526. SetDetailsPrint textonly
  527. DetailPrint "Finsihed."
  528. SectionEnd
  529. ##############################################################################
  530. # #
  531. # UNINSTALLER SECTION #
  532. # #
  533. ##############################################################################
  534. Var UnPageUserAppDataDialog
  535. Var UnPageUserAppDataCheckbox
  536. Var UnPageUserAppDataCheckbox_State
  537. Var UnPageUserAppDataEditBox
  538. Function un.UnPageUserAppData
  539. !insertmacro MUI_HEADER_TEXT "Uninstall ${APPLICATION_NAME}" "Remove ${APPLICATION_NAME}'s data folder from your computer."
  540. nsDialogs::Create /NOUNLOAD 1018
  541. Pop $UnPageUserAppDataDialog
  542. ${If} $UnPageUserAppDataDialog == error
  543. Abort
  544. ${EndIf}
  545. ${NSD_CreateLabel} 0 0 100% 12u "Do you want to delete ${APPLICATION_NAME}'s data folder?"
  546. Pop $0
  547. ${NSD_CreateText} 0 13u 100% 12u "$LOCALAPPDATA\${APPLICATION_NAME}"
  548. Pop $UnPageUserAppDataEditBox
  549. SendMessage $UnPageUserAppDataEditBox ${EM_SETREADONLY} 1 0
  550. ${NSD_CreateLabel} 0 46u 100% 24u "Leave unchecked to keep the data folder for later use or check to delete the data folder."
  551. Pop $0
  552. ${NSD_CreateCheckbox} 0 71u 100% 8u "Yes, delete this data folder."
  553. Pop $UnPageUserAppDataCheckbox
  554. nsDialogs::Show
  555. FunctionEnd
  556. Function un.UnPageUserAppDataLeave
  557. ${NSD_GetState} $UnPageUserAppDataCheckbox $UnPageUserAppDataCheckbox_State
  558. FunctionEnd
  559. Section Uninstall
  560. IfFileExists "$INSTDIR\${APPLICATION_NAME}.exe" tomahawk_installed
  561. MessageBox MB_YESNO "It does not appear that ${APPLICATION_NAME} is installed in the directory '$INSTDIR'.$\r$\nContinue anyway (not recommended)?" IDYES tomahawk_installed
  562. Abort "Uninstall aborted by user"
  563. tomahawk_installed:
  564. ;Delete registry keys.
  565. DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}"
  566. DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionBuild"
  567. DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMajor"
  568. DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionMinor"
  569. DeleteRegValue HKLM "Software\${APPLICATION_NAME}" "VersionRevision"
  570. DeleteRegValue HKLM "Software\${APPLICATION_NAME}" ""
  571. DeleteRegKey HKLM "Software\${APPLICATION_NAME}"
  572. ;DeleteRegKey HKCR "Software\${APPLICATION_NAME}"
  573. ;DeleteRegKey HKCR "Software\${APPLICATION_NAME}Spotify"
  574. DeleteRegKey HKCR "${APPLICATION_NAME}"
  575. ;Start menu shortcuts.
  576. !ifdef OPTION_SECTION_SC_START_MENU
  577. SetShellVarContext all
  578. RMDir /r "$SMPROGRAMS\${APPLICATION_NAME}"
  579. SetShellVarContext current
  580. !endif
  581. ;Desktop shortcut.
  582. !ifdef OPTION_SECTION_SC_DESKTOP
  583. IfFileExists "$DESKTOP\${APPLICATION_NAME}.lnk" 0 +2
  584. Delete "$DESKTOP\${APPLICATION_NAME}.lnk"
  585. !endif
  586. ;Quick Launch shortcut.
  587. !ifdef OPTION_SECTION_SC_QUICK_LAUNCH
  588. IfFileExists "$QUICKLAUNCH\${APPLICATION_NAME}.lnk" 0 +2
  589. Delete "$QUICKLAUNCH\${APPLICATION_NAME}.lnk"
  590. !endif
  591. ;Remove all the Program Files.
  592. RMDir /r $INSTDIR
  593. ;Uninstall User Data if option is checked, otherwise skip.
  594. ${If} $UnPageUserAppDataCheckbox_State == ${BST_CHECKED}
  595. RMDir /r "$LOCALAPPDATA\${APPLICATION_NAME}"
  596. ${EndIf}
  597. SetDetailsPrint textonly
  598. DetailPrint "Finsihed."
  599. SectionEnd
  600. ##############################################################################
  601. # #
  602. # NSIS Installer Event Handler Functions #
  603. # #
  604. ##############################################################################
  605. Function .onInit
  606. !insertmacro INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
  607. ;Remove Quick Launch option from Windows 7, as no longer applicable - usually.
  608. ${IfNot} ${AtMostWinVista}
  609. SectionSetText ${SEC_QUICK_LAUNCH} "Quick Launch Shortcut (N/A)"
  610. SectionSetFlags ${SEC_QUICK_LAUNCH} ${SF_RO}
  611. SectionSetInstTypes ${SEC_QUICK_LAUNCH} 0
  612. ${EndIf}
  613. ${MementoSectionRestore}
  614. UAC_Elevate:
  615. UAC::RunElevated
  616. StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
  617. StrCmp 0 $0 0 UAC_Err ; Error?
  618. StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
  619. Quit
  620. UAC_Err:
  621. MessageBox MB_ICONSTOP "Unable to elevate, error $0"
  622. Abort
  623. UAC_ElevationAborted:
  624. Abort
  625. UAC_Success:
  626. StrCmp 1 $3 +4 ;Admin?
  627. StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
  628. MessageBox MB_ICONSTOP "This installer requires admin access, try again"
  629. goto UAC_Elevate
  630. ;Prevent multiple instances.
  631. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkInstaller") i .r1 ?e'
  632. Pop $R0
  633. StrCmp $R0 0 +3
  634. MessageBox MB_OK|MB_ICONEXCLAMATION "The installer is already running."
  635. Abort
  636. ;Use available InstallLocation when possible. This is useful in the uninstaller
  637. ;via re-install, which would otherwise use a default location - a bug.
  638. ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPLICATION_NAME}" "InstallLocation"
  639. StrCmp $R0 "" SkipSetInstDir
  640. StrCpy $INSTDIR $R0
  641. SkipSetInstDir:
  642. ;Shutdown Tomahawk in case Add/Remove re-installer option used.
  643. Call EnsureTomahawkShutdown
  644. FunctionEnd
  645. Function .onInstSuccess
  646. ${MementoSectionSave}
  647. UAC::Unload ;Must call unload!
  648. FunctionEnd
  649. Function .onInstFailed
  650. UAC::Unload ;Must call unload!
  651. FunctionEnd
  652. ##############################################################################
  653. # #
  654. # NSIS Uninstaller Event Handler Functions #
  655. # #
  656. ##############################################################################
  657. Function un.onInit
  658. UAC_Elevate:
  659. UAC::RunElevated
  660. StrCmp 1223 $0 UAC_ElevationAborted ; UAC dialog aborted by user?
  661. StrCmp 0 $0 0 UAC_Err ; Error?
  662. StrCmp 1 $1 0 UAC_Success ;Are we the real deal or just the wrapper?
  663. Quit
  664. UAC_Err:
  665. MessageBox MB_ICONSTOP "Unable to elevate, error $0"
  666. Abort
  667. UAC_ElevationAborted:
  668. Abort
  669. UAC_Success:
  670. StrCmp 1 $3 +4 ;Admin?
  671. StrCmp 3 $1 0 UAC_ElevationAborted ;Try again?
  672. MessageBox MB_ICONSTOP "This uninstaller requires admin access, try again"
  673. goto UAC_Elevate
  674. ;Prevent multiple instances.
  675. System::Call 'kernel32::CreateMutexA(i 0, i 0, t "tomahawkUninstaller") i .r1 ?e'
  676. Pop $R0
  677. StrCmp $R0 0 +3
  678. MessageBox MB_OK|MB_ICONEXCLAMATION "This uninstaller is already running."
  679. Abort
  680. FunctionEnd
  681. Function un.onUnInstSuccess
  682. UAC::Unload ;Must call unload!
  683. FunctionEnd
  684. Function un.onUnInstFailed
  685. UAC::Unload ;Must call unload!
  686. FunctionEnd