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