* Small Device C Compiler 2.7.0 released
[fw/sdcc] / support / scripts / sdcc.nsi
1 # sdcc.nsi - NSIS installer script for SDCC
2 #
3 # Copyright (c) 2003-2006 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 file COPYING 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" sdcc.nsi
39 # - A setup file setup.exe is created in PKGDIR directory.
40 #   Rename it to sdcc-yyyymmdd-rrrr-setup.exe and upload it
41 #   to sdcc download repository at sourceforge.net
42 #
43 #
44 # How to create WIN32 release setup.exe package
45 #
46 # - unpack WIN32 mingw daily snapshot sdcc-snapshot-i586-mingw32msvc-yyyymmdd-rrrr.zip
47 #   to a clean directory (the option to create directories should be enabled).
48 #   A sub directory sdcc is created (referenced as PKGDIR in continuation).
49 # - remove the PKGDIR/doc/README.TXT file
50 # - unpack sdcc-doc-yyyymmdd-rrrr.zip to the PKGDIR/doc directory
51 # - copy files sdcc/support/scripts/sdcc.ico and sdcc/support/scripts/sdcc.nsi
52 #   (this file) from the sdcc Subversion snapshot to the PKGDIR directory
53 # - copy file COPYING from the sdcc Subversion snapshot to the PKGDIR directory,
54 #   rename it to COPYING.TXT and convert file COPYING to DOS format:
55 #   unix2dos COPYING.TXT
56 # - copy readline5.dll to PKGDIR/bin/readline5.dll
57 # - run NSIS installer from PKGDIR directory:
58 #   "c:\Program Files\NSIS\makensis.exe" -DFULL_DOC sdcc.nsi
59 # - A setup file setup.exe is created in PKGDIR directory.
60 #   Rename it to sdcc-x.x.x-setup.exe and upload it
61 #   to sdcc download repository at sourceforge.net
62 #
63 # How to upload secc setup.exe tosourceforge.net
64 #
65 # Execute following commands from the cmd prompt:
66 # - sftp sdcc.sourceforge.net
67 # - cd /home/groups/s/sd/sdcc/htdocs/snapshots/i586-mingw32msvc-setup
68 # - put sdcc_yyyymmdd_setup.exe
69 # - quit
70
71
72 !include "MUI.nsh"
73
74 SetCompressor /SOLID lzma
75
76 !define SDCC_ROOT "."
77
78 !define DEV_ROOT "${SDCC_ROOT}"
79
80 !system "unix2dos ${SDCC_ROOT}\doc\ChangeLog_head.txt" = 0
81 !system "unix2dos ${SDCC_ROOT}\doc\README.TXT" = 0
82
83 InstType "Full (Bin, ucSim, SDCDB, Doc, Lib, Src)"
84 InstType "Medium (Bin, ucSim, SDCDB, Doc, Lib)"
85 InstType "Compact (Bin, ucSim, SDCDB, Doc)"
86
87 ;--------------------------------
88 ;Variables
89
90 Var MUI_STARTMENUPAGE_VARIABLE
91
92 ;--------------------------------
93 !define MUI_ABORTWARNING
94
95 !insertmacro MUI_PAGE_WELCOME
96 !insertmacro MUI_PAGE_LICENSE "${SDCC_ROOT}\COPYING.TXT"
97 !define MUI_STARTMENUPAGE_DEFAULTFOLDER "SDCC"
98 !define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
99 !define MUI_STARTMENUPAGE_REGISTRY_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
100 !define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "NSIS:StartMenuDir"
101 !define MUI_STARTMENUPAGE_NODISABLE
102 !insertmacro MUI_PAGE_STARTMENU Application $MUI_STARTMENUPAGE_VARIABLE
103 !insertmacro MUI_PAGE_COMPONENTS
104 !insertmacro MUI_PAGE_DIRECTORY
105 !insertmacro MUI_PAGE_INSTFILES
106 !insertmacro MUI_PAGE_FINISH
107
108 !insertmacro MUI_UNPAGE_INSTFILES
109
110 !insertmacro MUI_LANGUAGE "English"
111
112 Name "SDCC"
113 BrandingText ""
114 OutFile "setup.exe"
115 InstallDir "$PROGRAMFILES\SDCC"
116 ShowInstDetails show
117 ShowUnInstDetails show
118
119 Function .onInit
120   ;Uninstall the old version, if present
121   ReadRegStr $R0 HKLM \
122   "Software\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" \
123   "UninstallString"
124   StrCmp $R0 "" inst
125
126   MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \
127   "$(^Name) is already installed. $\n$\nClick 'OK' to remove the \
128   previous version or 'Cancel' to cancel this upgrade." \
129   IDOK uninst
130   Abort
131
132 uninst:
133   ; Run the uninstaller
134   ClearErrors
135   ExecWait '$R0 _?=$INSTDIR' ;Do not copy the uninstaller to a temp file
136
137   ;IfErrors no_remove_uninstaller
138   ;  ;You can either use Delete /REBOOTOK in the uninstaller or add some code
139   ;  ;here to remove to remove the uninstaller. Use a registry key to check
140   ;  ;whether the user has chosen to uninstall. If you are using an uninstaller
141   ;  ;components page, make sure all sections are uninstalled.
142   ;no_remove_uninstaller:
143
144   Goto done
145 inst:
146
147   ; Install the new version
148   MessageBox MB_YESNO|MB_ICONQUESTION "This will install $(^Name). Do you wish to continue?" IDYES +2
149   Abort
150
151 done:
152 FunctionEnd
153
154 Section -Common
155   SetOutPath "$INSTDIR"
156   File ".\sdcc.ico"
157   File "${SDCC_ROOT}\COPYING.TXT"
158 SectionEnd
159
160 Section "SDCC application files"
161   SectionIn 1 2 3 RO
162   SetOutPath "$INSTDIR\bin"
163   File "${SDCC_ROOT}\bin\as-gbz80.exe"
164   File "${SDCC_ROOT}\bin\as-hc08.exe"
165   File "${SDCC_ROOT}\bin\as-z80.exe"
166   File "${SDCC_ROOT}\bin\asx8051.exe"
167   File "${SDCC_ROOT}\bin\aslink.exe"
168   File "${SDCC_ROOT}\bin\link-gbz80.exe"
169   File "${SDCC_ROOT}\bin\link-hc08.exe"
170   File "${SDCC_ROOT}\bin\link-z80.exe"
171   File "${SDCC_ROOT}\bin\makebin.exe"
172   File "${SDCC_ROOT}\bin\packihx.exe"
173   File "${SDCC_ROOT}\bin\sdcc.exe"
174   File "${SDCC_ROOT}\bin\sdcclib.exe"
175   File "${SDCC_ROOT}\bin\sdcpp.exe"
176   File "${SDCC_ROOT}\bin\readline5.dll"
177 SectionEnd
178
179 Section "ucSim application files"
180   SectionIn 1 2 3
181   SetOutPath "$INSTDIR\bin"
182   File "${SDCC_ROOT}\bin\s51.exe"
183   File "${SDCC_ROOT}\bin\savr.exe"
184   File "${SDCC_ROOT}\bin\shc08.exe"
185   File "${SDCC_ROOT}\bin\sz80.exe"
186 SectionEnd
187
188 Section "SDCDB files"
189   SectionIn 1 2 3
190   File "${SDCC_ROOT}\bin\sdcdb.exe"
191   File "${SDCC_ROOT}\bin\sdcdb.el"
192   File "${SDCC_ROOT}\bin\sdcdbsrc.el"
193 SectionEnd
194
195 Section "SDCC documentation"
196   SectionIn 1 2 3
197   SetOutPath "$INSTDIR\doc"
198 !ifdef FULL_DOC
199   File /r "${SDCC_ROOT}\doc\*"
200 !else
201   File "${SDCC_ROOT}\doc\ChangeLog_head.txt"
202   File "${SDCC_ROOT}\doc\README.TXT"
203 !endif
204 SectionEnd
205
206 Section "SDCC include files"
207   SectionIn 1 2
208   SetOutPath "$INSTDIR\include\asm\default"
209   File "${DEV_ROOT}\include\asm\default\features.h"
210   SetOutPath "$INSTDIR\include\asm\ds390"
211   File "${DEV_ROOT}\include\asm\ds390\features.h"
212   SetOutPath "$INSTDIR\include\asm\gbz80"
213   File "${DEV_ROOT}\include\asm\gbz80\features.h"
214   SetOutPath "$INSTDIR\include\asm\mcs51"
215   File "${DEV_ROOT}\include\asm\mcs51\features.h"
216   SetOutPath "$INSTDIR\include\asm\pic"
217   File "${DEV_ROOT}\include\asm\pic\features.h"
218   SetOutPath "$INSTDIR\include\asm\pic16"
219   File "${DEV_ROOT}\include\asm\pic16\features.h"
220   SetOutPath "$INSTDIR\include\asm\z80"
221   File "${DEV_ROOT}\include\asm\z80\features.h"
222   SetOutPath "$INSTDIR\include\hc08"
223   File "${DEV_ROOT}\include\hc08\*.h"
224   SetOutPath "$INSTDIR\include\mcs51"
225   File "${DEV_ROOT}\include\mcs51\*.h"
226   SetOutPath "$INSTDIR\include\pic"
227   File "${DEV_ROOT}\include\pic\*.h"
228   File "${DEV_ROOT}\include\pic\*.txt"
229   File "${DEV_ROOT}\include\pic\*.inc"
230   SetOutPath "$INSTDIR\include\pic16"
231   File "${DEV_ROOT}\include\pic16\*.h"
232   SetOutPath "$INSTDIR\include\z80"
233   File "${DEV_ROOT}\include\z80\*.h"
234   SetOutPath "$INSTDIR\include"
235   File "${DEV_ROOT}\include\*.h"
236 SectionEnd
237
238 Section "SDCC DS390 library"
239   SectionIn 1 2
240   SetOutPath "$INSTDIR\lib\ds390"
241   File "${DEV_ROOT}\lib\ds390\*.rel"
242   File "${DEV_ROOT}\lib\ds390\*.lib"
243 SectionEnd
244
245 Section "SDCC DS400 library"
246   SectionIn 1 2
247   SetOutPath "$INSTDIR\lib\ds400"
248   File "${DEV_ROOT}\lib\ds400\*.rel"
249   File "${DEV_ROOT}\lib\ds400\*.lib"
250 SectionEnd
251
252 Section "SDCC GBZ80 library"
253   SectionIn 1 2
254   SetOutPath "$INSTDIR\lib\gbz80"
255   File "${DEV_ROOT}\lib\gbz80\*.o"
256   File "${DEV_ROOT}\lib\gbz80\*.lib"
257 SectionEnd
258
259 Section "SDCC Z80 library"
260   SectionIn 1 2
261   SetOutPath "$INSTDIR\lib\z80"
262   File "${DEV_ROOT}\lib\z80\*.o"
263   File "${DEV_ROOT}\lib\z80\*.lib"
264 SectionEnd
265
266 Section "SDCC small model library"
267   SectionIn 1 2
268   SetOutPath "$INSTDIR\lib\small"
269   File "${DEV_ROOT}\lib\small\*.rel"
270   File "${DEV_ROOT}\lib\small\*.lib"
271 SectionEnd
272
273 Section "SDCC medium model library"
274   SectionIn 1 2
275   SetOutPath "$INSTDIR\lib\medium"
276   File "${DEV_ROOT}\lib\medium\*.rel"
277   File "${DEV_ROOT}\lib\medium\*.lib"
278 SectionEnd
279
280 Section "SDCC large model library"
281   SectionIn 1 2
282   SetOutPath "$INSTDIR\lib\large"
283   File "${DEV_ROOT}\lib\large\*.rel"
284   File "${DEV_ROOT}\lib\large\*.lib"
285 SectionEnd
286
287 Section "SDCC small-stack-auto model library"
288   SectionIn 1 2
289   SetOutPath "$INSTDIR\lib\small-stack-auto"
290   File "${DEV_ROOT}\lib\small-stack-auto\*.rel"
291   File "${DEV_ROOT}\lib\small-stack-auto\*.lib"
292 SectionEnd
293
294 Section "SDCC HC08 library"
295   SectionIn 1 2
296   SetOutPath "$INSTDIR\lib\hc08"
297   File "${DEV_ROOT}\lib\hc08\*.rel"
298   File "${DEV_ROOT}\lib\hc08\*.lib"
299 SectionEnd
300
301 Section "SDCC PIC16 library"
302   SectionIn 1 2
303   SetOutPath "$INSTDIR\lib\pic16"
304   File "${DEV_ROOT}\lib\pic16\*.o"
305   File "${DEV_ROOT}\lib\pic16\*.lib"
306 SectionEnd
307
308 Section "SDCC PIC library"
309   SectionIn 1 2
310   SetOutPath "$INSTDIR\lib\pic"
311   File "${DEV_ROOT}\lib\pic\*.lib"
312 SectionEnd
313
314 Section "SDCC library sources"
315   SectionIn 1
316   SetOutPath "$INSTDIR\lib\src\ds390\examples"
317   File "${DEV_ROOT}\lib\src\ds390\examples\MOVED"
318
319   SetOutPath "$INSTDIR\lib\src\ds390"
320   File "${DEV_ROOT}\lib\src\ds390\*.c"
321 #  File "${DEV_ROOT}\lib\src\ds390\Makefile"
322
323   SetOutPath "$INSTDIR\lib\src\ds400"
324   File "${DEV_ROOT}\lib\src\ds400\*.c"
325 #  File "${DEV_ROOT}\lib\src\ds400\Makefile"
326
327   SetOutPath "$INSTDIR\lib\src\gbz80"
328   File "${DEV_ROOT}\lib\src\gbz80\*.c"
329   File "${DEV_ROOT}\lib\src\gbz80\*.s"
330 #  File "${DEV_ROOT}\lib\src\gbz80\Makefile"
331
332   SetOutPath "$INSTDIR\lib\src\z80"
333   File "${DEV_ROOT}\lib\src\z80\*.c"
334   File "${DEV_ROOT}\lib\src\z80\*.s"
335 #  File "${DEV_ROOT}\lib\src\z80\Makefile"
336
337   SetOutPath "$INSTDIR\lib\src\hc08"
338   File "${DEV_ROOT}\lib\src\hc08\*.c"
339 #  File "${DEV_ROOT}\lib\src\hc08\Makefile"
340
341   SetOutPath "$INSTDIR\lib\src\mcs51"
342   File "${DEV_ROOT}\lib\src\mcs51\*.asm"
343 #  File "${DEV_ROOT}\lib\src\mcs51\Makefile"
344
345   SetOutPath "$INSTDIR\lib\src\small"
346 #  File "${DEV_ROOT}\lib\src\small\Makefile"
347
348   SetOutPath "$INSTDIR\lib\src\medium"
349 #  File "${DEV_ROOT}\lib\src\medium\Makefile"
350
351   SetOutPath "$INSTDIR\lib\src\large"
352 #  File "${DEV_ROOT}\lib\src\large\Makefile"
353
354   SetOutPath "$INSTDIR\lib\src\pic"
355 #  File "${DEV_ROOT}\lib\src\pic\configure"
356 #  File "${DEV_ROOT}\lib\src\pic\configure.in"
357 #  File "${DEV_ROOT}\lib\src\pic\GPL"
358 #  File "${DEV_ROOT}\lib\src\pic\LGPL"
359 #  File "${DEV_ROOT}\lib\src\pic\Makefile"
360 #  File "${DEV_ROOT}\lib\src\pic\Makefile.common"
361 #  File "${DEV_ROOT}\lib\src\pic\Makefile.common.in"
362 #  File "${DEV_ROOT}\lib\src\pic\Makefile.rules"
363 #  File "${DEV_ROOT}\lib\src\pic\Makefile.subdir"
364 #  File "${DEV_ROOT}\lib\src\pic\NEWS"
365 #  File "${DEV_ROOT}\lib\src\pic\README"
366   File "${DEV_ROOT}\lib\src\pic\TEMPLATE.c"
367   File "${DEV_ROOT}\lib\src\pic\TEMPLATE.S"
368
369   SetOutPath "$INSTDIR\lib\src\pic\libsdcc"
370   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.c"
371   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.S"
372   File "${DEV_ROOT}\lib\src\pic\libsdcc\*.inc"
373 #  File "${DEV_ROOT}\lib\src\pic\libsdcc\Makefile"
374   
375   SetOutPath "$INSTDIR\lib\src\pic\libdev"
376   File "${DEV_ROOT}\lib\src\pic\libdev\*.c"
377 #  File "${DEV_ROOT}\lib\src\pic\libdev\Makefile"
378
379   SetOutPath "$INSTDIR\lib\src\pic\libm"
380   File "${DEV_ROOT}\lib\src\pic\libm\*.c"
381
382   SetOutPath "$INSTDIR\lib\src\pic16"
383 #  File "${DEV_ROOT}\lib\src\pic16\configure"
384 #  File "${DEV_ROOT}\lib\src\pic16\configure.in"
385 #  File "${DEV_ROOT}\lib\src\pic16\COPYING"
386 #  File "${DEV_ROOT}\lib\src\pic16\Makefile"
387 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.common"
388 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.common.in"
389 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.rules"
390 #  File "${DEV_ROOT}\lib\src\pic16\Makefile.subdir"
391 #  File "${DEV_ROOT}\lib\src\pic16\pics.all"
392 #  File "${DEV_ROOT}\lib\src\pic16\pics.build"
393 #  File "${DEV_ROOT}\lib\src\pic16\README"
394
395   SetOutPath "$INSTDIR\lib\src\pic16\debug"
396 #  File "${DEV_ROOT}\lib\src\pic16\debug\Makefile"
397
398   SetOutPath "$INSTDIR\lib\src\pic16\debug\gstack"
399 #  File "${DEV_ROOT}\lib\src\pic16\debug\gstack\Makefile"
400   File "${DEV_ROOT}\lib\src\pic16\debug\gstack\*.c"
401
402   SetOutPath "$INSTDIR\lib\src\pic16\libc"
403 #  File "${DEV_ROOT}\lib\src\pic16\libc\Makefile"
404
405   SetOutPath "$INSTDIR\lib\src\pic16\libc\ctype"
406   File "${DEV_ROOT}\lib\src\pic16\libc\ctype\*.c"
407 #  File "${DEV_ROOT}\lib\src\pic16\libc\ctype\Makefile"
408
409   SetOutPath "$INSTDIR\lib\src\pic16\libc\delay"
410   File "${DEV_ROOT}\lib\src\pic16\libc\delay\*.S"
411 #  File "${DEV_ROOT}\lib\src\pic16\libc\delay\Makefile"
412
413   SetOutPath "$INSTDIR\lib\src\pic16\libc\stdio"
414   File "${DEV_ROOT}\lib\src\pic16\libc\stdio\*.c"
415 #  File "${DEV_ROOT}\lib\src\pic16\libc\stdio\Makefile"
416
417   SetOutPath "$INSTDIR\lib\src\pic16\libc\stdlib"
418   File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.c"
419   File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\*.S"
420 #  File "${DEV_ROOT}\lib\src\pic16\libc\stdlib\Makefile"
421
422   SetOutPath "$INSTDIR\lib\src\pic16\libc\string"
423   File "${DEV_ROOT}\lib\src\pic16\libc\string\*.c"
424 #  File "${DEV_ROOT}\lib\src\pic16\libc\string\Makefile"
425
426   SetOutPath "$INSTDIR\lib\src\pic16\libc\utils"
427   File "${DEV_ROOT}\lib\src\pic16\libc\utils\*.S"
428 #  File "${DEV_ROOT}\lib\src\pic16\libc\utils\Makefile"
429
430   SetOutPath "$INSTDIR\lib\src\pic16\libdev"
431   File "${DEV_ROOT}\lib\src\pic16\libdev\*.c"
432 #  File "${DEV_ROOT}\lib\src\pic16\libdev\Makefile"
433
434   SetOutPath "$INSTDIR\lib\src\pic16\libio"
435   File "${DEV_ROOT}\lib\src\pic16\libio\*.ignore"
436 #  File "${DEV_ROOT}\lib\src\pic16\libio\Makefile"
437
438   SetOutPath "$INSTDIR\lib\src\pic16\libio\adc"
439   File "${DEV_ROOT}\lib\src\pic16\libio\adc\*.c"
440 #  File "${DEV_ROOT}\lib\src\pic16\libio\adc\Makefile"
441
442   SetOutPath "$INSTDIR\lib\src\pic16\libio\i2c"
443   File "${DEV_ROOT}\lib\src\pic16\libio\i2c\*.c"
444 #  File "${DEV_ROOT}\lib\src\pic16\libio\i2c\Makefile"
445
446   SetOutPath "$INSTDIR\lib\src\pic16\libio\usart"
447   File "${DEV_ROOT}\lib\src\pic16\libio\usart\*.c"
448 #  File "${DEV_ROOT}\lib\src\pic16\libio\usart\Makefile"
449
450   SetOutPath "$INSTDIR\lib\src\pic16\libm"
451   File "${DEV_ROOT}\lib\src\pic16\libm\*.c"
452 #  File "${DEV_ROOT}\lib\src\pic16\libm\Makefile"
453
454   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc"
455 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\Makefile"
456
457   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\char"
458   File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\*.c"
459 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\char\Makefile"
460
461   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\fixed16x16"
462   File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.c"
463   File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\*.S"
464 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\fixed16x16\Makefile"
465
466   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\float"
467   File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\*.c"
468 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\float\Makefile"
469
470   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\gptr"
471   File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\*.c"
472 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\gptr\Makefile"
473
474   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\int"
475   File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\*.c"
476 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\int\Makefile"
477
478   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\long"
479   File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\*.c"
480 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\long\Makefile"
481
482   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\lregs"
483   File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\*.c"
484 #  File "${DEV_ROOT}\lib\src\pic16\libsdcc\lregs\Makefile"
485
486   SetOutPath "$INSTDIR\lib\src\pic16\libsdcc\stack"
487   File "${DEV_ROOT}\lib\src\pic16\libsdcc\stack\*.S"
488
489   SetOutPath "$INSTDIR\lib\src\pic16\startup"
490   File "${DEV_ROOT}\lib\src\pic16\startup\*.c"
491 #  File "${DEV_ROOT}\lib\src\pic16\startup\Makefile"
492 #  File "${DEV_ROOT}\lib\src\pic16\startup\README"
493
494   SetOutPath "$INSTDIR\lib\src"
495   File "${DEV_ROOT}\lib\src\*.c"
496 SectionEnd
497
498 Section -Icons
499 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
500   CreateDirectory "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
501   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk" "$INSTDIR\sdcc.url" 
502   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk" "$INSTDIR\uninstall.exe" 
503   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk" "$INSTDIR\doc\README.TXT" "" "$INSTDIR\sdcc.ico" "" "" "" ""
504   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk" "$INSTDIR\doc\ChangeLog_head.txt" "" "$INSTDIR\sdcc.ico" "" "" "" ""
505   CreateShortCut "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk" "$INSTDIR\COPYING.TXT" 
506 !insertmacro MUI_STARTMENU_WRITE_END
507 SectionEnd
508
509 Section -INI
510   WriteIniStr "$INSTDIR\sdcc.url" "InternetShortcut" "URL" "http://sdcc.sourceforge.net/"
511 SectionEnd
512
513 Section -PostInstall
514   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "DisplayName" "SDCC"
515   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "UninstallString" "$INSTDIR\uninstall.exe"
516   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "Publisher" "sdcc.sourceforge.net"
517   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLInfoAbout" "http://sdcc.sourceforge.net/"
518   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "HelpLink" "http://sdcc.sourceforge.net/"
519   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "URLUpdateInfo" "http://sdcc.sourceforge.net/"
520   WriteUninstaller "$INSTDIR\uninstall.exe"
521 SectionEnd
522
523 Section -AddToPath
524   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Do you want to add $INSTDIR\bin to the PATH?" IDNO +3
525     Push "$INSTDIR\bin"
526     Call AddToPath
527 SectionEnd
528
529
530 ;;;; Uninstaller code ;;;;
531
532 Function un.onInit
533   MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
534   Abort
535 FunctionEnd
536
537 Function un.onUninstSuccess
538   HideWindow
539   MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
540 FunctionEnd
541
542 Section Uninstall
543   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_STARTMENUPAGE_VARIABLE
544
545   Delete "$INSTDIR\sdcc.url"
546
547   DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC" "NSIS:StartMenuDir"
548   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\SDCC"
549
550   Delete "$INSTDIR\uninstall.exe"
551   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\GPL 2 License.lnk"
552   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Change Log.lnk"
553   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Documentation.lnk"
554   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\Uninstall SDCC.lnk"
555   Delete "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE\SDCC on the Web.lnk"
556
557   Delete "$INSTDIR\lib\src\large\Makefile"
558
559   Delete "$INSTDIR\lib\src\medium\Makefile"
560
561   Delete "$INSTDIR\lib\src\small\Makefile"
562
563   Delete "$INSTDIR\lib\src\mcs51\*.asm"
564   Delete "$INSTDIR\lib\src\mcs51\Makefile"
565   Delete "$INSTDIR\lib\src\mcs51\README"
566
567   Delete "$INSTDIR\lib\src\hc08\*.c"
568   Delete "$INSTDIR\lib\src\hc08\hc08.lib"
569   Delete "$INSTDIR\lib\src\hc08\Makefile"
570
571   Delete "$INSTDIR\lib\src\z80\*.c"
572   Delete "$INSTDIR\lib\src\z80\*.s"
573   Delete "$INSTDIR\lib\src\z80\z80.lib"
574   Delete "$INSTDIR\lib\src\z80\README"
575   Delete "$INSTDIR\lib\src\z80\Makefile"
576
577   Delete "$INSTDIR\lib\src\gbz80\*.c"
578   Delete "$INSTDIR\lib\src\gbz80\*.s"
579   Delete "$INSTDIR\lib\src\gbz80\gbz80.lib"
580   Delete "$INSTDIR\lib\src\gbz80\README"
581   Delete "$INSTDIR\lib\src\gbz80\Makefile"
582
583   Delete "$INSTDIR\lib\src\ds390\*.c"
584   Delete "$INSTDIR\lib\src\ds390\libds390.lib"
585   Delete "$INSTDIR\lib\src\ds390\Makefile.dep"
586   Delete "$INSTDIR\lib\src\ds390\Makefile"
587   Delete "$INSTDIR\lib\src\ds390\examples\MOVED"
588
589   Delete "$INSTDIR\lib\src\ds400\*.c"
590   Delete "$INSTDIR\lib\src\ds400\libds400.lib"
591   Delete "$INSTDIR\lib\src\ds400\Makefile.dep"
592   Delete "$INSTDIR\lib\src\ds400\Makefile"
593
594   Delete "$INSTDIR\lib\src\*.c"
595
596   Delete "$INSTDIR\lib\pic\*.o"
597   Delete "$INSTDIR\lib\pic\*.lib"
598
599   Delete "$INSTDIR\lib\pic16\*.o"
600   Delete "$INSTDIR\lib\pic16\*.lib"
601
602   Delete "$INSTDIR\lib\hc08\*.rel"
603   Delete "$INSTDIR\lib\hc08\*.lib"
604
605   Delete "$INSTDIR\lib\z80\*.o"
606   Delete "$INSTDIR\lib\z80\*.lib"
607
608   Delete "$INSTDIR\lib\small\*.rel"
609   Delete "$INSTDIR\lib\small\*.lib"
610
611   Delete "$INSTDIR\lib\medium\*.rel"
612   Delete "$INSTDIR\lib\medium\*.lib"
613
614   Delete "$INSTDIR\lib\large\*.rel"
615   Delete "$INSTDIR\lib\large\*.lib"
616
617   Delete "$INSTDIR\lib\small-stack-auto\*.rel"
618   Delete "$INSTDIR\lib\small-stack-auto\*.lib"
619
620   Delete "$INSTDIR\lib\gbz80\*.o"
621   Delete "$INSTDIR\lib\gbz80\*.lib"
622
623   Delete "$INSTDIR\lib\ds390\*.rel"
624   Delete "$INSTDIR\lib\ds390\*.lib"
625
626   Delete "$INSTDIR\lib\ds400\*.rel"
627   Delete "$INSTDIR\lib\ds400\*.lib"
628
629   Delete "$INSTDIR\include\asm\z80\*.h"
630   Delete "$INSTDIR\include\asm\pic16\*.h"
631   Delete "$INSTDIR\include\asm\pic\*.h"
632   Delete "$INSTDIR\include\asm\mcs51\*.h"
633   Delete "$INSTDIR\include\asm\gbz80\*.h"
634   Delete "$INSTDIR\include\asm\ds390\*.h"
635   Delete "$INSTDIR\include\asm\default\*.h"
636   Delete "$INSTDIR\include\z80\*.h"
637   Delete "$INSTDIR\include\pic\*.h"
638   Delete "$INSTDIR\include\pic\*.txt"
639   Delete "$INSTDIR\include\pic\*.inc"
640   Delete "$INSTDIR\include\pic16\*.h"
641   Delete "$INSTDIR\include\mcs51\*.h"
642   Delete "$INSTDIR\include\hc08\*.h"
643   Delete "$INSTDIR\include\*.h"
644
645 !ifndef FULL_DOC
646   Delete "$INSTDIR\doc\README.TXT"
647   Delete "$INSTDIR\doc\ChangeLog_head.txt"
648 !endif
649
650   Delete "$INSTDIR\bin\as-gbz80.exe"
651   Delete "$INSTDIR\bin\as-hc08.exe"
652   Delete "$INSTDIR\bin\as-z80.exe"
653   Delete "$INSTDIR\bin\asx8051.exe"
654   Delete "$INSTDIR\bin\aslink.exe"
655   Delete "$INSTDIR\bin\link-gbz80.exe"
656   Delete "$INSTDIR\bin\link-hc08.exe"
657   Delete "$INSTDIR\bin\link-z80.exe"
658   Delete "$INSTDIR\bin\makebin.exe"
659   Delete "$INSTDIR\bin\packihx.exe"
660   Delete "$INSTDIR\bin\sdcc.exe"
661   Delete "$INSTDIR\bin\sdcclib.exe"
662   Delete "$INSTDIR\bin\sdcpp.exe"
663   Delete "$INSTDIR\bin\readline5.dll"
664
665
666   Delete "$INSTDIR\bin\s51.exe"
667   Delete "$INSTDIR\bin\savr.exe"
668   Delete "$INSTDIR\bin\shc08.exe"
669   Delete "$INSTDIR\bin\sz80.exe"
670
671   Delete "$INSTDIR\bin\sdcdb.exe"
672   Delete "$INSTDIR\bin\sdcdb.el"
673   Delete "$INSTDIR\bin\sdcdbsrc.el"
674
675   Delete "$INSTDIR\COPYING.TXT"
676   Delete "$INSTDIR\sdcc.ico"
677
678   RMDir "$SMPROGRAMS\$MUI_STARTMENUPAGE_VARIABLE"
679
680   RMDir /r "$INSTDIR\lib\src\pic"
681   RMDir /r "$INSTDIR\lib\src\pic16"
682   RMDir "$INSTDIR\lib\src\small"
683   RMDir "$INSTDIR\lib\src\medium"
684   RMDir "$INSTDIR\lib\src\large"
685   RMDir "$INSTDIR\lib\src\mcs51"
686   RMDir "$INSTDIR\lib\src\z80"
687   RMDir "$INSTDIR\lib\src\gbz80"
688   RMDir "$INSTDIR\lib\src\ds390\examples"
689   RMDir "$INSTDIR\lib\src\ds390"
690   RMDir "$INSTDIR\lib\src\ds400"
691   RMDir "$INSTDIR\lib\src\hc08"
692   RMDir "$INSTDIR\lib\src"
693
694   RMDir "$INSTDIR\lib\pic"
695   RMDir "$INSTDIR\lib\pic16"
696   RMDir "$INSTDIR\lib\z80"
697   RMDir "$INSTDIR\lib\small"
698   RMDir "$INSTDIR\lib\medium"
699   RMDir "$INSTDIR\lib\large"
700   RMDir "$INSTDIR\lib\small-stack-auto"
701   RMDir "$INSTDIR\lib\gbz80"
702   RMDir "$INSTDIR\lib\ds390"
703   RMDir "$INSTDIR\lib\ds400"
704   RMDir "$INSTDIR\lib\hc08"
705   RMDir "$INSTDIR\lib"
706
707   RMDir "$INSTDIR\include\asm\z80"
708   RMDir "$INSTDIR\include\asm\pic16"
709   RMDir "$INSTDIR\include\asm\pic"
710   RMDir "$INSTDIR\include\asm\mcs51"
711   RMDir "$INSTDIR\include\asm\gbz80"
712   RMDir "$INSTDIR\include\asm\ds390"
713   RMDir "$INSTDIR\include\asm\default"
714   RMDir "$INSTDIR\include\asm"
715   RMDir "$INSTDIR\include\z80"
716   RMDir "$INSTDIR\include\pic"
717   RMDir "$INSTDIR\include\pic16"
718   RMDir "$INSTDIR\include\mcs51"
719   RMDir "$INSTDIR\include\hc08"
720   RMDir "$INSTDIR\include"
721
722 !ifdef FULL_DOC
723   RMDir /r "$INSTDIR\doc"
724 !else
725   RMDir "$INSTDIR\doc"
726 !endif
727
728   RMDir "$INSTDIR\bin"
729
730   RMDir "$INSTDIR"
731
732   Push "$INSTDIR\bin"
733   Call un.RemoveFromPath
734
735   SetAutoClose true
736 SectionEnd
737
738 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
739 ; Path Manipulation functions                                                 ;
740 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
741
742 !verbose 3
743 !include "WinMessages.nsh"
744 !verbose 4
745
746 ; AddToPath - Adds the given dir to the search path.
747 ;        Input - head of the stack
748 ;        Note - Win9x systems requires reboot
749
750 Function AddToPath
751   Exch $0
752   Push $1
753   Push $2
754   Push $3
755   Push $4
756
757   ; don't add if the path doesn't exist
758   IfFileExists $0 "" AddToPath_done
759
760   Call IsNT
761   Pop $4
762   StrCmp $4 1 +3
763     ; Not on NT: read PATH from environment variable
764     ReadEnvStr $1 PATH
765     Goto +2
766     ; On NT: read PATH from registry
767     ReadRegStr $1 HKCU "Environment" "PATH"
768   Push "$1;"
769   Push "$0;"
770   Call StrStr
771   Pop $2
772   StrCmp $2 "" "" AddToPath_done
773   Push "$1;"
774   Push "$0\;"
775   Call StrStr
776   Pop $2
777   StrCmp $2 "" "" AddToPath_done
778   GetFullPathName /SHORT $3 $0
779   Push "$1;"
780   Push "$3;"
781   Call StrStr
782   Pop $2
783   StrCmp $2 "" "" AddToPath_done
784   Push "$1;"
785   Push "$3\;"
786   Call StrStr
787   Pop $2
788   StrCmp $2 "" "" AddToPath_done
789
790   StrCmp $4 1 AddToPath_NT
791     ; Not on NT
792     StrCpy $1 $WINDIR 2
793     FileOpen $1 "$1\autoexec.bat" a
794     FileSeek $1 -1 END
795     FileReadByte $1 $2
796     IntCmp $2 26 0 +2 +2 ; DOS EOF
797       FileSeek $1 -1 END ; write over EOF
798     FileWrite $1 "$\r$\nSET PATH=%PATH%;$3$\r$\n"
799     FileClose $1
800     SetRebootFlag true
801     Goto AddToPath_done
802
803   AddToPath_NT:
804     ReadRegStr $1 HKCU "Environment" "PATH"
805     StrCpy $2 $1 1 -1  ; copy last char
806     StrCmp $2 ";" 0 +2 ; if last char == ;
807       StrCpy $1 $1 -1  ; remove last char
808     StrCmp $1 "" AddToPath_NTdoIt
809       StrCpy $0 "$1;$0"
810     AddToPath_NTdoIt:
811       WriteRegExpandStr HKCU "Environment" "PATH" $0
812       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
813
814   AddToPath_done:
815     Pop $4
816     Pop $3
817     Pop $2
818     Pop $1
819     Pop $0
820 FunctionEnd
821
822 ; RemoveFromPath - Remove a given dir from the path
823 ;     Input: head of the stack
824
825 Function un.RemoveFromPath
826   Exch $0
827   Push $1
828   Push $2
829   Push $3
830   Push $4
831   Push $5
832   Push $6
833
834   IntFmt $6 "%c" 26 ; DOS EOF
835
836   Call un.IsNT
837   Pop $1
838   StrCmp $1 1 unRemoveFromPath_NT
839     ; Not on NT
840     StrCpy $1 $WINDIR 2
841     FileOpen $1 "$1\autoexec.bat" r
842     GetTempFileName $4
843     FileOpen $2 $4 w
844     GetFullPathName /SHORT $0 $0
845     StrCpy $0 "SET PATH=%PATH%;$0"
846     Goto unRemoveFromPath_dosLoop
847
848     unRemoveFromPath_dosLoop:
849       FileRead $1 $3
850       StrCpy $5 $3 1 -1 ; read last char
851       StrCmp $5 $6 0 +2 ; if DOS EOF
852         StrCpy $3 $3 -1 ; remove DOS EOF so we can compare
853       StrCmp $3 "$0$\r$\n" unRemoveFromPath_dosLoopRemoveLine
854       StrCmp $3 "$0$\n" unRemoveFromPath_dosLoopRemoveLine
855       StrCmp $3 "$0" unRemoveFromPath_dosLoopRemoveLine
856       StrCmp $3 "" unRemoveFromPath_dosLoopEnd
857       FileWrite $2 $3
858       Goto unRemoveFromPath_dosLoop
859       unRemoveFromPath_dosLoopRemoveLine:
860         SetRebootFlag true
861         Goto unRemoveFromPath_dosLoop
862
863     unRemoveFromPath_dosLoopEnd:
864       FileClose $2
865       FileClose $1
866       StrCpy $1 $WINDIR 2
867       Delete "$1\autoexec.bat"
868       CopyFiles /SILENT $4 "$1\autoexec.bat"
869       Delete $4
870       Goto unRemoveFromPath_done
871
872   unRemoveFromPath_NT:
873     ReadRegStr $1 HKCU "Environment" "PATH"
874     StrCpy $5 $1 1 -1 ; copy last char
875     StrCmp $5 ";" +2  ; if last char != ;
876       StrCpy $1 "$1;" ; append ;
877     Push $1
878     Push "$0;"
879     Call un.StrStr    ; Find `$0;` in $1
880     Pop $2            ; pos of our dir
881     StrCmp $2 "" unRemoveFromPath_done
882       ; else, it is in path
883       ; $0 - path to add
884       ; $1 - path var
885       StrLen $3 "$0;"
886       StrLen $4 $2
887       StrCpy $5 $1 -$4   ; $5 is now the part before the path to remove
888       StrCpy $6 $2 "" $3 ; $6 is now the part after the path to remove
889       StrCpy $3 $5$6
890
891       StrCpy $5 $3 1 -1  ; copy last char
892       StrCmp $5 ";" 0 +2 ; if last char == ;
893         StrCpy $3 $3 -1  ; remove last char
894
895       StrCmp $3 "" +3
896         ; New PATH not empty: update the registry
897         WriteRegExpandStr HKCU "Environment" "PATH" $3
898         Goto +2
899         ; New PATH empty: remove from the registry
900         DeleteRegValue HKCU "Environment" "PATH"
901       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
902
903   unRemoveFromPath_done:
904     Pop $6
905     Pop $5
906     Pop $4
907     Pop $3
908     Pop $2
909     Pop $1
910     Pop $0
911 FunctionEnd
912
913 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
914 ;            Utility Functions            ;
915 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
916
917 ; IsNT
918 ; no input
919 ; output, top of the stack = 1 if NT or 0 if not
920 ;
921 ; Usage:
922 ;   Call IsNT
923 ;   Pop $R0
924 ;  ($R0 at this point is 1 or 0)
925
926 !macro IsNT un
927 Function ${un}IsNT
928   Push $0
929   ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
930   StrCmp $0 "" 0 IsNT_yes
931   ; we are not NT.
932   Pop $0
933   Push 0
934   Return
935
936   IsNT_yes:
937     ; NT!!!
938     Pop $0
939     Push 1
940 FunctionEnd
941 !macroend
942 !insertmacro IsNT ""
943 !insertmacro IsNT "un."
944
945 ; StrStr
946 ; input, top of stack = string to search for
947 ;        top of stack-1 = string to search in
948 ; output, top of stack (replaces with the portion of the string remaining)
949 ; modifies no other variables.
950 ;
951 ; Usage:
952 ;   Push "this is a long ass string"
953 ;   Push "ass"
954 ;   Call StrStr
955 ;   Pop $R0
956 ;  ($R0 at this point is "ass string")
957
958 !macro StrStr un
959 Function ${un}StrStr
960 Exch $R1   ; st=haystack,old$R1, $R1=needle
961   Exch     ; st=old$R1,haystack
962   Exch $R2 ; st=old$R1,old$R2, $R2=haystack
963   Push $R3
964   Push $R4
965   Push $R5
966   StrLen $R3 $R1
967   StrCpy $R4 0
968   ; $R1=needle
969   ; $R2=haystack
970   ; $R3=len(needle)
971   ; $R4=cnt
972   ; $R5=tmp
973   loop:
974     StrCpy $R5 $R2 $R3 $R4
975     StrCmp $R5 $R1 done
976     StrCmp $R5 "" done
977     IntOp $R4 $R4 + 1
978     Goto loop
979 done:
980   StrCpy $R1 $R2 "" $R4
981   Pop $R5
982   Pop $R4
983   Pop $R3
984   Pop $R2
985   Exch $R1
986 FunctionEnd
987 !macroend
988 !insertmacro StrStr ""
989 !insertmacro StrStr "un."