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