1 # sdcc.nsi - NSIS installer script for SDCC
3 # Copyright (c) 2003 Borut Razem
5 # This file is part of sdcc.
7 # This software is provided 'as-is', without any express or implied
8 # warranty. In no event will the authors be held liable for any damages
9 # arising from the use of this software.
11 # Permission is granted to anyone to use this software for any purpose,
12 # including commercial applications, and to alter it and redistribute it
13 # freely, subject to the following restrictions:
15 # 1. The origin of this software must not be misrepresented; you must not
16 # claim that you wrote the original software. If you use this software
17 # in a product, an acknowledgment in the product documentation would be
18 # appreciated but is not required.
19 # 2. Altered source versions must be plainly marked as such, and must not be
20 # misrepresented as being the original software.
21 # 3. This notice may not be removed or altered from any source distribution.
24 # borut.razem@siol.net
30 !define SDCC_ROOT "..\.."
35 !system "dir ${SDCC_ROOT}\device > NUL" <> 0
36 !define DEV_ROOT "${SDCC_ROOT}"
38 !system "dir ${SDCC_ROOT}\device > NUL" = 0
39 !define DEV_ROOT "${SDCC_ROOT}\device"
42 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
43 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
45 InstType "Full (Bin, Doc, Lib, Src)"
46 InstType "Medium (Bin, Doc, Lib)"
47 InstType "Compact (Bin, Doc)"
49 !define MUI_ABORTWARNING
50 !insertmacro MUI_PAGE_WELCOME
51 !define MUI_LICENSEPAGE_RADIOBUTTONS
52 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.TXT"
53 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SDCC"
54 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
55 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\%sSDCC"
56 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
57 !define MUI_STARTMENUPAGE_NODISABLE
58 !insertmacro MUI_PAGE_STARTMENU
59 !insertmacro MUI_PAGE_COMPONENTS
60 !insertmacro MUI_PAGE_DIRECTORY
61 !insertmacro MUI_PAGE_INSTFILES
62 !insertmacro MUI_PAGE_FINISH
63 !insertmacro MUI_UNPAGE_INSTFILES
64 !insertmacro MUI_LANGUAGE "English"
69 InstallDir "$PROGRAMFILES\SDCC"
71 ShowUnInstDetails show
74 MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
81 File "${SDCC_ROOT}\COPYING.TXT"
84 Section "SDCC application files"
86 SetOutPath "$INSTDIR\bin"
87 File "${SDCC_ROOT}\bin\*.exe"
90 Section "SDCC documentation"
92 SetOutPath "$INSTDIR\doc"
93 File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
94 File "${SDCC_ROOT}\doc\README.TXT"
97 Section "SDCC include files"
99 SetOutPath "$INSTDIR\include\asm\default"
100 File "${DEV_ROOT}\include\asm\default\features.h"
101 SetOutPath "$INSTDIR\include\asm\gbz80"
102 File "${DEV_ROOT}\include\asm\gbz80\features.h"
103 SetOutPath "$INSTDIR\include\asm\z80"
104 File "${DEV_ROOT}\include\asm\z80\features.h"
105 SetOutPath "$INSTDIR\include"
106 File "${DEV_ROOT}\include\*.h"
109 Section "SDCC DS390 library"
111 SetOutPath "$INSTDIR\lib\ds390"
112 File "${DEV_ROOT}\lib\ds390\*.asm"
113 File "${DEV_ROOT}\lib\ds390\*.rel"
114 File "${DEV_ROOT}\lib\ds390\*.lib"
117 Section "SDCC DS400 library"
119 SetOutPath "$INSTDIR\lib\ds400"
120 File "${DEV_ROOT}\lib\ds400\*.asm"
121 File "${DEV_ROOT}\lib\ds400\*.rel"
122 File "${DEV_ROOT}\lib\ds400\*.lib"
125 Section "SDCC GBZ80 library"
127 SetOutPath "$INSTDIR\lib\gbz80"
128 File "${DEV_ROOT}\lib\gbz80\*.asm"
129 File "${DEV_ROOT}\lib\gbz80\*.o"
130 File "${DEV_ROOT}\lib\gbz80\*.lib"
133 Section "SDCC Z80 library"
135 SetOutPath "$INSTDIR\lib\z80"
136 File "${DEV_ROOT}\lib\z80\*.asm"
137 File "${DEV_ROOT}\lib\z80\*.o"
138 File "${DEV_ROOT}\lib\z80\*.lib"
141 Section "SDCC large model library"
143 SetOutPath "$INSTDIR\lib\large"
144 File "${DEV_ROOT}\lib\large\*.asm"
145 File "${DEV_ROOT}\lib\large\*.rel"
146 File "${DEV_ROOT}\lib\large\*.lib"
149 Section "SDCC small model library"
151 SetOutPath "$INSTDIR\lib\small"
152 File "${DEV_ROOT}\lib\small\*.asm"
153 File "${DEV_ROOT}\lib\small\*.rel"
154 File "${DEV_ROOT}\lib\small\*.lib"
157 Section "SDCC HC08 library"
159 SetOutPath "$INSTDIR\lib\hc08"
160 File "${DEV_ROOT}\lib\hc08\*.asm"
161 File "${DEV_ROOT}\lib\hc08\*.rel"
162 File "${DEV_ROOT}\lib\hc08\*.lib"
165 Section "SDCC library sources"
167 SetOutPath "$INSTDIR\lib\src\ds390\examples"
168 File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
170 SetOutPath "$INSTDIR\lib\src\ds390"
171 File "${DEV_ROOT}\lib\src\ds390\*.c"
172 File "${DEV_ROOT}\lib\src\ds390\libds390.lib"
173 File "${DEV_ROOT}\lib\src\ds390\Makefile"
174 File "${DEV_ROOT}\lib\src\ds390\Makefile.dep"
176 SetOutPath "$INSTDIR\lib\src\ds400"
177 File "${DEV_ROOT}\lib\src\ds400\*.c"
178 File "${DEV_ROOT}\lib\src\ds400\libds400.lib"
179 File "${DEV_ROOT}\lib\src\ds400\Makefile"
180 File "${DEV_ROOT}\lib\src\ds400\Makefile.dep"
182 SetOutPath "$INSTDIR\lib\src\gbz80"
183 File "${DEV_ROOT}\lib\src\gbz80\*.c"
184 File "${DEV_ROOT}\lib\src\gbz80\*.s"
185 File "${DEV_ROOT}\lib\src\gbz80\gbz80.lib"
186 File "${DEV_ROOT}\lib\src\gbz80\Makefile"
187 File "${DEV_ROOT}\lib\src\gbz80\README"
189 SetOutPath "$INSTDIR\lib\src\z80"
190 File "${DEV_ROOT}\lib\src\z80\*.c"
191 File "${DEV_ROOT}\lib\src\z80\*.s"
192 File "${DEV_ROOT}\lib\src\z80\Makefile"
193 File "${DEV_ROOT}\lib\src\z80\README"
194 File "${DEV_ROOT}\lib\src\z80\z80.lib"
196 SetOutPath "$INSTDIR\lib\src\hc08"
197 File "${DEV_ROOT}\lib\src\hc08\*.c"
198 File "${DEV_ROOT}\lib\src\hc08\Makefile"
199 File "${DEV_ROOT}\lib\src\hc08\hc08.lib"
201 SetOutPath "$INSTDIR\lib\src"
202 File "${DEV_ROOT}\lib\src\*.c"
206 !insertmacro MUI_STARTMENU_WRITE_BEGIN
207 CreateDirectory "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
208 CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\SDCC on the Web.lnk" "$INSTDIR\sdcc.url"
209 CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe"
210 CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
211 CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
212 CreateShortCut "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT"
213 !insertmacro MUI_STARTMENU_WRITE_END
217 WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
221 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "DisplayName" "SDCC"
222 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "UninstallString" "$INSTDIR\uninstall.exe"
223 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "Publisher" "sdcc.sourceforge.net"
224 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLInfoAbout" "http://sdcc.sourceforge.net/"
225 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "HelpLink" "http://sdcc.sourceforge.net/"
226 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
227 WriteUninstaller "$INSTDIR\uninstall.exe"
231 #### Uninstaller code ####
234 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
238 Function un.onUninstSuccess
240 MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
244 ReadRegStr ${MUI_STARTMENUPAGE_VARIABLE} ${MUI_STARTMENUPAGE_REGISTRY_ROOT} "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
246 Delete "$INSTDIR\sdcc.url"
248 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
249 DeleteRegValue ${MUI_STARTMENUPAGE_REGISTRY_ROOT} "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
251 Delete "$INSTDIR\uninstall.exe"
252 Delete "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\GPL 2 License.lnk"
253 Delete "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Change Log.lnk"
254 Delete "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Documentation.lnk"
255 Delete "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\Uninstall SDCC.lnk"
256 Delete "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}\SDCC on the Web.lnk"
258 Delete "$INSTDIR\lib\src\hc08\*.c"
259 Delete "$INSTDIR\lib\src\hc08\hc08.lib"
260 Delete "$INSTDIR\lib\src\hc08\Makefile"
262 Delete "$INSTDIR\lib\src\z80\*.c"
263 Delete "$INSTDIR\lib\src\z80\*.s"
264 Delete "$INSTDIR\lib\src\z80\z80.lib"
265 Delete "$INSTDIR\lib\src\z80\README"
266 Delete "$INSTDIR\lib\src\z80\Makefile"
268 Delete "$INSTDIR\lib\src\gbz80\*.c"
269 Delete "$INSTDIR\lib\src\gbz80\*.s"
270 Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
271 Delete "$INSTDIR\lib\src\gbz80\README"
272 Delete "$INSTDIR\lib\src\gbz80\Makefile"
274 Delete "$INSTDIR\lib\src\ds390\*.c"
275 Delete "$INSTDIR\lib\src\ds390\libds390.lib"
276 Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
277 Delete "$INSTDIR\lib\src\ds390\Makefile"
278 Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
280 Delete "$INSTDIR\lib\src\ds400\*.c"
281 Delete "$INSTDIR\lib\src\ds400\libds400.lib"
282 Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
283 Delete "$INSTDIR\lib\src\ds400\Makefile"
285 Delete "$INSTDIR\lib\src\*.c"
287 Delete "$INSTDIR\lib\hc08\*.rel"
288 Delete "$INSTDIR\lib\hc08\*.asm"
289 Delete "$INSTDIR\lib\hc08\*.lib"
291 Delete "$INSTDIR\lib\z80\*.o"
292 Delete "$INSTDIR\lib\z80\*.asm"
293 Delete "$INSTDIR\lib\z80\*.lib"
295 Delete "$INSTDIR\lib\small\*.asm"
296 Delete "$INSTDIR\lib\small\*.rel"
297 Delete "$INSTDIR\lib\small\*.lib"
299 Delete "$INSTDIR\lib\large\*.asm"
300 Delete "$INSTDIR\lib\large\*.rel"
301 Delete "$INSTDIR\lib\large\*.lib"
303 Delete "$INSTDIR\lib\gbz80\*.asm"
304 Delete "$INSTDIR\lib\gbz80\*.o"
305 Delete "$INSTDIR\lib\gbz80\*.lib"
307 Delete "$INSTDIR\lib\ds390\*.asm"
308 Delete "$INSTDIR\lib\ds390\*.rel"
309 Delete "$INSTDIR\lib\ds390\*.lib"
311 Delete "$INSTDIR\lib\ds400\*.asm"
312 Delete "$INSTDIR\lib\ds400\*.rel"
313 Delete "$INSTDIR\lib\ds400\*.lib"
315 Delete "$INSTDIR\include\asm\z80\*.h"
316 Delete "$INSTDIR\include\asm\gbz80\*.h"
317 Delete "$INSTDIR\include\asm\default\*.h"
318 Delete "$INSTDIR\include\*.h"
320 Delete "$INSTDIR\doc\README.TXT"
321 Delete "$INSTDIR\doc\ChangeLog_head.txt"
323 Delete "$INSTDIR\bin\*.exe"
325 Delete "$INSTDIR\COPYING.TXT"
326 Delete "$INSTDIR\sdcc.ico"
328 RMDir "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
330 RMDir "$INSTDIR\lib\src\z80"
331 RMDir "$INSTDIR\lib\src\gbz80"
332 RMDir "$INSTDIR\lib\src\ds390\examples"
333 RMDir "$INSTDIR\lib\src\ds390"
334 RMDir "$INSTDIR\lib\src\ds400"
335 RMDir "$INSTDIR\lib\src\hc08"
336 RMDir "$INSTDIR\lib\src"
338 RMDir "$INSTDIR\lib\z80"
339 RMDir "$INSTDIR\lib\small"
340 RMDir "$INSTDIR\lib\large"
341 RMDir "$INSTDIR\lib\gbz80"
342 RMDir "$INSTDIR\lib\ds390"
343 RMDir "$INSTDIR\lib\ds400"
344 RMDir "$INSTDIR\lib\hc08"
347 RMDir "$INSTDIR\include\asm\z80"
348 RMDir "$INSTDIR\include\asm\gbz80"
349 RMDir "$INSTDIR\include\asm\default"
350 RMDir "$INSTDIR\include\asm"
351 RMDir "$INSTDIR\include"