Subversion Repositories gelsvn

Rev

Rev 253 | Rev 286 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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