Add KMime
[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         installer-options.ini.in libiconv.def libintl.def loreley.mid \
23         gpg4win-splash.wav exdll.h g4wihelp.c g4wihelp.nsi \
24         inst-sections.nsi installer.nsi installer-finish.nsi  \
25         zlib.pc sha1sum.c mkportable.c     \
26         mkportable-vanilla.h mkportable-light.h mkportable-full.h \
27         potomo Memento.nsh \
28         inst-gpg4win.nsi           uninst-gpg4win.nsi         \
29         inst-atk.nsi               uninst-atk.nsi             \
30         inst-expat.nsi             uninst-expat.nsi           \
31         inst-freetype.nsi          uninst-freetype.nsi        \
32         inst-fontconfig.nsi        uninst-fontconfig.nsi      \
33         inst-cairo.nsi             uninst-cairo.nsi           \
34         inst-gettext.nsi           uninst-gettext.nsi         \
35         inst-libffi.nsi            uninst-libffi.nsi          \
36         inst-glib.nsi              uninst-glib.nsi            \
37         inst-gnupg-w32.nsi         uninst-gnupg-w32.nsi       \
38         inst-gpa.nsi               uninst-gpa.nsi             \
39         inst-gpgme.nsi             uninst-gpgme.nsi           \
40         inst-paperkey.nsi          uninst-paperkey.nsi        \
41         inst-gpgol.nsi             uninst-gpgol.nsi           \
42         inst-gpgex.nsi             uninst-gpgex.nsi           \
43         inst-gdk-pixbuf.nsi        uninst-gdk-pixbuf.nsi      \
44         inst-gtk+.nsi              uninst-gtk+.nsi            \
45         inst-libassuan.nsi         uninst-libassuan.nsi       \
46         inst-libgpg-error.nsi      uninst-libgpg-error.nsi    \
47         inst-libiconv.nsi          uninst-libiconv.nsi        \
48         inst-libpng.nsi            uninst-libpng.nsi          \
49         inst-compendium.nsi        uninst-compendium.nsi   \
50         inst-man_advanced_de.nsi   uninst-man_advanced_de.nsi \
51         inst-man_advanced_en.nsi   uninst-man_advanced_en.nsi \
52         inst-man_novice_de.nsi     uninst-man_novice_de.nsi   \
53         inst-man_novice_en.nsi     uninst-man_novice_en.nsi   \
54         inst-pango.nsi             uninst-pango.nsi           \
55         inst-pinentry.nsi          uninst-pinentry.nsi        \
56         inst-pkgconfig.nsi         uninst-pkgconfig.nsi       \
57         inst-w32pth.nsi            uninst-w32pth.nsi          \
58         inst-zlib.nsi              uninst-zlib.nsi            \
59         inst-kconfig.nsi        uninst-kconfig.nsi              \
60         inst-dbus.nsi              uninst-dbus.nsi      \
61         inst-oxygen-icons.nsi      uninst-oxygen-icons.nsi    \
62         inst-kleopatra.nsi         uninst-kleopatra.nsi       \
63         inst-bzip2.nsi             uninst-bzip2.nsi           \
64         uninst-claws-mail.nsi uninst-claws-mail-cmds.nsi \
65         inst-qtbase.nsi uninst-qtbase.nsi \
66         inst-ki18n.nsi uninst-ki18n.nsi \
67         inst-gpgmepp.nsi uninst-gpgmepp.nsi \
68         inst-kwidgetsaddons.nsi uninst-kwidgetsaddons.nsi \
69         inst-kcompletion.nsi uninst-kcompletion.nsi \
70         inst-kwindowsystem.nsi uninst-kwindowsystem.nsi \
71         inst-libkleo.nsi uninst-libkleo.nsi \
72         inst-kcoreaddons.nsi uninst-kcoreaddons.nsi \
73         inst-kcodecs.nsi uninst-kcodecs.nsi \
74         inst-kmime.nsi uninst-kmime.nsi \
75         inst-qttools.nsi uninst-qttools.nsi \
76         inst-boost.nsi uninst-boost.nsi \
77         inst-extra-cmake-modules.nsi uninst-extra-cmake-modules.nsi \
78         inst-final.nsi
79
80 SUBDIRS = dictionaries
81
82 gpg4win_readme_ll = en de ar es fr ru pt
83
84 README_files = $(addsuffix .txt,$(addprefix README.,$(gpg4win_readme_ll)))
85
86 gpg4win_howto_smime_ll = en de
87
88 HOWTO_files = $(addsuffix .txt, \
89                 $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll)))
90
91 foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe mkportable.exe
92
93 # Need to clean the dll because we bypassed automake.
94 CLEANFILES = g4wihelp.dll versioninfo.txt $(README_files) $(HOWTO_files) \
95              installer-options.ini NEWS.tmp COMPONENTS-list.tmp \
96              license.blurb cdversioninfo.tmp \
97              $(foosum_exe)
98
99 # Supported source packages.
100 gpg4win_spkgs = glib libffi gdk-pixbuf gtk+ \
101                 libgpg-error gpgme gpgol gpgex libpng \
102                 gpa opencdk \
103                 pinentry libassuan \
104                 w32pth paperkey regex libiconv gettext \
105                 qtbase qttools boost qtwinextras
106
107 # Source packages following the KDE pattern
108 gpg4win_kdepkgs = kconfig kwidgetsaddons gpgmepp ki18n extra-cmake-modules \
109                   kcompletion kwindowsystem kcoreaddons libkleo kcodecs \
110                   kmime
111
112 # Supported source packages to build in an additional architecture
113 gpg4win_expkgs = libgpg-error libassuan libiconv gettext w32pth gpgex gpgol \
114                  gpgme
115
116 # Extra options to configure for individual packages.
117 # We can use $(idir) here for the installation prefix.
118
119 gpg4win_pkg_libiconv_ex_configure = \
120         --enable-shared=no --enable-static=yes
121
122 gpg4win_pkg_gettext_configure = \
123   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
124   CPPFLAGS=-I$(idir)/include CFLAGS=-O2 LDFLAGS=-L$(idir)/lib
125
126 gpg4win_pkg_gettext_ex_configure = \
127   --with-lib-prefix=$(ex_idir) --with-libiconv-prefix=$(ex_idir) \
128   CPPFLAGS=-I$(ex_idir)/include CFLAGS=-O2 LDFLAGS=-L$(ex_idir)/lib
129
130 # We only need gettext-runtime and there is sadly no top level
131 # configure option for this
132 gpg4win_pkg_gettext_make_dir = gettext-runtime
133 gpg4win_pkg_gettext_make_dir_inst = gettext-runtime
134 gpg4win_pkg_gettext_ex_make_dir = gettext-runtime
135 gpg4win_pkg_gettext_ex_make_dir_inst = gettext-runtime
136
137 gpg4win_pkg_glib_configure = \
138   --disable-modular-tests \
139   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
140   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib CCC=$(host)-g++
141 gpg4win_pkg_glib_extracflags = -march=i486
142
143 gpg4win_pkg_gdk_pixbuf_configure = \
144   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
145   --with-included-loaders=yes \
146   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
147
148 gpg4win_pkg_gtk__configure = \
149   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib --disable-cups
150
151 # The GnuPG package provides man pages which we have to convert.
152 # We also create the MO files here.
153 define gpg4win_pkg_gnupg2_post_install
154 (for i in gpg2 gpgv2 gpgsm gpg-agent scdaemon gpg-connect-agent gpgconf ; \
155   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
156     sed `printf "s/_\b//g;s/\b.//g"` | \
157     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
158  done ; \
159  for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
160      $(mkdir_p) $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES || true; \
161      rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo 2>/dev/null \
162        || true; \
163      $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
164               $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo; \
165  done)
166 endef
167
168 # Paperkey comes with a man pages which we have to convert.
169 define gpg4win_pkg_paperkey_post_install
170 (for i in paperkey ; \
171   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
172     sed `printf "s/_\b//g;s/\b.//g"` | \
173     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
174  done)
175 endef
176
177
178
179 # Build the reference manual.
180 define gpg4win_pkg_gpgol_post_install
181 ( cd $$$${pkgndir}/doc; make pdf )
182 endef
183
184 # We would like to use --with-libiconv-prefix and
185 # --with-libintl-prefix, but these don't work with the cheesy
186 # non-"libfoo.la" versions of iconv and gettext that we are using.
187 #gpg4win_pkg_libgpg_error_configure = \
188 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
189 gpg4win_pkg_libgpg_error_configure = --silent \
190   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib \
191   --enable-static
192
193 gpg4win_pkg_libgpg_error_ex_configure = --silent \
194   --enable-static
195
196 # We convert the PO files to UTF-8.  FIXME: This should be done in
197 # libgpg-error proper.
198 define gpg4win_pkg_libgpg_error_post_install
199 (for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
200    rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo \
201        2>/dev/null|| true; \
202    $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
203              $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo; \
204  done)
205 endef
206
207 gpg4win_pkg_libassuan_configure =  --silent --enable-static
208
209 gpg4win_pkg_libassuan_ex_configure =  --silent --enable-static
210
211 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\"
212
213 # We would like to use --with-libiconv-prefix and
214 # --with-libintl-prefix, but these don't work with the cheesy
215 # non-"libfoo.la" versions of iconv and gettext that we are using.
216 if BUILD_FULL_INSTALLER
217 pinentry_enable_disable= --enable-pinentry-qt
218 endif
219 gpg4win_pkg_pinentry_configure = \
220   $(pinentry_enable_disable) \
221   --enable-pinentry-gtk2 \
222   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
223 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
224
225 # The LDFLAGS is needed for -lintl for glib.  The QT4 variables work
226 # around the lack of cross compilation support in qt-dev.
227 gpg4win_pkg_gpgme_configure = --silent \
228   --with-gpg-error-prefix=$(idir) --enable-static \
229   `test -n "@HAVE_PKG_GLIB@" && echo "--enable-w32-glib"` \
230   --disable-w32-qt LDFLAGS=-L$(idir)/lib
231
232 gpg4win_pkg_gpgme_ex_configure = --silent \
233   --with-gpg-error-prefix=$(ex_idir) --enable-static \
234   --with-libassuan-prefix=$(ex_idir) \
235   LDFLAGS=-L$(ex_idir)/lib
236
237 gpg4win_pkg_gpa_configure = --silent \
238   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
239   --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
240   --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
241
242 gpg4win_pkg_gpgol_configure = --silent \
243   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir) \
244   --with-libassuan-prefix=$(idir) --enable-mime-send \
245   --enable-gpg4win-3-reg-keys
246
247 gpg4win_pkg_gpgol_ex_configure = --silent \
248   --with-gpgme-prefix=$(ex_idir) --with-gpg-error-prefix=$(ex_idir) \
249   --with-libassuan-prefix=$(ex_idir) --enable-mime-send \
250   --enable-gpg4win-3-reg-keys
251
252 gpg4win_pkg_gpgex_configure = --silent \
253   --with-gpg-error-prefix=$(idir) \
254   --with-libassuan-prefix=$(idir)
255
256 gpg4win_pkg_paperkey_configure = --silent
257
258 gpg4win_pkg_ki18n_configure = -DBUILD_WITH_QTSCRIPT=OFF
259
260 gpg4win_pkg_qtbase_configure = -opensource \
261             -confirm-license \
262             -xplatform win32-g++ \
263             -device-option CROSS_COMPILE=$(host)- \
264             -device-option PKG_CONFIG='$(host)-pkg-config' \
265             -force-pkg-config \
266             -no-use-gold-linker \
267             -release \
268             -shared \
269             -prefix $$$${pkgidir} \
270             -I '$(idir)/include' \
271             -L '$(idir)/lib' \
272             -no-icu \
273             -opengl desktop \
274             -no-glib \
275             -accessibility \
276             -nomake examples \
277             -nomake tests \
278             -no-sql-mysql \
279             -no-sql-sqlite \
280             -no-sql-odbc \
281             -no-sql-psql \
282             -no-sql-tds \
283             -qt-zlib \
284             -system-libpng \
285             -qt-libjpeg \
286             -fontconfig \
287             -system-freetype \
288             -qt-pcre \
289             -no-openssl \
290             -no-dbus
291
292 # invoke qmake with removed debug options as a workaround for
293 # https://bugreports.qt-project.org/browse/QTBUG-30898
294 gpg4win_pkg_qtbase_make_args = \
295     QMAKE='$$$${pkgsdir}/bin/qmake CONFIG-="debug debug_and_release"'
296
297 # Qmake still writes debug names in pkgconfig files.
298 define gpg4win_pkg_qtbase_post_install
299  (cd $$$${pkgidir}; \
300  sed -i 's/-lQt5\(\w*\)d/-lQt5\1/g' `find . -name \*.pc`)
301 endef
302
303 # Qmake does not support setting the installation path.
304 # really https://bugreports.qt.io/browse/QTBUG-12341
305 define gpg4win_pkg_qttools_post_install
306  (cd $$$${pkgbdir}; \
307   make uninstall; \
308   mkdir $$$${pkgidir}; \
309   cp -r bin lib include $$$${pkgidir};)
310 endef
311
312 define gpg4win_pkg_qtwinextras_post_install
313  (cd $$$${pkgbdir}; \
314   make uninstall; \
315   mkdir $$$${pkgidir}; \
316   cp -r lib include $$$${pkgidir}; \
317   mkdir $$$${pkgidir}/bin; \
318   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin;)
319 endef
320
321 # Supported make-only source packages.
322 gpg4win_mpkgs = bzip2 zlib
323
324 # Extra options for the make invocations for individual packages.
325 # make_flags is used for building, make_args_inst is used for installing.
326 gpg4win_pkg_bzip2_make_args = \
327   CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
328
329 gpg4win_pkg_bzip2_make_args_inst = \
330   PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
331
332 gpg4win_pkg_zlib_make_args = \
333   -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
334
335 gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \
336         BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \
337         LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a
338
339 # Supported binary packages.
340 gpg4win_bpkgs = pkgconfig pango expat freetype fontconfig \
341                 cairo atk dbus oxygen-icons kleopatra bsfilter gnupg-w32
342
343 # libiconv needs some special magic to generate a usable import
344 # library.
345 # define gpg4win_pkg_libiconv_post_install
346 # (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;         \
347 # cd $$$${pkgidir}/lib;                                 \
348 # $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
349 # endef
350
351 # libiconv needs some special magic to generate a usable import
352 # library.  Note that we include some internal symbols that are not
353 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
354 # configure test, but not used otherwise.
355 # define gpg4win_pkg_gettext_post_install
356 # (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;          \
357 # cd $$$${pkgidir}/lib;                                 \
358 # $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
359 # endef
360
361
362 # Zlib needs some special magic to generate a libtool file.
363 # We also install the pc file here.
364 define gpg4win_pkg_zlib_post_install
365 (mkdir $$$${pkgidir}/lib/pkgconfig || true;             \
366 cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/;  \
367 cd $$$${pkgidir};                                       \
368 echo "# Generated by libtool" > lib/libz.la             \
369 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
370 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
371 echo "old_library='libz.a'" >> lib/libz.la;             \
372 echo "dependency_libs=''" >> lib/libz.la;               \
373 echo "current=1" >> lib/libz.la;                        \
374 echo "age=2" >> lib/libz.la;                            \
375 echo "revision=5" >> lib/libz.la;                       \
376 echo "installed=yes" >> lib/libz.la;                    \
377 echo "shouldnotlink=no" >> lib/libz.la;                 \
378 echo "dlopen=''" >> lib/libz.la;                        \
379 echo "dlpreopen=''" >> lib/libz.la;                     \
380 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la)
381 endef
382
383 # We need to fix the prefix in the various packages using pkgconfig,
384 # or we can't substitute it properly in our pkg-config wrapper.
385 # glib also installs an empty charset.alias for mingw which creates
386 # a stow conflict with the one from iconv.
387 define gpg4win_pkg_glib_post_install
388  (cd $$$${pkgidir};                                                     \
389  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`; \
390  rm $$$${pkgidir}/lib/charset.alias)
391 endef
392
393 define gpg4win_pkg_libffi_post_install
394  (cd $$$${pkgidir};                                                     \
395  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
396 endef
397
398 define gpg4win_pkg_gdk_pixbuf_post_install
399  (cd $$$${pkgidir};                                                     \
400  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
401 endef
402
403 define gpg4win_pkg_atk_post_install
404  (cd $$$${pkgidir_dev};                                                 \
405  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
406 endef
407
408 define gpg4win_pkg_freetype_post_install
409  (cd $$$${pkgidir_dev};                                                 \
410  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
411 endef
412
413 define gpg4win_pkg_fontconfig_post_install
414  (cd $$$${pkgidir_dev};                                                 \
415  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
416 endef
417
418 define gpg4win_pkg_cairo_post_install
419  (cd $$$${pkgidir_dev};                                                 \
420  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
421 endef
422
423 define gpg4win_pkg_pango_post_install
424  (cd $$$${pkgidir_dev};                                                 \
425  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
426 endef
427
428 define gpg4win_pkg_gtk__post_install
429  (cd $$$${pkgidir_dev};                                                 \
430  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
431 endef
432
433 define gpg4win_pkg_libpng_post_install
434  (cd $$$${pkgidir};                                                     \
435  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
436 endef
437
438
439 # We don't use khelpcenter in kleopatra so remove the help links and
440 # point to the correct common folder
441 define gpg4win_pkg_kleopatra_post_install
442  (for i in de en ; do \
443     (cd $$$${pkgidir}/share/doc/HTML/$$$${i}; \
444      perl -pi -e 's/help:\///g' `find . -name \*.html`; \
445      perl -pi -e 's@common/@../../common/@g' `find . -name \*.html`); \
446  done)
447 endef
448
449
450 #define gpg4win_pkg_libiconv_post_install
451 #(cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;          \
452 #cd $$$${pkgidir}/lib;                                  \
453 #$(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
454 #endef
455
456 # Supported internal packages.  Internal packages do not require any
457 # special support.  Thus, this variable is actually unused, and no
458 # rules are added in gpg4win.mk.
459 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \
460                 compendium
461
462
463 # Now do the bunch of the work.  This is a bunch of dirty magic to
464 # integrate our special makefile into automake, while not actually
465 # including it (make should include it).  This is in turn necessary
466 # because automake can't deal with the elegant magic in the actual
467 # Makefile.
468
469 define INCLUDE_BY_MAKE
470 include $(1)
471 endef
472
473 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
474
475 clean-local: clean-gpg4win
476
477 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
478   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
479   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
480
481
482 # Prepare the versioninfo file.  The pipeline extracts the last
483 # occurrence of a package with the same name, sorts the entries and
484 # writes the file with DOS line endings.  This helps to avoid
485 # duplicate entries in case one package has been rebuild (which is
486 # common when developing a new version).
487 versioninfo.txt:
488         $(SHA1SUM) $(pkg_files) </dev/null > versioninfo.tmp
489         set -e; \
490         ( while read a b; do echo "$$a $$(basename $$b)"; \
491             done < versioninfo.tmp \
492           | sort -k2 -sf | tac | uniq -f1 ; \
493           echo '=========== SHA-1 checksum ============= == package ==' \
494          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
495         -rm versioninfo.tmp
496
497 NEWS.tmp : $(top_srcdir)/NEWS
498          awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
499              !skip { sub(/^\(en\)/,"   *"); print }' \
500              <$(top_srcdir)/NEWS >NEWS.tmp
501
502 COMPONENTS-list.tmp : $(top_srcdir)/NEWS
503         awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print "    "$$0}' \
504             < $(top_srcdir)/NEWS > COMPONENTS-list.tmp
505
506 installer-options.ini : $(top_srcdir)/src/installer-options.ini.in
507         cat $(top_srcdir)/src/installer-options.ini.in >installer-options.ini
508
509
510 # For some nut-crazy reason someone thought it would be a great idea
511 # if makensis changed to the directory of the source file at startup.
512 # So we have to pull a couple of strings to correct this.
513 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
514                         g4wihelp.dll \
515                         $(foosum_exe) \
516                         $(README_files) $(HOWTO_files) \
517                         license.blurb installer-options.ini versioninfo.txt
518         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
519            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi
520
521 gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
522                         g4wihelp.dll \
523                         $(foosum_exe) \
524                         $(README_files) $(HOWTO_files) \
525                         license.blurb installer-options.ini versioninfo.txt
526         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
527            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
528            -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
529
530 gpg4win-vanilla-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
531                         g4wihelp.dll  \
532                         $(foosum_exe) \
533                         $(README_files) $(HOWTO_files) \
534                         license.blurb installer-options.ini versioninfo.txt
535         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
536            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
537            -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi
538
539 gpg4win-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
540                         $(foosum_exe) \
541                         $(README_files) $(HOWTO_files) \
542                         versioninfo.txt
543         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
544                 --manifest gpg4win-$(VERSION).files \
545                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
546                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
547
548 gpg4win-light-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
549                         $(foosum_exe) \
550                         $(README_files) $(HOWTO_files) \
551                         versioninfo.txt
552         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
553                 --manifest gpg4win-light-$(VERSION).files \
554                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
555                 -DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi > $@
556
557 gpg4win-vanilla-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
558                         $(foosum_exe) \
559                         $(README_files) $(HOWTO_files) \
560                         versioninfo.txt
561         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
562                 --manifest gpg4win-vanilla-$(VERSION).files \
563                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
564                 -DSRCDIR=$(srcdir) -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi > $@
565
566 .PHONY: msi
567 msi: gpg4win-$(VERSION).wix gpg4win-light-$(VERSION).wix \
568      gpg4win-vanilla-$(VERSION).wix
569
570
571 stamps/stamp-dist-self: versioninfo.txt
572         (set -e; cd ..; make dist-bzip2)
573         touch stamps/stamp-dist-self
574
575 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final \
576                             stamps/stamp-dist-self installer-options.ini \
577                             license.blurb
578         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
579           -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi
580
581 license.blurb: $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3
582         cat $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 >$@
583
584 g4wihelp.dll: g4wihelp.c exdll.h
585         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
586            -lwinmm -lgdi32
587         $(STRIP) g4wihelp.dll
588
589 sha1sum.exe: sha1sum.c
590         $(CC) -O2 -o $@ $^
591         $(STRIP) $@
592
593 md5sum.exe: sha1sum.c
594         $(CC) -DBUILD_MD5SUM -O2 -o $@ $^
595         $(STRIP) $@
596
597 sha256sum.exe: sha1sum.c
598         $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
599         $(STRIP) $@
600
601 mkportable.exe: mkportable.c \
602                 mkportable-vanilla.h mkportable-light.h mkportable-full.h
603         $(CC) -O2 -o $@ $(srcdir)/mkportable.c
604         $(STRIP) $@
605
606 if BUILD_SOURCE_INSTALLER
607 all_src = gpg4win-src-$(VERSION).exe
608 else
609 all_src =
610 endif
611
612 if BUILD_LIGHT_INSTALLER
613 all_light = gpg4win-light-$(VERSION).exe
614 else
615 all_light =
616 endif
617
618 if BUILD_VANILLA_INSTALLER
619 all_vanilla = gpg4win-vanilla-$(VERSION).exe
620 else
621 all_vanilla =
622 endif
623
624 if BUILD_FULL_INSTALLER
625 all_full = gpg4win-$(VERSION).exe
626 else
627 all_full =
628 endif
629
630 all-local: $(all_full) $(all_light) $(all_vanilla) $(all_src)
631
632 clean-local:
633         rm -f gpg4win-$(VERSION).exe gpg4win-light-$(VERSION).exe \
634             gpg4win-vanilla-$(VERSION).exe gpg4win-src-$(VERSION).exe