• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; $Id: mingw-ncurses.nsi,v 1.645 2024/04/27 13:56:53 tom Exp $
2
3; TODO add examples
4; TODO bump ABI to 6
5
6; Define the application name
7!define APPNAME "ncurses"
8!define EXENAME "ncurses.exe"
9
10!define VERSION_MAJOR "6"
11!define VERSION_MINOR "5"
12!define VERSION_YYYY  "2024"
13!define VERSION_MMDD  "0427"
14!define VERSION_PATCH ${VERSION_YYYY}${VERSION_MMDD}
15
16!define MY_ABI   "5"
17!define MY_MODEL "w"
18
19!define SUBKEY "ncurses"
20
21!define INSTALL "${APPNAME} (Console)"
22!define VERSION ${VERSION_MAJOR}.${VERSION_MINOR}
23!define VERSION_FULL  ${VERSION}-${VERSION_PATCH}
24
25; Main Install settings
26Name "${INSTALL}"
27InstallDir "c:\mingw"
28InstallDirRegKey HKLM "Software\${SUBKEY}" "$INSTDIR\bin"
29OutFile "NSIS-Output\${APPNAME}-${VERSION_FULL}-setup.exe"
30
31CRCCheck on
32SetCompressor /SOLID lzma
33
34VIAddVersionKey ProductName "${SUBKEY}"
35VIAddVersionKey CompanyName "https://invisible-island.net"
36VIAddVersionKey FileDescription "NCurses Installer (MinGW)"
37VIAddVersionKey FileVersion ${VERSION_FULL}
38VIAddVersionKey ProductVersion ${VERSION_FULL}
39VIAddVersionKey Comments "This installer was built with NSIS and cross-compiling to MinGW."
40VIAddVersionKey InternalName "${APPNAME}-${VERSION_FULL}-setup.exe"
41; This is a dotted set of numbers limited to 16-bits each
42VIProductVersion "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_YYYY}.${VERSION_MMDD}"
43
44; Modern interface settings
45!include "MUI.nsh"
46
47!define MUI_ABORTWARNING
48;!define MUI_FINISHPAGE_RUN
49;"$INSTDIR\bin\${EXENAME}"
50
51!insertmacro MUI_PAGE_WELCOME
52!insertmacro MUI_PAGE_LICENSE "..\COPYING"
53!insertmacro MUI_PAGE_COMPONENTS
54!insertmacro MUI_PAGE_DIRECTORY
55!insertmacro MUI_PAGE_INSTFILES
56!insertmacro MUI_PAGE_FINISH
57
58!insertmacro MUI_UNPAGE_CONFIRM
59!insertmacro MUI_UNPAGE_INSTFILES
60
61; Set languages (first is default language)
62!insertmacro MUI_LANGUAGE "English"
63!insertmacro MUI_RESERVEFILE_LANGDLL
64
65InstType "Full"		; SectionIn 1
66InstType "Typical"	; SectionIn 2
67InstType "Minimal"	; SectionIn 3
68
69Section "${APPNAME}" Section1
70
71	SectionIn 1 2 3
72
73	; Set Section properties
74	SetOverwrite on
75
76	; Set Section Files and Shortcuts
77	SetOutPath "$INSTDIR\bin"
78
79	File ".\bin\*.dll"
80
81	SetOutPath "$INSTDIR\share\${APPNAME}"
82	File /oname=README.txt "..\README"
83	File /oname=README-mingw.txt "..\README.mingw"
84
85	CreateDirectory "$SMPROGRAMS\${INSTALL}"
86	CreateShortCut "$SMPROGRAMS\${INSTALL}\${APPNAME}.lnk" "$INSTDIR\bin\${EXENAME}"
87	CreateShortCut "$SMPROGRAMS\${INSTALL}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
88
89SectionEnd
90
91Section "development" Section2
92
93	SectionIn 1 2
94
95	; Set Section properties
96	SetOverwrite on
97
98	; Set Section Files and Shortcuts
99	SetOutPath "$INSTDIR\share\${APPNAME}"
100
101	SetOutPath "$INSTDIR\include\${APPNAME}${MY_MODEL}"
102
103	File ".\include\${APPNAME}${MY_MODEL}\*.h"
104
105	SetOutPath "$INSTDIR\lib"
106
107	File ".\lib\*.a"
108
109SectionEnd
110
111Section "examples" Section3
112
113	SectionIn 1
114
115	; Set Section properties
116	SetOverwrite on
117
118	; Set Section Files and Shortcuts
119	SetOutPath "$INSTDIR\lib\${APPNAME}"
120
121SectionEnd
122
123Section -FinishSection
124
125	WriteRegStr HKLM "Software\${SUBKEY}" "" "$INSTDIR"
126	WriteRegStr HKLM "Software\${SUBKEY}" "Environment" ""
127	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "DisplayName" "${APPNAME} ${VERSION_FULL} (Console)"
128	WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}" "UninstallString" "$INSTDIR\uninstall.exe"
129	WriteUninstaller "$INSTDIR\uninstall.exe"
130
131SectionEnd
132
133; Modern install component descriptions
134!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
135	!insertmacro MUI_DESCRIPTION_TEXT ${Section1} "${SUBKEY} runtime"
136	!insertmacro MUI_DESCRIPTION_TEXT ${Section2} "Development headers and libraries"
137	!insertmacro MUI_DESCRIPTION_TEXT ${Section3} "Examples"
138!insertmacro MUI_FUNCTION_DESCRIPTION_END
139
140;Uninstall section
141Section Uninstall
142
143	;Remove from registry...
144	DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${INSTALL}"
145	DeleteRegKey HKLM "SOFTWARE\${SUBKEY}"
146
147	; Delete self
148	Delete "$INSTDIR\uninstall.exe"
149
150	; Delete Shortcuts
151	Delete "$SMPROGRAMS\${INSTALL}\${APPNAME}.lnk"
152	Delete "$SMPROGRAMS\${INSTALL}\Uninstall.lnk"
153
154	; Clean up application
155	Delete "$INSTDIR\bin\libform${MY_MODEL}${MY_ABI}.dll"
156	Delete "$INSTDIR\bin\libmenu${MY_MODEL}${MY_ABI}.dll"
157	Delete "$INSTDIR\bin\libncurses++${MY_MODEL}${MY_ABI}.dll"
158	Delete "$INSTDIR\bin\libncurses${MY_MODEL}${MY_ABI}.dll"
159	Delete "$INSTDIR\bin\libpanel${MY_MODEL}${MY_ABI}.dll"
160
161	Delete "$INSTDIR\include\${APPNAME}${MY_MODEL}\*.h"
162
163	Delete "$INSTDIR\lib\libform${MY_MODEL}.a"
164	Delete "$INSTDIR\lib\libmenu${MY_MODEL}.a"
165	Delete "$INSTDIR\lib\libncurses++${MY_MODEL}.a"
166	Delete "$INSTDIR\lib\libncurses${MY_MODEL}.a"
167	Delete "$INSTDIR\lib\libpanel${MY_MODEL}.a"
168
169	Delete "$INSTDIR\lib\libform${MY_MODEL}.dll.a"
170	Delete "$INSTDIR\lib\libmenu${MY_MODEL}.dll.a"
171	Delete "$INSTDIR\lib\libncurses++${MY_MODEL}.dll.a"
172	Delete "$INSTDIR\lib\libncurses${MY_MODEL}.dll.a"
173	Delete "$INSTDIR\lib\libpanel${MY_MODEL}.dll.a"
174
175	Delete "$INSTDIR\lib\${APPNAME}\*.exe"
176
177	Delete "$INSTDIR\share\${APPNAME}\*.*"
178
179	; Remove remaining directories
180	RMDir "$SMPROGRAMS\${INSTALL}"
181	RMDir "$INSTDIR\share\${APPNAME}"
182	RMDir "$INSTDIR\share"
183	RMDir "$INSTDIR\lib\${APPNAME}"
184	RMDir "$INSTDIR\lib"
185	RMDir "$INSTDIR\include\${APPNAME}${MY_MODEL}"
186	RMDir "$INSTDIR\include"
187	RMDir "$INSTDIR\bin"
188	RMDir "$INSTDIR\"
189
190SectionEnd