MSI: Fix possible use of unintialized variable
[gpg4win.git] / src / Makefile.am
1 # Makefile.am - Installer for GnuPG 4 Windows Makefile.
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
20 EXTRA_DIST = pkg-config gpg4win.nsi gpg4win-src.nsi \
21         config.site config.nsi.in \
22         libiconv.def libintl.def loreley.mid \
23         gpg4win-splash.wav exdll.h g4wihelp.c desktopshellrun.cpp \
24         g4wihelp.nsi slideshow.cpp \
25         inst-sections.nsi installer.nsi installer-finish.nsi  \
26         zlib.pc sha1sum.c mkportable.c     \
27         mkportable-vanilla.h mkportable-full.h \
28         potomo Memento.nsh \
29         inst-gpg4win.nsi           uninst-gpg4win.nsi         \
30         inst-atk.nsi               uninst-atk.nsi             \
31         inst-expat.nsi             uninst-expat.nsi           \
32         inst-freetype.nsi          uninst-freetype.nsi        \
33         inst-fontconfig.nsi        uninst-fontconfig.nsi      \
34         inst-cairo.nsi             uninst-cairo.nsi           \
35         inst-gettext.nsi           uninst-gettext.nsi         \
36         inst-libffi.nsi            uninst-libffi.nsi          \
37         inst-glib.nsi              uninst-glib.nsi            \
38         inst-gnupg-w32.nsi         uninst-gnupg-w32.nsi       \
39         inst-gpa.nsi               uninst-gpa.nsi             \
40         inst-gpgme.nsi             uninst-gpgme.nsi           \
41         inst-paperkey.nsi          uninst-paperkey.nsi        \
42         inst-gpgol.nsi             uninst-gpgol.nsi           \
43         inst-gpgex.nsi             uninst-gpgex.nsi           \
44         inst-gdk-pixbuf.nsi        uninst-gdk-pixbuf.nsi      \
45         inst-gtk+.nsi              uninst-gtk+.nsi            \
46         inst-libassuan.nsi         uninst-libassuan.nsi       \
47         inst-libgpg-error.nsi      uninst-libgpg-error.nsi    \
48         inst-libiconv.nsi          uninst-libiconv.nsi        \
49         inst-libpng.nsi            uninst-libpng.nsi          \
50         inst-compendium.nsi        uninst-compendium.nsi   \
51         inst-man_advanced_de.nsi   uninst-man_advanced_de.nsi \
52         inst-man_advanced_en.nsi   uninst-man_advanced_en.nsi \
53         inst-man_novice_de.nsi     uninst-man_novice_de.nsi   \
54         inst-man_novice_en.nsi     uninst-man_novice_en.nsi   \
55         inst-pango.nsi             uninst-pango.nsi           \
56         inst-pinentry.nsi          uninst-pinentry.nsi        \
57         inst-pkgconfig.nsi         uninst-pkgconfig.nsi       \
58         inst-w32pth.nsi            uninst-w32pth.nsi          \
59         inst-zlib.nsi              uninst-zlib.nsi            \
60         inst-kconfig.nsi        uninst-kconfig.nsi              \
61         inst-kleopatra.nsi         uninst-kleopatra.nsi       \
62         inst-bzip2.nsi             uninst-bzip2.nsi           \
63         uninst-claws-mail.nsi uninst-claws-mail-cmds.nsi \
64         inst-qtbase.nsi uninst-qtbase.nsi \
65         inst-ki18n.nsi uninst-ki18n.nsi \
66         inst-kwidgetsaddons.nsi uninst-kwidgetsaddons.nsi \
67         inst-kcompletion.nsi uninst-kcompletion.nsi \
68         inst-kwindowsystem.nsi uninst-kwindowsystem.nsi \
69         inst-libkleo.nsi uninst-libkleo.nsi \
70         inst-kcoreaddons.nsi uninst-kcoreaddons.nsi \
71         inst-kcodecs.nsi uninst-kcodecs.nsi \
72         inst-kconfigwidgets.nsi uninst-kconfigwidgets.nsi \
73         inst-kxmlgui.nsi uninst-kxmlgui.nsi \
74         inst-kiconthemes.nsi uninst-kiconthemes.nsi \
75         inst-breeze-icons.nsi uninst-breeze-icons.nsi \
76         inst-karchive.nsi uninst-karchive.nsi \
77         inst-kcrash.nsi uninst-kcrash.nsi \
78         inst-kitemviews.nsi uninst-kitemviews.nsi \
79         inst-kitemmodels.nsi uninst-kitemmodels.nsi \
80         inst-kguiaddons.nsi uninst-kguiaddons.nsi \
81         inst-kmime.nsi uninst-kmime.nsi \
82         inst-kde-l10n.nsi uninst-kde-l10n.nsi \
83         inst-qtsvg.nsi uninst-qtsvg.nsi \
84         inst-qttools.nsi uninst-qttools.nsi \
85         inst-qttranslations.nsi uninst-qttranslations.nsi \
86         inst-qtwinextras.nsi uninst-qtwinextras.nsi \
87         inst-boost.nsi uninst-boost.nsi \
88         inst-scute.nsi uninst-scute.nsi \
89         inst-extra-cmake-modules.nsi uninst-extra-cmake-modules.nsi \
90         inst-gpg4win-tools.nsi uninst-gpg4win-tools.nsi \
91         inst-gpgme-browser.nsi \
92         inst-final.nsi index.theme \
93         slideshow/slides.dat \
94         slideshow/slide1-gpgol.png \
95         slideshow/slide2-gpgex.png \
96         slideshow/slide3-kleopatra.png \
97         slideshow/slide4-summary.png \
98         file-ext.ico
99
100 gpg4win_readme_ll = en de ar es fr ru pt
101
102 README_files = $(addsuffix .txt,$(addprefix README.,$(gpg4win_readme_ll)))
103
104 gpg4win_howto_smime_ll = en de
105
106 HOWTO_files = $(addsuffix .txt, \
107                 $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll)))
108
109 foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe mkportable.exe
110
111 # Need to clean the dll because we bypassed automake.
112 CLEANFILES = g4wihelp.dll desktopshellrun.o versioninfo.txt $(README_files) \
113                          $(HOWTO_files) NEWS.tmp COMPONENTS-list.tmp \
114                          license.blurb cdversioninfo.tmp slideshow.o \
115                          $(foosum_exe)
116
117 # Supported source packages.
118 gpg4win_spkgs = glib libffi gdk-pixbuf gtk+ \
119                 libgpg-error gpgme gpgol gpgex libpng \
120                 gpa opencdk \
121                 pinentry libassuan \
122                 w32pth paperkey regex libiconv gettext scute
123
124 gpg4win_qtpkgs = qtbase qttools qtwinextras qtsvg qttranslations
125
126 # Source packages following the KDE pattern
127 gpg4win_kdepkgs = kconfig kwidgetsaddons ki18n extra-cmake-modules \
128                   kcompletion kwindowsystem kcoreaddons libkleo kcodecs \
129                   kmime kconfigwidgets kxmlgui kguiaddons kitemviews \
130                   kiconthemes kleopatra breeze-icons kitemmodels karchive \
131                   gpg4win-tools kcrash
132
133 # Supported source packages to build in an additional architecture
134 gpg4win_expkgs = libgpg-error libassuan libiconv gettext w32pth gpgex gpgol \
135                  gpgme
136
137 # Some variables
138 WINE = wine
139 WINHOST = win10
140 WINLIGHT = c:/wix/light.exe
141
142 # Extra options to configure for individual packages.
143 # We can use $(idir) here for the installation prefix.
144
145 gpg4win_pkg_libiconv_ex_configure = \
146         --enable-shared=no --enable-static=yes
147
148 gpg4win_pkg_gettext_configure = \
149   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
150   CPPFLAGS=-I$(idir)/include CFLAGS=-O2 LDFLAGS=-L$(idir)/lib
151
152 gpg4win_pkg_gettext_ex_configure = \
153   --with-lib-prefix=$(ex_idir) --with-libiconv-prefix=$(ex_idir) \
154   CPPFLAGS=-I$(ex_idir)/include CFLAGS=-O2 LDFLAGS=-L$(ex_idir)/lib
155
156 # We only need gettext-runtime and there is sadly no top level
157 # configure option for this
158 gpg4win_pkg_gettext_make_dir = gettext-runtime
159 gpg4win_pkg_gettext_make_dir_inst = gettext-runtime
160 gpg4win_pkg_gettext_ex_make_dir = gettext-runtime
161 gpg4win_pkg_gettext_ex_make_dir_inst = gettext-runtime
162
163 gpg4win_pkg_glib_configure = \
164   --disable-modular-tests \
165   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
166   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib CCC=$(host)-g++
167 gpg4win_pkg_glib_extracflags = -march=i486
168
169 gpg4win_pkg_gdk_pixbuf_configure = \
170   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
171   --with-included-loaders=yes \
172   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
173
174 gpg4win_pkg_gtk__configure = \
175   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib --disable-cups
176
177 # The GnuPG package provides man pages which we have to convert.
178 # We also create the MO files here.
179 define gpg4win_pkg_gnupg2_post_install
180 (for i in gpg2 gpgv2 gpgsm gpg-agent scdaemon gpg-connect-agent gpgconf ; \
181   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
182     sed `printf "s/_\b//g;s/\b.//g"` | \
183     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
184  done ; \
185  for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
186      $(MKDIR_P) $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES || true; \
187      rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo 2>/dev/null \
188        || true; \
189      $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
190               $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo; \
191  done)
192 endef
193
194 # Paperkey comes with a man pages which we have to convert.
195 define gpg4win_pkg_paperkey_post_install
196 (for i in paperkey ; \
197   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
198     sed `printf "s/_\b//g;s/\b.//g"` | \
199     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
200  done)
201 endef
202
203
204
205 # Build the reference manual.
206 define gpg4win_pkg_gpgol_post_install
207 ( cd $$$${pkgbdir}/doc; make pdf )
208 endef
209
210 # We would like to use --with-libiconv-prefix and
211 # --with-libintl-prefix, but these don't work with the cheesy
212 # non-"libfoo.la" versions of iconv and gettext that we are using.
213 #gpg4win_pkg_libgpg_error_configure = \
214 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
215 gpg4win_pkg_libgpg_error_configure = --silent \
216   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib \
217   --enable-static
218
219 gpg4win_pkg_libgpg_error_ex_configure = --silent \
220   --enable-static
221
222 # We convert the PO files to UTF-8.  FIXME: This should be done in
223 # libgpg-error proper.
224 define gpg4win_pkg_libgpg_error_post_install
225 (for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
226    rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo \
227        2>/dev/null|| true; \
228    $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
229              $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo; \
230  done)
231 endef
232
233 gpg4win_pkg_libassuan_configure =  --silent --enable-static
234
235 gpg4win_pkg_libassuan_ex_configure =  --silent --enable-static
236
237 gpg4win_pkg_libpng_configure = HAVE_SOLARIS_LD_FALSE=yes CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\"
238
239 # We would like to use --with-libiconv-prefix and
240 # --with-libintl-prefix, but these don't work with the cheesy
241 # non-"libfoo.la" versions of iconv and gettext that we are using.
242 gpg4win_pkg_pinentry_configure = \
243   --enable-pinentry-qt \
244   $(pinentry_enable_disable) \
245   --disable-pinentry-fltk \
246   --enable-pinentry-gtk2 \
247   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
248 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
249
250 # The LDFLAGS is needed for -lintl for glib.  The QT4 variables work
251 # around the lack of cross compilation support in qt-dev.
252 gpg4win_pkg_gpgme_configure = --silent \
253   --with-gpg-error-prefix=$(idir) --enable-static \
254   `test -n "@HAVE_PKG_GLIB@" && echo "--enable-w32-glib"` \
255   CFLAGS=-I$(idir)/include/glib-2.0/ \
256   LDFLAGS=-L$(idir)/lib \
257   --enable-languages=qt,cpp \
258   --disable-gpg-test \
259   --disable-gpgsm-test
260
261 gpg4win_pkg_gpgme_ex_configure = --silent \
262   --with-gpg-error-prefix=$(ex_idir) --enable-static \
263   --with-libassuan-prefix=$(ex_idir) \
264   LDFLAGS=-L$(ex_idir)/lib \
265   --enable-languages=cpp \
266   --disable-gpg-test \
267   --disable-gpgsm-test
268
269 gpg4win_pkg_gpa_configure = --silent \
270   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
271   --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
272   --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
273
274 gpg4win_pkg_gpgol_configure = --silent \
275   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir) \
276   --with-libassuan-prefix=$(idir) --enable-mime-send
277
278 gpg4win_pkg_gpgol_ex_configure = --silent \
279   --with-gpgme-prefix=$(ex_idir) --with-gpg-error-prefix=$(ex_idir) \
280   --with-libassuan-prefix=$(ex_idir) --enable-mime-send
281
282 gpg4win_pkg_gpgex_configure = --silent \
283   --with-gpg-error-prefix=$(idir) \
284   --with-libassuan-prefix=$(idir)
285
286 gpg4win_pkg_gpgex_ex_configure = --silent \
287   --with-gpg-error-prefix=$(ex_idir) \
288   --with-libassuan-prefix=$(ex_idir)
289
290 gpg4win_pkg_paperkey_configure = --silent
291
292 gpg4win_pkg_ki18n_configure = -DBUILD_WITH_QML=OFF
293 gpg4win_pkg_kconfig_configure = -DKCONFIG_USE_DBUS=OFF
294
295 gpg4win_pkg_qtbase_configure = ../$$$${pkg_version}/configure -opensource \
296             -confirm-license \
297             -xplatform win32-g++ \
298             -device-option CROSS_COMPILE=$(host)- \
299             -device-option PKG_CONFIG='$(host)-pkg-config' \
300             -no-use-gold-linker \
301             -release \
302             -shared \
303             -prefix $$$${pkgidir} \
304             -I '$(idir)/include' \
305             -L '$(idir)/lib' \
306             -no-icu \
307             -opengl desktop \
308             -no-glib \
309             -accessibility \
310             -nomake examples \
311             -nomake tests \
312             -no-sql-mysql \
313             -no-sql-sqlite \
314             -no-sql-odbc \
315             -no-sql-psql \
316             -no-sql-tds \
317             -qt-zlib \
318             -qt-libpng \
319             -qt-libjpeg \
320             -qt-freetype \
321             -qt-pcre \
322             -no-openssl \
323             -no-dbus \
324             -v
325
326 # qtbase
327 # invoke qmake with removed debug options as a workaround for
328 # https://bugreports.qt-project.org/browse/QTBUG-30898
329 gpg4win_pkg_qtbase_make_args = \
330     QMAKE='$$$${pkgbdir}/bin/qmake'
331
332 # Qmake still writes debug names in pkgconfig files.
333 define gpg4win_pkg_qtbase_post_install
334         (cd $$$${pkgbdir}; \
335          make install;)
336 endef
337
338
339 gpg4win_pkg_qttools_configure = \
340         "$(idir)/bin/qmake" ../$$$${pkg_version}
341
342 define gpg4win_pkg_qttools_post_install
343          (cd $$$${pkgbdir}; \
344           mkdir -p $$$${pkgidir}; \
345           cp -r bin lib include $$$${pkgidir})
346 endef
347
348 # Qmake does not support setting the installation path.
349 # really https://bugreports.qt.io/browse/QTBUG-12341
350 gpg4win_pkg_qtwinextras_configure = \
351         "$(idir)/bin/qmake" ../$$$${pkg_version}
352
353 define gpg4win_pkg_qtwinextras_post_install
354  (cd $$$${pkgbdir}; \
355   mkdir -p $$$${pkgidir}/bin; \
356   cp -r lib include $$$${pkgidir}; \
357   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin;)
358 endef
359
360 gpg4win_pkg_qtsvg_configure = \
361         "$(idir)/bin/qmake" ../$$$${pkg_version}
362
363 # XXX Adding the qtconf after qtsvg is a weird hack
364 # because somhow (yay qmake) zlib is not linked if
365 # the qt conf exists before that. The qt conf is
366 # needed for qttranslations to find the correct path
367 # of the translation tools.
368 define gpg4win_pkg_qtsvg_post_install
369  (cd $$$${pkgbdir}; \
370   mkdir -p $$$${pkgidir}; \
371   cp -r lib include plugins $$$${pkgidir}; \
372   mkdir -p $$$${pkgidir}/bin; \
373   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin; \
374   echo "[Paths]" > $$$${pkgidir}/bin/qt.conf; \
375   echo "Prefix = .." >> $$$${pkgidir}/bin/qt.conf)
376 endef
377
378 gpg4win_pkg_qttranslations_configure = \
379         "$(idir)/bin/qmake" ../$$$${pkg_version}
380
381 define gpg4win_pkg_qttranslations_post_install
382  ( rm -f $$$${pkgidir}/qttranslations; \
383    mkdir -p $$$${pkgidir}; \
384    cp -r $$$${pkgbdir}/translations $$$${pkgidir}/qttranslations;)
385 endef
386
387 gpg4win_pkg_kleopatra_configure = \
388     -DFORCE_DISABLE_KCMUTILS=ON \
389     -DDISABLE_KWATCHGNUPG=ON \
390     -DKLEOPATRA_VERSION_SUFFIX=-gpg4win-$(VERSION)
391
392 gpg4win_pkg_kxmlgui_configure = \
393     -DFORCE_DISABLE_KGLOBALACCEL=ON \
394     -DFORCE_DISABLE_DBUS=ON \
395     -DXMLGUI_COMPILER_VERSION="i686-w64-mingw32-gcc" \
396     -DXMLGUI_DISTRIBUTION_TEXT="Gpg4win"
397
398 gpg4win_pkg_breeze_icons_configure = \
399     -DBINARY_ICONS_RESOURCE=OFF
400
401 # Supported make-only source packages.
402 gpg4win_mpkgs = bzip2 zlib
403
404 # Extra options for the make invocations for individual packages.
405 # make_flags is used for building, make_args_inst is used for installing.
406 gpg4win_pkg_bzip2_make_args = \
407   CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
408
409 gpg4win_pkg_bzip2_make_args_inst = \
410   PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
411
412 gpg4win_pkg_zlib_make_args = \
413   -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
414
415 gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \
416         BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \
417         LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a
418
419 # Supported binary packages.
420 gpg4win_bpkgs = pkgconfig pango expat freetype fontconfig \
421                 cairo atk gnupg-w32 kde-l10n
422
423 # libiconv needs some special magic to generate a usable import
424 # library.
425 # define gpg4win_pkg_libiconv_post_install
426 # (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;         \
427 # cd $$$${pkgidir}/lib;                                 \
428 # $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
429 # endef
430
431 # libiconv needs some special magic to generate a usable import
432 # library.  Note that we include some internal symbols that are not
433 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
434 # configure test, but not used otherwise.
435 # define gpg4win_pkg_gettext_post_install
436 # (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;          \
437 # cd $$$${pkgidir}/lib;                                 \
438 # $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
439 # endef
440
441
442 # Zlib needs some special magic to generate a libtool file.
443 # We also install the pc file here.
444 define gpg4win_pkg_zlib_post_install
445 (mkdir $$$${pkgidir}/lib/pkgconfig || true;             \
446 cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/;  \
447 cd $$$${pkgidir};                                       \
448 echo "# Generated by libtool" > lib/libz.la             \
449 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
450 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
451 echo "old_library='libz.a'" >> lib/libz.la;             \
452 echo "dependency_libs=''" >> lib/libz.la;               \
453 echo "current=1" >> lib/libz.la;                        \
454 echo "age=2" >> lib/libz.la;                            \
455 echo "revision=5" >> lib/libz.la;                       \
456 echo "installed=yes" >> lib/libz.la;                    \
457 echo "shouldnotlink=no" >> lib/libz.la;                 \
458 echo "dlopen=''" >> lib/libz.la;                        \
459 echo "dlpreopen=''" >> lib/libz.la;                     \
460 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la)
461 endef
462
463 # We need to fix the prefix in the various packages using pkgconfig,
464 # or we can't substitute it properly in our pkg-config wrapper.
465 # glib also installs an empty charset.alias for mingw which creates
466 # a stow conflict with the one from iconv.
467 define gpg4win_pkg_glib_post_install
468  (cd $$$${pkgidir};                                                     \
469  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`; \
470  rm $$$${pkgidir}/lib/charset.alias)
471 endef
472
473 define gpg4win_pkg_libffi_post_install
474  (cd $$$${pkgidir};                                                     \
475  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
476 endef
477
478 define gpg4win_pkg_gdk_pixbuf_post_install
479  (cd $$$${pkgidir};                                                     \
480  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
481 endef
482
483 define gpg4win_pkg_atk_post_install
484  (cd $$$${pkgidir_dev};                                                 \
485  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
486 endef
487
488 define gpg4win_pkg_freetype_post_install
489  (cd $$$${pkgidir_dev};                                                 \
490  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
491 endef
492
493 define gpg4win_pkg_fontconfig_post_install
494  (cd $$$${pkgidir_dev};                                                 \
495  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
496 endef
497
498 define gpg4win_pkg_cairo_post_install
499  (cd $$$${pkgidir_dev};                                                 \
500  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
501 endef
502
503 define gpg4win_pkg_pango_post_install
504  (cd $$$${pkgidir_dev};                                                 \
505  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
506 endef
507
508 define gpg4win_pkg_libpng_post_install
509  (cd $$$${pkgidir};                                                     \
510  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
511 endef
512
513
514 # We don't use khelpcenter in kleopatra so remove the help links and
515 # point to the correct common folder
516 # TODO Needs to be fixed with current doc
517 #define gpg4win_pkg_kleopatra_post_install
518 # (for i in de en ; do \
519 #    (cd $$$${pkgidir}/share/doc/HTML/$$$${i}; \
520 #     perl -pi -e 's/help:\///g' `find . -name \*.html`; \
521 #     perl -pi -e 's@common/@../../common/@g' `find . -name \*.html`); \
522 # done)
523 #endef
524
525
526 #define gpg4win_pkg_libiconv_post_install
527 #(cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;          \
528 #cd $$$${pkgidir}/lib;                                  \
529 #$(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
530 #endef
531
532 # Supported internal packages.  Internal packages do not require any
533 # special support.  Thus, this variable is actually unused, and no
534 # rules are added in gpg4win.mk.
535 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \
536                 compendium
537
538
539 # Now do the bunch of the work.  This is a bunch of dirty magic to
540 # integrate our special makefile into automake, while not actually
541 # including it (make should include it).  This is in turn necessary
542 # because automake can't deal with the elegant magic in the actual
543 # Makefile.
544
545 define INCLUDE_BY_MAKE
546 include $(1)
547 endef
548
549 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
550
551 clean-local: clean-gpg4win
552
553 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
554   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
555   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
556
557
558 # Prepare the versioninfo file.  The pipeline extracts the last
559 # occurrence of a package with the same name, sorts the entries and
560 # writes the file with DOS line endings.  This helps to avoid
561 # duplicate entries in case one package has been rebuild (which is
562 # common when developing a new version).
563 versioninfo.txt:
564         $(SHA1SUM) $(pkg_files) </dev/null > versioninfo.tmp
565         set -e; \
566         ( while read a b; do echo "$$a $$(basename $$b)"; \
567             done < versioninfo.tmp \
568           | sort -k2 -sf | tac | uniq -f1 ; \
569           echo '=========== SHA-1 checksum ============= == package ==' \
570          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
571         -rm versioninfo.tmp
572
573 NEWS.tmp : $(top_srcdir)/NEWS
574          awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
575              !skip { sub(/^\(en\)/,"   *"); print }' \
576              <$(top_srcdir)/NEWS >NEWS.tmp
577
578 NEWS.de : $(top_srcdir)/NEWS
579          awk '/^#/ {next} /^\(en\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
580              !skip { sub(/^\(de\)/,"-"); print }' \
581              <$(top_srcdir)/NEWS >NEWS.de; \
582      sed -i 's/^     /  /' NEWS.de
583
584 NEWS.en : $(top_srcdir)/NEWS
585          awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
586              !skip { sub(/^\(en\)/,"-"); print }'  \
587              <$(top_srcdir)/NEWS >NEWS.en; \
588      sed -i 's/^     /  /' NEWS.en
589
590 COMPONENTS-list.tmp : $(top_srcdir)/NEWS
591         awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print "    "$$0}' \
592             < $(top_srcdir)/NEWS > COMPONENTS-list.tmp
593
594 # For some nut-crazy reason someone thought it would be a great idea
595 # if makensis changed to the directory of the source file at startup.
596 # So we have to pull a couple of strings to correct this.
597 installers/gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
598                         g4wihelp.dll \
599                         $(foosum_exe) \
600                         $(README_files) $(HOWTO_files) \
601                         license.blurb versioninfo.txt
602         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
603            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi && \
604                    mv gpg4win-$(VERSION).exe installers/gpg4win-$(VERSION).exe
605
606 installers/Gpg4win-Enterprise-$(VERSION).msi: playground/install/gpg4win-$(VERSION).wixlib
607         ssh $(WINHOST) "mkdir AppData\\Local\\Temp\\gpg4win-$(VERSION)"
608         scp $(idir)/gpg4win-$(VERSION).wixlib $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)
609         scp $(top_srcdir)/packages/gnupg-w32-$(gpg4win_pkg_gnupg_w32_version).wixlib \
610                 $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION);
611         scp $(top_srcdir)/src/gpl.rtf $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)
612         ssh $(WINHOST) $(WINLIGHT) \
613         -ext WixUIExtension \
614         -out AppData/Local/Temp/gpg4win-$(VERSION)/Gpg4win-Enterprise-$(VERSION).msi \
615         -dcl:high \
616         -v -pedantic \
617          \
618          AppData/Local/Temp/gpg4win-$(VERSION)/gpg4win-$(VERSION).wixlib \
619          AppData/Local/Temp/gpg4win-$(VERSION)/gnupg-w32-$(gpg4win_pkg_gnupg_w32_version).wixlib; \
620          scp $(WINHOST):AppData/Local/Temp/gpg4win-$(VERSION)/Gpg4win-Enterprise-$(VERSION).msi \
621          installers;
622
623 playground/install/gpg4win-$(VERSION).wixlib: \
624       gpg4win-$(VERSION).wxs stamps/stamp-final \
625       $(foosum_exe) \
626       $(README_files) $(HOWTO_files) \
627       license.blurb versioninfo.txt
628         if [ -z "$$(which $(WINE))" ]; then \
629                 echo "ERROR: For the msi-package wine needs to be installed."; \
630         exit 1; \
631         fi;
632         ( \
633         if [ -z "$(WIXPREFIX)" ]; then \
634                 if [ -d `readlink -f ~/wix` ]; then \
635                         WIXPREFIX2=`readlink -f ~/wix`; \
636                         echo "Using $$WIXPREFIX2 as WIXPREFIX"; \
637                 else \
638                         echo "ERROR: You must set WIXPREFIX to an installation of wixtools."; \
639                         exit 1; \
640                 fi; \
641         else \
642                 WIXPREFIX2="$(WIXPREFIX)"; \
643         fi; \
644         if [ -z "$$WINEPREFIX" ]; then \
645                 WINEPREFIX="$$HOME/.wine"; \
646                 if [ ! -e "$$WINEPREFIX/dosdevices" ]; then \
647                         echo "ERROR: No wine prefix found under $$WINEPREFIX"; \
648                         exit 1; \
649                 fi; \
650         fi; \
651         WINEINST=$$WINEPREFIX/dosdevices/k:; \
652         WINESRC=$$WINEPREFIX/dosdevices/i:; \
653         WINEINSTEX=$$WINEPREFIX/dosdevices/j:; \
654         if [ -e "$$WINEINST" ]; then \
655                 echo "ERROR: $$WINEINST already exists. Please remove."; \
656                 exit 1; \
657         fi; \
658         if [ -e "$$WINESRC" ]; then \
659                 echo "ERROR: $$WINESRC already exists. Please remove."; \
660                 exit 1; \
661         fi; \
662         if [ -e "$$WINEINSTEX" ]; then \
663                 echo "ERROR: $$WINEINSTEX already exists. Please remove."; \
664                 exit 1; \
665         fi; \
666         echo "Gpg4win" > $(srcdir)/playground/VERSION; \
667         echo "$(VERSION)" >> $(srcdir)/playground/VERSION; \
668         MSI_VERSION=$$(echo $(VERSION) | tr -s \\-beta .); \
669         (ln -s $(idir) $$WINEINST; \
670          ln -s $(ex_idir) $$WINEINSTEX; \
671          ln -s `readlink -f $(top_srcdir)` $$WINESRC; \
672                 $(WINE) $$WIXPREFIX2/candle.exe \
673                 -dInstDir=k: \
674                 -dInstDirEx=j: \
675                 -dSrcDir=i:\\src \
676                 -dVersion=$$MSI_VERSION \
677                 -out k:\\gpg4win-$(VERSION).wixobj \
678                 -pedantic -wx i:\\src\\gpg4win-$(VERSION).wxs; \
679                 \
680                 $(WINE) $$WIXPREFIX2/lit.exe \
681                 -out k:\\gpg4win-$(VERSION).wixlib \
682                 -bf \
683                 -wx \
684                 -pedantic \
685                 k:\\gpg4win-$(VERSION).wixobj; \
686                 \
687         ); \
688                 (rm $$WINEINST; rm $$WINESRC; rm $$WINEINSTEX) \
689         )
690
691 gpg4win-$(VERSION).wxs: gpg4win.nsi $(common_nsi) stamps/stamp-final \
692                         $(foosum_exe) \
693                         $(README_files) $(HOWTO_files) \
694                         versioninfo.txt make-msi.pl
695         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
696                 --manifest gpg4win-$(VERSION).files \
697                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
698                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
699
700 .PHONY: msi
701 msi: installers/Gpg4win-Enterprise-$(VERSION).msi
702 wixscript: gpg4win-$(VERSION).wxs
703
704 stamps/stamp-dist-self: versioninfo.txt
705         (set -e; cd ..; make dist-bzip2)
706         touch stamps/stamp-dist-self
707
708 installers/gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsii) \
709                             stamps/stamp-final \
710                             stamps/stamp-dist-self \
711                             license.blurb
712         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
713           -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi && \
714         mv gpg4win-src-$(VERSION).exe installers/gpg4win-src-$(VERSION).exe
715
716 license.blurb: $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3
717         cat $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 >$@
718
719 g4wihelp.dll: slideshow.cpp desktopshellrun.cpp g4wihelp.c exdll.h
720         $(CC) -static-libgcc -I. -O2 -c -o desktopshellrun.o $(srcdir)/desktopshellrun.cpp
721         $(CC) -static-libgcc -I. -O2 -c -o slideshow.o $(srcdir)/slideshow.cpp
722         $(CC) -static-libgcc -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
723           desktopshellrun.o slideshow.o -lwinmm -lgdi32 -luserenv -lshell32 \
724           -lole32 -loleaut32 -lshlwapi -lmsimg32
725         $(STRIP) g4wihelp.dll
726
727 sha1sum.exe: sha1sum.c
728         $(CC) -O2 -o $@ $^
729         $(STRIP) $@
730
731 md5sum.exe: sha1sum.c
732         $(CC) -DBUILD_MD5SUM -O2 -o $@ $^
733         $(STRIP) $@
734
735 sha256sum.exe: sha1sum.c
736         $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
737         $(STRIP) $@
738
739 mkportable.exe: mkportable.c \
740                 mkportable-vanilla.h mkportable-full.h
741         $(CC) -O2 -o $@ $(srcdir)/mkportable.c
742         $(STRIP) $@
743
744 if BUILD_SOURCE_INSTALLER
745 all_src = installers/gpg4win-src-$(VERSION).exe
746 else
747 all_src =
748 endif
749
750 all_full = installers/gpg4win-$(VERSION).exe
751
752 all-local: $(all_full) $(all_src)
753         @echo "###################################################"
754         @echo " Gpg4win $(VERSION) successfully build!"
755         @echo " Installers can be found under src/installers"
756         @echo "###################################################"
757
758 clean-local:
759         rm -f installers/gpg4win-$(VERSION).exe \
760                   installers/gpg4win-src-$(VERSION).exe \
761                   installers/Gpg4win-Enterprise-$(VERSION).msi