[598aab1f] | 1 | ; |
---|
| 2 | ; $Id$ |
---|
| 3 | ; |
---|
| 4 | ; RTEMS Tools Installer. |
---|
| 5 | ; |
---|
| 6 | ; Copyright Chris Johns (chrisj@rtems.org) |
---|
| 7 | ; |
---|
| 8 | |
---|
| 9 | !include "${RTEMS_SOURCE}/strslash.nsi" |
---|
| 10 | |
---|
[f6cd0db] | 11 | Function MsysPath |
---|
| 12 | Push $R0 |
---|
| 13 | ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MSYS-1.0_is1" "Inno Setup: App Path" |
---|
| 14 | Exch $R0 |
---|
| 15 | FunctionEnd |
---|
| 16 | |
---|
| 17 | Function MsysDTKPath |
---|
| 18 | Push $R0 |
---|
| 19 | ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\MSYS-DTK_is1" "Inno Setup: App Path" |
---|
| 20 | Exch $R0 |
---|
| 21 | FunctionEnd |
---|
| 22 | |
---|
| 23 | Function MSYSCheckExes |
---|
| 24 | Exch $R0 |
---|
| 25 | DetailPrint "Checking for MSYS $R0\bin\sh.exe." |
---|
| 26 | IfFileExists "$R0\bin\sh.exe" +5 0 |
---|
| 27 | DetailPrint "Could not find $R0\bin\sh.exe." |
---|
| 28 | StrCpy $R0 "$R0\bin\sh.exe" |
---|
| 29 | Exch $R0 |
---|
| 30 | Return |
---|
| 31 | DetailPrint "Checking for MSYS $R0\bin\m4.exe." |
---|
| 32 | IfFileExists "$R0\bin\m4.exe" +5 0 |
---|
| 33 | DetailPrint "Could not find $R0\bin\m4.exe." |
---|
| 34 | StrCpy $R0 "$R0\bin\m4.exe" |
---|
| 35 | Exch $R0 |
---|
| 36 | Return |
---|
| 37 | DetailPrint "Checking for MSYS $R0\bin\perl.exe." |
---|
| 38 | IfFileExists "$R0\bin\perl.exe" +5 0 |
---|
| 39 | DetailPrint "Could not find $R0\bin\perl.exe." |
---|
| 40 | StrCpy $R0 "$R0\bin\perl.exe" |
---|
| 41 | Exch $R0 |
---|
| 42 | Return |
---|
| 43 | StrCpy $R0 "ok" |
---|
| 44 | Exch $R0 |
---|
| 45 | FunctionEnd |
---|
| 46 | |
---|
| 47 | Function MSYSDetect |
---|
| 48 | Push $R0 |
---|
| 49 | Push $R1 |
---|
| 50 | StrCpy $R1 "c:\msys\1.0" |
---|
| 51 | DetailPrint "Checking MSYS default install path: $R1" |
---|
| 52 | Push $R1 |
---|
| 53 | Call MSYSCheckExes |
---|
| 54 | Pop $R0 |
---|
| 55 | StrCmp $R0 "ok" Found |
---|
| 56 | DetailPrint "Checking Registry for MSYS Installed Path" |
---|
| 57 | Call MsysPath |
---|
| 58 | Pop $R0 |
---|
| 59 | ifErrors 0 +3 |
---|
[56f6b907] | 60 | MessageBox MB_OK "MSYS Not Installed. Please install MSYS from http://www.mingw.org/" |
---|
[f6cd0db] | 61 | Abort |
---|
| 62 | DetailPrint "Checking Registry for MSYS DTK Installed Path" |
---|
| 63 | Call MsysDTKPath |
---|
| 64 | Pop $R1 |
---|
| 65 | ifErrors 0 +3 |
---|
[56f6b907] | 66 | MessageBox MB_OK "MSYS DTK Not Installed. Please install MSYS DTK from http://www.mingw.org/" |
---|
[f6cd0db] | 67 | Abort |
---|
| 68 | StrCmp $R0 $R1 +3 0 |
---|
| 69 | MessageBox MB_OK "MSYS and MSYS DTK installed to different paths. This is not supported." |
---|
| 70 | Abort |
---|
| 71 | Push $R0 |
---|
| 72 | Call MSYSCheckExes |
---|
| 73 | Pop $R0 |
---|
| 74 | StrCmp $R0 "ok" Found |
---|
[56f6b907] | 75 | MessageBox MB_OK "MSYS Executable '$R0' not found. Please install from http://www.mingw.org/" |
---|
[f6cd0db] | 76 | Abort |
---|
| 77 | Found: |
---|
| 78 | StrCpy $R0 $R1 |
---|
| 79 | DetailPrint "MSYS Found: $R0" |
---|
| 80 | Pop $R1 |
---|
| 81 | Exch $R0 |
---|
| 82 | FunctionEnd |
---|
| 83 | |
---|
| 84 | Function MSYSDetectSilent |
---|
| 85 | Push $R0 |
---|
| 86 | Push $R1 |
---|
| 87 | StrCpy $R1 "c:\msys\1.0" |
---|
| 88 | DetailPrint "Checking MSYS default install path: $R1" |
---|
| 89 | Push $R1 |
---|
| 90 | Call MSYSCheckExes |
---|
| 91 | Pop $R0 |
---|
| 92 | StrCmp $R0 "ok" Done |
---|
| 93 | DetailPrint "Checking Registry for MSYS Installed Path" |
---|
| 94 | Call MsysPath |
---|
| 95 | Pop $R0 |
---|
| 96 | ifErrors 0 +3 |
---|
| 97 | StrCpy $R1 "not-found" |
---|
| 98 | Goto Done |
---|
| 99 | DetailPrint "Checking Registry for MSYS DTK Installed Path" |
---|
| 100 | Call MsysDTKPath |
---|
| 101 | Pop $R1 |
---|
| 102 | ifErrors 0 +3 |
---|
| 103 | StrCpy $R1 "not-found" |
---|
| 104 | Goto Done |
---|
| 105 | StrCmp $R0 $R1 +3 0 |
---|
| 106 | StrCpy $R1 "not-found" |
---|
| 107 | Goto Done |
---|
| 108 | Push $R0 |
---|
| 109 | Call MSYSCheckExes |
---|
| 110 | Pop $R0 |
---|
| 111 | StrCmp $R0 "ok" Done |
---|
| 112 | StrCpy $R1 "not-found" |
---|
| 113 | Goto Done |
---|
| 114 | Done: |
---|
| 115 | StrCpy $R0 $R1 |
---|
| 116 | DetailPrint "MSYS Result: $R0" |
---|
| 117 | Pop $R1 |
---|
| 118 | Exch $R0 |
---|
| 119 | FunctionEnd |
---|
[598aab1f] | 120 | |
---|
| 121 | Function MSYSFstabUpdate |
---|
| 122 | Call MSYSDetectSilent |
---|
| 123 | Pop $R0 |
---|
| 124 | Push $R0 |
---|
| 125 | Push $INSTDIR |
---|
| 126 | Push '\\' |
---|
| 127 | Pop $R0 |
---|
| 128 | Call StrSlash |
---|
| 129 | Pop $R1 |
---|
| 130 | Pop $R0 |
---|
| 131 | DetailPrint "Setting MSYS fstab: $R1 -> /opt/rtems-${PRODUCT_VERSION}" |
---|
| 132 | StrCpy $R1 "$R1 /opt/rtems-${PRODUCT_VERSION}$\n" |
---|
| 133 | FileOpen $9 "$R0\etc\fstab" a |
---|
| 134 | ifErrors 0 +3 |
---|
| 135 | MessageBox MB_OK "Cannot open $R0\etc\fstab. MSYS mount point not added." |
---|
| 136 | Goto Close |
---|
| 137 | FileSeek $9 0 SET |
---|
| 138 | ReadLoop: |
---|
| 139 | FileRead $9 $R2 |
---|
| 140 | ifErrors Append |
---|
| 141 | StrCmp $R1 $R2 Close ReadLoop |
---|
| 142 | Append: |
---|
| 143 | FileSeek $9 0 END |
---|
| 144 | StrCpy $R2 $R2 1 -1 |
---|
| 145 | StrCmp $R2 "$\n" +2 0 |
---|
| 146 | FileWrite $9 "$\n" |
---|
| 147 | FileWrite $9 $R1 |
---|
| 148 | Close: |
---|
| 149 | FileClose $9 |
---|
| 150 | ClearErrors |
---|
| 151 | FunctionEnd |
---|