config/msvc.h: inttypes.h and stdbool.h introduced in MSVS 2013
[nasm.git] / nsis / nasm.nsi
blobebb8ef9a2de1820a508634f262fc94e32e3eddf9
1 #!Nsis Installer Command Script
4 # Copyright (c) 2009, Shao Miller (shao.miller@yrdsb.edu.on.ca)
5 # Copyright (c) 2009, Cyrill Gorcunov (gorcunov@gmail.com)
6 # All rights reserved.
8 # The script requires NSIS v2.45 (or any later)
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions are met:
12 # * Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # * Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR
22 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 !addincludedir "${objdir}/nsis"
30 !addincludedir "${srcdir}/nsis"
31 !include "version.nsh"
32 !include /nonfatal "arch.nsh"
34 !define PRODUCT_NAME "Netwide Assembler"
35 !define PRODUCT_SHORT_NAME "nasm"
36 !define PACKAGE_NAME "${PRODUCT_NAME} ${VERSION}"
37 !define PACKAGE_SHORT_NAME "${PRODUCT_SHORT_NAME}-${VERSION}"
39 SetCompressor lzma
41 !define MULTIUSER_EXECUTIONLEVEL Highest
42 !define MULTIUSER_MUI
43 !define MULTIUSER_INSTALLMODE_COMMANDLINE
44 !define MULTIUSER_INSTALLMODE_INSTDIR "NASM"
45 !include "MultiUser.nsh"
47 !insertmacro MULTIUSER_PAGE_INSTALLMODE
48 !insertmacro MULTIUSER_INSTALLMODEPAGE_INTERFACE
50 ;--------------------------------
51 ;General
53 ;Name and file
54 Name "${PACKAGE_NAME}"
55 OutFile "${objdir}/${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe"
57 ;Get installation folder from registry if available
58 InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" ""
60 ;Request application privileges for Windows Vista
61 RequestExecutionLevel user
63 ;--------------------------------
64 ;Variables
66 Var StartMenuFolder
67 Var CmdFailed
69 ;--------------------------------
70 ;Interface Settings
71 Caption "${PACKAGE_SHORT_NAME} installation"
72 Icon "${srcdir}/nsis/nasm.ico"
73 UninstallIcon "${srcdir}/nsis/nasm-un.ico"
75 !define MUI_ABORTWARNING
77 ;--------------------------------
78 ;Pages
80 !insertmacro MUI_PAGE_COMPONENTS
81 !insertmacro MUI_PAGE_DIRECTORY
83 ;Start Menu Folder Page Configuration
84 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKCU"
85 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\${PRODUCT_SHORT_NAME}"
86 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_SHORT_NAME}"
88 !insertmacro MUI_PAGE_STARTMENU Application $StartMenuFolder
90 !insertmacro MUI_PAGE_INSTFILES
92 !insertmacro MUI_UNPAGE_CONFIRM
93 !insertmacro MUI_UNPAGE_INSTFILES
95 ;--------------------------------
96 ;Installer Sections
98 !insertmacro MUI_LANGUAGE English
100 Section "NASM" SecNasm
101 Sectionin RO
102 SetOutPath "$INSTDIR"
103 File "${srcdir}/LICENSE"
104 File "${objdir}/nasm.exe"
105 File "${objdir}/ndisasm.exe"
106 File "${srcdir}/nsis/nasm.ico"
108 ;Store installation folder
109 WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR
111 ;Store shortcuts folder
112 WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}\" "lnk" $SMPROGRAMS\$StartMenuFolder
113 WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}\" "bat-lnk" $DESKTOP\${PRODUCT_SHORT_NAME}.lnk
116 ; the bat we need
117 StrCpy $CmdFailed "true"
118 FileOpen $0 "nasmpath.bat" w
119 IfErrors skip
120 StrCpy $CmdFailed "false"
121 FileWrite $0 "@set path=$INSTDIR;%path%$\r$\n"
122 FileWrite $0 "@%comspec%"
123 FileClose $0
124 CreateShortCut "$DESKTOP\${PRODUCT_SHORT_NAME}.lnk" "$INSTDIR\nasmpath.bat" "" "$INSTDIR\nasm.ico" 0
125 skip:
126 ;Create uninstaller
127 WriteUninstaller "$INSTDIR\Uninstall.exe"
129 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
131 ;Create shortcuts
132 CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
133 StrCmp $CmdFailed "true" +2
134 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_SHORT_NAME}-shell.lnk" "$INSTDIR\nasmpath.bat"
135 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${PRODUCT_SHORT_NAME}.lnk" "$INSTDIR\nasm.exe" "" "$INSTDIR\nasm.ico" 0
136 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR\Uninstall.exe"
138 !insertmacro MUI_STARTMENU_WRITE_END
139 SectionEnd
141 Section "RDOFF" SecRdoff
142 File "${objdir}/rdoff/ldrdf.exe"
143 File "${objdir}/rdoff/rdf2bin.exe"
144 File "${objdir}/rdoff/rdf2com.exe"
145 File "${objdir}/rdoff/rdf2ith.exe"
146 File "${objdir}/rdoff/rdf2ihx.exe"
147 File "${objdir}/rdoff/rdf2srec.exe"
148 File "${objdir}/rdoff/rdfdump.exe"
149 File "${objdir}/rdoff/rdflib.exe"
150 SectionEnd
152 Section "Manual" SecManual
153 SetOutPath "$INSTDIR"
154 File "${objdir}/doc/nasmdoc.pdf"
155 CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf"
156 SectionEnd
158 Section "VS8 integration" SecVS8
159 CreateDirectory "$INSTDIR\VSrules"
160 SetOutPath "$INSTDIR\VSrules"
161 File "${srcdir}/contrib/VSrules/nasm.README"
162 File "${srcdir}/contrib/VSrules/nasm.rules"
163 SectionEnd
165 ;--------------------------------
166 ;Descriptions
168 ;Language strings
169 LangString DESC_SecNasm ${LANG_ENGLISH} "NASM assembler and disassember modules"
170 LangString DESC_SecManual ${LANG_ENGLISH} "Complete NASM manual (pdf file)"
171 LangString DESC_SecRdoff ${LANG_ENGLISH} "RDOFF utilities (you may not need it if you don't know what is it)"
172 LangString DESC_SecVS8 ${LANG_ENGLISH} "Visual Studio 2008 NASM integration (rules file)"
174 ;Assign language strings to sections
175 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
176 !insertmacro MUI_DESCRIPTION_TEXT ${SecNasm} $(DESC_SecNasm)
177 !insertmacro MUI_DESCRIPTION_TEXT ${SecRdoff} $(DESC_SecRdoff)
178 !insertmacro MUI_DESCRIPTION_TEXT ${SecManual} $(DESC_SecManual)
179 !insertmacro MUI_DESCRIPTION_TEXT ${SecVS8} $(DESC_SecVS8)
180 !insertmacro MUI_FUNCTION_DESCRIPTION_END
182 ;--------------------------------
183 ;Uninstaller Section
185 Section "Uninstall"
187 ; files on HDD
188 IfFileExists "$INSTDIR" +3 +1
189 MessageBox MB_OK "No files found, aborting."
190 Abort
191 MessageBox MB_YESNO "The following directory will be deleted$\n$INSTDIR" IDYES rm_instdir_true IDNO rm_instdir_false
192 rm_instdir_true:
193 RMDir /r /rebootok "$INSTDIR"
194 rm_instdir_false:
197 ; Desktop link
198 ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "bat-lnk"
199 StrCmp $0 0 +1 +3
200 MessageBox MB_OK "Invalid path to a bat-lnk file, aborting"
201 Abort
202 IfFileExists $0 +3 +1
203 MessageBox MB_OK "No bat-lnk files found, aborting."
204 Abort
205 MessageBox MB_YESNO "The following file will be deleted$\n$0" IDYES rm_batlinks_true IDNO rm_batlinks_false
206 rm_batlinks_true:
207 Delete /rebootok "$0"
208 RMDir "$0"
209 rm_batlinks_false:
212 ; Start menu folder
213 ReadRegStr $0 HKCU Software\${PRODUCT_SHORT_NAME} "lnk"
214 StrCmp $0 0 +1 +3
215 MessageBox MB_OK "Invalid path to a lnk file, aborting"
216 Abort
217 IfFileExists $0 +3 +1
218 MessageBox MB_OK "No lnk files found, aborting."
219 Abort
220 MessageBox MB_YESNO "The following directory will be deleted$\n$0" IDYES rm_links_true IDNO rm_links_false
221 rm_links_true:
222 Delete /rebootok "$0\*"
223 RMDir "$0"
224 rm_links_false:
225 DeleteRegKey /ifempty HKCU "Software\${PRODUCT_SHORT_NAME}"
226 SectionEnd
229 ; MUI requires this hooks
230 Function .onInit
231 !insertmacro MULTIUSER_INIT
232 FunctionEnd
234 Function un.onInit
235 !insertmacro MULTIUSER_UNINIT
236 FunctionEnd