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