File: gtkglextmm.nsi.in

package info (click to toggle)
gtkglextmm 1.2.0-8
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 5,248 kB
  • ctags: 4,387
  • sloc: sh: 8,904; cpp: 4,594; xml: 1,605; ansic: 832; makefile: 353; perl: 179
file content (445 lines) | stat: -rw-r--r-- 13,872 bytes parent folder | download | duplicates (5)
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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
;
; NSIS script for gtkglextmm Win32 binary installer.
;
; written by Naofumi Yasufuku <naofumi@users.sourceforge.net>
;
; about NSIS, see http://nsis.sourceforge.net/
;

!define GTKGLEXTMM_VERSION         @GTKGLEXTMM_VERSION@
!define GTKGLEXTMM_API_VERSION     @GTKGLEXTMM_API_VERSION@
!define GTKGLEXTMM_PUBLISHER       "GtkGLExt"
!define GTKGLEXTMM_URL_INFO_ABOUT  "http://gtkglext.sourceforge.net/"
!define GTKGLEXTMM_URL_UPDATE_INFO "http://sourceforge.net/projects/gtkglext/"
!define GTKGLEXTMM_HELP_LINK       "mailto:gtkglext-users@lists.sourceforge.net"

;--------------------------------
;Configuration

OutFile gtkglextmm-win32-${GTKGLEXTMM_VERSION}.exe
SetCompressor lzma

InstType "Full (Runtime w/ Development and Examples)"
InstType "Runtime (w/o Development and Examples)"

ShowInstDetails show
ShowUninstDetails show
SetDateSave on

; the default installation drive is changed by .onInit
InstallDir C:\GtkGLExt\${GTKGLEXTMM_API_VERSION}
InstallDirRegKey HKLM SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION} "Path"

;--------------------------------
;Header Files

!include "MUI.nsh"

;--------------------------------
;Configuration

; Names
Name "gtkglextmm"
Caption "gtkglextmm ${GTKGLEXTMM_VERSION} Setup"

;--------------------------------
;Variables

Var MUI_TEMP
Var STARTMENU_FOLDER

;--------------------------------
;Interface Settings

!define MUI_ABORTWARNING

!define MUI_COMPONENTSPAGE_SMALLDESC

!define MUI_FINISHPAGE_NOAUTOCLOSE
!define MUI_UNFINISHPAGE_NOAUTOCLOSE

;--------------------------------
;Pages

;Welcome Page
!define MUI_WELCOMEPAGE_TEXT "This wizard will guide you through the installation of gtkglextmm, C++ Wrapper for GtkGLExt.\r\n\r\n\r\n$_CLICK"
!insertmacro MUI_PAGE_WELCOME

;License Page
!insertmacro MUI_PAGE_LICENSE "COPYING.LIB"

;Components Page
!insertmacro MUI_PAGE_COMPONENTS

;Directory Page
!insertmacro MUI_PAGE_DIRECTORY

;Start Menu Folder Page
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "gtkglextmm ${GTKGLEXTMM_API_VERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "HKLM"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "StartMenuFolder"
!insertmacro MUI_PAGE_STARTMENU StartMenu $STARTMENU_FOLDER

;Installation Page
!insertmacro MUI_PAGE_INSTFILES

;Finish Page
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!insertmacro MUI_PAGE_FINISH

;Uninstall Welcome Page
!insertmacro MUI_UNPAGE_WELCOME

;Uninstall Confirm Page
!insertmacro MUI_UNPAGE_CONFIRM

;Uninstallation Page
!insertmacro MUI_UNPAGE_INSTFILES

;Uninstall Finish Page
!insertmacro MUI_UNPAGE_FINISH

;--------------------------------
;Languages

!insertmacro MUI_LANGUAGE "English"
  
;--------------------------------
;Reserve Files

;!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

;--------------------------------
;Installer Sections

Section "gtkglextmm Runtime" SecRuntime
  SectionIn 1 2 RO

  SetOutPath $INSTDIR\bin
  File bin\*.dll

  ; Registry
  WriteRegStr HKLM "SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION}\Runtime" "Path" "$INSTDIR"
  WriteRegStr HKLM "SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION}\Runtime" "Version" "${GTKGLEXTMM_VERSION}"

SectionEnd

Section "gtkglextmm Development" SecDevelopment
  SectionIn 1

  SetOutPath $INSTDIR\include\gtkglextmm-${GTKGLEXTMM_API_VERSION}
  File include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\*.h

  SetOutPath $INSTDIR\include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\gdkmm\gl
  File include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\gdkmm\gl\*.h

  SetOutPath $INSTDIR\include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\gdkmm\gl\private
  File include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\gdkmm\gl\private\*.h

  SetOutPath $INSTDIR\include\gtkglextmm-${GTKGLEXTMM_API_VERSION}
  File include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\*.h

  SetOutPath $INSTDIR\include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\gtkmm\gl
  File include\gtkglextmm-${GTKGLEXTMM_API_VERSION}\gtkmm\gl\*.h

  SetOutPath $INSTDIR\lib\gtkglextmm-${GTKGLEXTMM_API_VERSION}\include
  File lib\gtkglextmm-${GTKGLEXTMM_API_VERSION}\include\gdkglextmm-config.h

  SetOutPath $INSTDIR\lib\gtkglextmm-${GTKGLEXTMM_API_VERSION}\proc\m4
  File lib\gtkglextmm-${GTKGLEXTMM_API_VERSION}\proc\m4\*.m4

  SetOutPath $INSTDIR\lib
  File lib\*.a

  SetOutPath $INSTDIR\lib\pkgconfig
  File lib\pkgconfig\*.pc

  SetOutPath $INSTDIR\share\aclocal
  File share\aclocal\*.m4

  SetOutPath $INSTDIR\share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html
  File share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html\*.html
  File share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html\*.css
  File share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html\*.png
  File share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html\*.dot

  ; Update .pc files
  ; short name will cause a problem with current libtool :-<
  ;GetFullPathName /SHORT $0 $INSTDIR
  StrCpy $0 $INSTDIR
  Push $0
  Call ChangeDirSeparator
  Pop $0

  DetailPrint "Updating $INSTDIR\lib\pkgconfig\gdkglextmm-${GTKGLEXTMM_API_VERSION}.pc"
  Push $INSTDIR\lib\pkgconfig\gdkglextmm-${GTKGLEXTMM_API_VERSION}.pc
  Push $0
  Call UpdatePCFile
  DetailPrint "Done"

  DetailPrint "Updating $INSTDIR\lib\pkgconfig\gdkglextmm-win32-${GTKGLEXTMM_API_VERSION}.pc"
  Push $INSTDIR\lib\pkgconfig\gdkglextmm-win32-${GTKGLEXTMM_API_VERSION}.pc
  Push $0
  Call UpdatePCFile
  DetailPrint "Done"

  DetailPrint "Updating $INSTDIR\lib\pkgconfig\gtkglextmm-${GTKGLEXTMM_API_VERSION}.pc"
  Push $INSTDIR\lib\pkgconfig\gtkglextmm-${GTKGLEXTMM_API_VERSION}.pc
  Push $0
  Call UpdatePCFile
  DetailPrint "Done"

  DetailPrint "Updating $INSTDIR\lib\pkgconfig\gtkglextmm-win32-${GTKGLEXTMM_API_VERSION}.pc"
  Push $INSTDIR\lib\pkgconfig\gtkglextmm-win32-${GTKGLEXTMM_API_VERSION}.pc
  Push $0
  Call UpdatePCFile
  DetailPrint "Done"

  ; Registry
  WriteRegStr HKLM "SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION}\Development" "Path" "$INSTDIR"
  WriteRegStr HKLM "SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION}\Development" "Version" "${GTKGLEXTMM_VERSION}"

SectionEnd

Section "gtkglextmm Examples" SecExamples
  SectionIn 1

  SetOutPath $INSTDIR\gtkglextmm-examples
  File gtkglextmm-examples\Makefile.mingw
  File gtkglextmm-examples\*.h
  File gtkglextmm-examples\*.cc
  File gtkglextmm-examples\*.c
  File gtkglextmm-examples\*.exe

SectionEnd

Section "Start Menu" SecStartMenu
  SectionIn 1 2

  SetShellVarContext all

  !insertmacro MUI_STARTMENU_WRITE_BEGIN StartMenu

    CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"

    WriteINIStr "$SMPROGRAMS\$STARTMENU_FOLDER\GtkGLExt Website.url" "InternetShortcut" "URL" "http://gtkglext.sourceforge.net/"

    IfFileExists "$INSTDIR\share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html\index.html" "" +2
      CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\gtkglextmm Documentation.lnk" "$INSTDIR\share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}\html\index.html"

    CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall gtkglextmm.lnk" "$INSTDIR\uninst-gtkglextmm.exe"

  !insertmacro MUI_STARTMENU_WRITE_END

SectionEnd

Section -post

  ; Write $INSTDIR\bin\gtkglextmm-env.sh
  DetailPrint "Generating $INSTDIR\bin\gtkglextmm-env.sh"
  Push $INSTDIR\bin\gtkglextmm-env.sh
  Call WriteEnvSh
  DetailPrint "Done"

  ; Registry
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "DisplayName" "gtkglextmm ${GTKGLEXTMM_VERSION}"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "DisplayVersion" "${GTKGLEXTMM_VERSION}"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "Publisher" "${GTKGLEXTMM_PUBLISHER}"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "URLInfoAbout" "${GTKGLEXTMM_URL_INFO_ABOUT}"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "URLUpdateInfo" "${GTKGLEXTMM_URL_UPDATE_INFO}"
  WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "HelpLink" "${GTKGLEXTMM_HELP_LINK}"
  WriteRegExpandStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm" "UninstallString" "$INSTDIR\uninst-gtkglextmm.exe"

  ;; Uninstaller
  Delete $INSTDIR\uninst-gtkglextmm.exe
  WriteUninstaller $INSTDIR\uninst-gtkglextmm.exe

SectionEnd

;--------------------------------
;Descriptions

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SecRuntime} "gtkglextmm runtime libraries"
  !insertmacro MUI_DESCRIPTION_TEXT ${SecDevelopment} "gtkglextmm development headers, libraries, and documentations"
  !insertmacro MUI_DESCRIPTION_TEXT ${SecExamples} "gtkglextmm example programs"
  !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} "Adds icons to your start menu for easy access"
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;--------------------------------
;Installer Functions

Function .onInit
  ; Change the default installation drive
  StrLen $R0 $INSTDIR
  StrCpy $R1 $INSTDIR $R0 1
  StrCpy $INSTDIR $PROGRAMFILES 1
  StrCpy $INSTDIR "$INSTDIR$R1"
FunctionEnd

; ChangeDirSeparator
; input, top of stack  (e.g. C:\Program Files\...)
; output, top of stack (replaces, with e.g. C:/Program Files/...)
; modifies no other variables.
Function ChangeDirSeparator
  Exch $R0
  Push $R1
  Push $R2
  Push $R3
    StrCpy $R1 $R0
    StrCpy $R0 ""
    StrCpy $R2 0
    goto loop
    replace:
      StrCpy $R0 "$R0/"
    loop:
      StrCpy $R3 $R1 1 $R2
      IntOp $R2 $R2 + 1
      StrCmp $R3 "\" replace
      StrCmp $R3 "" done
      StrCpy $R0 "$R0$R3"
      goto loop
    done:
  Pop $R3
  Pop $R2
  Pop $R1
  Exch $R0
FunctionEnd

; UpdatePCFile
; update pkg-config .pc file
Function UpdatePCFile
  Pop $R0 ; prefix
  Pop $R1 ; target .pc file
  Push $R7
  Push $R8
  Push $R9
    Rename $R1 $R1.orig
    FileOpen $R7 $R1.orig r
    FileOpen $R8 $R1 w
    FileRead $R7 $R9 ; skip original prefix
    FileWrite $R8 "prefix=$R0$\n"
    loop:
      FileRead $R7 $R9
      StrCmp $R9 "" done
      FileWrite $R8 $R9
      goto loop
    done:
    FileClose $R7
    FileClose $R8
    Delete $R1.orig
  Pop $R9
  Pop $R8
  Pop $R7
FunctionEnd

; WriteEnvSh
Function WriteEnvSh
  Pop $R0 ; Output file
  Push $R8
  Push $R9
    GetFullPathName /SHORT $R8 $INSTDIR
    Push $R8
    Call ChangeDirSeparator
    Pop $R8
    FileOpen $R9 $R0 w
    FileWrite $R9 "#!/bin/sh$\n"
    FileWrite $R9 "$\n"
    FileWrite $R9 "export GTKGLEXTMM_PREFIX=$R8$\n"
    FileWrite $R9 "$\n"
    FileWrite $R9 "echo $\"Setting environment variables for gtkglextmm.$\"$\n"
    FileWrite $R9 "echo $\"$\"$\n"
    FileWrite $R9 "$\n"
    FileWrite $R9 "case $$TERM in$\n"
    FileWrite $R9 "cygwin)$\n"
    FileWrite $R9 "  GTKGLEXTMM_PATH=`cygpath -u $${GTKGLEXTMM_PREFIX}/bin`$\n"
    FileWrite $R9 "  ;;$\n"
    FileWrite $R9 "msys)$\n"
    FileWrite $R9 "  GTKGLEXTMM_PATH=/$${GTKGLEXTMM_PREFIX%:*}$${GTKGLEXTMM_PREFIX#*:}/bin$\n"
    FileWrite $R9 "  ;;$\n"
    FileWrite $R9 "*)$\n"
    FileWrite $R9 "  echo $\"Unknown TERM$\"$\n"
    FileWrite $R9 "  ;;$\n"
    FileWrite $R9 "esac$\n"
    FileWrite $R9 "$\n"
    FileWrite $R9 "echo $\"export PATH=\$\"$${GTKGLEXTMM_PATH}:\$${PATH}\$\"$\"$\n"
    FileWrite $R9 "export PATH=$\"$${GTKGLEXTMM_PATH}:$${PATH}$\"$\n"
    FileWrite $R9 "$\n"
    FileWrite $R9 "echo $\"export PKG_CONFIG_PATH=\$\"$${GTKGLEXTMM_PREFIX}/lib/pkgconfig;\$${PKG_CONFIG_PATH}\$\"$\"$\n"
    FileWrite $R9 "export PKG_CONFIG_PATH=$\"$${GTKGLEXTMM_PREFIX}/lib/pkgconfig;$${PKG_CONFIG_PATH}$\"$\n"
    FileWrite $R9 "$\n"
    FileWrite $R9 "echo $\"$\"$\n"
    FileClose $R9
  Pop $R9
  Pop $R8
FunctionEnd

;--------------------------------
;Uninstaller Section

Section Uninstall

  ;Remove shortcut
  SetShellVarContext all
  !insertmacro MUI_STARTMENU_GETFOLDER StartMenu $MUI_TEMP
  StrCmp $MUI_TEMP "" noshortcuts
    Delete "$SMPROGRAMS\$MUI_TEMP\GtkGLExt Website.url"
    Delete "$SMPROGRAMS\$MUI_TEMP\gtkglextmm Documentation.lnk"
    Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall gtkglextmm.lnk"
    RMDir "$SMPROGRAMS\$MUI_TEMP" ;Only if empty, so it won't delete other shortcuts
  noshortcuts:

  DeleteRegKey HKLM "SOFTWARE\gtkglextmm\${GTKGLEXTMM_API_VERSION}"
  DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\gtkglextmm"

  Delete $INSTDIR\uninst-gtkglextmm.exe

  ; bin

  Delete $INSTDIR\bin\gtkglextmm-env.sh
  Delete $INSTDIR\bin\libgdkglextmm-win32-${GTKGLEXTMM_API_VERSION}-*.dll
  Delete $INSTDIR\bin\libgtkglextmm-win32-${GTKGLEXTMM_API_VERSION}-*.dll

  RMDir $INSTDIR\bin

  ; include

  RMDir /r $INSTDIR\include\gtkglextmm-1.0

  RMDir $INSTDIR\include

  ; lib

  RMDir /r $INSTDIR\lib\gtkglextmm-1.0

  Delete $INSTDIR\lib\libgdkglextmm-win32-${GTKGLEXTMM_API_VERSION}.dll.a
  Delete $INSTDIR\lib\libgtkglextmm-win32-${GTKGLEXTMM_API_VERSION}.dll.a

  Delete $INSTDIR\lib\pkgconfig\gdkglextmm-${GTKGLEXTMM_API_VERSION}.pc
  Delete $INSTDIR\lib\pkgconfig\gdkglextmm-win32-${GTKGLEXTMM_API_VERSION}.pc
  Delete $INSTDIR\lib\pkgconfig\gtkglextmm-${GTKGLEXTMM_API_VERSION}.pc
  Delete $INSTDIR\lib\pkgconfig\gtkglextmm-win32-${GTKGLEXTMM_API_VERSION}.pc
  RMDir $INSTDIR\lib\pkgconfig

  RMDir $INSTDIR\lib

  ; share

  Delete $INSTDIR\share\aclocal\gtkglextmm-${GTKGLEXTMM_API_VERSION}.m4
  RMDir $INSTDIR\share\aclocal

  RMDir /r $INSTDIR\share\doc\gtkglextmm-${GTKGLEXTMM_API_VERSION}
  RMDir $INSTDIR\share\doc

  RMDir $INSTDIR\share

  ; gtkglextmm-examples

  RMDir /r $INSTDIR\gtkglextmm-examples

  ; $INSTDIR

  RMDir $INSTDIR

SectionEnd