summaryrefslogtreecommitdiffstats
path: root/PACKAGE/lynx.nsi
blob: c081c953b4eb2ab6fd306970e346e27155e4e5d2 (plain)
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
; $LynxId: lynx.nsi,v 1.44 2018/07/08 15:22:44 tom Exp $
; Script originally generated with the Venis Install Wizard, but customized.
; The Inno Setup script is preferred; but this can be built via cross-compiling.

; Define the application name
!define APPNAME "Lynx"
!define EXENAME "lynx.exe"

!define VERSION_EPOCH "2"
!define VERSION_MAJOR "8"
!define VERSION_MINOR "9"
!define VERSION_LEVEL "01"
!define VERSION_PATCH "rel.1"

!define SUBKEY "Lynx"

!define INSTALL "Lynx - web browser"
!define VERSION "${VERSION_EPOCH}.${VERSION_MAJOR}.${VERSION_MINOR}${VERSION_PATCH}"

; Main Install settings
Name "${INSTALL}"
InstallDir "$PROGRAMFILES\${INSTALL}"
InstallDirRegKey HKLM "Software\${SUBKEY}" "$INSTDIR\bin"
OutFile "NSIS-Output\${APPNAME}-${VERSION}-setup.exe"

CRCCheck on
SetCompressor /SOLID lzma

VIAddVersionKey ProductName "${SUBKEY}"
VIAddVersionKey CompanyName "https://invisible-island.net/lynx"
VIAddVersionKey LegalCopyright "� 1997-2017,2018, Thomas E. Dickey"
VIAddVersionKey FileDescription "Lynx Installer (MinGW)"
VIAddVersionKey FileVersion "${VERSION}"
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey Comments "This installer was built with NSIS and cross-compiling to MinGW."
VIAddVersionKey InternalName "setup-${APPNAME}-${VERSION}.exe"
VIProductVersion "${VERSION_EPOCH}.${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_LEVEL}"

; adapted from http://nsis.sourceforge.net/Readme_Page_Based_on_MUI_License_Page
!macro MUI_EXTRAPAGE_README UN TheFile
   !define MUI_LICENSEPAGE_BUTTON "$(^NextBtn)"
   !insertmacro MUI_${UN}PAGE_LICENSE "${TheFile}"
!macroend
!define ReadmeRun "!insertmacro MUI_EXTRAPAGE_README"
!macro MUI_PAGE_README TheFile
    ${ReadmeRun} "" "${TheFile}"
!macroend

; Modern interface settings
!include "MUI.nsh"

!define MUI_ABORTWARNING
!define MUI_FINISHPAGE_RUN "$INSTDIR\${EXENAME}"

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE "..\COPYHEADER"
!insertmacro MUI_PAGE_README "..\README"
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES

; Set languages (first is default language)
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_RESERVEFILE_LANGDLL

!define LYNX_CFG "lynx.cfg"

InstType "Full"		; SectionIn 1
InstType "Typical"	; SectionIn 2
InstType "Minimal"	; SectionIn 3

Section "${APPNAME}" Section1

	SectionIn 1 2 3

	; Set Section properties
	SetOverwrite on

	; Set Section Files and Shortcuts
	SetOutPath "$INSTDIR"
	File /oname=${EXENAME} ".\bin\*${EXENAME}"
	File ".\bin\bzip2.exe"
	File ".\bin\gzip.exe"
	File ".\bin\*.dll"

	; TODO: bzip2.exe, gzip.exe, *.dll

	CreateShortCut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${EXENAME}"
	CreateShortCut "$SENDTO\${APPNAME}.lnk" "$INSTDIR\${EXENAME}"
	CreateDirectory "$SMPROGRAMS\${INSTALL}"
	CreateShortCut "$SMPROGRAMS\${INSTALL}\${INSTALL}.lnk" "$INSTDIR\${EXENAME}"
	CreateShortCut "$SMPROGRAMS\${INSTALL}\${APPNAME} - Help.lnk" "$INSTDIR\help\lynx_help_main.html"
	CreateShortCut "$SMPROGRAMS\${INSTALL}\Uninstall.lnk" "$INSTDIR\uninstall.exe"

	File ".\share\lynx_doc\samples\*.lss"

	; preinstall lynx.cfg as a temporary file
	File /oname=${LYNX_CFG} ".\etc\${LYNX_CFG}"

	; at install-time, append our customization
	FileOpen $0 "${LYNX_CFG}" a
	FileSeek $0 0 END
	FileWrite $0 "HELPFILE:$INSTDIR\help\Lynx_help_main.html.gz$\n"
	FileWrite $0 "COLOR_STYLE:$INSTDIR\opaque.lss$\n"
	FileWrite $0 "CHMOD_PATH:$\n"
	FileWrite $0 "COPY_PATH:$\n"
	FileWrite $0 "MKDIR_PATH:$\n"
	FileWrite $0 "MV_PATH:$\n"
	FileWrite $0 "RMDIR_PATH:$\n"
	FileWrite $0 "RM_PATH:$\n"
	FileWrite $0 "TOUCH_PATH:$\n"
	FileClose $0

	File "..\samples\lynx.bat"
	File "..\samples\lynx-demo.cfg"
	File "..\samples\oldlynx.bat"

	File "..\samples\jumps.htm"
	File "..\samples\home.htm"
	File "..\samples\lynx_bookmarks.htm"

	SetOutPath "$INSTDIR\icon"
	File "..\samples\lynx.ico"

	SetOutPath "$INSTDIR\tmp"

SectionEnd

Section "documentation" Section2

	SectionIn 1 2

	; Set Section properties
	SetOverwrite on

	; Set Section Files and Shortcuts
	SetOutPath "$INSTDIR"
	File "..\lynx.man"

	SetOutPath "$INSTDIR\doc"
	File ".\share\lynx_doc\CHANGES*.*"
	File ".\share\lynx_doc\COPY*.*"
	File ".\share\lynx_doc\PROBLEM*.*"
	File ".\share\lynx_doc\README*.*"

	SetOutPath "$INSTDIR\help"
	File ".\share\lynx_help\*.*"

	SetOutPath "$INSTDIR\help\keystrokes"
	File ".\share\lynx_help\keystrokes\*.*"

SectionEnd

Section "samples" Section3

	SectionIn 1

	; Set Section properties
	SetOverwrite on

	; Set Section Files and Shortcuts
	SetOutPath "$INSTDIR\doc\samples"
	File ".\share\lynx_doc\samples\*.*"

	SetOutPath "$INSTDIR\doc\test"
	File ".\share\lynx_doc\test\*.*"

SectionEnd

Section -FinishSection

	WriteRegStr HKLM "Software\${SUBKEY}" "" "$INSTDIR"
	WriteRegStr HKLM "Software\${SUBKEY}" "Environment" ""
	WriteRegStr HKLM "Software\${SUBKEY}\Environment" "LYNX_CFG" "$INSTDIR\${LYNX_CFG}"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "DisplayName" "${INSTALL} ${VERSION}"
	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "UninstallString" "$INSTDIR\uninstall.exe"
	WriteUninstaller "$INSTDIR\uninstall.exe"

SectionEnd

; Modern install component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
	!insertmacro MUI_DESCRIPTION_TEXT ${Section1} "${SUBKEY}"
	!insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Documentation"
	!insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Samples and Test-files."
!insertmacro MUI_FUNCTION_DESCRIPTION_END

;Uninstall section
Section Uninstall

	;Remove from registry...
	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}"
	DeleteRegKey HKLM "SOFTWARE\${SUBKEY}"

	; Delete self
	Delete "$INSTDIR\uninstall.exe"

	; Delete Shortcuts
	Delete "$DESKTOP\${APPNAME}.lnk"
	Delete "$SENDTO\${APPNAME}.lnk"
	Delete "$SMPROGRAMS\${INSTALL}\${INSTALL}.lnk"
	Delete "$SMPROGRAMS\${INSTALL}\${APPNAME} - Help.lnk"
	Delete "$SMPROGRAMS\${INSTALL}\Uninstall.lnk"

	; Clean up application
	Delete "$INSTDIR\${EXENAME}"
	Delete "$INSTDIR\doc\samples\*.*"
	Delete "$INSTDIR\doc\test\*.*"
	Delete "$INSTDIR\doc\*.*"
	Delete "$INSTDIR\help\keystrokes\*.*"
	Delete "$INSTDIR\help\*.*"
	Delete "$INSTDIR\icon\*.*"
	Delete "$INSTDIR\tmp\*.*"
	Delete "$INSTDIR\bzip2.exe"
	Delete "$INSTDIR\gzip.exe"
	Delete "$INSTDIR\*.bat"
	Delete "$INSTDIR\*.cfg"
	Delete "$INSTDIR\*.dll"
	Delete "$INSTDIR\*.htm"
	Delete "$INSTDIR\*.man"
	Delete "$INSTDIR\*.lss"
	Delete "$INSTDIR\*.tmp"

	; Remove remaining directories
	RMDir "$SMPROGRAMS\${INSTALL}"
	RMDir "$INSTDIR\doc\samples"
	RMDir "$INSTDIR\doc\test"
	RMDir "$INSTDIR\doc"
	RMDir "$INSTDIR\help\keystrokes"
	RMDir "$INSTDIR\help"
	RMDir "$INSTDIR\icon"
	RMDir "$INSTDIR\tmp"
	RMDir "$INSTDIR\"

SectionEnd

; eof