Merge pull request #6732
[bitcoinplatinum.git] / share / setup.nsi.in
blob6c0e895bb118ac65885d7295fed51a9b837ab64f
1 Name "@PACKAGE_NAME@ (@WINDOWS_BITS@-bit)"
3 RequestExecutionLevel highest
4 SetCompressor /SOLID lzma
6 # General Symbol Definitions
7 !define REGKEY "SOFTWARE\$(^Name)"
8 !define VERSION @CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@
9 !define COMPANY "Bitcoin Core project"
10 !define URL http://www.bitcoin.org/
12 # MUI Symbol Definitions
13 !define MUI_ICON "@abs_top_srcdir@/share/pixmaps/bitcoin.ico"
14 !define MUI_WELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp"
15 !define MUI_HEADERIMAGE
16 !define MUI_HEADERIMAGE_RIGHT
17 !define MUI_HEADERIMAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-header.bmp"
18 !define MUI_FINISHPAGE_NOAUTOCLOSE
19 !define MUI_STARTMENUPAGE_REGISTRY_ROOT HKLM
20 !define MUI_STARTMENUPAGE_REGISTRY_KEY ${REGKEY}
21 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME StartMenuGroup
22 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "@PACKAGE_NAME@"
23 !define MUI_FINISHPAGE_RUN $INSTDIR\bitcoin-qt.exe
24 !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
25 !define MUI_UNWELCOMEFINISHPAGE_BITMAP "@abs_top_srcdir@/share/pixmaps/nsis-wizard.bmp"
26 !define MUI_UNFINISHPAGE_NOAUTOCLOSE
28 # Included files
29 !include Sections.nsh
30 !include MUI2.nsh
31 !if "@WINDOWS_BITS@" == "64"
32 !include x64.nsh
33 !endif
35 # Variables
36 Var StartMenuGroup
38 # Installer pages
39 !insertmacro MUI_PAGE_WELCOME
40 !insertmacro MUI_PAGE_DIRECTORY
41 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuGroup
42 !insertmacro MUI_PAGE_INSTFILES
43 !insertmacro MUI_PAGE_FINISH
44 !insertmacro MUI_UNPAGE_CONFIRM
45 !insertmacro MUI_UNPAGE_INSTFILES
47 # Installer languages
48 !insertmacro MUI_LANGUAGE English
50 # Installer attributes
51 OutFile @abs_top_srcdir@/bitcoin-${VERSION}-win@WINDOWS_BITS@-setup.exe
52 !if "@WINDOWS_BITS@" == "64"
53 InstallDir $PROGRAMFILES64\Bitcoin
54 !else
55 InstallDir $PROGRAMFILES\Bitcoin
56 !endif
57 CRCCheck on
58 XPStyle on
59 BrandingText " "
60 ShowInstDetails show
61 VIProductVersion ${VERSION}.@CLIENT_VERSION_BUILD@
62 VIAddVersionKey ProductName "Bitcoin Core"
63 VIAddVersionKey ProductVersion "${VERSION}"
64 VIAddVersionKey CompanyName "${COMPANY}"
65 VIAddVersionKey CompanyWebsite "${URL}"
66 VIAddVersionKey FileVersion "${VERSION}"
67 VIAddVersionKey FileDescription ""
68 VIAddVersionKey LegalCopyright ""
69 InstallDirRegKey HKCU "${REGKEY}" Path
70 ShowUninstDetails show
72 # Installer sections
73 Section -Main SEC0000
74 SetOutPath $INSTDIR
75 SetOverwrite on
76 File @abs_top_srcdir@/release/bitcoin-qt.exe
77 File /oname=COPYING.txt @abs_top_srcdir@/COPYING
78 File /oname=readme.txt @abs_top_srcdir@/doc/README_windows.txt
79 SetOutPath $INSTDIR\daemon
80 File @abs_top_srcdir@/release/bitcoind.exe
81 File @abs_top_srcdir@/release/bitcoin-cli.exe
82 SetOutPath $INSTDIR\doc
83 File /r @abs_top_srcdir@/doc\*.*
84 SetOutPath $INSTDIR
85 WriteRegStr HKCU "${REGKEY}\Components" Main 1
87 # Remove old wxwidgets-based-bitcoin executable and locales:
88 Delete /REBOOTOK $INSTDIR\bitcoin.exe
89 RMDir /r /REBOOTOK $INSTDIR\locale
90 SectionEnd
92 Section -post SEC0001
93 WriteRegStr HKCU "${REGKEY}" Path $INSTDIR
94 SetOutPath $INSTDIR
95 WriteUninstaller $INSTDIR\uninstall.exe
96 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
97 CreateDirectory $SMPROGRAMS\$StartMenuGroup
98 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk" $INSTDIR\bitcoin-qt.exe
99 CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
100 !insertmacro MUI_STARTMENU_WRITE_END
101 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
102 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayVersion "${VERSION}"
103 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" Publisher "${COMPANY}"
104 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" URLInfoAbout "${URL}"
105 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayIcon $INSTDIR\uninstall.exe
106 WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" UninstallString $INSTDIR\uninstall.exe
107 WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoModify 1
108 WriteRegDWORD HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" NoRepair 1
109 WriteRegStr HKCR "bitcoin" "URL Protocol" ""
110 WriteRegStr HKCR "bitcoin" "" "URL:Bitcoin"
111 WriteRegStr HKCR "bitcoin\DefaultIcon" "" $INSTDIR\bitcoin-qt.exe
112 WriteRegStr HKCR "bitcoin\shell\open\command" "" '"$INSTDIR\bitcoin-qt.exe" "%1"'
113 SectionEnd
115 # Macro for selecting uninstaller sections
116 !macro SELECT_UNSECTION SECTION_NAME UNSECTION_ID
117 Push $R0
118 ReadRegStr $R0 HKCU "${REGKEY}\Components" "${SECTION_NAME}"
119 StrCmp $R0 1 0 next${UNSECTION_ID}
120 !insertmacro SelectSection "${UNSECTION_ID}"
121 GoTo done${UNSECTION_ID}
122 next${UNSECTION_ID}:
123 !insertmacro UnselectSection "${UNSECTION_ID}"
124 done${UNSECTION_ID}:
125 Pop $R0
126 !macroend
128 # Uninstaller sections
129 Section /o -un.Main UNSEC0000
130 Delete /REBOOTOK $INSTDIR\bitcoin-qt.exe
131 Delete /REBOOTOK $INSTDIR\COPYING.txt
132 Delete /REBOOTOK $INSTDIR\readme.txt
133 RMDir /r /REBOOTOK $INSTDIR\daemon
134 RMDir /r /REBOOTOK $INSTDIR\doc
135 DeleteRegValue HKCU "${REGKEY}\Components" Main
136 SectionEnd
138 Section -un.post UNSEC0001
139 DeleteRegKey HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
140 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
141 Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\$(^Name).lnk"
142 Delete /REBOOTOK "$SMSTARTUP\Bitcoin.lnk"
143 Delete /REBOOTOK $INSTDIR\uninstall.exe
144 Delete /REBOOTOK $INSTDIR\debug.log
145 Delete /REBOOTOK $INSTDIR\db.log
146 DeleteRegValue HKCU "${REGKEY}" StartMenuGroup
147 DeleteRegValue HKCU "${REGKEY}" Path
148 DeleteRegKey /IfEmpty HKCU "${REGKEY}\Components"
149 DeleteRegKey /IfEmpty HKCU "${REGKEY}"
150 DeleteRegKey HKCR "bitcoin"
151 RmDir /REBOOTOK $SMPROGRAMS\$StartMenuGroup
152 RmDir /REBOOTOK $INSTDIR
153 Push $R0
154 StrCpy $R0 $StartMenuGroup 1
155 StrCmp $R0 ">" no_smgroup
156 no_smgroup:
157 Pop $R0
158 SectionEnd
160 # Installer functions
161 Function .onInit
162 InitPluginsDir
163 !if "@WINDOWS_BITS@" == "64"
164 ${If} ${RunningX64}
165 ; disable registry redirection (enable access to 64-bit portion of registry)
166 SetRegView 64
167 ${Else}
168 MessageBox MB_OK|MB_ICONSTOP "Cannot install 64-bit version on a 32-bit system."
169 Abort
170 ${EndIf}
171 !endif
172 FunctionEnd
174 # Uninstaller functions
175 Function un.onInit
176 ReadRegStr $INSTDIR HKCU "${REGKEY}" Path
177 !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuGroup
178 !insertmacro SELECT_UNSECTION Main ${UNSEC0000}
179 FunctionEnd