source: rtems/contrib/mingw/rtems-tools.nsi @ 0e6d50c

4.104.114.95
Last change on this file since 0e6d50c was 598aab1f, checked in by Chris Johns <chrisj@…>, on 08/20/07 at 02:12:48

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

  • filewrite.nsi, getparameters.nsi, instance-check.nsi, mingw-path.nsi, sm-dummy.nsi, strslash.nsi, strstr.nsi, options.nsi: Added the shared between the 2 installer scripts.
  • msys-path.nsi: Fixed the last LF bug.
  • rtems-autotools.nsi, rtems-tools.nsi: Fixed the instance check, added a start menu, remove pages from target installers.
  • rtems.ini: Fixed the URL links. Added support link.
  • rtems_logo.bmp: Trimmed a little more to get a better image.
  • ba-wrap.sh: Stop on a error.
  • build-exes.sh: Use the option parameter variables. Change the order the section appear in the installer.
  • Property mode set to 100644
File size: 11.9 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!ifdef COMMON_FILES
16!define PRODUCT_TITLE     "${PRODUCT_NAME} ${PRODUCT_VERSION} (Build ${RTEMS_BUILD_VERSION})"
17!else
18!define PRODUCT_TITLE     "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
19!endif
20!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}"
21!define PRODUCT_UNINST_ROOT_KEY "HKLM"
22!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
23
24; MUI 1.66 compatible ------
25!include "MUI.nsh"
26
27; MUI Settings
28!define MUI_FUNCTION_GUIINIT
29!define MUI_ABORTWARNING
30!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
31!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
32
33!define MUI_HEADERIMAGE
34!define MUI_HEADERIMAGE_BITMAP "${RTEMS_LOGO}"
35
36!define MUI_COMPONENTSPAGE_SMALLDESC
37
38!ifdef COMMON_FILES
39; Welcome page
40!insertmacro MUI_PAGE_WELCOME
41; Details of what will happen.
42Page custom RTEMSMessage
43; License page
44!insertmacro MUI_PAGE_LICENSE "${RTEMS_LICENSE_FILE}"
45; Components page
46!insertmacro MUI_PAGE_COMPONENTS
47
48; Directory page
49!define MUI_PAGE_HEADER_SUBTEXT "Choose the folder in which to install the RTEMS Tools."
50!define MUI_DIRECTORYPAGE_TEXT_TOP "${PRODUCT_NAME} will install RTEMS Tools in the following directory. To install in a different folder click Browse and select another folder. Click Next to continue."
51!insertmacro MUI_PAGE_DIRECTORY
52!endif
53
54; Start menu page
55!ifndef COMMON_FILES
56!include "${RTEMS_SOURCE}/sm-dummy.nsi"
57!endif
58var smfolder
59!define MUI_STARTMENUPAGE_NODISABLE
60!define MUI_STARTMENUPAGE_DEFAULTFOLDER "RTEMS ${PRODUCT_VERSION}"
61!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
62!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
63!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
64!ifdef COMMON_FILES
65!insertmacro MUI_PAGE_STARTMENU Application $smfolder
66!else
67!insertmacro MUI_PAGE_STARTMENU_DUMMY Application $smfolder
68!endif
69
70; Instfiles page
71!insertmacro MUI_PAGE_INSTFILES
72
73!ifdef COMMON_FILES
74; Finish page
75!insertmacro MUI_PAGE_FINISH
76!endif
77
78; Uninstaller pages
79!insertmacro MUI_UNPAGE_INSTFILES
80
81; Language files
82!insertmacro MUI_LANGUAGE "English"
83
84; Reserve files
85!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
86
87; MUI end ------
88
89ReserveFile "rtems.ini"
90!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
91
92!ifdef COMMON_FILES
93Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (Build ${RTEMS_BUILD_VERSION})"
94OutFile "${RTEMS_BINARY}/rtems${PRODUCT_VERSION}-tools-${RTEMS_BUILD_VERSION}.exe"
95BrandingText "RTEMS Tools v${PRODUCT_VERSION}"
96AutoCloseWindow false
97!else
98Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
99OutFile "${RTEMS_BINARY}/${RTEMS_OUTFILE}"
100BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
101AutoCloseWindow true
102!endif
103InstallDir "C:\opt\rtems-${PRODUCT_VERSION}"
104ShowInstDetails show
105ShowUnInstDetails show
106AllowRootDirInstall false
107CRCCheck force
108
109!include "${RTEMS_SOURCE}/instance-check.nsi"
110!include "${RTEMS_SOURCE}/msys-path.nsi"
111!include "${RTEMS_SOURCE}/options.nsi"
112!include "${RTEMS_SOURCE}/filewrite.nsi"
113
114Section -SecFiles
115 AddSize ${RTEMS_TOOLS_SIZE}
116 !insertmacro RTEMS_INSTALL_FILES
117SectionEnd
118
119!ifdef COMMON_FILES
120Section -SecCommon
121 SetOutPath "$INSTDIR"
122 File "${RTEMS_SOURCE}/AUTHORS"
123 File "${RTEMS_SOURCE}/COPYING"
124 File "${RTEMS_SOURCE}/README"
125SectionEnd
126!endif
127
128Function .onInit
129  ;Check if we are the correct instance for our mode.
130  Call CheckInstance
131  ;Extract InstallOptions INI files
132  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini"
133  ;Handle the Command line options
134  Call CheckSilent
135  Call CheckDebug
136  Call MSYSFstabUpdate
137FunctionEnd
138
139Function RTEMSMessage
140  !insertmacro MUI_HEADER_TEXT \
141               "RTEMS Tools (Build ${RTEMS_BUILD_VERSION})" \
142               "A tool set for the RTEMS operating system."
143
144  ;Display the Install Options dialog
145
146  Push $R0
147  Push $R1
148  Push $R2
149
150  InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini"
151  Pop $R0
152
153  GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
154  ;$R1 contains the HWND of the first field
155  CreateFont $R2 "Tahoma" "8" "300"
156  SendMessage $R1 ${WM_SETFONT} $R2 0
157     
158  GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
159  ;$R1 contains the HWND of the first field
160  CreateFont $R2 "Tahoma" "12" "700"
161  SendMessage $R1 ${WM_SETFONT} $R2 0
162     
163  GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1
164  ;$R1 contains the HWND of the first field
165  CreateFont $R2 "Tahoma" "8" "300"
166  SendMessage $R1 ${WM_SETFONT} $R2 0
167     
168  GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1
169  ;$R1 contains the HWND of the first field
170  CreateFont $R2 "Tahoma" "8" "300"
171  SendMessage $R1 ${WM_SETFONT} $R2 0
172     
173  GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1
174  ;$R1 contains the HWND of the first field
175  CreateFont $R2 "Tahoma" "8" "300"
176  SendMessage $R1 ${WM_SETFONT} $R2 0
177     
178  GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1
179  ;$R1 contains the HWND of the first field
180  CreateFont $R2 "Tahoma" "8" "300"
181  SendMessage $R1 ${WM_SETFONT} $R2 0
182     
183  GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1
184  ;$R1 contains the HWND of the first field
185  CreateFont $R2 "Tahoma" "8" "300"
186  SendMessage $R1 ${WM_SETFONT} $R2 0
187     
188  InstallOptions::show
189  Pop $R0
190  Pop $R2
191  Pop $R1
192  Pop $R0
193FunctionEnd
194
195!ifdef COMMON_FILES
196Section -BatchFiles
197 FileOpen $9 $INSTDIR\rtems-env.bat w
198 !insertmacro FILE_WRITE_LINE $9 "@echo off"
199 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
200 !insertmacro FILE_WRITE_LINE $9 "set PATH=$INSTDIR\bin;c:\mingw\bin;c:\msys\1.0\bin;%PATH%"
201 !insertmacro FILE_WRITE_LINE $9 "set PROMPT=RTEMS $$P$$G"
202 !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT_Title"
203 !insertmacro FILE_WRITE_LINE $9 "doskey > Nul"
204 !insertmacro FILE_WRITE_LINE $9 "goto Finished"
205 !insertmacro FILE_WRITE_LINE $9 ":WinNT_Title"
206 !insertmacro FILE_WRITE_LINE $9 "Title RTEMS ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
207 !insertmacro FILE_WRITE_LINE $9 ":Finished"
208 FileClose $9
209
210 FileOpen $9 $INSTDIR\rtems.bat w
211 !insertmacro FILE_WRITE_LINE $9 "@echo off"
212 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
213 !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT"
214 !insertmacro FILE_WRITE_LINE $9 "start command.com /e:4096 /k $INSTDIR\rtems-env.bat %1 %2 %3 %4"
215 !insertmacro FILE_WRITE_LINE $9 "exit"
216 !insertmacro FILE_WRITE_LINE $9 ":WinNT"
217 !insertmacro FILE_WRITE_LINE $9 "start cmd.exe /k $INSTDIR\rtems-env.bat %1 %2 %3 %4"
218 !insertmacro FILE_WRITE_LINE $9 "exit"
219 FileClose $9
220
221 FileOpen $9 $INSTDIR\sh-run.bat w
222 !insertmacro FILE_WRITE_LINE $9 "@echo off"
223 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
224 !insertmacro FILE_WRITE_LINE $9 "rem We can only handle 9 parameters. More is too hard."
225 !insertmacro FILE_WRITE_LINE $9 "call $INSTDIR\rtems-env.bat"
226 !insertmacro FILE_WRITE_LINE $9 "%1 %2 %3 %4 %5 %6 %7 %8 %9"
227 FileClose $9
228
229 FileOpen $9 $INSTDIR\vs-make.sh w
230 !insertmacro FILE_WRITE_LINE $9 "#! /bin/sh"
231 !insertmacro FILE_WRITE_LINE $9 "# RTEMS script: ${RTEMS_VERSION}-${RTEMS_BUILD_VERSION}"
232 !insertmacro FILE_WRITE_LINE $9 "if [ ! -d $$1 ]; then"
233 !insertmacro FILE_WRITE_LINE $9 " echo $\"error: no build directory found$\""
234 !insertmacro FILE_WRITE_LINE $9 " exit 1"
235 !insertmacro FILE_WRITE_LINE $9 "fi"
236 !insertmacro FILE_WRITE_LINE $9 "cd $$1"
237 !insertmacro FILE_WRITE_LINE $9 "shift"
238 !insertmacro FILE_WRITE_LINE $9 "make $$* 2>&1 | sed -e 's/c:\([0-9]*\):/c(\1):/' \\"
239 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/h:\([0-9]*\):/h(\1):/' \\"
240 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/S:\([0-9]*\):/S(\1):/' \\"
241 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/s:\([0-9]*\):/s(\1):/'"
242 FileClose $9
243SectionEnd
244!endif
245
246Section -Post
247!ifdef COMMON_FILES
248 StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-uninst.exe"
249 StrCpy $R1 "RTEMS Tools.lnk"
250!else
251 StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
252 StrCpy $R1 "RTEMS ${RTEMS_TARGET} Tools.lnk"
253 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $smfolder
254!endif
255 WriteUninstaller "$R0"
256 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
257                  "DisplayName" "$(^Name)"
258 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
259                  "UninstallString" "$R0"
260 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
261                  "DisplayVersion" "${PRODUCT_VERSION} Build-${RTEMS_BUILD_VERSION}"
262 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
263                  "URLInfoAbout" "${PRODUCT_WEB_SITE}"
264 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
265                  "Publisher" "${PRODUCT_PUBLISHER}"
266 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
267 CreateDirectory "$SMPROGRAMS\$smfolder"
268!ifdef COMMON_FILES
269 SetOutPath $INSTDIR
270 WriteIniStr "$INSTDIR\RTEMS.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
271 WriteIniStr "$INSTDIR\RTEMS-Wiki.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}wiki"
272 WriteIniStr "$INSTDIR\RTEMS-Documentation.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}onlinedocs/releases/rtemsdocs-4.7.99.2/share/rtems/html/"
273 WriteIniStr "$INSTDIR\RTEMS-Support.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}support.html"
274 CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Tools.lnk" "$INSTDIR\rtems.bat"
275 CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Website.lnk" "$INSTDIR\RTEMS.url"
276 CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Wiki.lnk" "$INSTDIR\RTEMS-Wiki.url"
277 CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Documentation.lnk" "$INSTDIR\RTEMS-Documentation.url"
278 CreateShortCut "$SMPROGRAMS\$smfolder\RTEMS Support.lnk" "$INSTDIR\RTEMS-Support.url"
279!endif
280 CreateDirectory "$SMPROGRAMS\$smfolder\Uninstall"
281 CreateShortCut "$SMPROGRAMS\$smfolder\Uninstall\$R1" "$R0"
282 !insertmacro MUI_STARTMENU_WRITE_END
283SectionEnd
284
285Function un.onInit
286 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
287            "Are you sure you want to uninstall ${PRODUCT_TITLE} ?" IDYES +2
288 Abort
289FunctionEnd
290
291Section Uninstall
292 SetDetailsView show
293 StrCpy $2 0
294!ifdef COMMON_FILES
295 FindFirst $0 $1 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-*-uninst.exe"
296 Uninstall_Targets:
297  StrCmp $1 "" Uninstall_Targets_Done
298  IntCmp $2 0 0 +3
299  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
300             "You have tools installed. Are you sure you want to uninstall all RTEMS Tools ?" IDYES +2
301    Abort
302  StrCpy $2 1
303  DetailPrint "Uninstalling $1"
304  ExecWait '"$INSTDIR\$1" $SilentOption $DebugOption'
305  Delete $1
306  BringToFront
307  FindNext $0 $1
308  Goto Uninstall_Targets
309 Uninstall_Targets_Done:
310 FindClose $0
311!endif
312 DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
313 DetailPrint "Delete the installed files"
314 !insertmacro RTEMS_DELETE_FILES
315 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $smfolder
316!ifdef COMMON_FILES
317 Delete "$INSTDIR\AUTHORS"
318 Delete "$INSTDIR\COPYING"
319 Delete "$INSTDIR\README"
320 Delete "$INSTDIR\rtems.bat"
321 Delete "$INSTDIR\rtems-env.bat"
322 Delete "$INSTDIR\sh-run.bat"
323 Delete "$INSTDIR\vs-make.sh"
324 Delete "$INSTDIR\RTEMS.url"
325 Delete "$INSTDIR\RTEMS-Wiki.url"
326 Delete "$INSTDIR\RTEMS-Documentation.url"
327 Delete "$INSTDIR\RTEMS-Support.url"
328 RMDir /r "$SMPROGRAMS\$smfolder"
329 Delete "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-uninst.exe"
330!else
331 Delete "$SMPROGRAMS\$smfolder\Uninstall\RTEMS ${RTEMS_TARGET} Tools.lnk"
332 Delete "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
333!endif
334 RMDir "$INSTDIR"
335 DetailPrint "All done."
336!ifdef COMMON_FILES
337 SetAutoClose false
338!else
339 SetAutoClose true
340!endif
341SectionEnd
Note: See TracBrowser for help on using the repository browser.