New NSIS script
[nasm.git] / nasm.nsi
blobba6b4a25b574cc1baaa41298aa9311844810e5c6
1 #!Nsis Installer Command Script
3 # Copyright (c) 2009, Shao Miller (shao.miller@yrdsb.edu.on.ca)
4 # All rights reserved.
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions are met:
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above copyright
11 # notice, this list of conditions and the following disclaimer in the
12 # documentation and/or other materials provided with the distribution.
14 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 # ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
16 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR
18 # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 !include "version.nsh"
26 !define PRODUCT_NAME "Netwide Assembler"
27 !define PRODUCT_SHORT_NAME "nasm"
28 !define PACKAGE_NAME "${PRODUCT_NAME} ${VERSION}"
29 !define PACKAGE_SHORT_NAME "${PRODUCT_SHORT_NAME}-${VERSION}"
31 Name "${PACKAGE_NAME}"
32 OutFile "${PACKAGE_SHORT_NAME}-installer.exe"
33 InstallDir "$PROGRAMFILES\NASM"
34 InstallDirRegKey HKLM "SOFTWARE\${PACKAGE_SHORT_NAME}" "InstallDir"
35 SetCompressor lzma
37 XPStyle on
39 DirText "Please select the installation folder."
40 Page directory
42 ComponentText "Select which optional components you want to install."
43 Page components
45 ShowInstDetails hide
46 ShowUninstDetails hide
47 Page instfiles
49 Section "${PACKAGE_NAME}"
50 SectionIn RO
52 SetOutPath "$INSTDIR\."
53 File "LICENSE"
54 File "nasm.exe"
55 File "ndisasm.exe"
56 File "doc/nasmdoc.pdf"
57 File "rdoff/ldrdf.exe"
58 File "rdoff/rdf2bin.exe"
59 File "rdoff/rdf2com.exe"
60 File "rdoff/rdf2ith.exe"
61 File "rdoff/rdf2ihx.exe"
62 File "rdoff/rdf2srec.exe"
63 File "rdoff/rdfdump.exe"
64 File "rdoff/rdflib.exe"
65 File "rdoff/rdx.exe"
66 FileOpen $0 "nasmpath.bat" w
67 IfErrors skip
68 FileWrite $0 "@set path=$INSTDIR;%path%$\r$\n"
69 FileWrite $0 "@%comspec%"
70 FileClose $0
71 skip:
72 SectionEnd
74 Section "Start Menu Shortcuts"
75 CreateDirectory "$SMPROGRAMS\${PACKAGE_NAME}"
76 CreateShortCut "$SMPROGRAMS\${PACKAGE_NAME}\Uninstall ${PACKAGE_NAME}.lnk" "$INSTDIR\Uninstall ${PACKAGE_NAME}.exe" "" "$INSTDIR\Uninstall ${PACKAGE_NAME}.exe" 0
77 CreateShortCut "$SMPROGRAMS\${PACKAGE_NAME}\NASM Shell.lnk" "$INSTDIR\nasmpath.bat" "" "$INSTDIR\nasmpath.bat" 0
78 CreateShortCut "$SMPROGRAMS\${PACKAGE_NAME}\NASM Manual.lnk" "$INSTDIR\nasmdoc.pdf" "" "$INSTDIR\nasmdoc.pdf" 0
79 SectionEnd
81 Section "Desktop Icons"
82 CreateShortCut "$DESKTOP\NASM.lnk" "$INSTDIR\nasmpath.bat" "" "$INSTDIR\nasmpath.bat" 0
83 SectionEnd
85 Section "Uninstall"
86 Delete /rebootok "$DESKTOP\NASM.lnk"
87 Delete /rebootok "$SMPROGRAMS\${PACKAGE_NAME}\NASM Shell.lnk"
88 Delete /rebootok "$SMPROGRAMS\${PACKAGE_NAME}\NASM Manual.lnk"
89 Delete /rebootok "$SMPROGRAMS\${PACKAGE_NAME}\Uninstall ${PACKAGE_NAME}.lnk"
90 RMDir "$SMPROGRAMS\${PACKAGE_NAME}"
92 Delete /rebootok "$INSTDIR\nasmpath.bat"
93 Delete /rebootok "$INSTDIR\rdx.exe"
94 Delete /rebootok "$INSTDIR\rdflib.exe"
95 Delete /rebootok "$INSTDIR\rdfdump.exe"
96 Delete /rebootok "$INSTDIR\rdf2srec.exe"
97 Delete /rebootok "$INSTDIR\rdf2ihx.exe"
98 Delete /rebootok "$INSTDIR\rdf2ith.exe"
99 Delete /rebootok "$INSTDIR\rdf2com.exe"
100 Delete /rebootok "$INSTDIR\rdf2bin.exe"
101 Delete /rebootok "$INSTDIR\ndisasm.exe"
102 Delete /rebootok "$INSTDIR\nasmdoc.pdf"
103 Delete /rebootok "$INSTDIR\nasm.exe"
104 Delete /rebootok "$INSTDIR\ldrdf.exe"
105 Delete /rebootok "$INSTDIR\LICENSE"
106 RMDir "$INSTDIR"
107 SectionEnd
109 Section -post
110 WriteUninstaller "$INSTDIR\Uninstall ${PACKAGE_NAME}.exe"
111 SectionEnd