support/scripts/sdcc.nsi: updated for NSIS 2.0 beta 4
[fw/sdcc] / support / scripts / sdcc.nsi
1 # sdcc.nsi - NSIS installer script for SDCC
2 #
3 # Copyright (c) 2003 Borut Razem
4 #
5 # This file is part of sdcc.
6 #
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.
10 #
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:
14 #
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.
22 #
23 #  Borut Razem
24 #  borut.razem@siol.net
25
26 !include "MUI.nsh"
27
28 SetCompressor bzip2
29
30 !define SDCC_ROOT "..\.."
31
32 !define FROM_SNAPSHOT
33
34 !ifdef FROM_SNAPSHOT
35 !system "dir ${SDCC_ROOT}\device > NUL" <> 0
36 !define DEV_ROOT "${SDCC_ROOT}"
37 !else
38 !system "dir ${SDCC_ROOT}\device > NUL" = 0
39 !define DEV_ROOT "${SDCC_ROOT}\device"
40 !endif
41
42 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
43 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
44
45 InstType "Full (Bin, Doc, Lib, Src)"
46 InstType "Medium (Bin, Doc, Lib)"
47 InstType "Compact (Bin, Doc)"
48
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"
65
66 Name "SDCC"
67 BrandingText ""
68 OutFile "setup.exe"
69 InstallDir "$PROGRAMFILES\SDCC"
70 ShowInstDetails show
71 ShowUnInstDetails show
72
73 Function .onInit
74   MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
75   Abort
76 FunctionEnd
77
78 Section -Common
79   SetOutPath "$INSTDIR"
80   File ".\sdcc.ico"
81   File "${SDCC_ROOT}\COPYING.TXT"
82 SectionEnd
83
84 Section "SDCC application files"
85   SectionIn 1 2 3 RO
86   SetOutPath "$INSTDIR\bin"
87   File "${SDCC_ROOT}\bin\*.exe"
88 SectionEnd
89
90 Section "SDCC documentation"
91   SectionIn 1 2 3
92   SetOutPath "$INSTDIR\doc"
93   File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
94   File "${SDCC_ROOT}\doc\README.TXT"
95 SectionEnd
96
97 Section "SDCC include files"
98   SectionIn 1 2
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"
107 SectionEnd
108
109 Section "SDCC DS390 library"
110   SectionIn 1 2
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"
115 SectionEnd
116
117 Section "SDCC DS400 library"
118   SectionIn 1 2
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"
123 SectionEnd
124
125 Section "SDCC GBZ80 library"
126   SectionIn 1 2
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"
131 SectionEnd
132
133 Section "SDCC Z80 library"
134   SectionIn 1 2
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"
139 SectionEnd
140
141 Section "SDCC large model library"
142   SectionIn 1 2
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"
147 SectionEnd
148
149 Section "SDCC small model library"
150   SectionIn 1 2
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"
155 SectionEnd
156
157 Section "SDCC HC08 library"
158   SectionIn 1 2
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"
163 SectionEnd
164
165 Section "SDCC library sources"
166   SectionIn 1
167   SetOutPath "$INSTDIR\lib\src\ds390\examples"
168   File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
169
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"
175
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"
181
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"
188
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"
195
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"
200
201   SetOutPath "$INSTDIR\lib\src"
202   File "${DEV_ROOT}\lib\src\*.c"
203 SectionEnd
204
205 Section -Icons
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
214 SectionEnd
215
216 Section -INI
217   WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
218 SectionEnd
219
220 Section -PostInstall
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"
228 SectionEnd
229
230
231 #### Uninstaller code ####
232
233 Function un.onInit
234   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
235   Abort
236 FunctionEnd
237
238 Function un.onUninstSuccess
239   HideWindow
240   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
241 FunctionEnd
242
243 Section Uninstall
244   ReadRegStr ${MUI_STARTMENUPAGE_VARIABLE} ${MUI_STARTMENUPAGE_REGISTRY_ROOT} "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
245
246   Delete "$INSTDIR\sdcc.url"
247
248   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
249   DeleteRegValue ${MUI_STARTMENUPAGE_REGISTRY_ROOT} "${MUI_STARTMENUPAGE_REGISTRY_KEY}" "${MUI_STARTMENUPAGE_REGISTRY_VALUENAME}"
250
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"
257
258   Delete "$INSTDIR\lib\src\hc08\*.c"
259   Delete "$INSTDIR\lib\src\hc08\hc08.lib"
260   Delete "$INSTDIR\lib\src\hc08\Makefile"
261
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"
267
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"
273
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"
279
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"
284
285   Delete "$INSTDIR\lib\src\*.c"
286
287   Delete "$INSTDIR\lib\hc08\*.rel"
288   Delete "$INSTDIR\lib\hc08\*.asm"
289   Delete "$INSTDIR\lib\hc08\*.lib"
290
291   Delete "$INSTDIR\lib\z80\*.o"
292   Delete "$INSTDIR\lib\z80\*.asm"
293   Delete "$INSTDIR\lib\z80\*.lib"
294
295   Delete "$INSTDIR\lib\small\*.asm"
296   Delete "$INSTDIR\lib\small\*.rel"
297   Delete "$INSTDIR\lib\small\*.lib"
298
299   Delete "$INSTDIR\lib\large\*.asm"
300   Delete "$INSTDIR\lib\large\*.rel"
301   Delete "$INSTDIR\lib\large\*.lib"
302
303   Delete "$INSTDIR\lib\gbz80\*.asm"
304   Delete "$INSTDIR\lib\gbz80\*.o"
305   Delete "$INSTDIR\lib\gbz80\*.lib"
306
307   Delete "$INSTDIR\lib\ds390\*.asm"
308   Delete "$INSTDIR\lib\ds390\*.rel"
309   Delete "$INSTDIR\lib\ds390\*.lib"
310
311   Delete "$INSTDIR\lib\ds400\*.asm"
312   Delete "$INSTDIR\lib\ds400\*.rel"
313   Delete "$INSTDIR\lib\ds400\*.lib"
314
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"
319
320   Delete "$INSTDIR\doc\README.TXT"
321   Delete "$INSTDIR\doc\ChangeLog_head.txt"
322
323   Delete "$INSTDIR\bin\*.exe"
324
325   Delete "$INSTDIR\COPYING.TXT"
326   Delete "$INSTDIR\sdcc.ico"
327
328   RMDir "$SMPROGRAMS\${MUI_STARTMENUPAGE_VARIABLE}"
329
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"
337
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"
345   RMDir "$INSTDIR\lib"
346
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"
352
353   RMDir "$INSTDIR\doc"
354
355   RMDir "$INSTDIR\bin"
356
357   RMDir "$INSTDIR"
358
359   SetAutoClose true
360 SectionEnd
361