source: rtems/contrib/mingw/rtems-autotools.nsi @ f6cd0db

4.104.114.84.95
Last change on this file since f6cd0db was f6cd0db, checked in by Chris Johns <chrisj@…>, on Jul 28, 2007 at 8:31:57 AM

2007-07-28 Chris Johns <chisj@…>

  • README, build-rpms.sh, rtems.ini, build-exes.sh, rtems-tools.nsi: Updated to the new 4.8 build plus a new installer.
  • autoconf.def, automake.def, ba-wrap.sh, build-autotools.sh, msys-path.nsi, rtems-autotools.nsi, target-section-text, upload.sh, version: New to version 4.8. Autotools is built when installing.
  • Property mode set to 100644
File size: 10.2 KB
Line 
1;
2; $Id$
3;
4; RTEMS Autotools Installer.
5;
6; Copyright Chris Johns (chrisj@rtems.org)
7;
8
9;!define EMPTY_INSTALLER
10
11!define PRODUCT_NAME      "RTEMS Autotools"
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}-tools-${RTEMS_TARGET}-${RTEMS_BUILD_VERSION}.exe"
61InstallDir "C:\opt\rtems-${PRODUCT_VERSION}"
62ShowInstDetails show
63ShowUnInstDetails show
64BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
65AllowRootDirInstall false
66AutoCloseWindow false
67CRCCheck force
68
69!include "${RTEMS_SOURCE}/msys-path.nsi"
70
71Section "RTEMS ${RTEMS_TARGET} Tools" SecTools
72 SetDetailsView show
73
74 /*
75  * Detect if MSYS is installed.
76  */
77 Call MSYSDetect
78 Pop $9
79
80 SetOutPath "$INSTDIR\Uninstall"
81 SetOutPath "$INSTDIR\Packages\Build"
82 SetOutPath "$INSTDIR\Packages\Build"
83 SetOutPath "$INSTDIR\Packages\Source"
84 File "${RTEMS_SOURCE}/build-autotools.sh"
85 File "${RTEMS_SOURCE}/ba-wrap.sh"
86 File "${RTEMS_PACKAGE_SOURCE}/${RTEMS_AUTOCONF_SOURCE}"
87 File "${RTEMS_SOURCE}/autoconf.def"
88 File "${RTEMS_SOURCE}/automake.def"
89 !insertmacro RTEMS_AUTOCONF_PATCHES
90 File "${RTEMS_PACKAGE_SOURCE}/${RTEMS_AUTOMAKE_SOURCE}"
91 !insertmacro RTEMS_AUTOMAKE_PATCHES
92
93 Delete "$INSTDIR\Packages\Source\at-log.txt"
94
95 /*
96  * Need to fix the slashes when using a Unix type shell.
97  */
98 Push "$INSTDIR\Packages\Source\ba-wrap.sh"
99 Push '\\'
100 Pop $R0
101 Call StrSlash
102 Pop $R1
103 Push "$INSTDIR\Packages\Build"
104 Push '\\'
105 Pop $R0
106 Call StrSlash
107 Pop $R2
108
109 /*
110  * Build Autoconf.
111  */
112 Push "$INSTDIR\Packages\Source\autoconf.def"
113 Push '\\'
114 Pop $R0
115 Call StrSlash
116 Pop $R0
117 DetailPrint "Building autoconf. Command window closes automatically."
118 ExecWait '"$9\bin\sh" --login -c "$R1 -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
119 BringToFront
120 IntCmp $0 0 +3
121  MessageBox MB_OK "Autoconf build failed. See $INSTDIR\Packages\Source\at-log.txt"
122  Abort
123
124 BringToFront
125
126 Push "$INSTDIR\Uninstall\${RTEMS_AUTOCONF}-files"
127 call InstallFilesFromFile
128
129 /*
130  * Build Automake.
131  */
132 Push "$INSTDIR\Packages\Source\automake.def"
133 Push '\\'
134 Pop $R0
135 Call StrSlash
136 Pop $R0
137 DetailPrint "Building automake. Command window closes automatically."
138 ExecWait '"$9\bin\sh" --login -c "$R1 -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
139 BringToFront
140 IntCmp $0 0 +3
141  MessageBox MB_OK "Automake build failed. See $INSTDIR\Packages\Source\at-log.txt"
142  Abort
143
144 BringToFront
145
146 Push "$INSTDIR\Uninstall\${RTEMS_AUTOMAKE}-files"
147 call InstallFilesFromFile
148
149 DetailPrint "Removing Build directory"
150 RMDir /r "$INSTDIR\Packages\Build"
151SectionEnd
152
153!macro FILE_WRITE_LINE Handle Text
154  FileWrite     ${Handle} `${Text}`
155  FileWriteByte ${Handle} "13"
156  FileWriteByte ${Handle} "10"
157!macroend
158
159Function .onInit
160  ;Extract InstallOptions INI files
161  !insertmacro MUI_INSTALLOPTIONS_EXTRACT "rtems.ini"
162FunctionEnd
163
164Function RTEMSMessage
165
166  !insertmacro MUI_HEADER_TEXT \
167               "RTEMS Tools (Autoconf/Automake)" \
168               "A tool set for the RTEMS operating system."
169
170  ;Display the Install Options dialog
171
172  Push $R0
173  Push $R1
174  Push $R2
175
176    InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\rtems.ini"
177    Pop $R0
178
179    GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
180    ;$R1 contains the HWND of the first field
181    CreateFont $R2 "Tahoma" "8" "300"
182    SendMessage $R1 ${WM_SETFONT} $R2 0
183       
184    GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
185    ;$R1 contains the HWND of the first field
186    CreateFont $R2 "Tahoma" "12" "700"
187    SendMessage $R1 ${WM_SETFONT} $R2 0
188       
189    GetDlgItem $R1 $R0 1202 ;1200 + Field number - 1
190    ;$R1 contains the HWND of the first field
191    CreateFont $R2 "Tahoma" "8" "300"
192    SendMessage $R1 ${WM_SETFONT} $R2 0
193       
194    GetDlgItem $R1 $R0 1203 ;1200 + Field number - 1
195    ;$R1 contains the HWND of the first field
196    CreateFont $R2 "Tahoma" "8" "300"
197    SendMessage $R1 ${WM_SETFONT} $R2 0
198       
199    GetDlgItem $R1 $R0 1204 ;1200 + Field number - 1
200    ;$R1 contains the HWND of the first field
201    CreateFont $R2 "Tahoma" "8" "300"
202    SendMessage $R1 ${WM_SETFONT} $R2 0
203       
204    GetDlgItem $R1 $R0 1205 ;1200 + Field number - 1
205    ;$R1 contains the HWND of the first field
206    CreateFont $R2 "Tahoma" "8" "300"
207    SendMessage $R1 ${WM_SETFONT} $R2 0
208       
209    GetDlgItem $R1 $R0 1206 ;1200 + Field number - 1
210    ;$R1 contains the HWND of the first field
211    CreateFont $R2 "Tahoma" "8" "300"
212    SendMessage $R1 ${WM_SETFONT} $R2 0
213       
214    InstallOptions::show
215    Pop $R0
216
217  Pop $R2
218  Pop $R1
219  Pop $R0
220
221FunctionEnd
222
223Var FileList
224
225Function InstallFilesFromFile
226  Pop $R6
227  Push $R7
228  Push $R8
229  Push $R9
230  DetailPrint "Installing file list: $R6"
231  SetFileAttributes "$R6" NORMAL
232  FileOpen $FileList "$R6" r
233  IfErrors 0 +3
234   MessageBox MB_OK "Internal error reading file list (0:$R6)."
235   Abort
236 ReadLoop:
237  FileRead $FileList $R7
238  IfErrors Done
239  StrCpy $R7 $R7 -1 # has a \n only at the end
240  StrCpy $R8 $R7
241  StrCpy $R7 $R7 1  # first character on the line
242  StrCpy $R8 $R8 256 2
243  StrCmpS $R7 "D" ReadLoop
244  StrCmpS $R7 "b" 0 +3
245   StrCpy $R9 $R8
246   Goto ReadLoop
247  StrCmpS $R7 "d" 0 +3
248   CreateDirectory "$INSTDIR\$R8"
249   Goto ReadLoop
250  StrCmpS $R7 "f" 0 +3
251   CopyFiles /SILENT "$INSTDIR\Packages\Build\$R9\$R8" "$INSTDIR\$R8" 
252   Goto ReadLoop
253  MessageBox MB_OK "Internal error installing package (2:$R6)."
254  Abort
255 Done:
256  FileClose $FileList
257  ClearErrors
258  Pop $R9
259  Pop $R8
260  Pop $R7
261FunctionEnd
262
263Function un.RemoveFilesFromFile
264  ; Two passes, one to delete files then the directories
265  ; This is due to the order in the *-files list. Plus
266  ; RMDir seems to stuff things up (maybe a NSIS bug!)
267  Pop $R6
268  Push $R7
269  Push $R8
270  Push $R9
271  DetailPrint "Delete file list: $R6"
272  SetFileAttributes "$R6" NORMAL
273  FileOpen $FileList "$R6" r
274  IfErrors 0 +3
275   MessageBox MB_OK "Internal error reading file list (0:$R6)."
276   Abort
277 ReadLoop:
278  FileRead $FileList $R7
279  IfErrors Pass2
280  StrCpy $R7 $R7 -1 # has a \n only at the end
281  StrCpy $R8 $R7
282  StrCpy $R7 $R7 1  # first character on the line
283  StrCpy $R8 $R8 256 2
284  StrCmp $R7 "b" ReadLoop
285  StrCmp $R7 "d" ReadLoop
286  StrCmp $R7 "D" ReadLoop
287  StrCmp $R7 "f" 0 +3
288   Delete "$INSTDIR\$R8"
289   Goto ReadLoop
290  MessageBox MB_OK "Internal error removing package (2:$R6)."
291  Abort
292 Pass2:
293  ClearErrors
294  FileSeek $FileList 0 SET
295 ReadLoop2:
296  FileRead $FileList $R7
297  IfErrors Done
298  StrCpy $R7 $R7 -1 # has a \n only at the end
299  StrCpy $R8 $R7
300  StrCpy $R7 $R7 1  # first character on the line
301  StrCpy $R8 $R8 256 2
302  StrCmpS $R7 "b" ReadLoop2
303  StrCmpS $R7 "d" ReadLoop2
304  StrCmpS $R7 "f" ReadLoop2
305  StrCmpS $R7 "D" 0 Fail
306   ifFileExists "$INSTDIR\$R8\*.*" 0 ReadLoop2
307    RMDir "$INSTDIR\$R8"  #is dir
308   Delete "$INSTDIR\$R8"
309   ClearErrors
310   Goto ReadLoop2
311 Fail:
312  MessageBox MB_OK "Internal error removing package (2:$R6)."
313  Abort
314 Done:
315  FileClose $FileList
316  ClearErrors
317  Delete $R6
318  Pop $R9
319  Pop $R8
320  Pop $R7
321FunctionEnd
322
323; Push $filenamestring (e.g. 'c:\this\and\that\filename.htm')
324; Push '\\'
325; Pop $R0
326; Call StrSlash
327; Pop $R0
328; ;Now $R0 contains 'c:/this/and/that/filename.htm'
329Function StrSlash
330 Exch $R0
331 Push $R1
332 Push $R2
333 StrCpy $R1 0
334loop:
335  IntOp $R1 $R1 - 1
336  StrCpy $R2 $R0 1 $R1
337  StrCmp $R2 "" done
338 StrCmp $R2 "\" 0 loop ;" keep to get Emacs for fontlock
339  StrCpy $R2 $R0 $R1
340   Push $R1
341  IntOp $R1 $R1 + 1
342  StrCpy $R1 $R0 "" $R1
343 StrCpy $R0 "$R2/$R1"
344   Pop $R1
345  IntOp $R1 $R1 - 1
346 Goto loop
347done:
348 Pop $R2
349 Pop $R1
350 Exch $R0
351FunctionEnd
352
353Section -Post
354 WriteUninstaller "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
355 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
356                  "DisplayName" "$(^Name)"
357 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
358                  "UninstallString" "$INSTDIR\uninst.exe"
359 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
360                  "DisplayVersion" "${PRODUCT_VERSION}"
361 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
362                  "URLInfoAbout" "${PRODUCT_WEB_SITE}"
363 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
364                  "Publisher" "${PRODUCT_PUBLISHER}"
365SectionEnd
366
367Section Uninstall
368 SetDetailsView show
369 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
370 DetailPrint "Delete the installed files"
371 Push "$INSTDIR\Uninstall\${RTEMS_AUTOCONF}-files"
372 call un.RemoveFilesFromFile
373 Push "$INSTDIR\Uninstall\${RTEMS_AUTOMAKE}-files"
374 call un.RemoveFilesFromFile
375 RMDir "$INSTDIR\Uninstall"
376 Delete "$INSTDIR\Packages\Source\build-autotools.sh"
377 Delete "$INSTDIR\Packages\Source\ba-wrap.sh"
378 Delete "$INSTDIR\Packages\Source\${RTEMS_AUTOCONF_SOURCE}"
379 Delete "$INSTDIR\Packages\Source\${RTEMS_AUTOMAKE_SOURCE}"
380 Delete "$INSTDIR\Packages\Source\autoconf.def"
381 Delete "$INSTDIR\Packages\Source\automake.def"
382 Delete "$INSTDIR\Packages\Source\at-log.txt"
383 !insertmacro RTEMS_DELETE_AUTOCONF_PATCHES
384 !insertmacro RTEMS_DELETE_AUTOMAKE_PATCHES
385 RMDir "$INSTDIR\Packages\Source"
386 RMDir "$INSTDIR\Packages\Build"
387 Delete $INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe
388 RMDir "$INSTDIR"
389 DetailPrint "All done."
390 SetAutoClose false
391SectionEnd
Note: See TracBrowser for help on using the repository browser.