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

4.104.114.95
Last change on this file since 0e6d50c was 598aab1f, checked in by Chris Johns <chrisj@…>, on Aug 20, 2007 at 2:12:48 AM

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: 9.3 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!define PRODUCT_TITLE     "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
16!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}"
17!define PRODUCT_UNINST_ROOT_KEY "HKLM"
18!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"
19
20; MUI 1.66 compatible ------
21!include "MUI.nsh"
22
23; MUI Settings
24!define MUI_ABORTWARNING
25!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\win-install.ico"
26!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\win-uninstall.ico"
27
28!define MUI_HEADERIMAGE
29!define MUI_HEADERIMAGE_BITMAP "${RTEMS_LOGO}"
30
31!define MUI_COMPONENTSPAGE_SMALLDESC
32
33; Start Menu Support
34!include "${RTEMS_SOURCE}/sm-dummy.nsi"
35var smfolder
36!define MUI_STARTMENUPAGE_DISABLE
37!define MUI_STARTMENUPAGE_DEFAULTFOLDER "RTEMS ${PRODUCT_VERSION}"
38!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
39!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
40!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
41!insertmacro MUI_PAGE_STARTMENU_DUMMY Application $smfolder
42
43; Instfiles page
44!insertmacro MUI_PAGE_INSTFILES
45
46; Uninstaller pages
47!insertmacro MUI_UNPAGE_INSTFILES
48
49; Language files
50!insertmacro MUI_LANGUAGE "English"
51
52; Reserve files
53!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
54
55; MUI end ------
56
57ReserveFile "rtems.ini"
58!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
59
60Name "${PRODUCT_NAME} ${PRODUCT_VERSION} (${RTEMS_TARGET})"
61OutFile "${RTEMS_BINARY}/rtems${PRODUCT_VERSION}-tools-${RTEMS_TARGET}-${RTEMS_BUILD_VERSION}.exe"
62InstallDir "C:\opt\rtems-${PRODUCT_VERSION}"
63ShowInstDetails show
64ShowUnInstDetails show
65BrandingText "RTEMS ${RTEMS_TARGET} Tools v${PRODUCT_VERSION}"
66AllowRootDirInstall false
67AutoCloseWindow true
68CRCCheck force
69
70!include "${RTEMS_SOURCE}/instance-check.nsi"
71!include "${RTEMS_SOURCE}/mingw-path.nsi"
72!include "${RTEMS_SOURCE}/msys-path.nsi"
73!include "${RTEMS_SOURCE}/options.nsi"
74!include "${RTEMS_SOURCE}/filewrite.nsi"
75
76Section "RTEMS ${RTEMS_TARGET} Tools" SecTools
77 SetDetailsView show
78 AddSize ${RTEMS_TOOLS_SIZE}
79
80 Call MSYSFstabUpdate
81
82 /*
83  * Detect if MSYS is installed.
84  */
85 Call MSYSDetect
86 Pop $9
87 StrCmp $9 "not-found" 0 +3
88  MessageBox MB_OK "Could not find a valid MSYS. Please install from http://www.mingw.org/"
89  Abort
90 SetOutPath "$INSTDIR\Uninstall"
91 SetOutPath "$INSTDIR\Packages\Build"
92 SetOutPath "$INSTDIR\Packages\Build"
93 SetOutPath "$INSTDIR\Packages\Source"
94 File "${RTEMS_SOURCE}/build-autotools.sh"
95 File "${RTEMS_SOURCE}/ba-wrap.sh"
96 File "${RTEMS_PACKAGE_SOURCE}/${RTEMS_AUTOCONF_SOURCE}"
97 File "${RTEMS_SOURCE}/autoconf.def"
98 File "${RTEMS_SOURCE}/automake.def"
99 !insertmacro RTEMS_AUTOCONF_PATCHES
100 File "${RTEMS_PACKAGE_SOURCE}/${RTEMS_AUTOMAKE_SOURCE}"
101 !insertmacro RTEMS_AUTOMAKE_PATCHES
102
103 Delete "$INSTDIR\Packages\Source\at-log.txt"
104
105 /*
106  * Need to fix the slashes when using a Unix type shell.
107  */
108 Push "$INSTDIR\Packages\Source\ba-wrap.sh"
109 Push '\\'
110 Pop $R0
111 Call StrSlash
112 Pop $R1
113 Push "$INSTDIR\Packages\Build"
114 Push '\\'
115 Pop $R0
116 Call StrSlash
117 Pop $R2
118
119 /*
120  * Build Autoconf.
121  */
122 Push "$INSTDIR\Packages\Source\autoconf.def"
123 Push '\\'
124 Pop $R0
125 Call StrSlash
126 Pop $R0
127 DetailPrint "Building automake. Command window closes automatically. Debug:$DebugScriptOption"
128 ExecWait '"$9\bin\sh" --login -c "$R1 $DebugScriptOption -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
129 BringToFront
130 IntCmp $0 0 +3
131  MessageBox MB_OK "Autoconf build failed. See $INSTDIR\Packages\Source\at-log.txt"
132  Abort
133
134 BringToFront
135
136 Push "$INSTDIR\Uninstall\${RTEMS_AUTOCONF}-files"
137 call InstallFilesFromFile
138
139 /*
140  * Build Automake.
141  */
142 Push "$INSTDIR\Packages\Source\automake.def"
143 Push '\\'
144 Pop $R0
145 Call StrSlash
146 Pop $R0
147 DetailPrint "Building automake. Command window closes automatically. Debug:$DebugScriptOption"
148 ExecWait '"$9\bin\sh" --login -c "$R1 $DebugScriptOption -p /opt/rtems-${PRODUCT_VERSION} -b $R2 -c $R0"' $0
149 BringToFront
150 IntCmp $0 0 +3
151  MessageBox MB_OK "Automake build failed. See $INSTDIR\Packages\Source\at-log.txt"
152  Abort
153
154 BringToFront
155
156 Push "$INSTDIR\Uninstall\${RTEMS_AUTOMAKE}-files"
157 call InstallFilesFromFile
158
159 DetailPrint "Removing Build directory"
160 RMDir /r "$INSTDIR\Packages\Build"
161SectionEnd
162
163Function .onInit
164  ;Check if we are the correct instance for our mode.
165  Call CheckInstance
166  ;Handle the Command line options
167  Call CheckSilent
168  Call CheckDebug
169  ;See if MinGW and MSYS are installed
170  Call MinGWDetect
171  Call MSYSDetect
172FunctionEnd
173
174Var FileList
175
176Function InstallFilesFromFile
177  Pop $R6
178  Push $R7
179  Push $R8
180  Push $R9
181  DetailPrint "Installing file list: $R6"
182  SetFileAttributes "$R6" NORMAL
183  FileOpen $FileList "$R6" r
184  IfErrors 0 +3
185   MessageBox MB_OK "Internal error reading file list (0:$R6)."
186   Abort
187 ReadLoop:
188  FileRead $FileList $R7
189  IfErrors Done
190  StrCpy $R7 $R7 -1 # has a \n only at the end
191  StrCpy $R8 $R7
192  StrCpy $R7 $R7 1  # first character on the line
193  StrCpy $R8 $R8 256 2
194  StrCmpS $R7 "D" ReadLoop
195  StrCmpS $R7 "b" 0 +3
196   StrCpy $R9 $R8
197   Goto ReadLoop
198  StrCmpS $R7 "d" 0 +3
199   CreateDirectory "$INSTDIR\$R8"
200   Goto ReadLoop
201  StrCmpS $R7 "f" 0 +3
202   CopyFiles /SILENT "$INSTDIR\Packages\Build\$R9\$R8" "$INSTDIR\$R8" 
203   Goto ReadLoop
204  MessageBox MB_OK "Internal error installing package (2:$R6)."
205  Abort
206 Done:
207  FileClose $FileList
208  ClearErrors
209  Pop $R9
210  Pop $R8
211  Pop $R7
212FunctionEnd
213
214Function un.RemoveFilesFromFile
215  ; Two passes, one to delete files then the directories
216  ; This is due to the order in the *-files list. Plus
217  ; RMDir seems to stuff things up (maybe a NSIS bug!)
218  Pop $R6
219  Push $R7
220  Push $R8
221  Push $R9
222  DetailPrint "Delete file list: $R6"
223  SetFileAttributes "$R6" NORMAL
224  FileOpen $FileList "$R6" r
225  IfErrors 0 +3
226   MessageBox MB_OK "Internal error reading file list (0:$R6)."
227   Abort
228 ReadLoop:
229  FileRead $FileList $R7
230  IfErrors Pass2
231  StrCpy $R7 $R7 -1 # has a \n only at the end
232  StrCpy $R8 $R7
233  StrCpy $R7 $R7 1  # first character on the line
234  StrCpy $R8 $R8 256 2
235  StrCmp $R7 "b" ReadLoop
236  StrCmp $R7 "d" ReadLoop
237  StrCmp $R7 "D" ReadLoop
238  StrCmp $R7 "f" 0 +3
239   Delete "$INSTDIR\$R8"
240   Goto ReadLoop
241  MessageBox MB_OK "Internal error removing package (2:$R6)."
242  Abort
243 Pass2:
244  ClearErrors
245  FileSeek $FileList 0 SET
246 ReadLoop2:
247  FileRead $FileList $R7
248  IfErrors Done
249  StrCpy $R7 $R7 -1 # has a \n only at the end
250  StrCpy $R8 $R7
251  StrCpy $R7 $R7 1  # first character on the line
252  StrCpy $R8 $R8 256 2
253  StrCmpS $R7 "b" ReadLoop2
254  StrCmpS $R7 "d" ReadLoop2
255  StrCmpS $R7 "f" ReadLoop2
256  StrCmpS $R7 "D" 0 Fail
257   ifFileExists "$INSTDIR\$R8\*.*" 0 ReadLoop2
258    RMDir "$INSTDIR\$R8"  #is dir
259   Delete "$INSTDIR\$R8"
260   ClearErrors
261   Goto ReadLoop2
262 Fail:
263  MessageBox MB_OK "Internal error removing package (2:$R6)."
264  Abort
265 Done:
266  FileClose $FileList
267  ClearErrors
268  Delete $R6
269  Pop $R9
270  Pop $R8
271  Pop $R7
272FunctionEnd
273
274Section -Post
275 StrCpy $R0 "$INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe"
276 StrCpy $R1 "RTEMS ${RTEMS_TARGET} Tools.lnk"
277 WriteUninstaller "$R0"
278 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
279                  "DisplayName" "$(^Name)"
280 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
281                  "UninstallString" "$R0"
282 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
283                  "DisplayVersion" "${PRODUCT_VERSION} Build-${RTEMS_BUILD_VERSION}"
284 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
285                  "URLInfoAbout" "${PRODUCT_WEB_SITE}"
286 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}" \
287                  "Publisher" "${PRODUCT_PUBLISHER}"
288 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $R2
289 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
290 CreateDirectory "$SMPROGRAMS\$R2"
291 CreateDirectory "$SMPROGRAMS\$R2\Uninstall"
292 CreateShortCut "$SMPROGRAMS\$R2\Uninstall\$R1" "$R0"
293 !insertmacro MUI_STARTMENU_WRITE_END
294SectionEnd
295
296Section Uninstall
297 SetDetailsView show
298 DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_TITLE}"
299 DetailPrint "Delete the installed files"
300 Push "$INSTDIR\Uninstall\${RTEMS_AUTOCONF}-files"
301 call un.RemoveFilesFromFile
302 Push "$INSTDIR\Uninstall\${RTEMS_AUTOMAKE}-files"
303 call un.RemoveFilesFromFile
304 RMDir "$INSTDIR\Uninstall"
305 Delete "$INSTDIR\Packages\Source\build-autotools.sh"
306 Delete "$INSTDIR\Packages\Source\ba-wrap.sh"
307 Delete "$INSTDIR\Packages\Source\${RTEMS_AUTOCONF_SOURCE}"
308 Delete "$INSTDIR\Packages\Source\${RTEMS_AUTOMAKE_SOURCE}"
309 Delete "$INSTDIR\Packages\Source\autoconf.def"
310 Delete "$INSTDIR\Packages\Source\automake.def"
311 Delete "$INSTDIR\Packages\Source\at-log.txt"
312 !insertmacro RTEMS_DELETE_AUTOCONF_PATCHES
313 !insertmacro RTEMS_DELETE_AUTOMAKE_PATCHES
314 RMDir "$INSTDIR\Packages\Source"
315 RMDir "$INSTDIR\Packages\Build"
316 !insertmacro MUI_STARTMENU_GETFOLDER "Application" $smfolder
317 Delete "$SMPROGRAMS\$smfolder\Uninstall\RTEMS ${RTEMS_TARGET} Tools.lnk"
318 Delete $INSTDIR\rtems${PRODUCT_VERSION}-${RTEMS_BUILD_VERSION}-tools-${RTEMS_TARGET}-uninst.exe
319 RMDir "$INSTDIR"
320 DetailPrint "All done."
321 SetAutoClose true
322SectionEnd
Note: See TracBrowser for help on using the repository browser.