source: rtems/contrib/mingw/rtems-tools.nsi @ 2ba11f8

4.104.114.84.95
Last change on this file since 2ba11f8 was 2ba11f8, checked in by Chris Johns <chrisj@…>, on Aug 27, 2006 at 12:45:28 PM

Set the prefix into the MSYS fstab, This is a hack but it works.

  • Property mode set to 100644
File size: 8.3 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 "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.
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})"
60OutFile "${RTEMS_BINARY}/rtems${PRODUCT_VERSION}-${RTEMS_TARGET}-${RTEMS_BUILD_VERSION}.exe"
61InstallDir "C:\rtems\${RTEMS_TARGET}"
62ShowInstDetails show
63ShowUnInstDetails show
64BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
65AllowRootDirInstall false
66AutoCloseWindow false
67CRCCheck force
68
69Section "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
75SectionEnd
76
77!macro FILE_WRITE_LINE Handle Text
78  FileWrite     ${Handle} `${Text}`
79  FileWriteByte ${Handle} "13"
80  FileWriteByte ${Handle} "10"
81!macroend
82
83Function .onInit
84  ;Extract InstallOptions INI files
85  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini"
86FunctionEnd
87
88Function 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
145FunctionEnd
146
147; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
148; Push '\\'
149; Pop $R0
150; Call StrSlash
151; Pop $R0
152; ;Now $R0 contains 'c:/this/and/that/filename.htm'
153Function StrSlash
154 Exch $R0
155 Push $R1
156 Push $R2
157 StrCpy $R1 0
158loop:
159  IntOp $R1 $R1 - 1
160  StrCpy $R2 $R0 1 $R1
161  StrCmp $R2 "" done
162 StrCmp $R2 "\" 0 loop
163  StrCpy $R2 $R0 $R1
164   Push $R1
165  IntOp $R1 $R1 + 1
166  StrCpy $R1 $R0 "" $R1
167 StrCpy $R0 "$R2/$R1"
168   Pop $R1
169  IntOp $R1 $R1 - 1
170 Goto loop
171done:
172 Pop $R2
173 Pop $R1
174 Exch $R0
175FunctionEnd
176
177Section -BatchFiles
178 FileOpen $9 $INSTDIR\rtems.bat w
179 !insertmacro FILE_WRITE_LINE $9 "@echo off"
180 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_TARGET} (${RTEMS_VERSION})"
181 !insertmacro FILE_WRITE_LINE $9 "set PATH=$INSTDIR\bin;c:\mingw\bin;c:\msys\1.0\bin;%PATH%"
182 !insertmacro FILE_WRITE_LINE $9 "set PROMPT=RTEMS(${RTEMS_TARGET}) $$P$$G"
183 !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT_Title"
184 !insertmacro FILE_WRITE_LINE $9 "doskey > Nul"
185 !insertmacro FILE_WRITE_LINE $9 "goto Finished"
186 !insertmacro FILE_WRITE_LINE $9 ":WinNT_Title"
187 !insertmacro FILE_WRITE_LINE $9 "Title RTEMS(${RTEMS_TARGET})"
188 !insertmacro FILE_WRITE_LINE $9 ":Finished"
189 FileClose $9
190
191 FileOpen $9 $INSTDIR\rtems-cmd.bat w
192 !insertmacro FILE_WRITE_LINE $9 "@echo off"
193 !insertmacro FILE_WRITE_LINE $9 "rem RTEMS batch file: ${RTEMS_TARGET} (${RTEMS_VERSION})"
194 !insertmacro FILE_WRITE_LINE $9 "If $\"x%OS%x$\" == $\"xWindows_NTx$\" Goto WinNT"
195 !insertmacro FILE_WRITE_LINE $9 "start command.com /e:4096 /k $INSTDIR\rtems.bat %1 %2 %3 %4"
196 !insertmacro FILE_WRITE_LINE $9 "exit"
197 !insertmacro FILE_WRITE_LINE $9 ":WinNT"
198 !insertmacro FILE_WRITE_LINE $9 "start cmd.exe /k $INSTDIR\rtems.bat %1 %2 %3 %4"
199 !insertmacro FILE_WRITE_LINE $9 "exit"
200 FileClose $9
201
202 FileOpen $9 $INSTDIR\sh-run.bat w
203 !insertmacro FILE_WRITE_LINE $9 "@echo off"
204 !insertmacro FILE_WRITE_LINE $9 "rem We can only handle 9 parameters. More is too hard."
205 !insertmacro FILE_WRITE_LINE $9 "call $INSTDIR\rtems.bat"
206 !insertmacro FILE_WRITE_LINE $9 "%1 %2 %3 %4 %5 %6 %7 %8 %9"
207 FileClose $9
208
209 FileOpen $9 $INSTDIR\vs-make.sh w
210 !insertmacro FILE_WRITE_LINE $9 "#! /bin/sh"
211 !insertmacro FILE_WRITE_LINE $9 "if [ ! -d $$1 ]; then"
212 !insertmacro FILE_WRITE_LINE $9 " echo $\"error: no build directory found$\""
213 !insertmacro FILE_WRITE_LINE $9 " exit 1"
214 !insertmacro FILE_WRITE_LINE $9 "fi"
215 !insertmacro FILE_WRITE_LINE $9 "cd $$1"
216 !insertmacro FILE_WRITE_LINE $9 "shift"
217 !insertmacro FILE_WRITE_LINE $9 "make $$* 2>&1 | sed -e 's/c:\([0-9]*\):/c(\1):/' \\"
218 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/h:\([0-9]*\):/h(\1):/' \\"
219 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/S:\([0-9]*\):/S(\1):/' \\"
220 !insertmacro FILE_WRITE_LINE $9 "                   -e 's/s:\([0-9]*\):/s(\1):/'"
221 FileClose $9
222SectionEnd
223
224Section -MSYSLinks
225 FindFirst $8 $1 c:\msys\1.0\etc\fstab
226 StrCmp $1 "" MSYSLinksdone
227  Push $INSTDIR
228  Call StrSlash
229  Pop $R0
230  DetailPrint "Setting MSYS fstab: $R0 -> ${TOOL_PREFIX}"
231  FileOpen $9 "c:\msys\1.0\etc\fstab" a
232  FileSeek $9 0 END
233  FileWrite $9 $R0
234  FileWriteByte $9 "32"
235  FileWrite $9 ${TOOL_PREFIX}
236  FileWriteByte $9 "10"
237  FileClose $9
238 MSYSLinksdone:
239 FindClose $8
240SectionEnd
241
242Section -Post
243 WriteUninstaller "$INSTDIR\rtems-${RTEMS_TARGET}-uninst.exe"
244 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
245                  "DisplayName" "$(^Name)"
246 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
247                  "UninstallString" "$INSTDIR\uninst.exe"
248 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
249                  "DisplayVersion" "${PRODUCT_VERSION}"
250 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
251                  "URLInfoAbout" "${PRODUCT_WEB_SITE}"
252 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
253                  "Publisher" "${PRODUCT_PUBLISHER}"
254SectionEnd
255
256Function un.onInit
257 MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 \
258            "Are you sure you want to uninstall RTEMS Tools?" IDYES +2
259 Abort
260FunctionEnd
261
262Section Uninstall
263 Delete $INSTDIR\rtems-${RTEMS_TARGET}-uninst.exe
264 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
265 DetailPrint "Delete the install directory"
266 Delete "$INSTDIR\AUTHORS"
267 Delete "$INSTDIR\COPYING"
268 Delete "$INSTDIR\README"
269 Delete "$INSTDIR\rtems.bat"
270 Delete "$INSTDIR\rtems-cmd.bat"
271 Delete "$INSTDIR\sh-run.bat"
272 Delete "$INSTDIR\vs-make.sh"
273 !insertmacro RTEMS_DELETE_FILES
274 DetailPrint "All done."
275 SetAutoClose true
276SectionEnd
Note: See TracBrowser for help on using the repository browser.