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