Add custom plugin DLL
[gpg4win.git] / src / inst-sections.nsi
1 # inst-sections.nsi - Installer for GPG4Win sections.  -*- coding: latin-1; -*-
2 # Copyright (C) 2005 g10 Code GmbH
3
4 # This file is part of GPG4Win.
5
6 # GPG4Win is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10
11 # GPG4Win is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20 # Sections
21
22 !ifdef HAVE_PKG_GNUPG
23 !include "inst-gnupg.nsi"
24 !endif
25 !ifdef HAVE_PKG_LIBGPG_ERROR
26 !include "inst-libgpg-error.nsi"
27 !endif
28 !ifdef HAVE_PKG_LIBICONV
29 !include "inst-libiconv.nsi"
30 !endif
31 !ifdef HAVE_PKG_PKGCONFIG
32 !include "inst-pkgconfig.nsi"
33 !endif
34 !ifdef HAVE_PKG_ZLIB
35 !include "inst-zlib.nsi"
36 !endif
37 !ifdef HAVE_PKG_GPGME
38 !include "inst-gpgme.nsi"
39 !endif
40 !ifdef HAVE_PKG_GETTEXT
41 !include "inst-gettext.nsi"
42 !endif
43 !ifdef HAVE_PKG_GLIB
44 !include "inst-glib.nsi"
45 !endif
46 !ifdef HAVE_PKG_LIBPNG
47 !include "inst-libpng.nsi"
48 !endif
49 !ifdef HAVE_PKG_GPGOL
50 !include "inst-gpgol.nsi"
51 !endif
52 !ifdef HAVE_PKG_PANGO
53 !include "inst-pango.nsi"
54 !endif
55 !ifdef HAVE_PKG_ATK
56 !include "inst-atk.nsi"
57 !endif
58 !ifdef HAVE_PKG_GTK_
59 !include "inst-gtk+.nsi"
60 !endif
61 !ifdef HAVE_PKG_GPA
62 !include "inst-gpa.nsi"
63 !endif
64 !ifdef HAVE_PKG_WINPT
65 !include "inst-winpt.nsi"
66 !endif
67 !ifdef HAVE_PKG_GPGEE
68 !include "inst-gpgee.nsi"
69 !endif
70 !ifdef HAVE_PKG_MAN_NOVICE_DE
71 !include "inst-man_novice_de.nsi"
72 !endif
73 !ifdef HAVE_PKG_MAN_ADVANCED_DE
74 !include "inst-man_advanced_de.nsi"
75 !endif
76
77 # We have to invoke the uninstallers in reverse order!
78
79 !ifdef HAVE_PKG_MAN_ADVANCED_DE
80 !include "uninst-man_advanced_de.nsi"
81 !endif
82 !ifdef HAVE_PKG_MAN_NOVICE_DE
83 !include "uninst-man_novice_de.nsi"
84 !endif
85 !ifdef HAVE_PKG_GPGEE
86 !include "uninst-gpgee.nsi"
87 !endif
88 !ifdef HAVE_PKG_WINPT
89 !include "uninst-winpt.nsi"
90 !endif
91 !ifdef HAVE_PKG_GPA
92 !include "uninst-gpa.nsi"
93 !endif
94 !ifdef HAVE_PKG_GTK_
95 !include "uninst-gtk+.nsi"
96 !endif
97 !ifdef HAVE_PKG_ATK
98 !include "uninst-atk.nsi"
99 !endif
100 !ifdef HAVE_PKG_PANGO
101 !include "uninst-pango.nsi"
102 !endif
103 !ifdef HAVE_PKG_GPGOL
104 !include "uninst-gpgol.nsi"
105 !endif
106 !ifdef HAVE_PKG_LIBPNG
107 !include "uninst-libpng.nsi"
108 !endif
109 !ifdef HAVE_PKG_GLIB
110 !include "uninst-glib.nsi"
111 !endif
112 !ifdef HAVE_PKG_GETTEXT
113 !include "uninst-gettext.nsi"
114 !endif
115 !ifdef HAVE_PKG_GPGME
116 !include "uninst-gpgme.nsi"
117 !endif
118 !ifdef HAVE_PKG_ZLIB
119 !include "uninst-zlib.nsi"
120 !endif
121 !ifdef HAVE_PKG_PKGCONFIG
122 !include "uninst-pkgconfig.nsi"
123 !endif
124 !ifdef HAVE_PKG_LIBICONV
125 !include "uninst-libiconv.nsi"
126 !endif
127 !ifdef HAVE_PKG_LIBGPG_ERROR
128 !include "uninst-libgpg-error.nsi"
129 !endif
130 !ifdef HAVE_PKG_GNUPG
131 !include "uninst-gnupg.nsi"
132 !endif
133
134 # Dependency Management
135
136 !include "Sections.nsh"
137
138 Function CalcDepends
139   # This section could very well be autogenerated from the
140   # information in configure.ac.  Note that it doesn't hurt to have
141   # stuff here for packages that we don't include.
142
143   # First clear all indirect dependencies.
144 !ifdef HAVE_PKG_LIBICONV
145   !insertmacro UnselectSection ${SEC_libiconv}
146 !endif
147 !ifdef HAVE_PKG_GETTEXT
148   !insertmacro UnselectSection ${SEC_gettext}
149 !endif
150 !ifdef HAVE_PKG_ZLIB
151   !insertmacro UnselectSection ${SEC_zlib}
152 !endif
153 !ifdef HAVE_PKG_LIBPNG
154   !insertmacro UnselectSection ${SEC_libpng}
155 !endif
156 !ifdef HAVE_PKG_PKGCONFIG
157   !insertmacro UnselectSection ${SEC_pkgconfig}
158 !endif
159 !ifdef HAVE_PKG_GLIB
160   !insertmacro UnselectSection ${SEC_glib}
161 !endif
162 !ifdef HAVE_PKG_ATK
163   !insertmacro UnselectSection ${SEC_atk}
164 !endif
165 !ifdef HAVE_PKG_PANGO
166   !insertmacro UnselectSection ${SEC_pango}
167 !endif
168 !ifdef HAVE_PKG_GTK_
169   !insertmacro UnselectSection ${SEC_gtk_}
170 !endif
171 !ifdef HAVE_PKG_LIBGPG_ERROR
172   !insertmacro UnselectSection ${SEC_libgpg_error}
173 !endif
174 !ifdef HAVE_PKG_GPGME
175   !insertmacro UnselectSection ${SEC_gpgme}
176 !endif
177
178   # Then enable all dependencies in reverse build list order!
179
180 !ifdef HAVE_PKG_GPGEE
181   !insertmacro SectionFlagIsSet ${SEC_gpgee} ${SF_SELECTED} have_gpgee skip_gpgee
182   have_gpgee:
183   !insertmacro SelectSection ${SEC_gpgme}
184   !insertmacro SelectSection ${SEC_gnupg}
185   skip_gpgee:
186 !endif
187
188 !ifdef HAVE_PKG_WINPT
189   !insertmacro SectionFlagIsSet ${SEC_winpt} ${SF_SELECTED} have_winpt skip_winpt
190   have_winpt:
191   !insertmacro SelectSection ${SEC_gpgme}
192   !insertmacro SelectSection ${SEC_gnupg}
193   skip_winpt:
194 !endif
195
196 !ifdef HAVE_PKG_GPA
197   !insertmacro SectionFlagIsSet ${SEC_gpa} ${SF_SELECTED} have_gpa skip_gpa
198   have_gpa:
199   !insertmacro SelectSection ${SEC_zlib}
200   !insertmacro SelectSection ${SEC_gtk_}
201   !insertmacro SelectSection ${SEC_libpng}
202   !insertmacro SelectSection ${SEC_glib}
203   !insertmacro SelectSection ${SEC_gpgme}
204   !insertmacro SelectSection ${SEC_gnupg}
205   skip_gpa:
206 !endif
207
208 !ifdef HAVE_PKG_GTK_
209   !insertmacro SectionFlagIsSet ${SEC_gtk_} \
210                 ${SF_SELECTED} have_gtk_ skip_gtk_
211   have_gtk_:
212   !insertmacro SelectSection ${SEC_atk}
213   !insertmacro SelectSection ${SEC_pango}
214   !insertmacro SelectSection ${SEC_glib}
215   !insertmacro SelectSection ${SEC_libiconv}
216   !insertmacro SelectSection ${SEC_gettext}
217   !insertmacro SelectSection ${SEC_pkgconfig}
218   skip_gtk_:
219 !endif
220
221 !ifdef HAVE_PKG_ATK
222   !insertmacro SectionFlagIsSet ${SEC_atk} \
223                 ${SF_SELECTED} have_atk skip_atk
224   have_atk:
225   !insertmacro SelectSection ${SEC_glib}
226   !insertmacro SelectSection ${SEC_pkgconfig}
227   skip_atk:
228 !endif
229
230 !ifdef HAVE_PKG_PANGO
231   !insertmacro SectionFlagIsSet ${SEC_pango} \
232                 ${SF_SELECTED} have_pango skip_pango
233   have_pango:
234   !insertmacro SelectSection ${SEC_glib}
235   !insertmacro SelectSection ${SEC_pkgconfig}
236   skip_pango:
237 !endif
238
239 !ifdef HAVE_PKG_GPGOL
240   !insertmacro SectionFlagIsSet ${SEC_gpgol} \
241                 ${SF_SELECTED} have_gpgol skip_gpgol
242   have_gpgol:
243   !insertmacro SelectSection ${SEC_gpgme}
244   !insertmacro SelectSection ${SEC_gnupg}
245   skip_gpgol:
246 !endif
247
248 !ifdef HAVE_PKG_LIBPNG
249   !insertmacro SectionFlagIsSet ${SEC_libpng} \
250                 ${SF_SELECTED} have_libpng skip_libpng
251   have_libpng:
252   !insertmacro SelectSection ${SEC_pkgconfig}
253   skip_libpng:
254 !endif
255
256 !ifdef HAVE_PKG_GLIB
257   !insertmacro SectionFlagIsSet ${SEC_glib} \
258                 ${SF_SELECTED} have_glib skip_glib
259   have_glib:
260   !insertmacro SelectSection ${SEC_pkgconfig}
261   skip_glib:
262 !endif
263
264 !ifdef HAVE_PKG_GETTEXT
265   !insertmacro SectionFlagIsSet ${SEC_gettext} \
266                 ${SF_SELECTED} have_gettext skip_gettext
267   have_gettext:
268   !insertmacro SelectSection ${SEC_libiconv}
269   skip_gettext:
270 !endif
271
272 !ifdef HAVE_PKG_GPGME
273   !insertmacro SectionFlagIsSet ${SEC_gpgme} \
274                 ${SF_SELECTED} have_gpgme skip_gpgme
275   have_gpgme:
276   !insertmacro SelectSection ${SEC_libgpg_error}
277   skip_gpgme:
278 !endif
279
280   # Package "zlib" has no dependencies.
281   # Package "pkgconfig" has no dependencies.
282   # Package "libiconv" has no dependencies.
283   # Package "libgpg-error" has no dependencies.
284   # Package "gnupg" has no dependencies.
285
286 FunctionEnd
287
288
289 Function .onInit
290   Call G4wRunOnce
291
292   #Call G4wTest
293  
294   SetOutPath $TEMP
295   File /oname=gpgspltmp.bmp "${TOP_SRCDIR}/src/gpg4win-splash.bmp"
296   File /oname=gpgspltmp.wav "${TOP_SRCDIR}/src/gpg4win-splash.wav"
297   advsplash::show 3000 600 400 -1 $TEMP\gpgspltmp
298   Pop $0 # $0 has '1' if the user closed the splash screen early,
299          # '0' if everything closed normal, and '-1' if some error occured.
300   Delete /rebootok $TEMP\gpgspltmp.wav
301   Delete /rebootok $TEMP\gpgspltmp.bmp
302
303   Call CalcDepends
304 FunctionEnd
305
306 Function .onSelChange
307   Call CalcDepends
308 FunctionEnd
309
310
311 # This must be in a central place.  Urgs.
312
313 !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
314 !ifdef HAVE_PKG_GNUPG
315   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gnupg} $(DESC_SEC_gnupg)
316 !endif
317 !ifdef HAVE_PKG_GPGOL
318   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpgol} $(DESC_SEC_gpgol)
319 !endif
320 !ifdef HAVE_PKG_GPA
321   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpa} $(DESC_SEC_gpa)
322 !endif
323 !ifdef HAVE_PKG_WINPT
324   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_winpt} $(DESC_SEC_winpt)
325 !endif
326 !ifdef HAVE_PKG_GPGEE
327   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_gpgee} $(DESC_SEC_gpgee)
328 !endif
329 !ifdef HAVE_PKG_MAN_NOVICE_DE
330   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_novice_de} $(DESC_SEC_man_novice_de)
331 !endif
332 !ifdef HAVE_PKG_MAN_ADVANCED_DE
333   !insertmacro MUI_DESCRIPTION_TEXT ${SEC_man_advanced_de} $(DESC_SEC_man_advanced_de)
334 !endif
335 !insertmacro MUI_FUNCTION_DESCRIPTION_END
336
337
338 # This also must be in a central place.  Also Urgs.
339
340 Section "-startmenu"
341
342 !ifdef HAVE_STARTMENU
343   # Make sure that the context of the automatic variables has been set to
344   # the "all users" shell folder.  This guarantees that the menu gets written
345   # for all users.  We have already checked that we are running as Admin; or
346   # we printed a warning that installation will not succeed.
347   SetShellVarContext all
348
349 !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
350     CreateDirectory "$SMPROGRAMS\$STARTMENU_FOLDER"
351
352 !ifdef HAVE_PKG_WINPT
353     SectionGetFlags ${SEC_winpt} $R0 
354     IntOp $R0 $R0 & ${SF_SELECTED} 
355     IntCmp $R0 ${SF_SELECTED} 0 no_winpt_menu 
356     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\WINPT.lnk" \
357         "$INSTDIR\winpt.exe" \
358         "" "$INSTDIR\winpt.exe" "" SW_SHOWNORMAL "" $(DESC_Menu_winpt)
359    no_winpt_menu:
360 !endif
361
362 !ifdef HAVE_PKG_GPA
363     SectionGetFlags ${SEC_gpa} $R0 
364     IntOp $R0 $R0 & ${SF_SELECTED} 
365     IntCmp $R0 ${SF_SELECTED} 0 no_gpa_menu 
366     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GPA.lnk" \
367         "$INSTDIR\gpa.exe" \
368         "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gpa)
369   no_gpa_menu:
370 !endif
371
372 !ifdef HAVE_PKG_MAN_NOVICE_DE
373     SectionGetFlags ${SEC_man_novice_de} $R0 
374     IntOp $R0 $R0 & ${SF_SELECTED} 
375     IntCmp $R0 ${SF_SELECTED} 0 no_man_novice_de_menu 
376     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Novice Manual.lnk" \
377         "$INSTDIR\share\gpg4win\man_novice_de.html" \
378         "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_man_novice_de)
379   no_man_novice_de_menu:
380 !endif
381
382 !ifdef HAVE_PKG_MAN_ADVANCED_DE
383     SectionGetFlags ${SEC_man_advanced_de} $R0 
384     IntOp $R0 $R0 & ${SF_SELECTED} 
385     IntCmp $R0 ${SF_SELECTED} 0 no_man_advanced_de_menu 
386     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Advanced Manual.lnk" \
387         "$INSTDIR\share\gpg4win\man_novice_de.html" \
388         "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_man_advanced_de)
389   no_man_advanced_de_menu:
390 !endif
391
392 !ifdef HAVE_PKG_GPGEE
393     SectionGetFlags ${SEC_gpgee} $R0 
394     IntOp $R0 $R0 & ${SF_SELECTED} 
395     IntCmp $R0 ${SF_SELECTED} 0 no_gpgee_menu 
396     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GPGee Manual.lnk" \
397         "$INSTDIR\GPGee.hlp" "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gpgee_hlp)
398   no_gpgee_menu:
399 !endif
400
401
402     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\GnuPG FAQ.lnk" \
403                    "$INSTDIR\share\gnupg\faq.html" \
404                    "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gnupg_faq)
405
406     CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" \
407         "$INSTDIR\${PACKAGE}-uninstall.exe"
408 !insertmacro MUI_STARTMENU_WRITE_END
409 !endif
410 SectionEnd