~ubuntu-branches/ubuntu/precise/gle-graphics/precise

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
; Script generated by the HM NIS Edit Script Wizard.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;                                                                      ;
; GLE - Graphics Layout Engine <http://www.gle-graphics.org/>          ;
;                                                                      ;
; Modified BSD License                                                 ;
;                                                                      ;
; Copyright (C) 2009 GLE.                                              ;
;                                                                      ;
; Redistribution and use in source and binary forms, with or without   ;
; modification, are permitted provided that the following conditions   ;
; are met:                                                             ;
;                                                                      ;
;    1. Redistributions of source code must retain the above copyright ;
; notice, this list of conditions and the following disclaimer.        ;
;                                                                      ;
;    2. Redistributions in binary form must reproduce the above        ;
; copyright notice, this list of conditions and the following          ;
; disclaimer in the documentation and/or other materials provided with ;
; the distribution.                                                    ;
;                                                                      ;
;    3. The name of the author may not be used to endorse or promote   ;
; products derived from this software without specific prior written   ;
; permission.                                                          ;
;                                                                      ;
; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR   ;
; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED       ;
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   ;
; ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY       ;
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   ;
; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE    ;
; GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS        ;
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER ;
; IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR      ;
; OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN  ;
; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                        ;
;                                                                      ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; HM NIS Edit Wizard helper defines
!define PRODUCT_NAME "GLE"
!define PRODUCT_VERSION "${GLE_VERSION}"
!define PRODUCT_PUBLISHER "GLE"
!define PRODUCT_WEB_SITE "http://www.gle-graphics.org/"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\gle.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

SetCompressor lzma

; MUI 1.67 compatible ------
!include "MUI.nsh"
!include "AddToPath.nsi"

; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "${NSISDIR}\Contrib\Graphics\Icons\modern-install.ico"
!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico"
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_RIGHT
!define MUI_HEADERIMAGE_BITMAP "banner_image.bmp"
!define MUI_HEADERIMAGE_BITMAP_NOSTRETCH
!define MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH
!define MUI_WELCOMEFINISHPAGE_BITMAP "welcome_image.bmp"

; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\readme-win32.txt"
!insertmacro MUI_PAGE_FINISH

; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"

; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; MUI end ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "${OUTPUT_FILENAME}"
InstallDir "$PROGRAMFILES\Gle4"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
RequestExecutionLevel admin

!define $GLEINST 0

Section "MainSection" SEC01
  SetShellVarContext all
  ; Previous installation of GLE found?
  ReadRegStr $0 HKLM "${PRODUCT_DIR_REGKEY}" ""
  StrCmp $0 "" GLENotRegistered
     CopyFiles /silent "$0/glerc" "$INSTDIR\glerc.old"
  GLENotRegistered:
  ; Is previous installation of GLE in same directory as currunt one?
  Push 0
  Pop $0
  IfFileExists $INSTDIR\glerc 0 GLENotExists
    IntOp $0 $0 + 1
  ; Start with the installation
  GLENotExists:
  SetOutPath "$INSTDIR\bin"
  SetOverwrite try
  File "..\..\..\build\bin\*.*"
  File /nonfatal "C:\cygwin\mingw\bin\mingwm10.dll"
  File "C:\Program Files\Debugging Tools for Windows (x86)\dbghelp.dll"
  SetOutPath "$INSTDIR\font"
  File /r "..\..\..\build\font\*.*"
  SetOutPath "$INSTDIR\doc"
  File "..\..\..\build\doc\*.*"  
  SetOutPath "$INSTDIR\gleinc"
  File /r "..\..\..\build\gleinc\*.*"
  SetOutPath "$INSTDIR\samples"
  File "..\..\..\..\gle-www\examples\2dsimple\*.gle"
  File "..\..\..\..\gle-www\examples\2dsimple\*.dat"
  File "..\..\..\..\gle-www\examples\2dsimple\*.csv"
  File "..\..\..\..\gle-www\examples\diagrams\shapes.gle"
  File "..\..\..\src\samples\qgle_keyboard.gle"
  SetOutPath "$INSTDIR"
  File "..\..\..\build\glerc"
  File "..\..\..\build\inittex.ini"
  File "..\..\..\build\init.tex"  
  File "..\..\..\README*.*"
  File "..\..\..\LICENSE*.*"
  File "www.ico"
  File /oname=readme-win32.txt "..\..\..\platform\readme.win32"
  SetShellVarContext current
  CreateDirectory "$DOCUMENTS\GLE"
  CopyFiles "$INSTDIR\samples" "$DOCUMENTS\GLE\samples"
  SetOutPath "$DOCUMENTS\GLE\samples"
  CreateDirectory "$SMPROGRAMS\GLE"
  CreateShortCut "$SMPROGRAMS\GLE\Command Prompt.lnk" "%SystemRoot%\system32\cmd.exe"
  CreateShortCut "$SMPROGRAMS\GLE\GLE Previewer.lnk" "$INSTDIR\bin\qgle.exe"  
  SetShellVarContext all
  SetOutPath "%SystemRoot%"
  CreateDirectory "$SMPROGRAMS\GLE"
  CreateShortCut "$SMPROGRAMS\GLE\Command Prompt.lnk" "%SystemRoot%\system32\cmd.exe"
  CreateShortCut "$SMPROGRAMS\GLE\GLE Previewer.lnk" "$INSTDIR\bin\qgle.exe"
  SetOutPath "$INSTDIR"
  IntCmp $0 0 NotYetInst DoneIsInst DoneIsInst
  NotYetInst:
    Push "$INSTDIR\bin"
    Call AddToPath
    MessageBox MB_OK "The directory $INSTDIR\bin has been added to your system path."
  DoneIsInst:
  Exec "$INSTDIR\bin\qgle.exe -finddeps '$INSTDIR\glerc.old'"
  !define Index "Line${__LINE__}"
  ReadRegStr $1 HKCR ".gle" ""
  StrCmp $1 "" "${Index}-NoBackup"
  StrCmp $1 "GLEFile" "${Index}-NoBackup"
    WriteRegStr HKCR ".gle" "backup_val" $1
"${Index}-NoBackup:"
  WriteRegStr HKCR ".gle" "" "GLEFile"
  WriteRegStr HKCR "GLEFile" "" "GLE Script"
  WriteRegStr HKCR "GLEFile\DefaultIcon" "" "$INSTDIR\bin\qgle.exe,0"
  WriteRegStr HKCR "GLEFile\shell\open\command" "" '$INSTDIR\bin\qgle.exe "%1"'
  WriteRegStr HKCR "GLEFile\shell\edit" "" "Edit GLE Script"
  WriteRegStr HKCR "GLEFile\shell\edit\command" "" '$INSTDIR\bin\qgle.exe "%1"'
  System::Call 'Shell32::SHChangeNotify(i 0x8000000, i 0, i 0, i 0)'
  !undef Index
SectionEnd

Section -AdditionalIcons
  WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  WriteIniStr "$INSTDIR\Tutorial.url" "InternetShortcut" "URL" "http://www.gle-graphics.org/tut/windows.html"
  CreateShortCut "$SMPROGRAMS\GLE\Readme.lnk" "$INSTDIR\readme-win32.txt"
  CreateShortCut "$SMPROGRAMS\GLE\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url" "" "$INSTDIR\www.ico"
  CreateShortCut "$SMPROGRAMS\GLE\Tutorial.lnk" "$INSTDIR\Tutorial.url" "" "$INSTDIR\www.ico"
  CreateShortCut "$SMPROGRAMS\GLE\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd

Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
  Abort
FunctionEnd

Section Uninstall
  Delete "$INSTDIR\*.url"
  Delete "$INSTDIR\*.ico"
  Delete "$INSTDIR\uninst.exe"
  Delete "$INSTDIR\glerc"
  Delete "$INSTDIR\README*.*"
  Delete "$INSTDIR\LICENSE*.*"
  Delete "$INSTDIR\inittex.ini"
  Delete "$INSTDIR\init.tex"  
  Delete "$INSTDIR\font\*.*"
  Delete "$INSTDIR\samples\*.*"
  Delete "$INSTDIR\lib\*.*"
  Delete "$INSTDIR\gleinc\*.*"
  Delete "$INSTDIR\gleinc\contrib\*.*"
  Delete "$INSTDIR\bin\*.*"

  Delete "$SMPROGRAMS\GLE\Uninstall.lnk"
  Delete "$SMPROGRAMS\GLE\Website.lnk"
  Delete "$SMPROGRAMS\GLE\Tutorial.lnk"
  Delete "$SMPROGRAMS\GLE\Readme.lnk"
  Delete "$SMPROGRAMS\GLE\GLE Previewer.lnk"
  Delete "$SMPROGRAMS\GLE\Command Prompt.lnk"

  RMDir "$SMPROGRAMS\GLE"
  RMDir "$INSTDIR\font"
  RMDir "$INSTDIR\bin"
  RMDir "$INSTDIR\samples"
  RMDir "$INSTDIR\lib"
  RMDir "$INSTDIR\gleinc\contrib"
  RMDir "$INSTDIR\gleinc"
  RMDir "$INSTDIR"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"

  Push "$INSTDIR\bin"
  Call un.RemoveFromPath

  SetAutoClose true
SectionEnd