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