* as/COPYING3: added
[fw/sdcc] / support / scripts / sdcc.nsi
1 # sdcc.nsi - NSIS installer script for SDCC
2 #
3 # Copyright (c) 2003-2009 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 # How to create WIN32 setup.exe
27 #
28 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
29 #   to a clean directory (the option to create directories should be enabled).
30 #   A sub directory sdcc is created (referenced as PKGDIR in continuation).
31 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
32 #   (this file) from the sdcc Subversion snapshot to the PKGDIR directory
33 # - copy file COPYING and COPYING3 from the sdcc Subversion snapshot to the PKGDIR directory,
34 #   rename it to COPYING.txt and COPYING3.txt and convert it to DOS format:
35 #   unix2dos COPYING.txt
36 #   unix2dos COPYING3.txt
37 # - copy readline5.dll to PKGDIR/bin/readline5.dll
38 # - run NSIS installer from PKGDIR directory:
39 #   "c:\Program Files\NSIS\makensis.exe" -DVER_MAJOR=<SDCC_VER_MAJOR> -DVER_MINOR=<SDCC_VER_MINOR> -DVER_REVISION=<SDCC_VER_DEVEL> -DVER_BUILD=<SDCC_REVISION> sdcc.nsi
40 #   replace <VER_XXX> with the appropriate values, for example for SDCC 2.7.4:
41 #   <SDCC_VER_MAJOR> = 2
42 #   <SDCC_VER_MINOR> = 7
43 #   <SDCC_VER_DEVEL> = 4
44 #   replace <SDCC_REVISION> with the current svn revision number
45 # - A setup file setup.exe is created in PKGDIR directory.
46 #   Rename it to sdcc-yyyymmdd-rrrr-setup.exe and upload it
47 #   to sdcc download repository at sourceforge.net
48 #
49 #
50 # How to create WIN32 release setup.exe package
51 #
52 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
53 #   to a clean directory (the option to create directories should be enabled).
54 #   A sub directory sdcc is created (referenced as PKGDIR in continuation).
55 # - remove the PKGDIR/doc/ directory
56 # - unpack sdcc-doc-yyyymmdd-rrrr.zip to the PKGDIR/doc directory
57 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
58 #   (this file) from the sdcc Subversion snapshot to the PKGDIR directory
59 # - copy file COPYING and COPYING3 from the sdcc Subversion snapshot to the PKGDIR directory,
60 #   rename it to COPYING.txt and COPYING3.txt and convert it to DOS format:
61 #   unix2dos COPYING.txt
62 #   unix2dos COPYING3.txt
63 # - copy readline5.dll to PKGDIR/bin/readline5.dll
64 # - run NSIS installer from PKGDIR directory:
65 #   "c:\Program Files\NSIS\makensis.exe" -DFULL_DOC -DVER_MAJOR=<VER_MAJOR> -DVER_MINOR=<VER_MINOR> -DVER_REVISION=<VER_PATCH> -DVER_BUILD=<REVISION> sdcc.nsi
66 # - A setup file setup.exe is created in PKGDIR directory.
67 #   Rename it to sdcc-x.x.x-setup.exe and upload it
68 #   to sdcc download repository at sourceforge.net
69 #
70 # How to upload secc setup.exe tosourceforge.net
71 #
72 # Execute following commands from the cmd prompt:
73 # - sftp sdcc.sourceforge.net
74 # - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
75 # - put sdcc_yyyymmdd_setup.exe
76 # - quit
77 #
78 # For debugging define -DSDCC.DEBUG command line option
79
80 ;--------------------------------
81 ; Debugging Macros
82
83 !ifdef SDCC.DEBUG
84   Var SDCC.FunctionName
85   Var SDCC.StrStack0
86   Var SDCC.StrStack1
87   Var SDCC.StrStack2
88   Var SDCC.StrStack3
89   Var SDCC.StrStack4
90
91 !define SDCC.PushStr "!insertmacro MACRO_SDCC_PushStr"
92 !macro MACRO_SDCC_PushStr NAME
93   StrCpy $SDCC.StrStack4 $SDCC.StrStack3
94   StrCpy $SDCC.StrStack3 $SDCC.StrStack2
95   StrCpy $SDCC.StrStack2 $SDCC.StrStack1
96   StrCpy $SDCC.StrStack1 $SDCC.StrStack0
97   StrCpy $SDCC.StrStack0 $SDCC.FunctionName
98   StrCpy $SDCC.FunctionName "${NAME}"
99 !macroend
100
101 !define SDCC.PopStr "!insertmacro MACRO_SDCC_PopStr"
102 !macro MACRO_SDCC_PopStr
103   StrCpy $SDCC.FunctionName $SDCC.StrStack0
104   StrCpy $SDCC.StrStack0 $SDCC.StrStack1
105   StrCpy $SDCC.StrStack1 $SDCC.StrStack2
106   StrCpy $SDCC.StrStack2 $SDCC.StrStack3
107   StrCpy $SDCC.StrStack3 $SDCC.StrStack4
108 !macroend
109 !endif
110
111 !define DebugMsg "!insertmacro MACRO_SDCC_DebugMsg"
112 !macro MACRO_SDCC_DebugMsg MSG
113   !ifdef SDCC.DEBUG
114     MessageBox MB_OK "*** $SDCC.FunctionName: ${MSG} ***"
115   !endif
116 !macroend
117
118 !define Function "!insertmacro MACRO_SDCC_Function"
119 !macro MACRO_SDCC_Function NAME
120   Function "${NAME}"
121   !ifdef SDCC.DEBUG
122     ${SDCC.PushStr} ${NAME}
123   !endif
124 !macroend
125
126 !define FunctionEnd "!insertmacro MACRO_SDCC_FunctionEnd"
127 !macro MACRO_SDCC_FunctionEnd
128   !ifdef SDCC.DEBUG
129     ${SDCC.PopStr}
130   !endif
131   FunctionEnd
132 !macroend
133
134 !define Section "!insertmacro MACRO_SDCC_Section"
135 !macro MACRO_SDCC_Section NAME ID
136   Section "${NAME}" "${ID}"
137   !ifdef SDCC.DEBUG
138     ${SDCC.PushStr} "${NAME}"
139   !endif
140 !macroend
141
142 !define UnselectedSection "!insertmacro MACRO_SDCC_UnselectedSection"
143 !macro MACRO_SDCC_UnselectedSection NAME ID
144   Section /o ${NAME} ${ID}
145   !ifdef SDCC.DEBUG
146     ${SDCC.PushStr} "${NAME}"
147   !endif
148 !macroend
149
150 !define SectionEnd "!insertmacro MACRO_SDCC_SectionEnd"
151 !macro MACRO_SDCC_SectionEnd
152   !ifdef SDCC.DEBUG
153     ${SDCC.PopStr}
154   !endif
155   SectionEnd
156 !macroend
157
158
159 !define PRODUCT_NAME "SDCC"
160
161 ; Version
162 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
163   !define PRODUCT_VERSION "${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}"
164 !else
165   !define PRODUCT_VERSION "XX.XX"
166 !endif
167
168 SetCompressor /SOLID lzma
169
170 !define SDCC_ROOT "."
171
172 !define DEV_ROOT "${SDCC_ROOT}"
173
174 !ifdef FULL_DOC
175 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog.txt" = 0
176 !else
177 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
178 !endif
179 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
180
181 InstType "Full (Bin, ucSim, SDCDB, Doc, Lib, Src)"
182 InstType "Medium (Bin, ucSim, SDCDB, Doc, Lib)"
183 InstType "Compact (Bin, ucSim, SDCDB, Doc)"
184
185 ;--------------------------------
186 ; Configuration
187
188 !define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
189 !define UNINST_ROOT_KEY HKLM
190 !define SDCC_ROOT_KEY HKLM
191
192 ;--------------------------------
193 ; Header Files
194
195 !include MUI2.nsh
196 !include WordFunc.nsh
197 !include StrFunc.nsh
198 ${StrStr}
199 ${UnStrStr}
200
201 ;--------------------------------
202 ; Functions
203
204 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
205   !insertmacro VersionCompare
206 !endif
207
208 ;--------------------------------
209 ; Variables
210
211 Var SDCC.PathToRemove
212
213 ;--------------------------------
214 ; Configuration
215
216 ; MUI Settings
217 !define MUI_ABORTWARNING
218 !define MUI_ICON ".\sdcc.ico"
219
220 ; Welcome page
221 !insertmacro MUI_PAGE_WELCOME
222
223 ; License page
224 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.txt"
225
226 ; Uninstall/reinstall page
227 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
228 Page custom SDCC.PageReinstall SDCC.PageLeaveReinstall
229 !endif
230
231 ; StartMenu page
232 !define MUI_STARTMENUPAGE_DEFAULTFOLDER ${PRODUCT_NAME}
233 !define MUI_STARTMENUPAGE_REGISTRY_ROOT ${UNINST_ROOT_KEY}
234 !define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
235 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
236 !define MUI_STARTMENUPAGE_NODISABLE
237 Var MUI_STARTMENUPAGE_VARIABLE
238 !insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
239
240 ; Components page
241 !define MUI_COMPONENTSPAGE_SMALLDESC
242 !insertmacro MUI_PAGE_COMPONENTS
243
244 ; Directory page
245 !insertmacro MUI_PAGE_DIRECTORY
246
247 ; Instfiles page
248 !define MUI_PAGE_CUSTOMFUNCTION_LEAVE "SDCC.InstFilesLeave"
249 !insertmacro MUI_PAGE_INSTFILES
250
251 ${Function} SDCC.InstFilesLeave
252   ; Remove old path if reinstallation
253   ${If} $SDCC.PathToRemove != ""
254     ${DebugMsg} "removing path $SDCC.PathToRemove"
255     Push $SDCC.PathToRemove
256     Call SDCC.RemoveFromPath
257   ${EndIf}
258 ${FunctionEnd}
259
260 ; Finish page - add to path
261 !define MUI_FINISHPAGE_TEXT "Confirm the checkbox if you want to add SDCC binary directory to the PATH environment variable"
262 !define MUI_FINISHPAGE_SHOWREADME_TEXT "Add $INSTDIR\bin to the PATH"
263 !define MUI_FINISHPAGE_SHOWREADME_FUNCTION SDCC.AddBinToPath
264 !define MUI_FINISHPAGE_SHOWREADME
265 !define MUI_FINISHPAGE_BUTTON "Next"
266 !insertmacro MUI_PAGE_FINISH
267
268 ; Finish page - reboot
269 !insertmacro MUI_PAGE_FINISH
270
271 ${Function} SDCC.AddBinToPath
272   ; Add new path
273   ${DebugMsg} "adding path $INSTDIR\bin"
274   Push "$INSTDIR\bin"
275   Call SDCC.AddToPath
276 ${FunctionEnd}
277
278 ; Uninstaller pages
279 !insertmacro MUI_UNPAGE_CONFIRM
280 !insertmacro MUI_UNPAGE_INSTFILES
281 !insertmacro MUI_UNPAGE_FINISH
282
283 ; Language files
284 !insertmacro MUI_LANGUAGE "English"
285
286 Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
287 BrandingText ""
288 OutFile "setup.exe"
289 InstallDir "$PROGRAMFILES\SDCC"
290 ;;;;ShowInstDetails show
291 ;;;;ShowUnInstDetails show
292
293
294 ${Function} .onInit
295   ${DebugMsg} "Pre INSTDIR = $INSTDIR"
296
297 !ifndef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
298   ; Old unistallation method
299   ; Uninstall the old version, if present
300   ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
301   StrCmp $R0 "" inst
302
303   MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
304   "$(^Name) is already installed. $\n$\nClick 'OK' to remove the \
305   previous version or 'Cancel' to cancel this upgrade." \
306   IDOK uninst
307   Abort
308
309 uninst:
310   ; Run the uninstaller
311   ClearErrors
312   ExecWait '$R0'
313
314   Goto done
315 inst:
316
317   ; Install the new version
318   MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
319   Abort
320
321 done:
322 !else
323   ; If the registry key exists it is an uninstallation or reinstallation:
324   ;  take the old installation directory
325   Push $R0
326
327   ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
328   ${IfNot} ${Errors}
329     StrCpy $INSTDIR $R0
330     StrCpy $SDCC.PathToRemove "$INSTDIR\bin"
331   ${EndIf}
332
333   Pop $R0
334 !endif
335   ${DebugMsg} "Post INSTDIR = $INSTDIR"
336 ${FunctionEnd}
337
338 ${Function} un.onInit
339
340   ${DebugMsg} "Pre INSTDIR = $INSTDIR"
341
342   Push $R0
343   ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation"
344   ${IfNot} ${Errors}
345     StrCpy $INSTDIR $R0
346   ${EndIf}
347   Pop $R0
348
349   ${DebugMsg} "Post INSTDIR = $INSTDIR"
350
351 ${FunctionEnd}
352
353 ${Section} -Common SECCOMMON
354   SetOutPath "$INSTDIR"
355   File ".\sdcc.ico"
356   File "${SDCC_ROOT}\COPYING.txt"
357   File "${SDCC_ROOT}\COPYING3.txt"
358 ${SectionEnd}
359
360 ${Section} "SDCC application files" SEC01
361   SectionIn 1 2 3 RO
362   SetOutPath "$INSTDIR\bin"
363   File "${SDCC_ROOT}\bin\as-gbz80.exe"
364   File "${SDCC_ROOT}\bin\as-hc08.exe"
365   File "${SDCC_ROOT}\bin\as-z80.exe"
366   File "${SDCC_ROOT}\bin\asx8051.exe"
367   File "${SDCC_ROOT}\bin\aslink.exe"
368   File "${SDCC_ROOT}\bin\asranlib.exe"
369   File "${SDCC_ROOT}\bin\link-gbz80.exe"
370   File "${SDCC_ROOT}\bin\link-hc08.exe"
371   File "${SDCC_ROOT}\bin\link-z80.exe"
372   File "${SDCC_ROOT}\bin\makebin.exe"
373   File "${SDCC_ROOT}\bin\packihx.exe"
374   File "${SDCC_ROOT}\bin\sdcc.exe"
375   File "${SDCC_ROOT}\bin\sdcclib.exe"
376   File "${SDCC_ROOT}\bin\sdcpp.exe"
377   File "${SDCC_ROOT}\bin\readline5.dll"
378 ${SectionEnd}
379
380 ${Section} "ucSim application files" SEC02
381   SectionIn 1 2 3
382   SetOutPath "$INSTDIR\bin"
383   File "${SDCC_ROOT}\bin\s51.exe"
384   File "${SDCC_ROOT}\bin\savr.exe"
385   File "${SDCC_ROOT}\bin\shc08.exe"
386   File "${SDCC_ROOT}\bin\sz80.exe"
387 ${SectionEnd}
388
389 ${Section} "SDCDB files" SEC03
390   SectionIn 1 2 3
391   File "${SDCC_ROOT}\bin\sdcdb.exe"
392   File "${SDCC_ROOT}\bin\sdcdb.el"
393   File "${SDCC_ROOT}\bin\sdcdbsrc.el"
394 ${SectionEnd}
395
396 ${Section} "SDCC documentation" SEC04
397   SectionIn 1 2 3
398   SetOutPath "$INSTDIR\doc"
399 !ifdef FULL_DOC
400   File /r "${SDCC_ROOT}\doc\*"
401 !else
402   File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
403   File "${SDCC_ROOT}\doc\README.TXT"
404 !endif
405 ${SectionEnd}
406
407 ${Section} "SDCC include files" SEC05
408   SectionIn 1 2
409   SetOutPath "$INSTDIR\include\asm\default"
410   File "${DEV_ROOT}\include\asm\default\features.h"
411   SetOutPath "$INSTDIR\include\asm\ds390"
412   File "${DEV_ROOT}\include\asm\ds390\features.h"
413   SetOutPath "$INSTDIR\include\asm\gbz80"
414   File "${DEV_ROOT}\include\asm\gbz80\features.h"
415   SetOutPath "$INSTDIR\include\asm\mcs51"
416   File "${DEV_ROOT}\include\asm\mcs51\features.h"
417   SetOutPath "$INSTDIR\include\asm\pic"
418   File "${DEV_ROOT}\include\asm\pic\features.h"
419   SetOutPath "$INSTDIR\include\asm\pic16"
420   File "${DEV_ROOT}\include\asm\pic16\features.h"
421   SetOutPath "$INSTDIR\include\asm\z80"
422   File "${DEV_ROOT}\include\asm\z80\features.h"
423   SetOutPath "$INSTDIR\include\hc08"
424   File "${DEV_ROOT}\include\hc08\*.h"
425   SetOutPath "$INSTDIR\include\mcs51"
426   File "${DEV_ROOT}\include\mcs51\*.h"
427   SetOutPath "$INSTDIR\include\pic"
428   File "${DEV_ROOT}\include\pic\*.h"
429   File "${DEV_ROOT}\include\pic\*.txt"
430   File "${DEV_ROOT}\include\pic\*.inc"
431   SetOutPath "$INSTDIR\include\pic16"
432   File "${DEV_ROOT}\include\pic16\*.h"
433   File "${DEV_ROOT}\include\pic16\*.txt"
434   SetOutPath "$INSTDIR\include\z80"
435   File "${DEV_ROOT}\include\z80\*.h"
436   SetOutPath "$INSTDIR\include"
437   File "${DEV_ROOT}\include\*.h"
438 ${SectionEnd}
439
440 ${Section} "SDCC DS390 library" SEC06
441   SectionIn 1 2
442   SetOutPath "$INSTDIR\lib\ds390"
443   File "${DEV_ROOT}\lib\ds390\*.*"
444 ${SectionEnd}
445
446 ${Section} "SDCC DS400 library" SEC07
447   SectionIn 1 2
448   SetOutPath "$INSTDIR\lib\ds400"
449   File "${DEV_ROOT}\lib\ds400\*.*"
450 ${SectionEnd}
451
452 ${Section} "SDCC GBZ80 library" SEC08
453   SectionIn 1 2
454   SetOutPath "$INSTDIR\lib\gbz80"
455   File "${DEV_ROOT}\lib\gbz80\*.*"
456 ${SectionEnd}
457
458 ${Section} "SDCC Z80 library" SEC09
459   SectionIn 1 2
460   SetOutPath "$INSTDIR\lib\z80"
461   File "${DEV_ROOT}\lib\z80\*.*"
462 ${SectionEnd}
463
464 ${Section} "SDCC small model library" SEC10
465   SectionIn 1 2
466   SetOutPath "$INSTDIR\lib\small"
467   File "${DEV_ROOT}\lib\small\*.*"
468 ${SectionEnd}
469
470 ${Section} "SDCC medium model library" SEC11
471   SectionIn 1 2
472   SetOutPath "$INSTDIR\lib\medium"
473   File "${DEV_ROOT}\lib\medium\*.*"
474 ${SectionEnd}
475
476 ${Section} "SDCC large model library" SEC12
477   SectionIn 1 2
478   SetOutPath "$INSTDIR\lib\large"
479   File "${DEV_ROOT}\lib\large\*.*"
480 ${SectionEnd}
481
482 ${Section} "SDCC small-stack-auto model library" SEC13
483   SectionIn 1 2
484   SetOutPath "$INSTDIR\lib\small-stack-auto"
485   File "${DEV_ROOT}\lib\small-stack-auto\*.*"
486 ${SectionEnd}
487
488 ${Section} "SDCC HC08 library" SEC14
489   SectionIn 1 2
490   SetOutPath "$INSTDIR\lib\hc08"
491   File "${DEV_ROOT}\lib\hc08\*.*"
492 ${SectionEnd}
493
494 ${Section} "SDCC PIC16 library" SEC15
495   SectionIn 1 2
496   SetOutPath "$INSTDIR\lib\pic16"
497   File "${DEV_ROOT}\lib\pic16\*.o"
498   File "${DEV_ROOT}\lib\pic16\*.lib"
499 ${SectionEnd}
500
501 ${Section} "SDCC PIC library" SEC16
502   SectionIn 1 2
503   SetOutPath "$INSTDIR\lib\pic"
504   File "${DEV_ROOT}\lib\pic\*.lib"
505 ${SectionEnd}
506
507 ${Section} "SDCC library sources" SEC17
508   SectionIn 1
509   SetOutPath "$INSTDIR\lib\src\ds390\examples"
510   File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
511
512   SetOutPath "$INSTDIR\lib\src\ds390"
513   File "${DEV_ROOT}\lib\src\ds390\*.c"
514 #  File "${DEV_ROOT}\lib\src\ds390\Makefile"
515
516   SetOutPath "$INSTDIR\lib\src\ds400"
517   File "${DEV_ROOT}\lib\src\ds400\*.c"
518 #  File "${DEV_ROOT}\lib\src\ds400\Makefile"
519
520   SetOutPath "$INSTDIR\lib\src\gbz80"
521   File "${DEV_ROOT}\lib\src\gbz80\*.c"
522   File "${DEV_ROOT}\lib\src\gbz80\*.s"
523 #  File "${DEV_ROOT}\lib\src\gbz80\Makefile"
524
525   SetOutPath "$INSTDIR\lib\src\z80"
526   File "${DEV_ROOT}\lib\src\z80\*.s"
527 #  File "${DEV_ROOT}\lib\src\z80\Makefile"
528
529   SetOutPath "$INSTDIR\lib\src\hc08"
530   File "${DEV_ROOT}\lib\src\hc08\*.c"
531 #  File "${DEV_ROOT}\lib\src\hc08\Makefile"
532
533   SetOutPath "$INSTDIR\lib\src\mcs51"
534   File "${DEV_ROOT}\lib\src\mcs51\*.asm"
535 #  File "${DEV_ROOT}\lib\src\mcs51\Makefile"
536
537   SetOutPath "$INSTDIR\lib\src\small"
538 #  File "${DEV_ROOT}\lib\src\small\Makefile"
539
540   SetOutPath "$INSTDIR\lib\src\medium"
541 #  File "${DEV_ROOT}\lib\src\medium\Makefile"
542
543   SetOutPath "$INSTDIR\lib\src\large"
544 #  File "${DEV_ROOT}\lib\src\large\Makefile"
545
546   SetOutPath "$INSTDIR\lib\src\pic"
547 #  File "${DEV_ROOT}\lib\src\pic\configure"
548 #  File "${DEV_ROOT}\lib\src\pic\configure.in"
549 #  File "${DEV_ROOT}\lib\src\pic\GPL"
550 #  File "${DEV_ROOT}\lib\src\pic\LGPL"
551 #  File "${DEV_ROOT}\lib\src\pic\Makefile"
552 #  File "${DEV_ROOT}\lib\src\pic\Makefile.common"
553 #  File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
554 #  File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
555 #  File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
556 #  File "${DEV_ROOT}\lib\src\pic\NEWS"
557 #  File "${DEV_ROOT}\lib\src\pic\README"
558   File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
559   File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
560
561   SetOutPath "$INSTDIR\lib\src\pic\libsdcc"
562   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
563   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
564   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
565 #  File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
566   
567   SetOutPath "$INSTDIR\lib\src\pic\libdev"
568   File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
569 #  File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
570
571   SetOutPath "$INSTDIR\lib\src\pic\libm"
572   File "${DEV_ROOT}\lib\src\pic\libm\*.c"
573
574   SetOutPath "$INSTDIR\lib\src\pic16"
575 #  File "${DEV_ROOT}\lib\src\pic16\configure"
576 #  File "${DEV_ROOT}\lib\src\pic16\configure.in"
577 #  File "${DEV_ROOT}\lib\src\pic16\COPYING"
578 #  File "${DEV_ROOT}\lib\src\pic16\Makefile"
579 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
580 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
581 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
582 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
583 #  File "${DEV_ROOT}\lib\src\pic16\pics.all"
584 #  File "${DEV_ROOT}\lib\src\pic16\pics.build"
585 #  File "${DEV_ROOT}\lib\src\pic16\README"
586
587   SetOutPath "$INSTDIR\lib\src\pic16\debug"
588 #  File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
589
590   SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
591 #  File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
592   File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
593
594   SetOutPath "$INSTDIR\lib\src\pic16\libc"
595 #  File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
596
597   SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
598   File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
599 #  File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
600
601   SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
602   File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
603 #  File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
604
605   SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
606   File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
607 #  File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
608
609   SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
610   File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
611   File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
612 #  File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
613
614   SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
615   File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
616 #  File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
617
618   SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
619   File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
620 #  File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
621
622   SetOutPath "$INSTDIR\lib\src\pic16\libdev"
623   File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
624 #  File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
625
626   SetOutPath "$INSTDIR\lib\src\pic16\libio"
627   File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
628 #  File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
629
630   SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
631   File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
632 #  File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
633
634   SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
635   File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
636 #  File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
637
638   SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
639   File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
640 #  File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
641
642   SetOutPath "$INSTDIR\lib\src\pic16\libm"
643   File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
644 #  File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
645
646   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
647 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
648
649   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
650   File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
651 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
652
653   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
654   File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
655   File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
656 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
657
658   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
659   File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
660 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
661
662   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
663   File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
664 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
665
666   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
667   File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
668 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
669
670   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
671   File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
672 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
673
674   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
675   File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
676 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
677
678   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
679   File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
680
681   SetOutPath "$INSTDIR\lib\src\pic16\startup"
682   File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
683 #  File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
684 #  File "${DEV_ROOT}\lib\src\pic16\startup\README"
685
686   SetOutPath "$INSTDIR\lib\src"
687   File "${DEV_ROOT}\lib\src\*.c"
688 ${SectionEnd}
689
690 ;--------------------------------
691 ;Descriptions
692
693 ;Language strings
694 LangString DESC_SEC01 ${LANG_ENGLISH} "SDCC application files"
695 LangString DESC_SEC02 ${LANG_ENGLISH} "ucSim application files"
696 LangString DESC_SEC03 ${LANG_ENGLISH} "SDCDB files"
697 LangString DESC_SEC04 ${LANG_ENGLISH} "SDCC documentation"
698 LangString DESC_SEC05 ${LANG_ENGLISH} "SDCC include files"
699 LangString DESC_SEC06 ${LANG_ENGLISH} "SDCC DS390 library"
700 LangString DESC_SEC07 ${LANG_ENGLISH} "SDCC DS400 library"
701 LangString DESC_SEC08 ${LANG_ENGLISH} "SDCC GBZ80 library"
702 LangString DESC_SEC09 ${LANG_ENGLISH} "SDCC Z80 library"
703 LangString DESC_SEC10 ${LANG_ENGLISH} "SDCC small model library"
704 LangString DESC_SEC11 ${LANG_ENGLISH} "SDCC medium model library"
705 LangString DESC_SEC12 ${LANG_ENGLISH} "SDCC large model library"
706 LangString DESC_SEC13 ${LANG_ENGLISH} "SDCC small-stack-auto model library"
707 LangString DESC_SEC14 ${LANG_ENGLISH} "SDCC HC08 library"
708 LangString DESC_SEC15 ${LANG_ENGLISH} "SDCC PIC16 library"
709 LangString DESC_SEC16 ${LANG_ENGLISH} "SDCC PIC library"
710 LangString DESC_SEC17 ${LANG_ENGLISH} "SDCC library sources"
711
712 ;Assign language strings to sections
713 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
714   !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} $(DESC_SEC01)
715   !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} $(DESC_SEC02)
716   !insertmacro MUI_DESCRIPTION_TEXT ${SEC03} $(DESC_SEC03)
717   !insertmacro MUI_DESCRIPTION_TEXT ${SEC04} $(DESC_SEC04)
718   !insertmacro MUI_DESCRIPTION_TEXT ${SEC05} $(DESC_SEC05)
719   !insertmacro MUI_DESCRIPTION_TEXT ${SEC06} $(DESC_SEC06)
720   !insertmacro MUI_DESCRIPTION_TEXT ${SEC07} $(DESC_SEC07)
721   !insertmacro MUI_DESCRIPTION_TEXT ${SEC08} $(DESC_SEC08)
722   !insertmacro MUI_DESCRIPTION_TEXT ${SEC09} $(DESC_SEC09)
723   !insertmacro MUI_DESCRIPTION_TEXT ${SEC10} $(DESC_SEC10)
724   !insertmacro MUI_DESCRIPTION_TEXT ${SEC11} $(DESC_SEC11)
725   !insertmacro MUI_DESCRIPTION_TEXT ${SEC12} $(DESC_SEC12)
726   !insertmacro MUI_DESCRIPTION_TEXT ${SEC13} $(DESC_SEC13)
727   !insertmacro MUI_DESCRIPTION_TEXT ${SEC14} $(DESC_SEC14)
728   !insertmacro MUI_DESCRIPTION_TEXT ${SEC15} $(DESC_SEC15)
729   !insertmacro MUI_DESCRIPTION_TEXT ${SEC16} $(DESC_SEC16)
730   !insertmacro MUI_DESCRIPTION_TEXT ${SEC17} $(DESC_SEC17)
731 !insertmacro MUI_FUNCTION_DESCRIPTION_END
732 ;--------------------------------
733
734 ${Section} -Icons SECICONS
735 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
736   CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
737   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe" 
738 !ifdef FULL_DOC
739   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\sdccman.pdf" "" "$INSTDIR\sdcc.ico" "" "" "" ""
740   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
741   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
742 !else
743   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
744   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
745 !endif
746   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.txt"
747 !insertmacro MUI_STARTMENU_WRITE_END
748 ${SectionEnd}
749
750 ${Section} -INI SECINI
751   WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
752 !ifdef FULL_DOC
753   WriteIniStr "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url" "InternetShortcut" "URL" "http://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc/ChangeLog"
754 !endif
755 ${SectionEnd}
756
757 ${Section} -PostInstall SECPOSTINSTALL
758   WriteRegStr ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "" $INSTDIR
759 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
760   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor" "${VER_MAJOR}"
761   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor" "${VER_MINOR}"
762   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision" "${VER_REVISION}"
763   WriteRegDword ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild" "${VER_BUILD}"
764 !endif
765
766   WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninstall.exe"
767   WriteRegExpandStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "InstallLocation" "$INSTDIR"
768   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "${PRODUCT_NAME}"
769   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "sdcc.sourceforge.net"
770   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "http://sdcc.sourceforge.net/"
771   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "HelpLink" "http://sdcc.sourceforge.net/"
772   WriteRegStr ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
773
774   WriteUninstaller "$INSTDIR\uninstall.exe"
775 ${SectionEnd}
776
777
778 ;;;; Uninstaller code ;;;;
779
780 ${Section} Uninstall SECUNINSTALL
781   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
782
783   ${DebugMsg} "removing path $INSTDIR\bin"
784   Push "$INSTDIR\bin"
785   Call un.SDCC.RemoveFromPath
786
787 ; Clean the registry
788   DeleteRegKey ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
789   DeleteRegKey ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}"
790
791   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
792   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
793 !ifdef FULL_DOC
794   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Latest Changes.url"
795   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\README.lnk"
796 !endif
797   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
798   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
799   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.url"
800
801   RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
802
803   Delete "$INSTDIR\lib\src\large\Makefile"
804
805   Delete "$INSTDIR\lib\src\medium\Makefile"
806
807   Delete "$INSTDIR\lib\src\small\Makefile"
808
809   Delete "$INSTDIR\lib\src\mcs51\*.asm"
810   Delete "$INSTDIR\lib\src\mcs51\Makefile"
811   Delete "$INSTDIR\lib\src\mcs51\README"
812
813   Delete "$INSTDIR\lib\src\hc08\*.c"
814   Delete "$INSTDIR\lib\src\hc08\hc08.lib"
815   Delete "$INSTDIR\lib\src\hc08\Makefile"
816
817   Delete "$INSTDIR\lib\src\z80\*.s"
818   Delete "$INSTDIR\lib\src\z80\z80.lib"
819   Delete "$INSTDIR\lib\src\z80\README"
820   Delete "$INSTDIR\lib\src\z80\Makefile"
821
822   Delete "$INSTDIR\lib\src\gbz80\*.c"
823   Delete "$INSTDIR\lib\src\gbz80\*.s"
824   Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
825   Delete "$INSTDIR\lib\src\gbz80\README"
826   Delete "$INSTDIR\lib\src\gbz80\Makefile"
827
828   Delete "$INSTDIR\lib\src\ds390\*.c"
829   Delete "$INSTDIR\lib\src\ds390\libds390.lib"
830   Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
831   Delete "$INSTDIR\lib\src\ds390\Makefile"
832   Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
833
834   Delete "$INSTDIR\lib\src\ds400\*.c"
835   Delete "$INSTDIR\lib\src\ds400\libds400.lib"
836   Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
837   Delete "$INSTDIR\lib\src\ds400\Makefile"
838
839   Delete "$INSTDIR\lib\src\*.c"
840
841   Delete "$INSTDIR\lib\pic\*.lib"
842
843   Delete "$INSTDIR\lib\pic16\*.o"
844   Delete "$INSTDIR\lib\pic16\*.lib"
845
846   Delete "$INSTDIR\lib\hc08\*.lib"
847
848   Delete "$INSTDIR\lib\z80\*.o"
849   Delete "$INSTDIR\lib\z80\*.lib"
850
851   Delete "$INSTDIR\lib\small\*.lib"
852
853   Delete "$INSTDIR\lib\medium\*.lib"
854
855   Delete "$INSTDIR\lib\large\*.lib"
856
857   Delete "$INSTDIR\lib\small-stack-auto\*.lib"
858
859   Delete "$INSTDIR\lib\gbz80\*.lib"
860
861   Delete "$INSTDIR\lib\ds390\*.lib"
862
863   Delete "$INSTDIR\lib\ds400\*.lib"
864
865   Delete "$INSTDIR\include\asm\z80\*.h"
866   Delete "$INSTDIR\include\asm\pic16\*.h"
867   Delete "$INSTDIR\include\asm\pic\*.h"
868   Delete "$INSTDIR\include\asm\mcs51\*.h"
869   Delete "$INSTDIR\include\asm\gbz80\*.h"
870   Delete "$INSTDIR\include\asm\ds390\*.h"
871   Delete "$INSTDIR\include\asm\default\*.h"
872   Delete "$INSTDIR\include\z80\*.h"
873   Delete "$INSTDIR\include\pic\*.h"
874   Delete "$INSTDIR\include\pic\*.txt"
875   Delete "$INSTDIR\include\pic\*.inc"
876   Delete "$INSTDIR\include\pic16\*.h"
877   Delete "$INSTDIR\include\pic16\*.txt"
878   Delete "$INSTDIR\include\mcs51\*.h"
879   Delete "$INSTDIR\include\hc08\*.h"
880   Delete "$INSTDIR\include\*.h"
881
882 !ifndef FULL_DOC
883   Delete "$INSTDIR\doc\README.TXT"
884   Delete "$INSTDIR\doc\ChangeLog_head.txt"
885 !endif
886
887   Delete "$INSTDIR\bin\as-gbz80.exe"
888   Delete "$INSTDIR\bin\as-hc08.exe"
889   Delete "$INSTDIR\bin\as-z80.exe"
890   Delete "$INSTDIR\bin\asx8051.exe"
891   Delete "$INSTDIR\bin\aslink.exe"
892   Delete "$INSTDIR\bin\asranlib.exe"
893   Delete "$INSTDIR\bin\link-gbz80.exe"
894   Delete "$INSTDIR\bin\link-hc08.exe"
895   Delete "$INSTDIR\bin\link-z80.exe"
896   Delete "$INSTDIR\bin\makebin.exe"
897   Delete "$INSTDIR\bin\packihx.exe"
898   Delete "$INSTDIR\bin\sdcc.exe"
899   Delete "$INSTDIR\bin\sdcclib.exe"
900   Delete "$INSTDIR\bin\sdcpp.exe"
901   Delete "$INSTDIR\bin\readline5.dll"
902
903
904   Delete "$INSTDIR\bin\s51.exe"
905   Delete "$INSTDIR\bin\savr.exe"
906   Delete "$INSTDIR\bin\shc08.exe"
907   Delete "$INSTDIR\bin\sz80.exe"
908
909   Delete "$INSTDIR\bin\sdcdb.exe"
910   Delete "$INSTDIR\bin\sdcdb.el"
911   Delete "$INSTDIR\bin\sdcdbsrc.el"
912
913   Delete "$INSTDIR\COPYING.txt"
914   Delete "$INSTDIR\COPYING3.txt"
915   Delete "$INSTDIR\sdcc.ico"
916   Delete "$INSTDIR\uninstall.exe"
917
918   RMDir /r "$INSTDIR\lib\src\pic"
919   RMDir /r "$INSTDIR\lib\src\pic16"
920   RMDir "$INSTDIR\lib\src\small"
921   RMDir "$INSTDIR\lib\src\medium"
922   RMDir "$INSTDIR\lib\src\large"
923   RMDir "$INSTDIR\lib\src\mcs51"
924   RMDir "$INSTDIR\lib\src\z80"
925   RMDir "$INSTDIR\lib\src\gbz80"
926   RMDir "$INSTDIR\lib\src\ds390\examples"
927   RMDir "$INSTDIR\lib\src\ds390"
928   RMDir "$INSTDIR\lib\src\ds400"
929   RMDir "$INSTDIR\lib\src\hc08"
930   RMDir "$INSTDIR\lib\src"
931
932   RMDir "$INSTDIR\lib\pic"
933   RMDir "$INSTDIR\lib\pic16"
934   RMDir "$INSTDIR\lib\z80"
935   RMDir "$INSTDIR\lib\small"
936   RMDir "$INSTDIR\lib\medium"
937   RMDir "$INSTDIR\lib\large"
938   RMDir "$INSTDIR\lib\small-stack-auto"
939   RMDir "$INSTDIR\lib\gbz80"
940   RMDir "$INSTDIR\lib\ds390"
941   RMDir "$INSTDIR\lib\ds400"
942   RMDir "$INSTDIR\lib\hc08"
943   RMDir "$INSTDIR\lib"
944
945   RMDir "$INSTDIR\include\asm\z80"
946   RMDir "$INSTDIR\include\asm\pic16"
947   RMDir "$INSTDIR\include\asm\pic"
948   RMDir "$INSTDIR\include\asm\mcs51"
949   RMDir "$INSTDIR\include\asm\gbz80"
950   RMDir "$INSTDIR\include\asm\ds390"
951   RMDir "$INSTDIR\include\asm\default"
952   RMDir "$INSTDIR\include\asm"
953   RMDir "$INSTDIR\include\z80"
954   RMDir "$INSTDIR\include\pic"
955   RMDir "$INSTDIR\include\pic16"
956   RMDir "$INSTDIR\include\mcs51"
957   RMDir "$INSTDIR\include\hc08"
958   RMDir "$INSTDIR\include"
959
960 !ifdef FULL_DOC
961   RMDir /r "$INSTDIR\doc"
962 !else
963   RMDir "$INSTDIR\doc"
964 !endif
965
966   RMDir "$INSTDIR\bin"
967
968   RMDir "$INSTDIR"
969 ;;;;  SetAutoClose true
970 ${SectionEnd}
971
972 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
973 ; Path Manipulation functions                                                 ;
974 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
975
976 !verbose 3
977 !include "WinMessages.nsh"
978 !verbose 4
979
980 ; AddToPath - Adds the given dir to the search path.
981 ;        Input - head of the stack
982 ;        Note - Win9x systems requires reboot
983
984 ${Function} SDCC.AddToPath
985   Exch $0
986   Push $1
987   Push $2
988   Push $3
989   Push $4
990
991   ; don't add if the path doesn't exist
992   ${If} ${FileExists} $0
993     Call SDCC.IsNT
994     Pop $4
995     ${If} $4 != 1
996       ; Not on NT: read PATH from environment variable
997       ReadEnvStr $1 PATH
998     ${Else}
999       ; On NT: read PATH from registry
1000       ReadRegStr $1 HKCU "Environment" "PATH"
1001     ${EndIf}
1002
1003     ${StrStr} $2 "$1;" "$0;"
1004     ${If} $2 == ""
1005       ${StrStr} $2 "$1;" "$0\;"
1006       ${If} $2 == ""
1007         GetFullPathName /SHORT $3 $0
1008         ${StrStr} $2 "$1;" "$3;"
1009         ${If} $2 == ""
1010           ${StrStr} $2 "$1;" "$03\;"
1011           ${If} $2 == ""
1012             ${If} $4 != 1
1013               ; Not on NT
1014               StrCpy $1 $WINDIR 2
1015               FileOpen $1 "$1\autoexec.bat" a
1016               FileSeek $1 -1 END
1017               FileReadByte $1 $2
1018               ${If} $2 = 26        ; DOS EOF
1019                 FileSeek $1 -1 END ; write over EOF
1020               ${Endif}
1021               ${DebugMsg} "adding line $\r$\nSET PATH=%PATH%;$3$\r$\n"
1022               FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
1023               FileClose $1
1024               ${DebugMsg} "SetRebootFlag true"
1025               SetRebootFlag true
1026             ${Else}
1027               ;System PATH variable is at:
1028               ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
1029               ReadRegStr $1 HKCU "Environment" "PATH"
1030               StrCpy $2 $1 1 -1  ; copy last char
1031               ${If} $2 == ";"    ; if last char == ;
1032                 StrCpy $1 $1 -1  ; remove last char
1033               ${Endif}
1034               ${If} $1 != ""
1035                 StrCpy $0 "$1;$0"
1036               ${Endif}
1037               WriteRegExpandStr HKCU "Environment" "PATH" $0
1038               SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
1039             ${Endif}
1040           ${Endif}
1041         ${Endif}
1042       ${Endif}
1043     ${Endif}
1044   ${EndIf}
1045
1046   Pop $4
1047   Pop $3
1048   Pop $2
1049   Pop $1
1050   Pop $0
1051 ${FunctionEnd}
1052
1053 ; RemoveFromPath - Remove a given dir from the path
1054 ;     Input: head of the stack
1055
1056 !macro SDCC.RemoveFromPath un
1057 ${Function} ${un}SDCC.RemoveFromPath
1058   Exch $0
1059   Push $1
1060   Push $2
1061   Push $3
1062   Push $4
1063   Push $5
1064   Push $6
1065
1066   IntFmt $6 "%c" 26 ; DOS EOF
1067
1068   Call ${un}SDCC.IsNT
1069   Pop $1
1070   ${If} $1 != 1
1071     ; Not on NT
1072     StrCpy $1 $WINDIR 2
1073     FileOpen $1 "$1\autoexec.bat" r
1074     GetTempFileName $4
1075     FileOpen $2 $4 w
1076     GetFullPathName /SHORT $0 $0
1077     StrCpy $0 "SET PATH=%PATH%;$0"
1078
1079   nextLine:
1080     ; copy all lines except the line containing "SET PATH=%PATH%;$0"
1081     ; from autoexec.bat to the temporary file
1082     ClearErrors
1083     FileRead $1 $3
1084     ${IfNot} ${Errors}
1085       StrCpy $5 $3 1 -1 ; read last char
1086       ${If} $5 == $6    ; if DOS EOF
1087         StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
1088       ${EndIf}
1089       ${If} $3 != "$0$\r$\n"
1090         ${AndIf} $3 != "$0$\n"
1091         ${AndIf} $3 != "$0"
1092         FileWrite $2 $3
1093         Goto nextLine
1094       ${Else}
1095         ; This is the line I'm looking for:
1096         ; don't copy it
1097         ${DebugMsg} "removing line $0"
1098         ${DebugMsg} "SetRebootFlag true"
1099         SetRebootFlag true
1100         Goto nextLine
1101       ${EndIf}
1102     ${EndIf}
1103
1104     FileClose $2
1105     FileClose $1
1106     StrCpy $1 $WINDIR 2
1107     Delete "$1\autoexec.bat"
1108     CopyFiles /SILENT $4 "$1\autoexec.bat"
1109     Delete $4
1110   ${Else}
1111     ;System PATH variable is at:
1112     ;HKLM "/SYSTEM/CurrentControlSet/Control/Session Manager/Environment" "Path"
1113     ReadRegStr $1 HKCU "Environment" "PATH"
1114     StrCpy $5 $1 1 -1 ; copy last char
1115     ${If} $5 != ";"   ; if last char != ;
1116       StrCpy $1 "$1;" ; append ;
1117     ${EndIf}
1118     Push $1
1119     Push "$0;"
1120     Call ${un}StrStr  ; Find `$0;` in $1
1121     Pop $2            ; pos of our dir
1122     ${If} $2 != ""
1123       ; it is in path:
1124       ; $0 - path to add
1125       ; $1 - path var
1126       StrLen $3 "$0;"
1127       StrLen $4 $2
1128       StrCpy $5 $1 -$4   ; $5 is now the part before the path to remove
1129       StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
1130       StrCpy $3 $5$6
1131
1132       StrCpy $5 $3 1 -1  ; copy last char
1133       ${If} $5 == ";"    ; if last char == ;
1134         StrCpy $3 $3 -1  ; remove last char
1135       ${EndIf}
1136       ${If} $3 != ""
1137         ; New PATH not empty: update the registry
1138         WriteRegExpandStr HKCU "Environment" "PATH" $3
1139       ${Else}
1140         ; New PATH empty: remove from the registry
1141         DeleteRegValue HKCU "Environment" "PATH"
1142       ${EndIf}
1143       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
1144     ${Endif}
1145   ${Endif}
1146
1147   Pop $6
1148   Pop $5
1149   Pop $4
1150   Pop $3
1151   Pop $2
1152   Pop $1
1153   Pop $0
1154 ${FunctionEnd}
1155 !macroend
1156 !insertmacro SDCC.RemoveFromPath ""
1157 !insertmacro SDCC.RemoveFromPath "un."
1158
1159 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1160 ; Utility Functions                                                           ;
1161 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1162
1163 ; IsNT
1164 ; no input
1165 ; output, top of the stack = 1 if NT or 0 if not
1166 ;
1167 ; Usage:
1168 ;   Call IsNT
1169 ;   Pop $R0
1170 ;  ($R0 at this point is 1 or 0)
1171
1172 !macro SDCC.IsNT un
1173 ${Function} ${un}SDCC.IsNT
1174   Push $R0
1175   ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
1176   ${If} $R0 == ""
1177     ; we are not NT.
1178     Pop $R0
1179     Push 0
1180   ${Else}
1181     ; NT!!!
1182     Pop $R0
1183     Push 1
1184   ${EndIf}
1185 ${FunctionEnd}
1186 !macroend
1187 !insertmacro SDCC.IsNT ""
1188 !insertmacro SDCC.IsNT "un."
1189
1190 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1191 ;  Uninstall/Reinstall page functions                                         ;
1192 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1193
1194 !ifdef VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD
1195
1196 Var ReinstallPageCheck
1197
1198 ${Function} SDCC.PageReinstall
1199
1200   ReadRegStr $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" ""
1201
1202   ${If} $R0 == ""
1203     ReadRegStr $R0 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
1204     ${If} $R0 == ""
1205       Abort
1206     ${EndIf}
1207   ${EndIf}
1208
1209   ReadRegDWORD $R0 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMajor"
1210   ReadRegDWORD $R1 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionMinor"
1211   ReadRegDWORD $R2 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionRevision"
1212   ReadRegDWORD $R3 ${SDCC_ROOT_KEY} "Software\${PRODUCT_NAME}" "VersionBuild"
1213   StrCpy $R0 $R0.$R1.$R2.$R3
1214
1215   ${VersionCompare} ${VER_MAJOR}.${VER_MINOR}.${VER_REVISION}.${VER_BUILD} $R0 $R0
1216   ${If} $R0 == 0
1217     StrCpy $R1 "${PRODUCT_NAME} ${PRODUCT_VERSION} is already installed. Select the operation you want to perform and click Next to continue."
1218     StrCpy $R2 "Add/Reinstall components"
1219     StrCpy $R3 "Uninstall ${PRODUCT_NAME}"
1220     !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose the maintenance option to perform."
1221     StrCpy $R0 "2"
1222   ${ElseIf} $R0 == 1
1223     StrCpy $R1 "An older version of ${PRODUCT_NAME} is installed on your system. It's recommended that you uninstall the current version before installing. Select the operation you want to perform and click Next to continue."
1224     StrCpy $R2 "Uninstall before installing"
1225     StrCpy $R3 "Do not uninstall"
1226     !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
1227     StrCpy $R0 "1"
1228   ${ElseIf} $R0 == 2
1229     StrCpy $R1 "A newer version of ${PRODUCT_NAME} is already installed! It is not recommended that you install an older version. If you really want to install this older version, it's better to uninstall the current version first. Select the operation you want to perform and click Next to continue."
1230     StrCpy $R2 "Uninstall before installing"
1231     StrCpy $R3 "Do not uninstall"
1232     !insertmacro MUI_HEADER_TEXT "Already Installed" "Choose how you want to install ${PRODUCT_NAME}."
1233     StrCpy $R0 "1"
1234   ${Else}
1235     Abort
1236   ${EndIf}
1237
1238   nsDialogs::Create /NOUNLOAD 1018
1239
1240   ${NSD_CreateLabel} 0 0 100% 24u $R1
1241   Pop $R1
1242
1243   ${NSD_CreateRadioButton} 30u 50u -30u 8u $R2
1244   Pop $R2
1245   ${NSD_OnClick} $R2 SDCC.PageReinstallUpdateSelection
1246
1247   ${NSD_CreateRadioButton} 30u 70u -30u 8u $R3
1248   Pop $R3
1249   ${NSD_OnClick} $R3 SDCC.PageReinstallUpdateSelection
1250
1251   ${If} $ReinstallPageCheck != 2
1252     SendMessage $R2 ${BM_SETCHECK} ${BST_CHECKED} 0
1253   ${Else}
1254     SendMessage $R3 ${BM_SETCHECK} ${BST_CHECKED} 0
1255   ${EndIf}
1256
1257   nsDialogs::Show
1258
1259 ${FunctionEnd}
1260
1261 ${Function} SDCC.PageReinstallUpdateSelection
1262
1263   Pop $R1
1264
1265   ${NSD_GetState} $R2 $R1
1266
1267   ${If} $R1 == ${BST_CHECKED}
1268     StrCpy $ReinstallPageCheck 1
1269   ${Else}
1270     StrCpy $ReinstallPageCheck 2
1271   ${EndIf}
1272
1273 ${FunctionEnd}
1274
1275 ${Function} SDCC.PageLeaveReinstall
1276
1277   ${NSD_GetState} $R2 $R1
1278
1279   ${DebugMsg} "R0 = $R0, R1 = $R1, R2 = $R2"
1280
1281   ${If} $R0 == "1"
1282     ${AndIf} $R1 != "1"
1283     Goto reinst_done
1284   ${EndIf}
1285
1286   ${If} $R0 == "2"
1287     ${AndIf} $R1 == 1
1288     Goto reinst_done
1289   ${EndIf}
1290
1291   ReadRegStr $R1 ${UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString"
1292
1293   ;Run uninstaller
1294   HideWindow
1295
1296   ${If} $R0 == "2"
1297     ; Uninstall only: uninstaller should be removed
1298     ClearErrors
1299     ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
1300     ExecWait '$R1'
1301     Quit
1302   ${Else}
1303     ; Uninstal & Reinstall: uninstaller will be rewritten
1304     ClearErrors
1305     ; ExecWait doesn't wait if _?=$INSTDIR is not defined!
1306     ExecWait '$R1 _?=$INSTDIR'
1307   ${EndIf}
1308
1309   BringToFront
1310
1311 reinst_done:
1312
1313 ${FunctionEnd}
1314
1315 !endif # VER_MAJOR & VER_MINOR & VER_REVISION & VER_BUILD