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