source: rtems/contrib/mingw/rtems-tools.nsi @ 56f6b907

4.104.114.84.95
Last change on this file since 56f6b907 was 56f6b907, checked in by Chris Johns <chrisj@…>, on Aug 4, 2007 at 6:24:12 AM

2007-08-03 Chris Johns <chisj@…>

  • rtems_logo.bmp: Clipped to get the correct proportions in the installer's header.
  • upload.sh: Install only the specific build installers.
  • rtems.ini: Change to show the actual web paths.
  • version: Build 15.
  • build-exes.sh, msys-path.nsi, rtems-autotools.nsi, rtems-tools.nsi: Fixed MSYS path detection. Fixed the uninstaller registry data. Changed the way the top level is generated. Now all the sections are added no matter what target is specified.
  • Property mode set to 100644
File size: 9.7 KB
Line 
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 "RTEMS 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.
32Page 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
56ReserveFile "rtems.ini"
57!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
58
59Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
60!ifdef COMMON_FILES
61OutFile "${RTEMS_BINARY}/rtems${PRODUCT_VERSION}-tools-${RTEMS_BUILD_VERSION}.exe"
62!else
63OutFile "${RTEMS_BINARY}/${RTEMS_OUTFILE}"
64!endif
65InstallDir "C:\opt\rtems-${PRODUCT_VERSION}"
66ShowInstDetails show
67ShowUnInstDetails show
68BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
69AllowRootDirInstall false
70AutoCloseWindow false
71CRCCheck force
72
73!include "${RTEMS_SOURCE}/msys-path.nsi"
74
75Section -SecFiles
76 AddSize ${RTEMS_TOOLS_SIZE}
77 !insertmacro RTEMS_INSTALL_FILES
78SectionEnd
79
80!ifdef COMMON_FILES
81Section -SecCommon
82 SetOutPath "$INSTDIR"
83 File "${RTEMS_SOURCE}/AUTHORS"
84 File "${RTEMS_SOURCE}/COPYING"
85 File "${RTEMS_SOURCE}/README"
86SectionEnd
87!endif
88
89!macro FILE_WRITE_LINE Handle Text
90  FileWrite     ${Handle} `${Text}`
91  FileWriteByte ${Handle} "13"
92  FileWriteByte ${Handle} "10"
93!macroend
94
95Function .onInit
96  ;Extract InstallOptions INI files
97  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini"
98FunctionEnd
99
100Function RTEMSMessage
101
102  !insertmacro MUI_HEADER_TEXT \
103               "RTEMS Tools (${RTEMS_TARGET})" \
104               "A tool set for the RTEMS operating system."
105
106  ;Display the Install Options dialog
107
108  Push $R0
109  Push $R1
110  Push $R2
111
112    InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini"
113    Pop $R0
114
115    GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
116    ;$R1 contains the HWND of the first field
117    CreateFont $R2 "Tahoma" "8" "300"
118    SendMessage $R1 ${WM_SETFONT} $R2 0
119       
120    GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
121    ;$R1 contains the HWND of the first field
122    CreateFont $R2 "Tahoma" "12" "700"
123    SendMessage $R1 ${WM_SETFONT} $R2 0
124       
125    GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1
126    ;$R1 contains the HWND of the first field
127    CreateFont $R2 "Tahoma" "8" "300"
128    SendMessage $R1 ${WM_SETFONT} $R2 0
129       
130    GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1
131    ;$R1 contains the HWND of the first field
132    CreateFont $R2 "Tahoma" "8" "300"
133    SendMessage $R1 ${WM_SETFONT} $R2 0
134       
135    GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1
136    ;$R1 contains the HWND of the first field
137    CreateFont $R2 "Tahoma" "8" "300"
138    SendMessage $R1 ${WM_SETFONT} $R2 0
139       
140    GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1
141    ;$R1 contains the HWND of the first field
142    CreateFont $R2 "Tahoma" "8" "300"
143    SendMessage $R1 ${WM_SETFONT} $R2 0
144       
145    GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1
146    ;$R1 contains the HWND of the first field
147    CreateFont $R2 "Tahoma" "8" "300"
148    SendMessage $R1 ${WM_SETFONT} $R2 0
149       
150    InstallOptions::show
151    Pop $R0
152
153  Pop $R2
154  Pop $R1
155  Pop $R0
156
157FunctionEnd
158
159; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
160; Push '\\'
161; Pop $R0
162; Call StrSlash
163; Pop $R0
164; ;Now $R0 contains 'c:/this/and/that/filename.htm'
165Function StrSlash
166 Exch $R0
167 Push $R1
168 Push $R2
169 StrCpy $R1 0
170loop:
171  IntOp $R1 $R1 - 1
172  StrCpy $R2 $R0 1 $R1
173  StrCmp $R2 "" done
174 StrCmp $R2 "\" 0 loop  ; "
175  StrCpy $R2 $R0 $R1
176   Push $R1
177  IntOp $R1 $R1 + 1
178  StrCpy $R1 $R0 "" $R1
179 StrCpy $R0 "$R2/$R1"
180   Pop $R1
181  IntOp $R1 $R1 - 1
182 Goto loop
183done:
184 Pop $R2
185 Pop $R1
186 Exch $R0
187FunctionEnd
188
189!ifdef COMMON_FILES
190Section -BatchFiles
191 FileOpen $9 $INSTDIR\rtems.bat w
192 !insertmacro FILE_WRITE_LINE $9 "@echo off"
193 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
194 !insertmacro FILE_WRITE_LINE $9 "set PATH=$INSTDIR\bin;c:\mingw\bin;c:\msys\1.0\bin;%PATH%"
195 !insertmacro FILE_WRITE_LINE $9 "set PROMPT=RTEMS $$P$$G"
196 !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT_Title"
197 !insertmacro FILE_WRITE_LINE $9 "doskey > Nul"
198 !insertmacro FILE_WRITE_LINE $9 "goto Finished"
199 !insertmacro FILE_WRITE_LINE $9 ":WinNT_Title"
200 !insertmacro FILE_WRITE_LINE $9 "Title RTEMS ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
201 !insertmacro FILE_WRITE_LINE $9 ":Finished"
202 FileClose $9
203
204 FileOpen $9 $INSTDIR\rtems-cmd.bat w
205 !insertmacro FILE_WRITE_LINE $9 "@echo off"
206 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
207 !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT"
208 !insertmacro FILE_WRITE_LINE $9 "start command.com /e:4096 /k $INSTDIR\rtems.bat %1 %2 %3 %4"
209 !insertmacro FILE_WRITE_LINE $9 "exit"
210 !insertmacro FILE_WRITE_LINE $9 ":WinNT"
211 !insertmacro FILE_WRITE_LINE $9 "start cmd.exe /k $INSTDIR\rtems.bat %1 %2 %3 %4"
212 !insertmacro FILE_WRITE_LINE $9 "exit"
213 FileClose $9
214
215 FileOpen $9 $INSTDIR\sh-run.bat w
216 !insertmacro FILE_WRITE_LINE $9 "@echo off"
217 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
218 !insertmacro FILE_WRITE_LINE $9 "rem We can only handle 9 parameters. More is too hard."
219 !insertmacro FILE_WRITE_LINE $9 "call $INSTDIR\rtems.bat"
220 !insertmacro FILE_WRITE_LINE $9 "%1 %2 %3 %4 %5 %6 %7 %8 %9"
221 FileClose $9
222
223 FileOpen $9 $INSTDIR\vs-make.sh w
224 !insertmacro FILE_WRITE_LINE $9 "#! /bin/sh"
225 !insertmacro FILE_WRITE_LINE $9 "# RTEMS script: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
226 !insertmacro FILE_WRITE_LINE $9 "if [ ! -d $$1 ]; then"
227 !insertmacro FILE_WRITE_LINE $9 " echo $\"error: no build directory found$\""
228 !insertmacro FILE_WRITE_LINE $9 " exit 1"
229 !insertmacro FILE_WRITE_LINE $9 "fi"
230 !insertmacro FILE_WRITE_LINE $9 "cd $$1"
231 !insertmacro FILE_WRITE_LINE $9 "shift"
232 !insertmacro FILE_WRITE_LINE $9 "make $$* 2>&1 | sed -e 's/c:\([0-9]*\):/c(\1):/' \\"
233 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/h:\([0-9]*\):/h(\1):/' \\"
234 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/S:\([0-9]*\):/S(\1):/' \\"
235 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/s:\([0-9]*\):/s(\1):/'"
236 FileClose $9
237SectionEnd
238
239Section -MSYSLinks
240 Call MSYSDetectSilent
241 Pop $R0
242 ifFileExists "$R0\etc\fstab" 0 Done
243  Push $R0
244  Push $INSTDIR
245  Push '\\'
246  Pop $R0
247  Call StrSlash
248  Pop $R1
249  Pop $R0
250  DetailPrint "Setting MSYS fstab: $R1 -> /opt/rtems-${PRODUCT_VERSION}"
251  StrCpy $R1 "$R1 /opt/rtems-${PRODUCT_VERSION}$\n"
252  FileOpen $9 "$R0\etc\fstab" a
253  ifErrors 0 +3
254    MessageBox MB_OK "Cannot open $R0\etc\fstab. MSYS mount point no added."
255    Goto Close
256  FileSeek $9 0 SET
257 ReadLoop:
258  FileRead $9 $R2
259  ifErrors Append
260  StrCmp $R1 $R2 Close ReadLoop
261 Append:
262  FileSeek $9 0 END
263  FileWrite $9 $R1
264 Close:
265  FileClose $9
266 Done:
267  ClearErrors
268SectionEnd
269!endif
270
271Section -Post
272!ifdef COMMON_FILES
273 StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-uninst.exe"
274!else
275 StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
276!endif
277 WriteUninstaller "$R0"
278 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
279                  "DisplayName" "$(^Name)"
280 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
281                  "UninstallString" "$R0"
282 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
283                  "DisplayVersion" "${PRODUCT_VERSION} Build-${RTEMS_BUILD_VERSION}"
284 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
285                  "URLInfoAbout" "${PRODUCT_WEB_SITE}"
286 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
287                  "Publisher" "${PRODUCT_PUBLISHER}"
288SectionEnd
289
290Function un.onInit
291 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
292            "Are you sure you want to uninstall RTEMS Tools (${RTEMS_TARGET})?" IDYES +2
293 Abort
294FunctionEnd
295
296Section Uninstall
297 SetDetailsView show
298 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
299 DetailPrint "Delete the installed files"
300 !insertmacro RTEMS_DELETE_FILES
301!ifdef COMMON_FILES
302 FindFirst $0 $1 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-*-uninst.exe"
303 Uninstall_Targets:
304  StrCmp $1 "" Uninstall_Targets_Done
305  DetailPrint "Uninstalling $1"
306  ExecWait '"$INSTDIR\$1" /S'
307  Delete $1
308  BringToFront
309  FindNext $0 $1
310  Goto Uninstall_Targets
311 Uninstall_Targets_Done:
312 FindClose $0
313 Delete "$INSTDIR\AUTHORS"
314 Delete "$INSTDIR\COPYING"
315 Delete "$INSTDIR\README"
316 Delete "$INSTDIR\rtems.bat"
317 Delete "$INSTDIR\rtems-cmd.bat"
318 Delete "$INSTDIR\sh-run.bat"
319 Delete "$INSTDIR\vs-make.sh"
320 Delete "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-uninst.exe"
321!else
322 Delete "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
323 Delete "$INSTDIR\Packages"
324!endif
325 RMDir "$INSTDIR"
326 DetailPrint "All done."
327 SetAutoClose false
328SectionEnd
Note: See TracBrowser for help on using the repository browser.