1 | ; |
---|
2 | ; $Id$ |
---|
3 | ; |
---|
4 | ; RTEMS Tools Installer. |
---|
5 | ; |
---|
6 | ; Copyright Chris Johns (chrisj@rtems.org) |
---|
7 | ; |
---|
8 | |
---|
9 | ;!define EMPTY_INSTALLER |
---|
10 | |
---|
11 | !define PRODUCT_NAME "RTEMS Tools" |
---|
12 | !define PRODUCT_VERSION ${RTEMS_VERSION} |
---|
13 | !define PRODUCT_PUBLISHER "RTEM Project Team" |
---|
14 | !define PRODUCT_WEB_SITE "http://www.rtems.org/" |
---|
15 | |
---|
16 | ; MUI 1.66 compatible ------ |
---|
17 | !include "MUI.nsh" |
---|
18 | |
---|
19 | ; MUI Settings |
---|
20 | !define MUI_ABORTWARNING |
---|
21 | !define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico" |
---|
22 | !define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico" |
---|
23 | |
---|
24 | !define MUI_HEADERIMAGE |
---|
25 | !define MUI_HEADERIMAGE_BITMAP "${RTEMS_LOGO}" |
---|
26 | |
---|
27 | !define MUI_COMPONENTSPAGE_SMALLDESC |
---|
28 | |
---|
29 | ; Welcome page |
---|
30 | !insertmacro MUI_PAGE_WELCOME |
---|
31 | ; Details of what will happen. |
---|
32 | Page custom RTEMSMessage |
---|
33 | ; License page |
---|
34 | ;!define MUI_LICENSEPAGE_CHECKBOX |
---|
35 | !insertmacro MUI_PAGE_LICENSE "${RTEMS_LICENSE_FILE}" |
---|
36 | ; Components page |
---|
37 | !insertmacro MUI_PAGE_COMPONENTS |
---|
38 | ; Directory page |
---|
39 | !insertmacro MUI_PAGE_DIRECTORY |
---|
40 | ; Instfiles page |
---|
41 | !insertmacro MUI_PAGE_INSTFILES |
---|
42 | ; Finish page |
---|
43 | !insertmacro MUI_PAGE_FINISH |
---|
44 | |
---|
45 | ; Uninstaller pages |
---|
46 | !insertmacro MUI_UNPAGE_INSTFILES |
---|
47 | |
---|
48 | ; Language files |
---|
49 | !insertmacro MUI_LANGUAGE "English" |
---|
50 | |
---|
51 | ; Reserve files |
---|
52 | !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS |
---|
53 | |
---|
54 | ; MUI end ------ |
---|
55 | |
---|
56 | ReserveFile "rtems.ini" |
---|
57 | !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS |
---|
58 | |
---|
59 | Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})" |
---|
60 | OutFile "${RTEMS_BINARY}/rtems${PRODUCT_VERSION}-${RTEMS_TARGET}-${RTEMS_BUILD_VERSION}.exe" |
---|
61 | InstallDir "C:\rtems\${RTEMS_TARGET}" |
---|
62 | ShowInstDetails show |
---|
63 | ShowUnInstDetails show |
---|
64 | BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}" |
---|
65 | AllowRootDirInstall false |
---|
66 | AutoCloseWindow false |
---|
67 | CRCCheck force |
---|
68 | |
---|
69 | Section "RTEMS ${RTEMS_TARGET} Tools" SecTools |
---|
70 | SetOutPath "$INSTDIR" |
---|
71 | File "${RTEMS_SOURCE}/AUTHORS" |
---|
72 | File "${RTEMS_SOURCE}/COPYING" |
---|
73 | File "${RTEMS_SOURCE}/README" |
---|
74 | !insertmacro RTEMS_INSTALL_FILES |
---|
75 | SectionEnd |
---|
76 | |
---|
77 | !macro FILE_WRITE_LINE Handle Text |
---|
78 | FileWrite ${Handle} `${Text}` |
---|
79 | FileWriteByte ${Handle} "13" |
---|
80 | FileWriteByte ${Handle} "10" |
---|
81 | !macroend |
---|
82 | |
---|
83 | Function .onInit |
---|
84 | ;Extract InstallOptions INI files |
---|
85 | !insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini" |
---|
86 | FunctionEnd |
---|
87 | |
---|
88 | Function RTEMSMessage |
---|
89 | |
---|
90 | !insertmacro MUI_HEADER_TEXT \ |
---|
91 | "RTEMS Tools (${RTEMS_TARGET})" \ |
---|
92 | "A tool set for the RTEMS operating system." |
---|
93 | |
---|
94 | ;Display the Install Options dialog |
---|
95 | |
---|
96 | Push $R0 |
---|
97 | Push $R1 |
---|
98 | Push $R2 |
---|
99 | |
---|
100 | InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini" |
---|
101 | Pop $R0 |
---|
102 | |
---|
103 | GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1 |
---|
104 | ;$R1 contains the HWND of the first field |
---|
105 | CreateFont $R2 "Tahoma" "8" "300" |
---|
106 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
107 | |
---|
108 | GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1 |
---|
109 | ;$R1 contains the HWND of the first field |
---|
110 | CreateFont $R2 "Tahoma" "12" "700" |
---|
111 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
112 | |
---|
113 | GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1 |
---|
114 | ;$R1 contains the HWND of the first field |
---|
115 | CreateFont $R2 "Tahoma" "8" "300" |
---|
116 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
117 | |
---|
118 | GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1 |
---|
119 | ;$R1 contains the HWND of the first field |
---|
120 | CreateFont $R2 "Tahoma" "8" "300" |
---|
121 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
122 | |
---|
123 | GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1 |
---|
124 | ;$R1 contains the HWND of the first field |
---|
125 | CreateFont $R2 "Tahoma" "8" "300" |
---|
126 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
127 | |
---|
128 | GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1 |
---|
129 | ;$R1 contains the HWND of the first field |
---|
130 | CreateFont $R2 "Tahoma" "8" "300" |
---|
131 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
132 | |
---|
133 | GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1 |
---|
134 | ;$R1 contains the HWND of the first field |
---|
135 | CreateFont $R2 "Tahoma" "8" "300" |
---|
136 | SendMessage $R1 ${WM_SETFONT} $R2 0 |
---|
137 | |
---|
138 | InstallOptions::show |
---|
139 | Pop $R0 |
---|
140 | |
---|
141 | Pop $R2 |
---|
142 | Pop $R1 |
---|
143 | Pop $R0 |
---|
144 | |
---|
145 | FunctionEnd |
---|
146 | |
---|
147 | Section -BatchFiles |
---|
148 | FileOpen $9 $INSTDIR\rtems.bat w |
---|
149 | !insertmacro FILE_WRITE_LINE $9 "@echo off" |
---|
150 | !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_TARGET} (${RTEMS_VERSION})" |
---|
151 | !insertmacro FILE_WRITE_LINE $9 "set PATH=$INSTDIR\bin;c:\mingw\bin;c:\msys\1.0\bin;%PATH%" |
---|
152 | !insertmacro FILE_WRITE_LINE $9 "set PROMPT=RTEMS(${RTEMS_TARGET}) $$P$$G" |
---|
153 | !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT_Title" |
---|
154 | !insertmacro FILE_WRITE_LINE $9 "doskey > Nul" |
---|
155 | !insertmacro FILE_WRITE_LINE $9 "goto Finished" |
---|
156 | !insertmacro FILE_WRITE_LINE $9 ":WinNT_Title" |
---|
157 | !insertmacro FILE_WRITE_LINE $9 "Title RTEMS(${RTEMS_TARGET})" |
---|
158 | !insertmacro FILE_WRITE_LINE $9 ":Finished" |
---|
159 | FileClose $9 |
---|
160 | |
---|
161 | FileOpen $9 $INSTDIR\rtems-cmd.bat w |
---|
162 | !insertmacro FILE_WRITE_LINE $9 "@echo off" |
---|
163 | !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_TARGET} (${RTEMS_VERSION})" |
---|
164 | !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT" |
---|
165 | !insertmacro FILE_WRITE_LINE $9 "start command.com /e:4096 /k $INSTDIR\rtems.bat %1 %2 %3 %4" |
---|
166 | !insertmacro FILE_WRITE_LINE $9 "exit" |
---|
167 | !insertmacro FILE_WRITE_LINE $9 ":WinNT" |
---|
168 | !insertmacro FILE_WRITE_LINE $9 "start cmd.exe /k $INSTDIR\rtems.bat %1 %2 %3 %4" |
---|
169 | !insertmacro FILE_WRITE_LINE $9 "exit" |
---|
170 | FileClose $9 |
---|
171 | |
---|
172 | FileOpen $9 $INSTDIR\sh-run.bat w |
---|
173 | !insertmacro FILE_WRITE_LINE $9 "@echo off" |
---|
174 | !insertmacro FILE_WRITE_LINE $9 "rem We can only handle 9 parameters. More is too hard." |
---|
175 | !insertmacro FILE_WRITE_LINE $9 "call $INSTDIR\rtems.bat" |
---|
176 | !insertmacro FILE_WRITE_LINE $9 "%1 %2 %3 %4 %5 %6 %7 %8 %9" |
---|
177 | FileClose $9 |
---|
178 | |
---|
179 | FileOpen $9 $INSTDIR\vs-make.sh w |
---|
180 | !insertmacro FILE_WRITE_LINE $9 "#! /bin/sh" |
---|
181 | !insertmacro FILE_WRITE_LINE $9 "if [ ! -d $$1 ]; then" |
---|
182 | !insertmacro FILE_WRITE_LINE $9 " echo $\"error: no build directory found$\"" |
---|
183 | !insertmacro FILE_WRITE_LINE $9 " exit 1" |
---|
184 | !insertmacro FILE_WRITE_LINE $9 "fi" |
---|
185 | !insertmacro FILE_WRITE_LINE $9 "cd $$1" |
---|
186 | !insertmacro FILE_WRITE_LINE $9 "shift" |
---|
187 | !insertmacro FILE_WRITE_LINE $9 "make $$* 2>&1 | sed -e 's/c:\([0-9]*\):/c(\1):/' \\" |
---|
188 | !insertmacro FILE_WRITE_LINE $9 " -e 's/h:\([0-9]*\):/h(\1):/' \\" |
---|
189 | !insertmacro FILE_WRITE_LINE $9 " -e 's/S:\([0-9]*\):/S(\1):/' \\" |
---|
190 | !insertmacro FILE_WRITE_LINE $9 " -e 's/s:\([0-9]*\):/s(\1):/'" |
---|
191 | FileClose $9 |
---|
192 | SectionEnd |
---|
193 | |
---|
194 | Section -Post |
---|
195 | WriteUninstaller "$INSTDIR\rtems-${RTEMS_TARGET}-uninst.exe" |
---|
196 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ |
---|
197 | "DisplayName" "$(^Name)" |
---|
198 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ |
---|
199 | "UninstallString" "$INSTDIR\uninst.exe" |
---|
200 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ |
---|
201 | "DisplayVersion" "${PRODUCT_VERSION}" |
---|
202 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ |
---|
203 | "URLInfoAbout" "${PRODUCT_WEB_SITE}" |
---|
204 | WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \ |
---|
205 | "Publisher" "${PRODUCT_PUBLISHER}" |
---|
206 | SectionEnd |
---|
207 | |
---|
208 | Function un.onInit |
---|
209 | MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \ |
---|
210 | "Are you sure you want to uninstall RTEMS Tools?" IDYES +2 |
---|
211 | Abort |
---|
212 | FunctionEnd |
---|
213 | |
---|
214 | Section Uninstall |
---|
215 | Delete $INSTDIR\rtems-${RTEMS_TARGET}-uninst.exe |
---|
216 | DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" |
---|
217 | DetailPrint "Delete the install directory" |
---|
218 | Delete "$INSTDIR\AUTHORS" |
---|
219 | Delete "$INSTDIR\COPYING" |
---|
220 | Delete "$INSTDIR\README" |
---|
221 | Delete "$INSTDIR\rtems.bat" |
---|
222 | Delete "$INSTDIR\rtems-cmd.bat" |
---|
223 | Delete "$INSTDIR\sh-run.bat" |
---|
224 | Delete "$INSTDIR\vs-make.sh" |
---|
225 | !insertmacro RTEMS_DELETE_FILES |
---|
226 | DetailPrint "All done." |
---|
227 | SetAutoClose true |
---|
228 | SectionEnd |
---|