|
15 | 15 | !Include "WordFunc.nsh"
|
16 | 16 | !Include "CreateInternetShortcut.nsh"
|
17 | 17 | !Include "x64.nsh"
|
| 18 | + !insertmacro GetParameters |
| 19 | + !insertmacro GetOptions |
18 | 20 |
|
19 | 21 | ;--------------------------------
|
20 | 22 | ;Defines
|
|
30 | 32 |
|
31 | 33 | Var START_MENU_FOLDER
|
32 | 34 | Var PROGRAM_FILES
|
| 35 | + Var STACK_INSTALL_DIR |
33 | 36 |
|
34 | 37 | ;--------------------------------
|
35 | 38 | ;General settings
|
|
39 | 42 | OutFile "{{productFile}}"
|
40 | 43 |
|
41 | 44 | ;Default install dir
|
| 45 | + ; Set as appropriate for 32-bit or 64-bit OS |
| 46 | +{{#build64bit}} |
| 47 | + InstallDir "$PROGRAMFILES64\Haskell Platform\${PLATFORM_VERSION}" |
| 48 | +{{/build64bit}} |
| 49 | + |
| 50 | +{{^build64bit}} |
42 | 51 | InstallDir "$PROGRAMFILES\Haskell Platform\${PLATFORM_VERSION}"
|
| 52 | +{{/build64bit}} |
| 53 | + |
43 | 54 | InstallDirRegKey HKLM "${PRODUCT_DIR_REG_KEY}" ""
|
44 | 55 |
|
45 | 56 | ;Icon
|
@@ -83,38 +94,29 @@ CheckAdminDone:
|
83 | 94 | ; The 'isInstall' argument is 1 for the install part of the script (from
|
84 | 95 | ; .onInit function) and 0 if for the uninstall part (via un.onInit). The
|
85 | 96 | ; $INSTDIR must be changed for the installation step to account for the case
|
86 |
| - ; of installing the 32-bit installer onto 64-bit Windows; and and it must |
| 97 | + ; of installing the 32-bit installer onto 64-bit Windows; and it must |
87 | 98 | ; happen before the user gets to the dialog to change installation location.
|
88 | 99 | ; On the other hand, $INSTDIR must *not* be changed for the uninstall step
|
89 | 100 | ; because doing so over-rides what the user did during the install step.
|
90 | 101 | ;
|
91 | 102 | ; Also, do not force $INSTDIR to change if this is a silent install.
|
92 | 103 | SetRegView 32
|
93 | 104 | StrCpy $PROGRAM_FILES "$PROGRAMFILES"
|
94 |
| -${IfNot} ${Silent} |
95 |
| - ${If} ${isInstall} = 1 |
96 |
| - StrCpy $INSTDIR "$PROGRAM_FILES\Haskell Platform\${PLATFORM_VERSION}" |
97 |
| - ${EndIf} |
98 |
| -${EndIf} |
99 | 105 | {{#build64bit}}
|
100 | 106 | ${If} ${RunningX64}
|
101 | 107 | ; If this is installing the 64-bit HP on 64-bit Windows, enable FSRedirection.
|
102 | 108 | ${EnableX64FSRedirection}
|
103 | 109 | ; enable access to 64-bit portion of registry
|
104 | 110 | SetRegView 64
|
105 | 111 | StrCpy $PROGRAM_FILES "$PROGRAMFILES64"
|
106 |
| - ${IfNot} ${Silent} |
107 |
| - ${If} ${isInstall} = 1 |
108 |
| - StrCpy $INSTDIR "$PROGRAM_FILES\Haskell Platform\${PLATFORM_VERSION}" |
109 |
| - ${EndIf} |
110 |
| - ${EndIf} |
111 | 112 | ${Else}
|
112 | 113 | ; pop up an error message: Cannot install 64-bit HP on 32-bit Windows
|
113 | 114 | MessageBox MB_OK "You are trying to install the 64-bit version of the Haskell Platform onto a 32-bit version of Windows. Please use the 32-bit version of the Haskell Platform."
|
114 | 115 | SetErrorLevel 0x800401FAL ; CO_E_WRONGOSFORAPP
|
115 | 116 | Quit
|
116 | 117 | ${EndIf}
|
117 | 118 | {{/build64bit}}
|
| 119 | + |
118 | 120 | !macroend
|
119 | 121 |
|
120 | 122 | ;--------------------------------
|
@@ -175,6 +177,11 @@ Function .onInit
|
175 | 177 | SetShellVarContext all
|
176 | 178 | SectionSetSize 0 {{mainInstalledSize}} ; 0 is ${SecMain} but the symbol is not defined yet
|
177 | 179 | SectionSetSize 1 {{stackInstalledSize}} ; 1 is ${SecStack}
|
| 180 | + ; /STACK switch to the HP installer for setting the stack install dir |
| 181 | + ${GetParameters} $R0 |
| 182 | + ${GetOptions} $R0 "/STACK=" $STACK_INSTALL_DIR |
| 183 | + StrCmp $STACK_INSTALL_DIR "" +2 |
| 184 | + StrCpy $STACK_INSTALL_DIR "/D=$STACK_INSTALL_DIR" |
178 | 185 | FunctionEnd
|
179 | 186 |
|
180 | 187 | Function un.onInit
|
@@ -267,7 +274,11 @@ Section "Base components" SecMain
|
267 | 274 | File "{{stackInstallerPath}}"
|
268 | 275 | DetailPrint "installing Stack"
|
269 | 276 | SetDetailsPrint listonly
|
270 |
| - ExecWait '"$INSTDIR\temp\{{stackInstallerFileName}}" /S' |
| 277 | + ${If} ${Silent} |
| 278 | + ExecWait '"$INSTDIR\temp\{{stackInstallerFileName}}" /S $STACK_INSTALL_DIR' |
| 279 | + ${Else} |
| 280 | + ExecWait '"$INSTDIR\temp\{{stackInstallerFileName}}" $STACK_INSTALL_DIR' |
| 281 | + ${EndIf} |
271 | 282 | SetDetailsPrint lastused
|
272 | 283 | DetailPrint "finished Stack"
|
273 | 284 | Delete "$INSTDIR\temp\{{stackInstallerFileName}}"
|
|
0 commit comments