-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
make_installer.nsi
179 lines (116 loc) · 4.46 KB
/
make_installer.nsi
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
!include LogicLib.nsh
!include "MUI2.nsh"
; --------------------------------
; Change these as needed
!define VERSION "1.0-RC2"
!define INST_FOLDER "package"
SetCompressor /SOLID /FINAL lzma
SetCompressorDictSize 64
Name "sdl_img-${VERSION}"
OutFile "sdl_img-${VERSION}-Setup.exe"
; Not sure how this works if they keep the default install folder
RequestExecutionLevel user
; Default install folder
InstallDir "$PROGRAMfILES64\sdl_img"
; Do registry stuff here if wanted
;-----------------------------------
; Interface configuration
!define MUI_ICON "${INST_FOLDER}\sdl_img.ico"
!define MUI_UNICON "${INST_FOLDER}\sdl_img.ico"
;
; Recommended to be 150 x 57
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "${INST_FOLDER}\sdl_img.bmp"
!define MUI_HEADERIMAGE_UNBITMAP "${INST_FOLDER}\sdl_img.bmp"
;
!define MUI_ABORTWARNING
;
; Recommended to be 164 x 314
!define MUI_WELCOMEFINISHPAGE_BITMAP "${INST_FOLDER}\sdl_img2.bmp"
!define MUI_UNWELCOMEFINISHPAGE_BITMAP "${INST_FOLDER}\sdl_img2.bmp"
;
; !define MUI_WELCOMEPAGE_TITLE "Welcome to the sdl_img Setup"
!define MUI_WELCOMEPAGE_TEXT "http://robertwinkler.com/projects/sdl_img$\r$\n$\r$\nThis will install sdl_img on your computer.$\r$\n$\r$\nsdl_img is an image viewer built using the SDL2 and stb_image libraries. Thanks to the latter, it has support for many different image formats including JPEG, PNG, BMP, GIF, and netpbm. sdl_img focuses on interesting, unique features like multi-image browsing, full control of GIF playback, a vim inspired thumbnail mode, and a list mode."
!define MUI_FINISHPAGE_LINK "sdl_img Website"
!define MUI_FINISHPAGE_LINK_LOCATION "http://robertwinkler.com/projects/sdl_img"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.md"
;-----------------------------------
; Pages
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "${INST_FOLDER}\LICENSE.txt"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_WELCOME
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_UNPAGE_FINISH
;-----------------------------------
; Languages
; Extremely unlikely I'll ever add support for other languages
!insertmacro MUI_LANGUAGE "English"
;-----------------------------------
; Installer Sections
#default section start
Section "-Core"
SetOutPath $INSTDIR
File ${INST_FOLDER}\sdl_img.exe
;SetOutPath $INSTDIR\lib
File /nonfatal ${INST_FOLDER}\*.dll
; SetOutPath $INSTDIR\lib
File ${INST_FOLDER}\sdl_img.ico
File ${INST_FOLDER}\sdl_img.bmp
File ${INST_FOLDER}\sdl_img2.bmp
File ${INST_FOLDER}\LICENSE
File ${INST_FOLDER}\LICENSE.txt
File ${INST_FOLDER}\README.md
File ${INST_FOLDER}\ca-bundle.crt
WriteUninstaller $INSTDIR\uninstall.exe
;WriteRegStr SHCTX "Software\sdl_img " "" $INSTDIR
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\sdl_img" "DisplayName" "sdl_img"
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\sdl_img" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
WriteRegStr SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\sdl_img" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
SectionEnd
; I'll put back the group if I ever add other optional sections
;SectionGroup /e "Optional" optional_id
Section "Source Code" source_id
SetOutPath $INSTDIR\src
FILE src\*
SectionEnd
;SectionGroupEnd
;-----------------------------------
; Descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${source_id} "Include the sdl_img source code."
!insertmacro MUI_FUNCTION_DESCRIPTION_END
;------------------------------------
; Installer Functions
;Function .onInit
;
;FunctionEnd
;------------------------------------
; Uninstaller section
; NOTE in Uninstall section $INSTDIR contains location of uninstaller
; not necessarily the same value as in the installer section
Section "Uninstall"
; RMDir /r /REBOOTOK $INSTDIR
;
delete $INSTDIR\sdl_img.exe
delete $INSTDIR\*.dll
delete $INSTDIR\sdl_img.ico
delete $INSTDIR\sdl_img.bmp
delete $INSTDIR\sdl_img2.bmp
delete $INSTDIR\LICENSE
delete $INSTDIR\LICENSE.txt
delete $INSTDIR\README.md
delete $INSTDIR\ca-bundle.crt
rmdir /r $INSTDIR\src
; remove uninstaller last
delete $INSTDIR\uninstall.exe
; will only remove if dir is empty
rmDir $INSTDIR
DeleteRegKey SHCTX "Software\Microsoft\Windows\CurrentVersion\Uninstall\sdl_img"
; don't forget this
RMDir /r $STARTMENU\sdl_img
SectionEnd