Remove help:/ prefix in kleopatra documentation
[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 config.site \
21         installer-options.ini.in libiconv.def libintl.def loreley.mid \
22         gpg4win-splash.wav gpgwrap.c exdll.h g4wihelp.c g4wihelp.nsi \
23         inst-sections.nsi installer.nsi installer-finish.nsi  \
24         QtCore.pc QtGui.pc zlib.pc sha1sum.c                  \
25         qt.conf kleowrap.c potomo Memento.nsh dirmngr.conf    \
26         inst-gpg4win.nsi           uninst-gpg4win.nsi         \
27         inst-atk.nsi               uninst-atk.nsi             \
28         inst-expat.nsi             uninst-expat.nsi           \
29         inst-freetype.nsi          uninst-freetype.nsi        \
30         inst-fontconfig.nsi        uninst-fontconfig.nsi      \
31         inst-cairo.nsi             uninst-cairo.nsi           \
32         inst-libgsasl.nsi          uninst-libgsasl.nsi        \
33         inst-libtasn1.nsi          uninst-libtasn1.nsi        \
34         inst-gnutls.nsi            uninst-gnutls.nsi          \
35         inst-curl.nsi              uninst-curl.nsi            \
36         inst-libxml2.nsi           uninst-libxml2.nsi         \
37         inst-libetpan.nsi          uninst-libetpan.nsi        \
38         inst-claws-mail.nsi        uninst-claws-mail.nsi      \
39         inst-notification_plugin.nsi uninst-notification_plugin.nsi  \
40         inst-gtkhtml2_viewer.nsi   uninst-gtkhtml2_viewer.nsi \
41         inst-vcalendar.nsi         uninst-vcalendar.nsi       \
42         inst-rssyl.nsi             uninst-rssyl.nsi           \
43         inst-tnef_parse.nsi        uninst-tnef_parse.nsi      \
44         inst-attachwarner.nsi      uninst-attachwarner.nsi    \
45         inst-bsfilter_plugin.nsi   uninst-bsfilter_plugin.nsi \
46         inst-crypt.nsi             uninst-crypt.nsi           \
47         inst-dirmngr.nsi           uninst-dirmngr.nsi         \
48         inst-gettext.nsi           uninst-gettext.nsi         \
49         inst-libffi.nsi            uninst-libffi.nsi          \
50         inst-glib.nsi              uninst-glib.nsi            \
51         inst-gnupg2.nsi            uninst-gnupg2.nsi          \
52         inst-gpa.nsi               uninst-gpa.nsi             \
53         inst-gpgme.nsi             uninst-gpgme.nsi           \
54         inst-scute.nsi             uninst-scute.nsi           \
55         inst-paperkey.nsi          uninst-paperkey.nsi        \
56         inst-gpgol.nsi             uninst-gpgol.nsi           \
57         inst-gpgex.nsi             uninst-gpgex.nsi           \
58         inst-gdk-pixbuf.nsi        uninst-gdk-pixbuf.nsi      \
59         inst-gtk+.nsi              uninst-gtk+.nsi            \
60         inst-libassuan.nsi         uninst-libassuan.nsi       \
61         inst-libgcrypt.nsi         uninst-libgcrypt.nsi       \
62         inst-libgpg-error.nsi      uninst-libgpg-error.nsi    \
63         inst-libiconv.nsi          uninst-libiconv.nsi        \
64         inst-libksba.nsi           uninst-libksba.nsi         \
65         inst-adns.nsi              uninst-adns.nsi            \
66         inst-libpng.nsi            uninst-libpng.nsi          \
67         inst-enchant.nsi           uninst-enchant.nsi         \
68         inst-compendium.nsi        uninst-compendium.nsi   \
69         inst-man_advanced_de.nsi   uninst-man_advanced_de.nsi \
70         inst-man_advanced_en.nsi   uninst-man_advanced_en.nsi \
71         inst-man_novice_de.nsi     uninst-man_novice_de.nsi   \
72         inst-man_novice_en.nsi     uninst-man_novice_en.nsi   \
73         inst-pango.nsi             uninst-pango.nsi           \
74         inst-pinentry.nsi          uninst-pinentry.nsi        \
75         inst-pkgconfig.nsi         uninst-pkgconfig.nsi       \
76         inst-pthreads-w32.nsi      uninst-pthreads-w32.nsi    \
77         inst-regex.nsi             uninst-regex.nsi           \
78         inst-w32pth.nsi            uninst-w32pth.nsi          \
79         inst-zlib.nsi              uninst-zlib.nsi            \
80         inst-bsfilter.nsi          uninst-bsfilter.nsi        \
81         inst-qt.nsi                uninst-qt.nsi              \
82         inst-dbus.nsi              uninst-dbus.nsi      \
83         inst-oxygen-icons.nsi      uninst-oxygen-icons.nsi    \
84         inst-kleopatra.nsi         uninst-kleopatra.nsi       \
85         inst-bzip2.nsi             uninst-bzip2.nsi           \
86         inst-final.nsi
87
88 SUBDIRS = dictionaries
89
90 gpg4win_readme_ll = en de ar es fr ru pt
91
92 README_files = $(addsuffix .txt,$(addprefix README.,$(gpg4win_readme_ll)))
93
94 gpg4win_howto_smime_ll = en de
95
96 HOWTO_files = $(addsuffix .txt, \
97                 $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll)))
98
99 foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe
100
101 # Need to clean the dll because we bypassed automake.
102 CLEANFILES = g4wihelp.dll versioninfo.txt $(README_files) $(HOWTO_files) \
103              installer-options.ini NEWS.tmp COMPONENTS-list.tmp \
104              versioninfo.tmp \
105              gpgwrap.exe gpgwrap-2.exe kleowrap.exe $(foosum_exe)
106
107 # Supported source packages.
108 gpg4win_spkgs = glib libffi gdk-pixbuf gtk+ \
109                 libgpg-error gpgme gpgol gpgex libpng enchant \
110                 gpa libgsasl libtasn1 opencdk gnutls curl libxml2 \
111                 libetpan claws-mail notification_plugin gtkhtml2_viewer \
112                 vcalendar rssyl gnupg2 pinentry libassuan libksba libgcrypt \
113                 adns dirmngr w32pth scute paperkey tnef_parse attachwarner \
114                 bsfilter_plugin regex
115
116 # Extra options to configure for individual packages.
117 # We can use $(idir) here for the installation prefix.
118
119 gpg4win_pkg_glib_configure = \
120   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
121   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib CCC=$(host)-g++
122 gpg4win_pkg_glib_extracflags = -march=i486
123
124 gpg4win_pkg_gdk_pixbuf_configure = \
125   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
126   --with-included-loaders=yes \
127   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
128
129 gpg4win_pkg_gtk__configure = \
130   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib --disable-cups
131
132 # The GnuPG package provides man pages which we have to convert.
133 # We also create the MO files here.
134 define gpg4win_pkg_gnupg2_post_install
135 (for i in gpg2 gpgv2 gpgsm gpg-agent scdaemon gpg-connect-agent gpgconf ; \
136   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
137     sed `printf "s/_\b//g;s/\b.//g"` | \
138     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
139  done ; \
140  for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
141      $(mkdir_p) $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES || true; \
142      rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo 2>/dev/null \
143        || true; \
144      $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
145               $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo; \
146  done)
147 endef
148
149 # Paperkey comes with a man pages which we have to convert.
150 define gpg4win_pkg_paperkey_post_install
151 (for i in paperkey ; \
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 endef
157
158
159
160 # Build the reference manual.
161 define gpg4win_pkg_gpgol_post_install
162 ( cd $$$${pkgndir}/doc; make pdf )
163 endef
164
165 # We would like to use --with-libiconv-prefix and
166 # --with-libintl-prefix, but these don't work with the cheesy
167 # non-"libfoo.la" versions of iconv and gettext that we are using.
168 #gpg4win_pkg_libgpg_error_configure = \
169 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
170 gpg4win_pkg_libgpg_error_configure = --silent \
171   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib \
172   --enable-static
173
174 # We convert the PO files to UTF-8.  FIXME: This should be done in
175 # libgpg-error proper.
176 define gpg4win_pkg_libgpg_error_post_install
177 (for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
178    rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo \
179        2>/dev/null|| true; \
180    $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
181              $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo; \
182  done)
183 endef
184
185 gpg4win_pkg_libassuan_configure =  --silent \
186   --enable-static
187
188 gpg4win_pkg_libksba_configure = --silent \
189   --with-gpg-error-prefix=$(idir)
190
191 # Using gpgsm with VirtualBox on AES-NI hardware crashes gpg-agent.
192 # However, the Libgcrypt's regression tests work just fine.  I don't
193 # have a windows instance on AES-NI, thus I can't currently debug
194 # this. As a workaround we disable AES-NI for now.
195 gpg4win_pkg_libgcrypt_configure = --silent \
196   --with-gpg-error-prefix=$(idir) \
197   --disable-aesni-support
198
199 gpg4win_pkg_adns_configure = --silent
200
201 gpg4win_pkg_libpng_configure = CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\"
202
203 gpg4win_pkg_enchant_configure = CPPFLAGS=\"-I$(idir)/include -UENCHANT_GLOBAL_MODULE_DIR -UENCHANT_GLOBAL_ORDERING -UENCHANT_MYSPELL_DICT_DIR -UENCHANT_USPELL_DICT_DIR\" LDFLAGS=\"-L$(idir)/lib\"
204
205 gpg4win_pkg_dirmngr_configure = \
206   --with-gpg-error-prefix=$(idir) \
207   --with-ksba-prefix=$(idir) \
208   --with-libgcrypt-prefix=$(idir) \
209   --with-libassuan-prefix=$(idir) \
210   --with-pth-prefix=$(idir)
211
212 gpg4win_pkg_gnupg2_configure = \
213   --with-gpg-error-prefix=$(idir) \
214   --with-ksba-prefix=$(idir) \
215   --with-libgcrypt-prefix=$(idir) \
216   --with-libassuan-prefix=$(idir) \
217   --with-zlib=$(idir) \
218   --with-bzip2=$(idir) \
219   --with-pth-prefix=$(idir) \
220   --with-adns=$(idir) \
221   --without-included-gettext \
222   --enable-gpgtar \
223   --disable-regex
224
225 # We would like to use --with-libiconv-prefix and
226 # --with-libintl-prefix, but these don't work with the cheesy
227 # non-"libfoo.la" versions of iconv and gettext that we are using.
228 if BUILD_FULL_INSTALLER
229 pinentry_enable_disable= --disable-pinentry-qt --enable-pinentry-qt4
230 else
231 pinentry_enable_disable= --disable-pinentry-qt --disable-pinentry-qt4
232 endif
233 gpg4win_pkg_pinentry_configure = \
234   $(pinentry_enable_disable) \
235   --disable-pinentry-gtk \
236   --enable-pinentry-gtk2 \
237   --with-glib-prefix=$(idir) --with-gtk-prefix=$(idir) \
238   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
239 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
240
241 # The LDFLAGS is needed for -lintl for glib.  The QT4 variables work
242 # around the lack of cross compilation support in qt-dev.
243 gpg4win_pkg_gpgme_configure = --silent \
244   --with-gpg-error-prefix=$(idir) --enable-static \
245   `test -n "@HAVE_PKG_GLIB@" && echo "--enable-w32-glib"` \
246   --disable-w32-qt LDFLAGS=-L$(idir)/lib
247 #  `test -n "@HAVE_PKG_QT@" && echo "--disable-w32-qt"` \
248 #  QT4_CORE_CFLAGS=\"-DQT_LARGEFILE_SUPPORT -DQT_DLL \
249 #                   -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_THREAD_SUPPORT \
250 #                   -I$(idir)/include/QtCore -I$(idir)/include \
251 #                  -I$(idir)/mkspecs/win32-g++\" \
252 #  QT4_CORE_LIBS=\"-L$(idir)/lib -lQtCore4\"
253
254 gpg4win_pkg_gpa_configure = --silent \
255   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
256   --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
257   --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
258
259 gpg4win_pkg_gpgol_configure = --silent \
260   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir) \
261   --with-libassuan-prefix=$(idir)
262
263 gpg4win_pkg_gpgex_configure = --silent \
264   --with-gpg-error-prefix=$(idir) \
265   --with-libassuan-prefix=$(idir)
266
267 # We want to build with libgcrypt
268 # We can't use pkcs11 tue to tto much additional dependencies.
269 gpg4win_pkg_gnutls_configure = \
270   --disable-cxx \
271   --with-libgcrypt \
272   --without-p11-kit \
273   --with-libtasn1-prefix=$(idir) \
274   --with-libgcrypt-prefix=$(idir)
275
276 # In 2.12.21 gnutls_openssl is not linked to libtasn1, thus we use
277 # this hack to here.  (Using the included minitasn does work either
278 # due to a missing soruce file.)
279 gpg4win_pkg_gnutls_make_args = \
280    LTLIBTASN1=-ltasn1
281
282
283 gpg4win_pkg_curl_configure = \
284   --with-gnutls --without-ca-bundle --with-libiconv-prefix=$(idir)
285
286 gpg4win_pkg_libxml2_configure = \
287   --enable-shared --without-python --with-iconv=$(idir)
288
289 # The CFLAGS are needed to find pthread-w32.
290 gpg4win_pkg_libetpan_configure = --with-gnutls \
291   CPPFLAGS=\"-I$(idir)/include\" LIBS=\"-L$(idir)/lib\"
292
293 gpg4win_pkg_claws_mail_configure = \
294   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
295   --with-gpg-error-prefix=$(idir) --with-gpgme-prefix=$(idir) \
296   --with-config-dir="Claws-mail" --enable-pthread --enable-gnutls \
297   --enable-libetpan --disable-trayicon-plugin --disable-dbus \
298   --disable-dillo-viewer-plugin \
299   --disable-jpilot --disable-startup-notification --disable-ipv6 \
300   --disable-spamassassin-plugin --disable-bogofilter-plugin \
301   --disable-valgrind --disable-networkmanager-support
302
303 # This is not anymore needed sinces 3.8.0 already builds a PDF version.
304 # define gpg4win_pkg_claws_mail_post_install
305 # (for i in de en ; do \
306 #     (cd $$$${pkgidir}/share/doc/claws-mail/manual/$$$${i}; \
307 #     ps2pdf claws-mail-manual.ps); \
308 #  done)
309 # endef
310
311
312 gpg4win_pkg_notification_plugin_configure = \
313   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
314   --disable-libnotify --disable-lcdproc --disable-hotkeys
315
316 gpg4win_pkg_gtkhtml2_viewer_configure = \
317   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
318
319 gpg4win_pkg_vcalendar_configure = \
320   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
321
322 gpg4win_pkg_rssyl_configure = \
323   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
324
325 gpg4win_pkg_tnef_parse_configure = \
326   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
327
328 gpg4win_pkg_attachwarner_configure = \
329   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
330
331 gpg4win_pkg_bsfilter_plugin_configure = \
332   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
333
334 gpg4win_pkg_scute_configure = --silent \
335   --with-gpg-error-prefix=$(idir) --with-libassuan-prefix=$(idir)
336
337 gpg4win_pkg_paperkey_configure = --silent
338
339 # Supported make-only source packages.
340 gpg4win_mpkgs = pthreads-w32 bzip2 zlib crypt
341
342 # Extra options for the make invocations for individual packages.
343 # make_flags is used for building, make_args_inst is used for installing.
344 gpg4win_pkg_pthreads_w32_make_args = \
345   prefix=$(idir) CROSS=$(host_alias)- clean GC-inlined
346
347 gpg4win_pkg_pthreads_w32_make_args_inst = \
348   prefix=$$$${pkgidir} CROSS=$(host_alias)-
349
350 gpg4win_pkg_bzip2_make_args = \
351   CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
352
353 gpg4win_pkg_bzip2_make_args_inst = \
354   PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
355
356 gpg4win_pkg_crypt_make_args = \
357   CC=$(CC) AR=$(AR)
358
359 gpg4win_pkg_crypt_make_args_inst = \
360   prefix=$$$${pkgidir}
361
362 gpg4win_pkg_zlib_make_args = \
363   -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
364
365 gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \
366         BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \
367         LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a
368
369 # Supported binary packages.
370 gpg4win_bpkgs = libiconv gettext pkgconfig pango expat freetype fontconfig \
371                 cairo atk qt dbus oxygen-icons kleopatra bsfilter
372
373 # libiconv needs some special magic to generate a usable import
374 # library.
375 define gpg4win_pkg_libiconv_post_install
376 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
377 cd $$$${pkgidir}/lib;                                   \
378 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
379 endef
380
381 # libiconv needs some special magic to generate a usable import
382 # library.  Note that we include some internal symbols that are not
383 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
384 # configure test, but not used otherwise.
385 define gpg4win_pkg_gettext_post_install
386 (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;            \
387 cd $$$${pkgidir}/lib;                                   \
388 $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
389 endef
390
391
392 # Zlib needs some special magic to generate a libtool file.
393 # We also install the pc file here.
394 define gpg4win_pkg_zlib_post_install
395 (mkdir $$$${pkgidir}/lib/pkgconfig || true;             \
396 cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/;  \
397 cd $$$${pkgidir};                                       \
398 echo "# Generated by libtool" > lib/libz.la             \
399 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
400 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
401 echo "old_library='libz.a'" >> lib/libz.la;             \
402 echo "dependency_libs=''" >> lib/libz.la;               \
403 echo "current=1" >> lib/libz.la;                        \
404 echo "age=2" >> lib/libz.la;                            \
405 echo "revision=5" >> lib/libz.la;                       \
406 echo "installed=yes" >> lib/libz.la;                    \
407 echo "shouldnotlink=no" >> lib/libz.la;                 \
408 echo "dlopen=''" >> lib/libz.la;                        \
409 echo "dlpreopen=''" >> lib/libz.la;                     \
410 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la)
411 endef
412
413 # To make sure that we link against the static versions we need
414 # remove the import libs from crypt
415 #define gpg4win_pkg_crypt_post_install
416 #(cd $$$${pkgidir}/lib && rm libcrypt.dll.a libcrypt.lib)
417 #endef
418
419 # We need to fix the prefix in the various packages using pkgconfig,
420 # or we can't substitute it properly in our pkg-config wrapper.
421 define gpg4win_pkg_glib_post_install
422  (cd $$$${pkgidir};                                                     \
423  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
424 endef
425
426 define gpg4win_pkg_libffi_post_install
427  (cd $$$${pkgidir};                                                     \
428  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
429 endef
430
431 define gpg4win_pkg_gdk_pixbuf_post_install
432  (cd $$$${pkgidir};                                                     \
433  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
434 endef
435
436 define gpg4win_pkg_atk_post_install
437  (cd $$$${pkgidir_dev};                                                 \
438  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
439 endef
440
441 define gpg4win_pkg_freetype_post_install
442  (cd $$$${pkgidir_dev};                                                 \
443  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
444 endef
445
446 define gpg4win_pkg_fontconfig_post_install
447  (cd $$$${pkgidir_dev};                                                 \
448  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
449 endef
450
451 define gpg4win_pkg_cairo_post_install
452  (cd $$$${pkgidir_dev};                                                 \
453  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
454 endef
455
456 define gpg4win_pkg_pango_post_install
457  (cd $$$${pkgidir_dev};                                                 \
458  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
459 endef
460
461 define gpg4win_pkg_gtk__post_install
462  (cd $$$${pkgidir_dev};                                                 \
463  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
464 endef
465
466 define gpg4win_pkg_libpng_post_install
467  (cd $$$${pkgidir};                                                     \
468  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
469 endef
470
471 define gpg4win_pkg_enchant_post_install
472  (cd $$$${pkgidir};                                                     \
473  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
474 endef
475
476 define gpg4win_pkg_libgsasl_post_install
477  (cd $$$${pkgidir};                                                     \
478  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
479 endef
480
481 define gpg4win_pkg_libtasn1_post_install
482  (cd $$$${pkgidir};                                                     \
483  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
484 endef
485
486 define gpg4win_pkg_gnutls_post_install
487  (cd $$$${pkgidir};                                                     \
488  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
489 endef
490
491 # We don't use khelpcenter in kleopatra so remove the help links
492 define gpg4win_pkg_kleopatra_post_install
493  (for i in de en ; do \
494     (cd $$$${pkgidir}/share/doc/HTML/$$$${i}; \
495      perl -pi -e 's/help:\///g' `find . -name \*.html`); \
496  done)
497 endef
498
499
500 define gpg4win_pkg_libiconv_post_install
501 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
502 cd $$$${pkgidir}/lib;                                   \
503 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
504 endef
505
506 # Qt is missing the pkgconfig files.
507 define gpg4win_pkg_qt_post_install
508 (mkdir $$$${pkgidir_dev}/lib/pkgconfig; \
509  cp $(srcdir)/QtCore.pc $(srcdir)/QtGui.pc $$$${pkgidir_dev}/lib/pkgconfig/)
510 endef
511
512 # Supported internal packages.  Internal packages do not require any
513 # special support.  Thus, this variable is actually unused, and no
514 # rules are added in gpg4win.mk.
515 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \
516                 compendium
517
518
519 # Now do the bunch of the work.  This is a bunch of dirty magic to
520 # integrate our special makefile into automake, while not actually
521 # including it (make should include it).  This is in turn necessary
522 # because automake can't deal with the elegant magic in the actual
523 # Makefile.
524
525 define INCLUDE_BY_MAKE
526 include $(1)
527 endef
528
529 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
530
531 clean-local: clean-gpg4win
532
533 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
534   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
535   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
536
537
538 # Prepare the versioninfo file.  The pipeline extracts the last
539 # occurrence of a package with the same name, sorts the entries and
540 # writes the file with DOS line endings.  This helps to avoid
541 # duplicate entries in case one package has been rebuild (which is
542 # common when developing a new version).
543 versioninfo.txt:
544         $(SHA1SUM) $(pkg_files) </dev/null > versioninfo.tmp
545         set -e; \
546         ( while read a b; do echo "$$a $$(basename $$b)"; \
547             done < versioninfo.tmp \
548           | sort -k2 -sf | tac | uniq -f1 ; \
549           echo '=========== SHA-1 checksum ============= == package ==' \
550          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
551         -rm versioninfo.tmp
552
553 NEWS.tmp : $(top_srcdir)/NEWS
554          awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
555              !skip { sub(/^\(en\)/,"   *"); print }' \
556              <$(top_srcdir)/NEWS >NEWS.tmp
557
558 COMPONENTS-list.tmp : $(top_srcdir)/NEWS
559         awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print "    "$$0}' \
560             < $(top_srcdir)/NEWS > COMPONENTS-list.tmp
561
562 installer-options.ini : $(top_srcdir)/src/installer-options.ini.in
563         cat $(top_srcdir)/src/installer-options.ini.in >installer-options.ini
564
565
566 # For some nut-crazy reason someone thought it would be a great idea
567 # if makensis changed to the directory of the source file at startup.
568 # So we have to pull a couple of strings to correct this.
569 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
570                         g4wihelp.dll gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
571                         $(foosum_exe) \
572                         $(README_files) $(HOWTO_files) \
573                         installer-options.ini versioninfo.txt
574         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
575            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi
576
577 gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
578                         g4wihelp.dll gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
579                         $(foosum_exe) \
580                         $(README_files) $(HOWTO_files) \
581                         installer-options.ini versioninfo.txt
582         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
583            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
584            -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
585
586 gpg4win-vanilla-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
587                         g4wihelp.dll gpgwrap.exe gpgwrap-2.exe \
588                         $(foosum_exe) \
589                         $(README_files) $(HOWTO_files) \
590                         installer-options.ini versioninfo.txt
591         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
592            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
593            -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi
594
595 gpg4win-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
596                         gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
597                         $(foosum_exe) \
598                         $(README_files) $(HOWTO_files) \
599                         versioninfo.txt
600         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
601                 --manifest gpg4win-$(VERSION).files \
602                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
603                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
604
605 gpg4win-light-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
606                         gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
607                         $(foosum_exe) \
608                         $(README_files) $(HOWTO_files) \
609                         versioninfo.txt
610         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
611                 --manifest gpg4win-light-$(VERSION).files \
612                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
613                 -DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi > $@
614
615 gpg4win-vanilla-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
616                         gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
617                         $(foosum_exe) \
618                         $(README_files) $(HOWTO_files) \
619                         versioninfo.txt
620         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
621                 --manifest gpg4win-vanilla-$(VERSION).files \
622                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
623                 -DSRCDIR=$(srcdir) -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi > $@
624
625 .PHONY: msi
626 msi: gpg4win-$(VERSION).wix gpg4win-light-$(VERSION).wix \
627      gpg4win-vanilla-$(VERSION).wix
628
629
630 stamps/stamp-dist-self: versioninfo.txt
631         (set -e; cd ..; make dist-bzip2)
632         touch stamps/stamp-dist-self
633
634 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final \
635                             stamps/stamp-dist-self installer-options.ini
636         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
637           -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi
638
639 g4wihelp.dll: g4wihelp.c exdll.h
640         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
641            -lwinmm -lgdi32
642         $(STRIP) g4wihelp.dll
643
644 gpgwrap.exe: gpgwrap.c
645         $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -o $@ $^
646         $(STRIP) $@
647
648 gpgwrap-2.exe: gpgwrap.c
649         $(CC) -I. -I.. -DHAVE_CONFIG_H -DGPGWRAP_VARIANT=2 -O2 -o $@ $^
650         $(STRIP) $@
651
652 kleowrap.exe: kleowrap.c
653         $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -mwindows -o $@ $^
654         $(STRIP) $@
655
656 sha1sum.exe: sha1sum.c
657         $(CC) -O2 -o $@ $^
658         $(STRIP) $@
659
660 md5sum.exe: sha1sum.c
661         $(CC) -DBUILD_MD5SUM -O2 -o $@ $^
662         $(STRIP) $@
663
664 sha256sum.exe: sha1sum.c
665         $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
666         $(STRIP) $@
667
668
669 if BUILD_SOURCE_INSTALLER
670 all_src = gpg4win-src-$(VERSION).exe
671 else
672 all_src =
673 endif
674
675 if BUILD_LIGHT_INSTALLER
676 all_light = gpg4win-light-$(VERSION).exe
677 else
678 all_light =
679 endif
680
681 if BUILD_VANILLA_INSTALLER
682 all_vanilla = gpg4win-vanilla-$(VERSION).exe
683 else
684 all_vanilla =
685 endif
686
687 if BUILD_FULL_INSTALLER
688 all_full = gpg4win-$(VERSION).exe
689 else
690 all_full =
691 endif
692
693 all-local: $(all_full) $(all_light) $(all_vanilla) $(all_src)
694
695 clean-local:
696         rm -f gpg4win-$(VERSION).exe gpg4win-light-$(VERSION).exe \
697             gpg4win-vanilla-$(VERSION).exe gpg4win-src-$(VERSION).exe