MSI: Fix possible use of unintialized variable
[gpg4win.git] / src / inst-sections.nsi
1 # inst-sections.nsi - Installer for GPG4Win sections.  -*- coding: latin-1; -*-
2 # Copyright (C) 2005, 2006, 2007, 2008, 2009 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, see <http://www.gnu.org/licenses/>.
18
19 !include "inst-gpg4win.nsi"
20
21 # The order of installation must be the same as the build order.  You
22 # can use tsort on the info in configure.ac, or just check out
23 # gpg4win_build_list in config.nsi.  The order determines also the
24 # order in the packages selection dialog.
25
26 !ifdef HAVE_PKG_BZIP2
27 !include "inst-bzip2.nsi"
28 !endif
29 !ifdef HAVE_PKG_LIBICONV
30 !include "inst-libiconv.nsi"
31 !endif
32 !ifdef HAVE_PKG_LIBTASN1
33 !include "inst-libtasn1.nsi"
34 !endif
35 !ifdef HAVE_PKG_BREEZE_ICONS
36 !include "inst-breeze-icons.nsi"
37 !endif
38 !ifdef HAVE_PKG_PKGCONFIG
39 !include "inst-pkgconfig.nsi"
40 !endif
41 !ifdef HAVE_PKG_W32PTH
42 !include "inst-w32pth.nsi"
43 !endif
44 !ifdef HAVE_PKG_ZLIB
45 !include "inst-zlib.nsi"
46 !endif
47 !ifdef HAVE_PKG_QTBASE
48 !include "inst-qtbase.nsi"
49 !endif
50 !ifdef HAVE_PKG_GETTEXT
51 !include "inst-gettext.nsi"
52 !endif
53 !ifdef HAVE_PKG_LIBPNG
54 !include "inst-libpng.nsi"
55 !endif
56 !ifdef HAVE_PKG_LIBASSUAN
57 !include "inst-libassuan.nsi"
58 !endif
59 !ifdef HAVE_PKG_LIBGPG_ERROR
60 !include "inst-libgpg-error.nsi"
61 !endif
62 !ifdef HAVE_PKG_LIBFFI
63 !include "inst-libffi.nsi"
64 !endif
65 !ifdef HAVE_PKG_GLIB
66 !include "inst-glib.nsi"
67 !endif
68 !ifdef HAVE_PKG_EXPAT
69 !include "inst-expat.nsi"
70 !endif
71 !ifdef HAVE_PKG_FREETYPE
72 !include "inst-freetype.nsi"
73 !endif
74 !ifdef HAVE_PKG_FONTCONFIG
75 !include "inst-fontconfig.nsi"
76 !endif
77 !ifdef HAVE_PKG_CAIRO
78 !include "inst-cairo.nsi"
79 !endif
80 !ifdef HAVE_PKG_PANGO
81 !include "inst-pango.nsi"
82 !endif
83 !ifdef HAVE_PKG_ATK
84 !include "inst-atk.nsi"
85 !endif
86 !ifdef HAVE_PKG_GDK_PIXBUF
87 !include "inst-gdk-pixbuf.nsi"
88 !endif
89 !ifdef HAVE_PKG_GTK_
90 !include "inst-gtk+.nsi"
91 !endif
92 !ifdef HAVE_PKG_PINENTRY
93 !include "inst-pinentry.nsi"
94 !endif
95 !ifdef HAVE_PKG_GNUPG_W32
96 !include "inst-gnupg-w32.nsi"
97 !endif
98 !ifdef HAVE_PKG_GPGME
99 !include "inst-gpgme.nsi"
100 !endif
101 !ifdef HAVE_PKG_QTTOOLS
102 !include "inst-qttools.nsi"
103 !endif
104 !ifdef HAVE_PKG_QTWINEXTRAS
105 !include "inst-qtwinextras.nsi"
106 !endif
107 !ifdef HAVE_PKG_BOOST
108 !include "inst-boost.nsi"
109 !endif
110 !ifdef HAVE_PKG_KCONFIG
111 !include "inst-kconfig.nsi"
112 !endif
113 !ifdef HAVE_PKG_KI18N
114 !include "inst-ki18n.nsi"
115 !endif
116 !ifdef HAVE_PKG_KWIDGETSADDONS
117 !include "inst-kwidgetsaddons.nsi"
118 !endif
119 !ifdef HAVE_PKG_KCOMPLETION
120 !include "inst-kcompletion.nsi"
121 !endif
122 !ifdef HAVE_PKG_KWINDOWSYSTEM
123 !include "inst-kwindowsystem.nsi"
124 !endif
125 !ifdef HAVE_PKG_KCOREADDONS
126 !include "inst-kcoreaddons.nsi"
127 !endif
128 !ifdef HAVE_PKG_KCODECS
129 !include "inst-kcodecs.nsi"
130 !endif
131 !ifdef HAVE_PKG_KCONFIGWIDGETS
132 !include "inst-kconfigwidgets.nsi"
133 !endif
134 !ifdef HAVE_PKG_KXMLGUI
135 !include "inst-kxmlgui.nsi"
136 !endif
137 !ifdef HAVE_PKG_KGUIADDONS
138 !include "inst-kguiaddons.nsi"
139 !endif
140 !ifdef HAVE_PKG_KMIME
141 !include "inst-kmime.nsi"
142 !endif
143 !ifdef HAVE_PKG_KDE_L10N
144 !include "inst-kde-l10n.nsi"
145 !endif
146 !ifdef HAVE_PKG_KICONTHEMES
147 !include "inst-kiconthemes.nsi"
148 !endif
149 !ifdef HAVE_PKG_KARCHIVE
150 !include "inst-karchive.nsi"
151 !endif
152 !ifdef HAVE_PKG_KCRASH
153 !include "inst-kcrash.nsi"
154 !endif
155 !ifdef HAVE_PKG_KITEMVIEWS
156 !include "inst-kitemviews.nsi"
157 !endif
158 !ifdef HAVE_PKG_KITEMMODELS
159 !include "inst-kitemmodels.nsi"
160 !endif
161 !ifdef HAVE_PKG_LIBKLEO
162 !include "inst-libkleo.nsi"
163 !endif
164 !ifdef HAVE_PKG_EXTRA_CMAKE_MODULES
165 !include "inst-extra-cmake-modules.nsi"
166 !endif
167 !ifdef HAVE_PKG_QTSVG
168 !include "inst-qtsvg.nsi"
169 !endif
170 !ifdef HAVE_PKG_QTTRANSLATIONS
171 !include "inst-qttranslations.nsi"
172 !endif
173 !ifdef HAVE_PKG_GPG4WIN_TOOLS
174 !include "inst-gpg4win-tools.nsi"
175 !endif
176 !ifdef HAVE_PKG_SCUTE
177 !include "inst-scute.nsi"
178 !endif
179
180 # These are displayed in the selection dialog.
181
182 !ifdef HAVE_PKG_KLEOPATRA
183 !include "inst-kleopatra.nsi"
184 !endif
185 !ifdef HAVE_PKG_GPA
186 !include "inst-gpa.nsi"
187 !endif
188 !ifdef HAVE_PKG_GPGOL
189 !include "inst-gpgol.nsi"
190 !endif
191 !ifdef HAVE_PKG_GPGEX
192 !include "inst-gpgex.nsi"
193 !endif
194 !ifdef HAVE_PKG_PAPERKEY
195 !include "inst-paperkey.nsi"
196 !endif
197 !ifdef HAVE_PKG_COMPENDIUM
198 !include "inst-compendium.nsi"
199 !endif
200 !ifdef HAVE_PKG_MAN_NOVICE_EN
201 !include "inst-man_novice_en.nsi"
202 !endif
203 !ifdef HAVE_PKG_MAN_ADVANCED_EN
204 !include "inst-man_advanced_en.nsi"
205 !endif
206 !ifdef HAVE_PKG_MAN_NOVICE_DE
207 !include "inst-man_novice_de.nsi"
208 !endif
209 !ifdef HAVE_PKG_MAN_ADVANCED_DE
210 !include "inst-man_advanced_de.nsi"
211 !endif
212
213 !include "inst-gpgme-browser.nsi"
214
215 !include "inst-final.nsi"
216
217 # We have to invoke the uninstallers in reverse order!
218
219 !ifdef HAVE_PKG_MAN_ADVANCED_DE
220 !include "uninst-man_advanced_de.nsi"
221 !endif
222 !ifdef HAVE_PKG_MAN_NOVICE_DE
223 !include "uninst-man_novice_de.nsi"
224 !endif
225 !ifdef HAVE_PKG_MAN_ADVANCED_EN
226 !include "uninst-man_advanced_en.nsi"
227 !endif
228 !ifdef HAVE_PKG_MAN_NOVICE_EN
229 !include "uninst-man_novice_en.nsi"
230 !endif
231 !ifdef HAVE_PKG_COMPENDIUM
232 !include "uninst-compendium.nsi"
233 !endif
234 !ifdef HAVE_PKG_PAPERKEY
235 !include "uninst-paperkey.nsi"
236 !endif
237 !ifdef HAVE_PKG_GPGEX
238 !include "uninst-gpgex.nsi"
239 !endif
240 !ifdef HAVE_PKG_GPGOL
241 !include "uninst-gpgol.nsi"
242 !endif
243 !ifdef HAVE_PKG_GPA
244 !include "uninst-gpa.nsi"
245 !endif
246 !ifdef HAVE_PKG_KLEOPATRA
247 !include "uninst-kleopatra.nsi"
248 !endif
249
250 !ifdef HAVE_PKG_GPGME
251 !include "uninst-gpgme.nsi"
252 !endif
253 !ifdef HAVE_PKG_GNUPG_W32
254 !include "uninst-gnupg-w32.nsi"
255 !endif
256 !ifdef HAVE_PKG_PINENTRY
257 !include "uninst-pinentry.nsi"
258 !endif
259 !ifdef HAVE_PKG_GNUTLS
260 !include "uninst-gnutls.nsi"
261 !endif
262 !ifdef HAVE_PKG_CURL
263 !include "uninst-curl.nsi"
264 !endif
265 !ifdef HAVE_PKG_GTK_
266 !include "uninst-gtk+.nsi"
267 !endif
268 !ifdef HAVE_PKG_GDK_PIXBUF
269 !include "uninst-gdk-pixbuf.nsi"
270 !endif
271 !ifdef HAVE_PKG_ATK
272 !include "uninst-atk.nsi"
273 !endif
274 !ifdef HAVE_PKG_PANGO
275 !include "uninst-pango.nsi"
276 !endif
277 !ifdef HAVE_PKG_CAIRO
278 !include "uninst-cairo.nsi"
279 !endif
280 !ifdef HAVE_PKG_FONTCONFIG
281 !include "uninst-fontconfig.nsi"
282 !endif
283 !ifdef HAVE_PKG_FREETYPE
284 !include "uninst-freetype.nsi"
285 !endif
286 !ifdef HAVE_PKG_EXPAT
287 !include "uninst-expat.nsi"
288 !endif
289 !ifdef HAVE_PKG_GLIB
290 !include "uninst-glib.nsi"
291 !endif
292 !ifdef HAVE_PKG_LIBFFI
293 !include "uninst-libffi.nsi"
294 !endif
295 !ifdef HAVE_PKG_LIBGPG_ERROR
296 !include "uninst-libgpg-error.nsi"
297 !endif
298 !ifdef HAVE_PKG_LIBASSUAN
299 !include "uninst-libassuan.nsi"
300 !endif
301 !ifdef HAVE_PKG_LIBPNG
302 !include "uninst-libpng.nsi"
303 !endif
304 !ifdef HAVE_PKG_GETTEXT
305 !include "uninst-gettext.nsi"
306 !endif
307 !ifdef HAVE_PKG_QTBASE
308 !include "uninst-qtbase.nsi"
309 !endif
310 !ifdef HAVE_PKG_ZLIB
311 !include "uninst-zlib.nsi"
312 !endif
313 !ifdef HAVE_PKG_W32PTH
314 !include "uninst-w32pth.nsi"
315 !endif
316 !ifdef HAVE_PKG_PKGCONFIG
317 !include "uninst-pkgconfig.nsi"
318 !endif
319 !ifdef HAVE_PKG_BREEZE_ICONS
320 !include "uninst-breeze-icons.nsi"
321 !endif
322 !ifdef HAVE_PKG_MAN_ADVANCED_DE
323 !include "uninst-man_advanced_de.nsi"
324 !endif
325 !ifdef HAVE_PKG_MAN_NOVICE_DE
326 !include "uninst-man_novice_de.nsi"
327 !endif
328 !ifdef HAVE_PKG_MAN_ADVANCED_EN
329 !include "uninst-man_advanced_en.nsi"
330 !endif
331 !ifdef HAVE_PKG_MAN_NOVICE_EN
332 !include "uninst-man_novice_en.nsi"
333 !endif
334 !ifdef HAVE_PKG_LIBICONV
335 !include "uninst-libiconv.nsi"
336 !endif
337 !ifdef HAVE_PKG_QTTOOLS
338 !include "uninst-qttools.nsi"
339 !endif
340 !ifdef HAVE_PKG_QTWINEXTRAS
341 !include "uninst-qtwinextras.nsi"
342 !endif
343 !ifdef HAVE_PKG_BOOST
344 !include "uninst-boost.nsi"
345 !endif
346 !ifdef HAVE_PKG_KCONFIG
347 !include "uninst-kconfig.nsi"
348 !endif
349 !ifdef HAVE_PKG_KI18N
350 !include "uninst-ki18n.nsi"
351 !endif
352 !ifdef HAVE_PKG_KWIDGETSADDONS
353 !include "uninst-kwidgetsaddons.nsi"
354 !endif
355 !ifdef HAVE_PKG_KCOMPLETION
356 !include "uninst-kcompletion.nsi"
357 !endif
358 !ifdef HAVE_PKG_KWINDOWSYSTEM
359 !include "uninst-kwindowsystem.nsi"
360 !endif
361 !ifdef HAVE_PKG_KCOREADDONS
362 !include "uninst-kcoreaddons.nsi"
363 !endif
364 !ifdef HAVE_PKG_KCODECS
365 !include "uninst-kcodecs.nsi"
366 !endif
367 !ifdef HAVE_PKG_KCONFIGWIDGETS
368 !include "uninst-kconfigwidgets.nsi"
369 !endif
370 !ifdef HAVE_PKG_KGUIADDONS
371 !include "uninst-kguiaddons.nsi"
372 !endif
373 !ifdef HAVE_PKG_KXMLGUI
374 !include "uninst-kxmlgui.nsi"
375 !endif
376 !ifdef HAVE_PKG_KICONTHEMES
377 !include "uninst-kiconthemes.nsi"
378 !endif
379 !ifdef HAVE_PKG_KARCHIVE
380 !include "uninst-karchive.nsi"
381 !endif
382 !ifdef HAVE_PKG_KCRASH
383 !include "uninst-kcrash.nsi"
384 !endif
385 !ifdef HAVE_PKG_KITEMVIEWS
386 !include "uninst-kitemviews.nsi"
387 !endif
388 !ifdef HAVE_PKG_KITEMMODELS
389 !include "uninst-kitemmodels.nsi"
390 !endif
391 !ifdef HAVE_PKG_KMIME
392 !include "uninst-kmime.nsi"
393 !endif
394 !ifdef HAVE_PKG_KDE_L10N
395 !include "uninst-kde-l10n.nsi"
396 !endif
397 !ifdef HAVE_PKG_LIBKLEO
398 !include "uninst-libkleo.nsi"
399 !endif
400 !ifdef HAVE_PKG_EXTRA_CMAKE_MODULES
401 !include "uninst-extra-cmake-modules.nsi"
402 !endif
403 !ifdef HAVE_PKG_BZIP2
404 !include "uninst-bzip2.nsi"
405 !endif
406 !ifdef HAVE_PKG_QTSVG
407 !include "uninst-qtsvg.nsi"
408 !endif
409 !ifdef HAVE_PKG_QTTRANSLATIONS
410 !include "uninst-qttranslations.nsi"
411 !endif
412 !ifdef HAVE_PKG_GPG4WIN_TOOLS
413 !include "uninst-gpg4win-tools.nsi"
414 !endif
415 !ifdef HAVE_PKG_SCUTE
416 !include "uninst-scute.nsi"
417 !endif
418
419 !include "uninst-gpg4win.nsi"
420
421
422 # Dependency Management
423
424 ${MementoSectionDone}
425
426 Function CalcDefaults
427
428 !ifdef HAVE_PKG_KLEOPATRA
429   g4wihelp::config_fetch_bool "inst_kleopatra"
430   StrCmp $R0 "1" 0 calc_defaults_kleopatra_not_one
431    !insertmacro SelectSection ${SEC_kleopatra}
432    Goto calc_defaults_kleopatra_done
433   calc_defaults_kleopatra_not_one:
434   StrCmp $R0 "0" 0 calc_defaults_kleopatra_done
435    !insertmacro UnselectSection ${SEC_kleopatra}
436 calc_defaults_kleopatra_done:
437 !endif
438
439 !ifdef HAVE_PKG_GPGOL
440   g4wihelp::config_fetch_bool "inst_gpgol"
441   StrCmp $R0 "1" 0 calc_defaults_gpgol_not_one
442    !insertmacro SelectSection ${SEC_gpgol}
443    Goto calc_defaults_gpgol_done
444   calc_defaults_gpgol_not_one:
445   StrCmp $R0 "0" 0 calc_defaults_gpgol_done
446    !insertmacro UnselectSection ${SEC_gpgol}
447 calc_defaults_gpgol_done:
448 !endif
449
450 !ifdef HAVE_PKG_GPGEX
451   g4wihelp::config_fetch_bool "inst_gpgex"
452   StrCmp $R0 "1" 0 calc_defaults_gpgex_not_one
453    !insertmacro SelectSection ${SEC_gpgex}
454    Goto calc_defaults_gpgex_done
455   calc_defaults_gpgex_not_one:
456   StrCmp $R0 "0" 0 calc_defaults_gpgex_done
457    !insertmacro UnselectSection ${SEC_gpgex}
458 calc_defaults_gpgex_done:
459 !endif
460
461 !ifdef HAVE_PKG_PAPERKEY
462   g4wihelp::config_fetch_bool "inst_paperkey"
463   StrCmp $R0 "1" 0 calc_defaults_paperkey_not_one
464    !insertmacro SelectSection ${SEC_paperkey}
465    Goto calc_defaults_paperkey_done
466   calc_defaults_paperkey_not_one:
467   StrCmp $R0 "0" 0 calc_defaults_paperkey_done
468    !insertmacro UnselectSection ${SEC_paperkey}
469 calc_defaults_paperkey_done:
470 !endif
471
472 !ifdef HAVE_PKG_GPA
473   g4wihelp::config_fetch_bool "inst_gpa"
474   StrCmp $R0 "1" 0 calc_defaults_gpa_not_one
475    !insertmacro SelectSection ${SEC_gpa}
476    Goto calc_defaults_gpa_done
477   calc_defaults_gpa_not_one:
478   StrCmp $R0 "0" 0 calc_defaults_gpa_done
479    !insertmacro UnselectSection ${SEC_gpa}
480 calc_defaults_gpa_done:
481 !endif
482
483 !ifdef HAVE_PKG_COMPENDIUM
484   g4wihelp::config_fetch_bool "inst_compendium"
485   StrCmp $R0 "1" 0 calc_defaults_compendium_not_one
486    !insertmacro SelectSection ${SEC_compendium}
487    Goto calc_defaults_compendium_done
488   calc_defaults_compendium_not_one:
489   StrCmp $R0 "0" 0 calc_defaults_compendium_done
490    !insertmacro UnselectSection ${SEC_compendium}
491 calc_defaults_compendium_done:
492 !endif
493
494
495 !ifdef HAVE_PKG_MAN_NOVICE_DE
496   g4wihelp::config_fetch_bool "inst_man_novice_de"
497   StrCmp $R0 "1" 0 calc_defaults_man_novice_de_not_one
498    !insertmacro SelectSection ${SEC_man_novice_de}
499    Goto calc_defaults_man_novice_de_done
500   calc_defaults_man_novice_de_not_one:
501   StrCmp $R0 "0" 0 calc_defaults_man_novice_de_done
502    !insertmacro UnselectSection ${SEC_man_novice_de}
503 calc_defaults_man_novice_de_done:
504 !endif
505
506 !ifdef HAVE_PKG_MAN_NOVICE_EN
507   g4wihelp::config_fetch_bool "inst_man_novice_en"
508   StrCmp $R0 "1" 0 calc_defaults_man_novice_en_not_one
509    !insertmacro SelectSection ${SEC_man_novice_en}
510    Goto calc_defaults_man_novice_en_done
511   calc_defaults_man_novice_en_not_one:
512   StrCmp $R0 "0" 0 calc_defaults_man_novice_en_done
513    !insertmacro UnselectSection ${SEC_man_novice_en}
514 calc_defaults_man_novice_en_done:
515 !endif
516
517 !ifdef HAVE_PKG_MAN_ADVANCED_DE
518   g4wihelp::config_fetch_bool "inst_man_advanced_de"
519   StrCmp $R0 "1" 0 calc_defaults_man_advanced_de_not_one
520    !insertmacro SelectSection ${SEC_man_advanced_de}
521    Goto calc_defaults_man_advanced_de_done
522   calc_defaults_man_advanced_de_not_one:
523   StrCmp $R0 "0" 0 calc_defaults_man_advanced_de_done
524    !insertmacro UnselectSection ${SEC_man_advanced_de}
525 calc_defaults_man_advanced_de_done:
526 !endif
527
528 !ifdef HAVE_PKG_MAN_ADVANCED_EN
529   g4wihelp::config_fetch_bool "inst_man_advanced_en"
530   StrCmp $R0 "1" 0 calc_defaults_man_advanced_en_not_one
531    !insertmacro SelectSection ${SEC_man_advanced_en}
532    Goto calc_defaults_man_advanced_en_done
533   calc_defaults_man_advanced_en_not_one:
534   StrCmp $R0 "0" 0 calc_defaults_man_advanced_en_done
535    !insertmacro UnselectSection ${SEC_man_advanced_en}
536 calc_defaults_man_advanced_en_done:
537 !endif
538
539 # Check if minimal install was requested on the command line
540
541 StrCmp $is_minimal '1' select_minimal continue
542 select_minimal:
543    !insertmacro UnselectSection ${SEC_kleopatra}
544    !insertmacro UnselectSection ${SEC_gpgol}
545    !insertmacro UnselectSection ${SEC_gpgex}
546    !insertmacro UnselectSection ${SEC_gpa}
547    !insertmacro UnselectSection ${SEC_gpgme_browser}
548    !insertmacro UnselectSection ${SEC_compendium}
549
550 # We only do pinentry and gnupg-w32
551    !insertmacro SelectSection ${SEC_paperkey}
552    !insertmacro SelectSection ${SEC_gnupg_w32}
553    !insertmacro SelectSection ${SEC_pinentry}
554 continue:
555
556 # Check if browser integration was selected on the command line
557 # or in the ini
558 # You can either select the browser integration by adding
559 # inst_browser = true to a gpg4win.ini or adding a
560 # /WITH_BROWSER=1 command line switch to the installer.
561 g4wihelp::config_fetch_bool "inst_browser"
562 StrCmp $R0 "1" select_browser 0
563 StrCmp $with_browser '1' select_browser skip_browser
564 select_browser:
565     !insertmacro SelectSection ${SEC_gpgme_browser}
566 skip_browser:
567
568 FunctionEnd
569
570
571
572 Function CalcDepends
573   # This section could very well be autogenerated from the
574   # information in configure.ac.  Note that it doesn't hurt to have
575   # stuff here for packages that we don't include.
576
577   # First clear all indirect dependencies.
578 !ifdef HAVE_PKG_LIBICONV
579   !insertmacro UnselectSection ${SEC_libiconv}
580 !endif
581 !ifdef HAVE_PKG_GETTEXT
582   !insertmacro UnselectSection ${SEC_gettext}
583 !endif
584 !ifdef HAVE_PKG_ZLIB
585   !insertmacro UnselectSection ${SEC_zlib}
586 !endif
587 !ifdef HAVE_PKG_LIBPNG
588   !insertmacro UnselectSection ${SEC_libpng}
589 !endif
590 !ifdef HAVE_PKG_PKGCONFIG
591   !insertmacro UnselectSection ${SEC_pkgconfig}
592 !endif
593 !ifdef HAVE_PKG_GLIB
594   !insertmacro UnselectSection ${SEC_glib}
595 !endif
596 !ifdef HAVE_PKG_ATK
597   !insertmacro UnselectSection ${SEC_atk}
598 !endif
599 !ifdef HAVE_PKG_PANGO
600   !insertmacro UnselectSection ${SEC_pango}
601 !endif
602 !ifdef HAVE_PKG_EXPAT
603   !insertmacro UnselectSection ${SEC_expat}
604 !endif
605 !ifdef HAVE_PKG_FREETYPE
606   !insertmacro UnselectSection ${SEC_freetype}
607 !endif
608 !ifdef HAVE_PKG_FONTCONFIG
609   !insertmacro UnselectSection ${SEC_fontconfig}
610 !endif
611 !ifdef HAVE_PKG_CAIRO
612   !insertmacro UnselectSection ${SEC_cairo}
613 !endif
614 !ifdef HAVE_PKG_GTK_
615   !insertmacro UnselectSection ${SEC_gtk_}
616 !endif
617 !ifdef HAVE_PKG_BZIP2
618   !insertmacro UnselectSection ${SEC_bzip2}
619 !endif
620 !ifdef HAVE_PKG_LIBGPG_ERROR
621   !insertmacro UnselectSection ${SEC_libgpg_error}
622 !endif
623 !ifdef HAVE_PKG_W32PTH
624   !insertmacro UnselectSection ${SEC_w32pth}
625 !endif
626 !ifdef HAVE_PKG_LIBASSUAN
627   !insertmacro UnselectSection ${SEC_libassuan}
628 !endif
629 !ifdef HAVE_PKG_PINENTRY
630   !insertmacro UnselectSection ${SEC_pinentry}
631 !endif
632 !ifdef HAVE_PKG_GPGME
633   !insertmacro UnselectSection ${SEC_gpgme}
634 !endif
635 !ifdef HAVE_PKG_LIBGSASL
636   !insertmacro UnselectSection ${SEC_libgsasl}
637 !endif
638 !ifdef HAVE_PKG_LIBTASN1
639   !insertmacro UnselectSection ${SEC_libtasn1}
640 !endif
641 !ifdef HAVE_PKG_GNUTLS
642   !insertmacro UnselectSection ${SEC_gnutls}
643 !endif
644 !ifdef HAVE_PKG_CURL
645   !insertmacro UnselectSection ${SEC_curl}
646 !endif
647 !ifdef HAVE_PKG_QTBASE
648   !insertmacro UnselectSection ${SEC_qtbase}
649 !endif
650 !ifdef HAVE_PKG_QTTOOLS
651   !insertmacro UnselectSection ${SEC_qttools}
652 !endif
653 !ifdef HAVE_PKG_QTWINEXTRAS
654   !insertmacro UnselectSection ${SEC_qtwinextras}
655 !endif
656 !ifdef HAVE_PKG_BREEZE_ICONS
657   !insertmacro UnselectSection ${SEC_breeze_icons}
658 !endif
659 !ifdef HAVE_PKG_KCONFIG
660   !insertmacro UnselectSection ${SEC_kconfig}
661 !endif
662 !ifdef HAVE_PKG_KI18N
663   !insertmacro UnselectSection ${SEC_ki18n}
664 !endif
665 !ifdef HAVE_PKG_KWIDGETSADDONS
666   !insertmacro UnselectSection ${SEC_kwidgetsaddons}
667 !endif
668 !ifdef HAVE_PKG_KCOMPLETION
669   !insertmacro UnselectSection ${SEC_kcompletion}
670 !endif
671 !ifdef HAVE_PKG_KWINDOWSYSTEM
672   !insertmacro UnselectSection ${SEC_kwindowsystem}
673 !endif
674 !ifdef HAVE_PKG_KCOREADDONS
675   !insertmacro UnselectSection ${SEC_kcoreaddons}
676 !endif
677 !ifdef HAVE_PKG_KCODECS
678   !insertmacro UnselectSection ${SEC_kcodecs}
679 !endif
680 !ifdef HAVE_PKG_KCONFIGWIDGETS
681   !insertmacro UnselectSection ${SEC_kconfigwidgets}
682 !endif
683 !ifdef HAVE_PKG_KXMLGUI
684   !insertmacro UnselectSection ${SEC_kxmlgui}
685 !endif
686 !ifdef HAVE_PKG_KICONTHEMES
687   !insertmacro UnselectSection ${SEC_kiconthemes}
688 !endif
689 !ifdef HAVE_PKG_KARCHIVE
690   !insertmacro UnselectSection ${SEC_karchive}
691 !endif
692 !ifdef HAVE_PKG_KCRASH
693   !insertmacro UnselectSection ${SEC_kcrash}
694 !endif
695 !ifdef HAVE_PKG_KITEMVIEWS
696   !insertmacro UnselectSection ${SEC_kitemviews}
697 !endif
698 !ifdef HAVE_PKG_KITEMMODELS
699   !insertmacro UnselectSection ${SEC_kitemmodels}
700 !endif
701 !ifdef HAVE_PKG_KGUIADDONS
702   !insertmacro UnselectSection ${SEC_kguiaddons}
703 !endif
704 !ifdef HAVE_PKG_LIBKLEO
705   !insertmacro UnselectSection ${SEC_libkleo}
706 !endif
707 !ifdef HAVE_PKG_KMIME
708   !insertmacro UnselectSection ${SEC_kmime}
709 !endif
710 !ifdef HAVE_PKG_KDE_L10N
711   !insertmacro UnselectSection ${SEC_kde-l10n}
712 !endif
713 !ifdef HAVE_PKG_QTSVG
714   !insertmacro UnselectSection ${SEC_qtsvg}
715 !endif
716 !ifdef HAVE_PKG_QTTRANSLATIONS
717   !insertmacro UnselectSection ${SEC_qttranslations}
718 !endif
719 !ifdef HAVE_PKG_GPG4WIN_TOOLS
720   !insertmacro UnselectSection ${SEC_gpg4win-tools}
721 !endif
722 !ifdef HAVE_PKG_SCUTE
723   !insertmacro UnselectSection ${SEC_scute}
724 !endif
725
726   # Always install gnupg2.  This is also ensured by putting
727   # these packages in the RO section and enabling them by default, but
728   # it doesn't harm to add it explicitely here as well.
729
730   # TODO: Handle newer / other gnupg versions
731   !insertmacro SelectSection ${SEC_gnupg_w32}
732
733   # Then enable all dependencies, mostly in reverse build list order!
734
735   # First the explicitely installed packages.
736
737
738 !ifdef HAVE_PKG_PAPERKEY
739   !insertmacro SectionFlagIsSet ${SEC_paperkey} \
740                 ${SF_SELECTED} have_paperkey skip_paperkey
741   have_paperkey:
742   # All dependencies are linked in statically.
743   skip_paperkey:
744 !endif
745
746 !ifdef HAVE_PKG_GPGEX
747   !insertmacro SectionFlagIsSet ${SEC_gpgex} \
748                 ${SF_SELECTED} have_gpgex skip_gpgex
749   have_gpgex:
750
751   # This is not a build dependency, but it is a run-time dependency.
752   !insertmacro SectionFlagIsSet ${SEC_gpa} \
753                 ${SF_SELECTED} skipa_gpgex_dep_kleopatra need_gpgex_dep_kleopatra
754   need_gpgex_dep_kleopatra:
755   !insertmacro SelectSection ${SEC_kleopatra}
756   skipa_gpgex_dep_kleopatra:
757
758   # Other dependencies are linked in statically.
759   skip_gpgex:
760 !endif
761
762 !ifdef HAVE_PKG_GPGOL
763   !insertmacro SectionFlagIsSet ${SEC_gpgol} \
764                 ${SF_SELECTED} have_gpgol skip_gpgol
765   have_gpgol:
766   !insertmacro SelectSection ${SEC_gpgme}
767   !insertmacro SelectSection ${SEC_gpg4win-tools}
768
769   # This is not a build dependency, but it is a run-time dependency.
770   !insertmacro SectionFlagIsSet ${SEC_gpa} \
771                 ${SF_SELECTED} skipa_gpgol_dep_kleopatra need_gpgol_dep_kleopatra
772   need_gpgol_dep_kleopatra:
773   !insertmacro SelectSection ${SEC_kleopatra}
774   skipa_gpgol_dep_kleopatra:
775
776   skip_gpgol:
777 !endif
778
779 !ifdef HAVE_PKG_KLEOPATRA
780 !ifndef SOURCES
781   ${IfNot} ${AtLeastWin7}
782     # Disable Kleo for Windows below 7
783     SectionSetFlags ${SEC_kleopatra} 16
784     !insertmacro SelectSection ${SEC_gpa}
785   ${Endif}
786 !endif
787   !insertmacro SectionFlagIsSet ${SEC_kleopatra} ${SF_SELECTED} have_kleopatra skip_kleopatra
788   have_kleopatra:
789   !insertmacro SelectSection ${SEC_gpgme}
790   !insertmacro SelectSection ${SEC_compendium}
791   !insertmacro SelectSection ${SEC_qtbase}
792   !insertmacro SelectSection ${SEC_breeze_icons}
793   !insertmacro SelectSection ${SEC_kconfig}
794   !insertmacro SelectSection ${SEC_ki18n}
795   !insertmacro SelectSection ${SEC_kwidgetsaddons}
796   !insertmacro SelectSection ${SEC_kcompletion}
797   !insertmacro SelectSection ${SEC_kwindowsystem}
798   !insertmacro SelectSection ${SEC_kcoreaddons}
799   !insertmacro SelectSection ${SEC_kcodecs}
800   !insertmacro SelectSection ${SEC_kconfigwidgets}
801   !insertmacro SelectSection ${SEC_kxmlgui}
802   !insertmacro SelectSection ${SEC_kitemviews}
803   !insertmacro SelectSection ${SEC_kitemmodels}
804   !insertmacro SelectSection ${SEC_kiconthemes}
805   !insertmacro SelectSection ${SEC_karchive}
806   !insertmacro SelectSection ${SEC_kcrash}
807   !insertmacro SelectSection ${SEC_kguiaddons}
808   !insertmacro SelectSection ${SEC_qtsvg}
809   !insertmacro SelectSection ${SEC_qttranslations}
810   !insertmacro SelectSection ${SEC_kmime}
811   !insertmacro SelectSection ${SEC_kde-l10n}
812   !insertmacro SelectSection ${SEC_libkleo}
813   !insertmacro SelectSection ${SEC_qttools}
814   !insertmacro SelectSection ${SEC_qtwinextras}
815   !insertmacro SelectSection ${SEC_boost}
816   !insertmacro SelectSection ${SEC_extra-cmake-modules}
817   skip_kleopatra:
818 !endif
819
820 !ifdef HAVE_PKG_GNUPG_W32
821   !insertmacro SectionFlagIsSet ${SEC_gnupg_w32} ${SF_SELECTED} have_gnupg_w32 skip_gnupg_w32
822   have_gnupg_w32:
823   !insertmacro SelectSection ${SEC_pinentry}
824   !insertmacro SelectSection ${SEC_scute}
825   skip_gnupg_w32:
826 !endif
827
828 !ifdef HAVE_PKG_GPA
829   !insertmacro SectionFlagIsSet ${SEC_gpa} ${SF_SELECTED} have_gpa skip_gpa
830   have_gpa:
831   !insertmacro SelectSection ${SEC_libiconv}
832   !insertmacro SelectSection ${SEC_gettext}
833   !insertmacro SelectSection ${SEC_zlib}
834   !insertmacro SelectSection ${SEC_gtk_}
835   !insertmacro SelectSection ${SEC_libpng}
836   !insertmacro SelectSection ${SEC_glib}
837   !insertmacro SelectSection ${SEC_gpgme}
838   skip_gpa:
839 !endif
840
841 !insertmacro SectionFlagIsSet ${SEC_gpgme_browser} ${SF_SELECTED} have_gpgme_browser skip_gpgme_browser
842 have_gpgme_browser:
843 !insertmacro SelectSection ${SEC_gpgme}
844 skip_gpgme_browser:
845
846 # Now the implicitely installed packages.
847
848 !ifdef HAVE_PKG_GPGME
849   !insertmacro SectionFlagIsSet ${SEC_gpgme} \
850                 ${SF_SELECTED} have_gpgme skip_gpgme
851   have_gpgme:
852   # GPGME does not depend on gnupg2.  Do this in the
853   # actual application instead.
854   !insertmacro SelectSection ${SEC_libgpg_error}
855   !insertmacro SelectSection ${SEC_libassuan}
856 !ifdef HAVE_PKG_QTBASE
857   !insertmacro SelectSection ${SEC_qtbase}
858 !endif
859    skip_gpgme:
860 !endif
861
862 !ifdef HAVE_PKG_PINENTRY
863   !insertmacro SectionFlagIsSet ${SEC_pinentry} \
864                 ${SF_SELECTED} have_pinentry skip_pinentry
865   have_pinentry:
866   !insertmacro SelectSection ${SEC_libiconv}
867   !insertmacro SelectSection ${SEC_libgpg_error}
868   !insertmacro SelectSection ${SEC_libassuan}
869 !ifdef HAVE_PKG_QTBASE
870   !insertmacro SelectSection ${SEC_qtbase}
871 !endif
872 !ifdef HAVE_PKG_GTK_
873   !insertmacro SelectSection ${SEC_gtk_}
874 !endif
875    skip_pinentry:
876 !endif
877
878 !ifdef HAVE_PKG_QTBASE
879   !ifndef SOURCES
880   ${IfNot} ${AtLeastWin7}
881     # Disable qt for Windows below 7
882     !insertmacro UnSelectSection ${SEC_qtbase}
883   ${Endif}
884   !endif
885   !insertmacro SectionFlagIsSet ${SEC_qtbase} \
886                 ${SF_SELECTED} have_qt skip_qt
887   have_qt:
888   !insertmacro SelectSection ${SEC_libpng}
889   !insertmacro SelectSection ${SEC_zlib}
890   !insertmacro SelectSection ${SEC_qttranslations}
891   skip_qt:
892 !endif
893
894 !ifdef HAVE_PKG_LIBASSUAN
895   !insertmacro SectionFlagIsSet ${SEC_libassuan} ${SF_SELECTED} have_libassuan skip_libassuan
896   have_libassuan:
897   !insertmacro SelectSection ${SEC_libgpg_error}
898   !insertmacro SelectSection ${SEC_w32pth}
899   skip_libassuan:
900 !endif
901
902   # Package "w32pth" has no dependencies.
903
904 !ifdef HAVE_PKG_LIBGPG_ERROR
905   !insertmacro SectionFlagIsSet ${SEC_libgpg_error} ${SF_SELECTED} have_libgpg_error skip_libgpg_error
906   have_libgpg_error:
907   !insertmacro SelectSection ${SEC_libiconv}
908   !insertmacro SelectSection ${SEC_gettext}
909   skip_libgpg_error:
910 !endif
911
912   # Package "bzip2" has no dependencies.
913
914 !ifdef HAVE_PKG_GTK_
915   !insertmacro SectionFlagIsSet ${SEC_gtk_} \
916                 ${SF_SELECTED} have_gtk_ skip_gtk_
917   have_gtk_:
918   !insertmacro SelectSection ${SEC_libiconv}
919   !insertmacro SelectSection ${SEC_gettext}
920   !insertmacro SelectSection ${SEC_pkgconfig}
921   !insertmacro SelectSection ${SEC_atk}
922   !insertmacro SelectSection ${SEC_pango}
923   !insertmacro SelectSection ${SEC_glib}
924   !insertmacro SelectSection ${SEC_cairo}
925   skip_gtk_:
926 !endif
927
928 !ifdef HAVE_PKG_CAIRO
929   !insertmacro SectionFlagIsSet ${SEC_cairo} \
930                 ${SF_SELECTED} have_cairo skip_cairo
931   have_cairo:
932   !insertmacro SelectSection ${SEC_glib}
933   !insertmacro SelectSection ${SEC_pkgconfig}
934   !insertmacro SelectSection ${SEC_expat}
935   !insertmacro SelectSection ${SEC_freetype}
936   !insertmacro SelectSection ${SEC_fontconfig}
937   skip_cairo:
938 !endif
939
940 !ifdef HAVE_PKG_FONTCONFIG
941   !insertmacro SectionFlagIsSet ${SEC_fontconfig} \
942                 ${SF_SELECTED} have_fontconfig skip_fontconfig
943   have_fontconfig:
944   !insertmacro SelectSection ${SEC_pkgconfig}
945   !insertmacro SelectSection ${SEC_freetype}
946   skip_fontconfig:
947 !endif
948
949 !ifdef HAVE_PKG_FREETYPE
950   !insertmacro SectionFlagIsSet ${SEC_freetype} \
951                 ${SF_SELECTED} have_freetype skip_freetype
952   have_freetype:
953   !insertmacro SelectSection ${SEC_pkgconfig}
954   !insertmacro SelectSection ${SEC_expat}
955   skip_freetype:
956 !endif
957
958 # Package "expat" has no dependencies.
959
960 !ifdef HAVE_PKG_PANGO
961   !insertmacro SectionFlagIsSet ${SEC_pango} \
962                 ${SF_SELECTED} have_pango skip_pango
963   have_pango:
964   !insertmacro SelectSection ${SEC_glib}
965   !insertmacro SelectSection ${SEC_pkgconfig}
966   skip_pango:
967 !endif
968
969 !ifdef HAVE_PKG_ATK
970   !insertmacro SectionFlagIsSet ${SEC_atk} \
971                 ${SF_SELECTED} have_atk skip_atk
972   have_atk:
973   !insertmacro SelectSection ${SEC_glib}
974   !insertmacro SelectSection ${SEC_pkgconfig}
975   skip_atk:
976 !endif
977
978 !ifdef HAVE_PKG_GLIB
979   !insertmacro SectionFlagIsSet ${SEC_glib} \
980                 ${SF_SELECTED} have_glib skip_glib
981   have_glib:
982   !insertmacro SelectSection ${SEC_libiconv}
983   !insertmacro SelectSection ${SEC_gettext}
984   !insertmacro SelectSection ${SEC_pkgconfig}
985   skip_glib:
986 !endif
987
988   # Package "pkgconfig" has no dependencies.
989
990 !ifdef HAVE_PKG_LIBPNG
991   !insertmacro SectionFlagIsSet ${SEC_libpng} \
992                 ${SF_SELECTED} have_libpng skip_libpng
993   have_libpng:
994   !insertmacro SelectSection ${SEC_pkgconfig}
995   skip_libpng:
996 !endif
997
998   # Package "zlib" has no dependencies.
999
1000 !ifdef HAVE_PKG_GETTEXT
1001   !insertmacro SectionFlagIsSet ${SEC_gettext} \
1002                 ${SF_SELECTED} have_gettext skip_gettext
1003   have_gettext:
1004   !insertmacro SelectSection ${SEC_libiconv}
1005   skip_gettext:
1006 !endif
1007
1008   # Package "libiconv" has no dependencies.
1009
1010 FunctionEnd
1011
1012 Function .onInstFailed
1013   Delete $TEMP\gpgspltmp.wav
1014 FunctionEnd
1015
1016 Function .onInstSuccess
1017   ${MementoSectionSave}
1018   Delete $TEMP\gpgspltmp.wav
1019 FunctionEnd
1020
1021 Function .onSelChange
1022   Call CalcDepends
1023 FunctionEnd
1024
1025
1026 # Note used anymore:
1027 # This function is run from the finish page.
1028 #Function RunOnFinish
1029 #!ifdef HAVE_PKG_GPA
1030 #    SectionGetFlags ${SEC_gpa} $R0
1031 #    IntOp $R0 $R0 & ${SF_SELECTED}
1032 #    IntCmp $R0 ${SF_SELECTED} 0 no_gpa_avail
1033 #       Exec "$INSTDIR\gpa.exe"
1034 #       Return
1035 #   no_gpa_avail:
1036 #!endif
1037 #  MessageBox MB_OK "$(T_NoKeyManager)"
1038 #FunctionEnd
1039
1040
1041
1042 # This also must be in a central place.  Also Urgs.
1043
1044 Section "-startmenu"
1045
1046   UserInfo::GetAccountType
1047   Pop $1
1048   StrCmp $1 "Admin" is_admin is_no_admin
1049 is_admin:
1050   SetShellVarContext all
1051
1052 is_no_admin:
1053
1054   # NOT SetOutPath.
1055   StrCpy $OUTDIR "%HOMEDRIVE%%HOMEPATH%"
1056
1057   # Check if the start menu entries where requested.
1058   g4wihelp::config_fetch_bool "inst_start_menu"
1059   StrCmp $R0 "0" no_start_menu
1060
1061 !ifdef HAVE_PKG_GPA
1062     SectionGetFlags ${SEC_gpa} $R0
1063     IntOp $R0 $R0 & ${SF_SELECTED}
1064     IntCmp $R0 ${SF_SELECTED} 0 no_gpa_menu
1065     CreateShortCut "$SMPROGRAMS\GPA.lnk" \
1066         "$INSTDIR\bin\gpa.exe" \
1067         "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gpa)
1068   no_gpa_menu:
1069 !endif
1070
1071 !ifdef HAVE_PKG_KLEOPATRA
1072     SectionGetFlags ${SEC_kleopatra} $R0
1073     IntOp $R0 $R0 & ${SF_SELECTED}
1074     IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_menu
1075     CreateShortCut "$SMPROGRAMS\Kleopatra.lnk" \
1076         "$INSTDIR\bin\kleopatra.exe" \
1077         "" "$INSTDIR\bin\kleopatra.exe" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
1078   no_kleopatra_menu:
1079 !endif
1080
1081  no_start_menu:
1082
1083   # Check if the desktop entries where requested.
1084   g4wihelp::config_fetch_bool "inst_desktop"
1085   StrCmp $R0 "0" no_desktop
1086
1087 !ifdef HAVE_PKG_GPA
1088     SectionGetFlags ${SEC_gpa} $R0
1089     IntOp $R0 $R0 & ${SF_SELECTED}
1090     IntCmp $R0 ${SF_SELECTED} 0 no_gpa_desktop
1091     StrCmp $is_update '1' no_gpa_desktop
1092     CreateShortCut "$DESKTOP\GPA.lnk" \
1093         "$INSTDIR\bin\gpa.exe" \
1094         "" "" "" SW_SHOWNORMAL "" $(DESC_Menu_gpa)
1095   no_gpa_desktop:
1096 !endif
1097
1098 !ifdef HAVE_PKG_KLEOPATRA
1099     SectionGetFlags ${SEC_kleopatra} $R0
1100     IntOp $R0 $R0 & ${SF_SELECTED}
1101     IntCmp $R0 ${SF_SELECTED} 0 no_kleopatra_desktop
1102     StrCmp $is_update '1' no_kleopatra_desktop
1103     CreateShortCut "$DESKTOP\Kleopatra.lnk" \
1104         "$INSTDIR\bin\kleopatra.exe" \
1105         "" "$INSTDIR\bin\kleopatra.exe" "" SW_SHOWNORMAL "" $(DESC_Menu_kleopatra)
1106   no_kleopatra_desktop:
1107 !endif
1108
1109 no_desktop:
1110
1111 SectionEnd