Subversion Repositories gelsvn

Rev

Rev 286 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 286 Rev 287
1
!include "LogicLib.nsh" 
1
!include "LogicLib.nsh" 
2
!include "WinMessages.NSH"
2
!include "WinMessages.NSH"
3
 
3
 
4
!define TEMP1 $R0 ;Temp variable
4
!define TEMP1 $R0 ;Temp variable
5
 
5
 
6
; The name of the installer
6
; The name of the installer
7
Name "GEL Externals"
7
Name "GEL Externals"
8
 
8
 
9
; The file to write
9
; The file to write
10
OutFile "GELsetup.exe"
10
OutFile "GELsetup.exe"
11
 
11
 
12
; The default installation directory
12
; The default installation directory
13
InstallDir $DOCUMENTS\GEL
13
InstallDir H:\GEL
14
 
14
 
15
; Show install details
15
; Show install details
16
ShowInstDetails show
16
ShowInstDetails show
17
 
17
 
18
;Things that need to be extracted on startup (keep these lines before any File command!)
18
;Things that need to be extracted on startup (keep these lines before any File command!)
19
;Only useful for BZIP2 compression
19
;Only useful for BZIP2 compression
20
;Use ReserveFile for your own InstallOptions INI files too!
20
;Use ReserveFile for your own InstallOptions INI files too!
21
 
21
 
22
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
22
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
23
ReserveFile "custdir.ini"
23
ReserveFile "custdir.ini"
24
 
24
 
25
 
25
 
26
;--------------------------------
26
;--------------------------------
27
 
27
 
28
; Pages
28
; Pages
29
 
29
 
30
;Page directory
30
;Page directory
31
Page custom SetCustom "" ": Installation Folder"
31
Page custom SetCustom "" ": Installation Folder"
32
Page components
32
Page components
33
 
33
 
34
InstType "Externals only"
34
InstType "Externals only"
35
InstType "Full"
35
InstType "Full"
36
 
36
 
37
Section "Externals" Externals_flag
37
Section "Externals" Externals_flag
38
SectionIn 1 2
38
SectionIn 1 2
39
SectionEnd
39
SectionEnd
40
 
40
 
41
SectionGroup "GEL binary (ver. 0.1)"
41
SectionGroup "GEL binary (ver. 0.1)"
42
 
42
 
43
Section "CGLA" CGLA_flag
43
Section "CGLA" CGLA_flag
44
SectionIn 2
44
SectionIn 2
45
SectionEnd
45
SectionEnd
46
 
46
 
47
 
47
 
48
Section "Geometry" Geometry_flag
48
Section "Geometry" Geometry_flag
49
SectionIn 2
49
SectionIn 2
50
SectionEnd
50
SectionEnd
51
 
51
 
52
Section "GLGraphics" GLGraphics_flag
52
Section "GLGraphics" GLGraphics_flag
53
SectionIn 2
53
SectionIn 2
54
SectionEnd
54
SectionEnd
55
 
55
 
56
Section "HMesh" HMesh_flag
56
Section "HMesh" HMesh_flag
57
SectionIn 2
57
SectionIn 2
58
SectionEnd
58
SectionEnd
59
 
59
 
60
Section "LinAlg" LinAlg_flag
60
Section "LinAlg" LinAlg_flag
61
SectionIn 2
61
SectionIn 2
62
SectionEnd
62
SectionEnd
63
 
63
 
64
Section "Util" Util_flag
64
Section "Util" Util_flag
65
SectionIn 2
65
SectionIn 2
66
SectionEnd
66
SectionEnd
67
 
67
 
68
SectionGroupEnd
68
SectionGroupEnd
69
 
69
 
70
 
70
 
71
 
71
 
72
Page instfiles
72
Page instfiles
73
 
73
 
74
;--------------------------------
74
;--------------------------------
75
 
75
 
76
 
76
 
77
 
77
 
78
Section ""
78
Section ""
79
 
79
 
80
  ReadINIStr $INSTDIR "$PLUGINSDIR\custdir.ini" "Field 2" "State"
80
  ReadINIStr $INSTDIR "$PLUGINSDIR\custdir.ini" "Field 2" "State"
81
   
81
   
82
  Var /GLOBAL Externals
82
  Var /GLOBAL Externals
83
  Var /GLOBAL CGLA
83
  Var /GLOBAL CGLA
84
  Var /GLOBAL Geometry 
84
  Var /GLOBAL Geometry 
85
  Var /GLOBAL GLGraphics 
85
  Var /GLOBAL GLGraphics 
86
  Var /GLOBAL HMesh 
86
  Var /GLOBAL HMesh 
87
  Var /GLOBAL LinAlg
87
  Var /GLOBAL LinAlg
88
  Var /GLOBAL Util 
88
  Var /GLOBAL Util 
89
 
89
 
90
  # Get flags of each section into appropriate variables
90
  # Get flags of each section into appropriate variables
91
  SectionGetFlags ${Externals_flag} $Externals
91
  SectionGetFlags ${Externals_flag} $Externals
92
  SectionGetFlags ${CGLA_flag} $CGLA 
92
  SectionGetFlags ${CGLA_flag} $CGLA 
93
  SectionGetFlags ${Geometry_flag} $Geometry
93
  SectionGetFlags ${Geometry_flag} $Geometry
94
  SectionGetFlags ${GLGraphics_flag} $GLGraphics
94
  SectionGetFlags ${GLGraphics_flag} $GLGraphics
95
  SectionGetFlags ${HMesh_flag} $HMesh
95
  SectionGetFlags ${HMesh_flag} $HMesh
96
  SectionGetFlags ${LinAlg_flag} $LinAlg
96
  SectionGetFlags ${LinAlg_flag} $LinAlg
97
  SectionGetFlags ${Util_flag} $Util
97
  SectionGetFlags ${Util_flag} $Util
98
  
98
  
99
  ;MessageBox MB_OK "Externals: $0 $\r$\n GEL: $1 $\r$\n "
99
  ;MessageBox MB_OK "Externals: $0 $\r$\n GEL: $1 $\r$\n "
100
 
100
 
101
  ${If} $Externals = 1
101
  ${If} $Externals = 1
102
    SetOutPath $INSTDIR\bin
102
    SetOutPath $INSTDIR\bin
103
    File externals\bin\*.dll 
103
    File externals\bin\*.dll 
104
   
104
   
105
    SetOutPath $INSTDIR\lib
105
    SetOutPath $INSTDIR\lib
106
    File externals\lib\*.lib 
106
    File externals\lib\*.lib 
107
 
107
 
108
    SetOutPath $INSTDIR
108
    SetOutPath $INSTDIR
109
    File /r externals\include
109
    File /r externals\include
110
  ${EndIf}
110
  ${EndIf}
111
 
111
 
112
  !macro GELModule mvar mstring
112
  !macro GELModule mvar mstring
113
    ${If} ${mvar} = 1
113
    ${If} ${mvar} = 1
114
      SetOutPath $INSTDIR\lib
114
      SetOutPath $INSTDIR\lib
115
      File current\lib\${mstring}.lib 
115
      File current\lib\${mstring}.lib 
116
 
116
 
117
      SetOutPath $INSTDIR\include
117
      SetOutPath $INSTDIR\include
118
      File /r current\include\${mstring}
118
      File /r current\include\${mstring}
119
    ${EndIf}
119
    ${EndIf}
120
  !macroend
120
  !macroend
121
 
121
 
122
  !insertmacro GELModule $CGLA "CGLA"
122
  !insertmacro GELModule $CGLA "CGLA"
123
  !insertmacro GELModule $Geometry "Geometry"
123
  !insertmacro GELModule $Geometry "Geometry"
124
  !insertmacro GELModule $GLGraphics "GLGraphics"
124
  !insertmacro GELModule $GLGraphics "GLGraphics"
125
  !insertmacro GELModule $HMesh "HMesh"
125
  !insertmacro GELModule $HMesh "HMesh"
126
  !insertmacro GELModule $LinAlg "LinAlg"
126
  !insertmacro GELModule $LinAlg "LinAlg"
127
  !insertmacro GELModule $Util "Util"
127
  !insertmacro GELModule $Util "Util"
128
 
128
 
129
  # Create Environment variables
129
  # Create Environment variables
130
 
130
 
131
  ReadINIStr $R2 "$PLUGINSDIR\custdir.ini" "Field 3" "State"
131
  ReadINIStr $R2 "$PLUGINSDIR\custdir.ini" "Field 3" "State"
132
  ReadINIStr $R3 "$PLUGINSDIR\custdir.ini" "Field 4" "State"
132
  ReadINIStr $R3 "$PLUGINSDIR\custdir.ini" "Field 4" "State"
133
 
133
 
134
  ${If} $R2 = 0
134
  ${If} $R2 = 0
135
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_INCLUDE" "$INSTDIR\include"
135
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_INCLUDE" "$INSTDIR\include"
136
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_LIB" "$INSTDIR\lib"
136
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_LIB" "$INSTDIR\lib"
137
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_BIN" "$INSTDIR\bin"
137
    WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "GEL_BIN" "$INSTDIR\bin"
138
 
138
 
139
  ${Else}
139
  ${Else}
140
    WriteRegExpandStr 'HKCU' "Environment" "GEL_INCLUDE" "$INSTDIR\include"
140
    WriteRegExpandStr 'HKCU' "Environment" "GEL_INCLUDE" "$INSTDIR\include"
141
    WriteRegExpandStr 'HKCU' "Environment" "GEL_LIB" "$INSTDIR\lib"
141
    WriteRegExpandStr 'HKCU' "Environment" "GEL_LIB" "$INSTDIR\lib"
142
    WriteRegExpandStr 'HKCU' "Environment" "GEL_BIN" "$INSTDIR\bin"
142
    WriteRegExpandStr 'HKCU' "Environment" "GEL_BIN" "$INSTDIR\bin"
143
 
143
 
144
  ${EndIf}
144
  ${EndIf}
145
 
145
 
146
  ClearErrors
146
 ; ClearErrors
147
  FileOpen $0 $INSTDIR\bin\setenvvars.bat w
147
 ; FileOpen $0 $INSTDIR\bin\setenvvars.bat w
148
  IfErrors done
148
 ; IfErrors done
149
  FileWrite $0 "set GEL_INCLUDE=$INSTDIR\include"
149
 ; FileWrite $0 "set GEL_INCLUDE=$INSTDIR\include"
-
 
150
 ; FileWriteByte $0 "13"
-
 
151
 ; FileWriteByte $0 "10"
150
  FileWrite $0 "set GEL_LIB=$INSTDIR\lib"
152
 ; FileWrite $0 "set GEL_LIB=$INSTDIR\lib"
-
 
153
 ; FileWriteByte $0 "13"
-
 
154
 ; FileWriteByte $0 "10"
151
  FileWrite $0 "set GEL_BIN=$INSTDIR\bin"
155
 ; FileWrite $0 "set GEL_BIN=$INSTDIR\bin"
-
 
156
 ; FileWriteByte $0 "13"
-
 
157
 ; FileWriteByte $0 "10"
152
  FileClose $0
158
 ; FileClose $0
153
  done:
159
 ; done:
154
  
160
  
155
  # Add %GEL_BIN% to path
161
  # Add %GEL_BIN% to path
156
  
162
  
157
  ${If} $R2 = 0
163
  ${If} $R2 = 0
158
    ReadRegStr $1 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
164
    ReadRegStr $1 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
159
  ${Else}
165
  ${Else}
160
    ReadRegStr $1 'HKCU' "Environment" "PATH"
166
    ReadRegStr $1 'HKCU' "Environment" "PATH"
161
  ${EndIf}
167
  ${EndIf}
162
 
168
 
163
  StrCpy $2 $1 1 -1 # copy last char
169
  StrCpy $2 $1 1 -1 # copy last char
164
  StrCmp $2 ";" 0 +2 # if last char == ;
170
  StrCmp $2 ";" 0 +2 # if last char == ;
165
    StrCpy $1 $1 -1 # remove last char
171
    StrCpy $1 $1 -1 # remove last char
166
  StrCmp $1 "" AddToPath_NTdoIt
172
  StrCmp $1 "" AddToPath_NTdoIt
167
    StrCpy $0 "$1;%GEL_BIN%"
173
    StrCpy $0 "$1;$INSTDIR\bin"
168
  AddToPath_NTdoIt:
174
  AddToPath_NTdoIt:
169
    ${If} $R2 = 0
175
    ${If} $R2 = 0
170
      WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
176
      WriteRegExpandStr 'HKLM' "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $0
171
    ${Else}
177
    ${Else}
172
      WriteRegExpandStr 'HKCU' "Environment" "PATH" $0
178
      WriteRegExpandStr 'HKCU' "Environment" "PATH" $0
173
    ${EndIf}
179
    ${EndIf}
174
    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
180
    SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
175
 
181
 
176
 
182
 
177
SectionEnd ; end the section
183
SectionEnd ; end the section
178
 
184
 
179
Function .onInit
185
Function .onInit
180
 
186
 
181
  ;Extract InstallOptions files
187
  ;Extract InstallOptions files
182
  ;$PLUGINSDIR will automatically be removed when the installer closes
188
  ;$PLUGINSDIR will automatically be removed when the installer closes
183
 
189
 
184
  InitPluginsDir
190
  InitPluginsDir
185
  File /oname=$PLUGINSDIR\custdir.ini "custdir.ini"
191
  File /oname=$PLUGINSDIR\custdir.ini "custdir.ini"
186
  WriteINIStr  "$PLUGINSDIR\custdir.ini" "Field 2" "State" $INSTDIR
192
  WriteINIStr  "$PLUGINSDIR\custdir.ini" "Field 2" "State" $INSTDIR
187
 
193
 
188
 
194
 
189
FunctionEnd
195
FunctionEnd
190
 
196
 
191
Function SetCustom
197
Function SetCustom
192
 
198
 
193
  ;Display the InstallOptions dialog
199
  ;Display the InstallOptions dialog
194
 
200
 
195
  Push ${TEMP1}
201
  Push ${TEMP1}
196
 
202
 
197
    InstallOptions::dialog "$PLUGINSDIR\custdir.ini"
203
    InstallOptions::dialog "$PLUGINSDIR\custdir.ini"
198
    Pop ${TEMP1}
204
    Pop ${TEMP1}
199
 
205
 
200
  Pop ${TEMP1}
206
  Pop ${TEMP1}
201
 
207
 
202
FunctionEnd
208
FunctionEnd
203
 
209