gtk+: Build from source.
[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-kdesupport.nsi        uninst-kdesupport.nsi      \
83         inst-oxygen-icons.nsi      uninst-oxygen-icons.nsi    \
84         inst-kdelibs.nsi           uninst-kdelibs.nsi         \
85         inst-kleopatra.nsi         uninst-kleopatra.nsi       \
86         inst-bzip2.nsi             uninst-bzip2.nsi           \
87         inst-final.nsi
88
89 SUBDIRS = dictionaries
90
91 gpg4win_readme_ll = en de ar es fr ru pt
92
93 README_files = $(addsuffix .txt,$(addprefix README.,$(gpg4win_readme_ll)))
94
95 gpg4win_howto_smime_ll = en de
96
97 HOWTO_files = $(addsuffix .txt, \
98                 $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll)))
99
100 foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe
101
102 # Need to clean the dll because we bypassed automake.
103 CLEANFILES = g4wihelp.dll versioninfo.txt $(README_files) $(HOWTO_files) \
104              installer-options.ini NEWS.tmp 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=i586-mingw32msvc-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
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 gpg4win_pkg_libgcrypt_configure = --silent \
192   --with-gpg-error-prefix=$(idir)
193
194 gpg4win_pkg_adns_configure = --silent
195
196 gpg4win_pkg_libpng_configure = CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\"
197
198 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\"
199
200 gpg4win_pkg_dirmngr_configure = \
201   --with-gpg-error-prefix=$(idir) \
202   --with-ksba-prefix=$(idir) \
203   --with-libgcrypt-prefix=$(idir) \
204   --with-libassuan-prefix=$(idir) \
205   --with-pth-prefix=$(idir)
206
207 gpg4win_pkg_gnupg2_configure = \
208   --with-gpg-error-prefix=$(idir) \
209   --with-ksba-prefix=$(idir) \
210   --with-libgcrypt-prefix=$(idir) \
211   --with-libassuan-prefix=$(idir) \
212   --with-zlib=$(idir) \
213   --with-bzip2=$(idir) \
214   --with-pth-prefix=$(idir) \
215   --with-adns=$(idir) \
216   --without-included-gettext \
217   --enable-gpgtar \
218   --disable-regex
219
220 # We would like to use --with-libiconv-prefix and
221 # --with-libintl-prefix, but these don't work with the cheesy
222 # non-"libfoo.la" versions of iconv and gettext that we are using.
223 gpg4win_pkg_pinentry_configure = \
224   --disable-pinentry-gtk \
225   --enable-pinentry-gtk2 \
226   --with-glib-prefix=$(idir) --with-gtk-prefix=$(idir) \
227   --disable-pinentry-qt \
228   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
229 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
230
231 # The LDFLAGS is needed for -lintl for glib.  The QT4 variables work
232 # around the lack of cross compilation support in qt-dev.
233 gpg4win_pkg_gpgme_configure = --silent \
234   --with-gpg-error-prefix=$(idir) --enable-static \
235   `test -n "@HAVE_PKG_GLIB@" && echo "--enable-w32-glib"` \
236   --disable-w32-qt LDFLAGS=-L$(idir)/lib
237 #  `test -n "@HAVE_PKG_QT@" && echo "--disable-w32-qt"` \
238 #  QT4_CORE_CFLAGS=\"-DQT_LARGEFILE_SUPPORT -DQT_DLL \
239 #                   -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_THREAD_SUPPORT \
240 #                   -I$(idir)/include/QtCore -I$(idir)/include \
241 #                  -I$(idir)/mkspecs/win32-g++\" \
242 #  QT4_CORE_LIBS=\"-L$(idir)/lib -lQtCore4\"
243
244 gpg4win_pkg_gpa_configure = --silent \
245   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
246   --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
247   --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
248
249 gpg4win_pkg_gpgol_configure = --silent \
250   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir) \
251   --with-libassuan-prefix=$(idir)
252
253 gpg4win_pkg_gpgex_configure = --silent \
254   --with-gpg-error-prefix=$(idir) \
255   --with-libassuan-prefix=$(idir)
256
257 gpg4win_pkg_gnutls_configure = \
258   --disable-cxx \
259   --with-libtasn1-prefix=$(idir) \
260   --with-libgcrypt-prefix=$(idir)
261
262 gpg4win_pkg_curl_configure = \
263   --with-gnutls --without-ca-bundle --with-libiconv-prefix=$(idir)
264
265 gpg4win_pkg_libxml2_configure = \
266   --enable-shared --without-python --with-iconv=$(idir)
267
268 # The CFLAGS are needed to find pthread-w32.
269 gpg4win_pkg_libetpan_configure = --with-gnutls \
270   CPPFLAGS=\"-I$(idir)/include\" LIBS=\"-L$(idir)/lib\"
271
272 gpg4win_pkg_claws_mail_configure = \
273   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
274   --with-gpg-error-prefix=$(idir) --with-gpgme-prefix=$(idir) \
275   --with-config-dir="Claws-mail" --enable-pthread --enable-gnutls \
276   --enable-libetpan --disable-trayicon-plugin --disable-dbus \
277   --disable-dillo-viewer-plugin \
278   --disable-jpilot --disable-startup-notification --disable-ipv6 \
279   --disable-spamassassin-plugin --disable-bogofilter-plugin \
280   --disable-valgrind --disable-networkmanager-support
281
282 # This is not anymore needed sinces 3.8.0 already builds a PDF version.
283 # define gpg4win_pkg_claws_mail_post_install
284 # (for i in de en ; do \
285 #     (cd $$$${pkgidir}/share/doc/claws-mail/manual/$$$${i}; \
286 #     ps2pdf claws-mail-manual.ps); \
287 #  done)
288 # endef
289
290
291 gpg4win_pkg_notification_plugin_configure = \
292   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
293   --disable-libnotify --disable-lcdproc --disable-hotkeys
294
295 gpg4win_pkg_gtkhtml2_viewer_configure = \
296   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
297
298 gpg4win_pkg_vcalendar_configure = \
299   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
300
301 gpg4win_pkg_rssyl_configure = \
302   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
303
304 gpg4win_pkg_tnef_parse_configure = \
305   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
306
307 gpg4win_pkg_attachwarner_configure = \
308   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
309
310 gpg4win_pkg_bsfilter_plugin_configure = \
311   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) LIBS=\"-L$(idir)/bin\"
312
313 gpg4win_pkg_scute_configure = --silent \
314   --with-gpg-error-prefix=$(idir) --with-libassuan-prefix=$(idir)
315
316 gpg4win_pkg_paperkey_configure = --silent
317
318 # Supported make-only source packages.
319 gpg4win_mpkgs = pthreads-w32 bzip2 zlib crypt
320
321 # Extra options for the make invocations for individual packages.
322 # make_flags is used for building, make_args_inst is used for installing.
323 gpg4win_pkg_pthreads_w32_make_args = \
324   prefix=$(idir) CROSS=$(host_alias)- clean GC-inlined
325
326 gpg4win_pkg_pthreads_w32_make_args_inst = \
327   prefix=$$$${pkgidir} CROSS=$(host_alias)-
328
329 gpg4win_pkg_bzip2_make_args = \
330   CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
331
332 gpg4win_pkg_bzip2_make_args_inst = \
333   PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
334
335 gpg4win_pkg_crypt_make = \
336   CC=$(CC) AR=$(AR)
337
338 gpg4win_pkg_crypt_make_args_inst = \
339   prefix=$$$${pkgidir}
340
341 gpg4win_pkg_zlib_make_args = -fwin32/Makefile.gcc PREFIX=i586-mingw32msvc- IMPLIB=libz.dll.a
342
343 gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \
344         BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \
345         LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a
346
347 # Supported binary packages.
348 gpg4win_bpkgs = libiconv gettext pkgconfig pango expat freetype fontconfig cairo \
349                 atk qt kdesupport oxygen-icons kdelibs kleopatra bsfilter
350
351 # libiconv needs some special magic to generate a usable import
352 # library.
353 define gpg4win_pkg_libiconv_post_install
354 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
355 cd $$$${pkgidir}/lib;                                   \
356 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
357 endef
358
359 # libiconv needs some special magic to generate a usable import
360 # library.  Note that we include some internal symbols that are not
361 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
362 # configure test, but not used otherwise.
363 define gpg4win_pkg_gettext_post_install
364 (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;            \
365 cd $$$${pkgidir}/lib;                                   \
366 $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
367 endef
368
369
370 # Zlib needs some special magic to generate a libtool file.
371 # We also install the pc file here.
372 define gpg4win_pkg_zlib_post_install
373 (mkdir $$$${pkgidir}/lib/pkgconfig || true;             \
374 cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/;  \
375 cd $$$${pkgidir};                                       \
376 echo "# Generated by libtool" > lib/libz.la             \
377 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
378 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
379 echo "old_library='libz.a'" >> lib/libz.la;             \
380 echo "dependency_libs=''" >> lib/libz.la;               \
381 echo "current=1" >> lib/libz.la;                        \
382 echo "age=2" >> lib/libz.la;                            \
383 echo "revision=5" >> lib/libz.la;                       \
384 echo "installed=yes" >> lib/libz.la;                    \
385 echo "shouldnotlink=no" >> lib/libz.la;                 \
386 echo "dlopen=''" >> lib/libz.la;                        \
387 echo "dlpreopen=''" >> lib/libz.la;                     \
388 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la)
389 endef
390
391 # To make sure that we link against the static versions we need
392 # remove the import libs from crypt
393 #define gpg4win_pkg_crypt_post_install
394 #(cd $$$${pkgidir}/lib && rm libcrypt.dll.a libcrypt.lib)
395 #endef
396
397 # We need to fix the prefix in the various packages using pkgconfig,
398 # or we can't substitute it properly in our pkg-config wrapper.
399 define gpg4win_pkg_glib_post_install
400  (cd $$$${pkgidir};                                                     \
401  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
402 endef
403
404 define gpg4win_pkg_libffi_post_install
405  (cd $$$${pkgidir};                                                     \
406  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
407 endef
408
409 define gpg4win_pkg_gdk_pixbuf_post_install
410  (cd $$$${pkgidir};                                                     \
411  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
412 endef
413
414 define gpg4win_pkg_atk_post_install
415  (cd $$$${pkgidir_dev};                                                 \
416  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
417 endef
418
419 define gpg4win_pkg_freetype_post_install
420  (cd $$$${pkgidir_dev};                                                 \
421  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
422 endef
423
424 define gpg4win_pkg_fontconfig_post_install
425  (cd $$$${pkgidir_dev};                                                 \
426  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
427 endef
428
429 define gpg4win_pkg_cairo_post_install
430  (cd $$$${pkgidir_dev};                                                 \
431  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
432 endef
433
434 define gpg4win_pkg_pango_post_install
435  (cd $$$${pkgidir_dev};                                                 \
436  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
437 endef
438
439 define gpg4win_pkg_gtk__post_install
440  (cd $$$${pkgidir_dev};                                                 \
441  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
442 endef
443
444 define gpg4win_pkg_libpng_post_install
445  (cd $$$${pkgidir};                                                     \
446  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
447 endef
448
449 define gpg4win_pkg_enchant_post_install
450  (cd $$$${pkgidir};                                                     \
451  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
452 endef
453
454
455 define gpg4win_pkg_libiconv_post_install
456 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
457 cd $$$${pkgidir}/lib;                                   \
458 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
459 endef
460
461 # Qt is missing the pkgconfig files.
462 define gpg4win_pkg_qt_post_install
463 (mkdir $$$${pkgidir_dev}/lib/pkgconfig; \
464  cp $(srcdir)/QtCore.pc $(srcdir)/QtGui.pc $$$${pkgidir_dev}/lib/pkgconfig/)
465 endef
466
467
468 # kdesupport ships gettext, which we already have.  Remove a stow
469 # conflict about that.  Also remove a stow conflict with kdelibs-lib.
470 define gpg4win_pkg_kdesupport_post_install
471 (rm -fR "$$$${pkgidir_dev}/share/locale"; \
472  rm -fR "$$$${pkgidir_dev}/share/apps/cmake/modules")
473 endef
474
475 # libxml2 ships some binaries, which we already have from kdesupport.  Remove a stow
476 # conflict about that.
477 define gpg4win_pkg_libxml2_post_install
478 (rm -f "$$$${pkgidir}/bin/xmllint.exe"; \
479  rm -f "$$$${pkgidir}/bin/xmlcatalog.exe")
480 endef
481
482 # Supported internal packages.  Internal packages do not require any
483 # special support.  Thus, this variable is actually unused, and no
484 # rules are added in gpg4win.mk.
485 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \
486                 compendium
487
488
489 # Now do the bunch of the work.  This is a bunch of dirty magic to
490 # integrate our special makefile into automake, while not actually
491 # including it (make should include it).  This is in turn necessary
492 # because automake can't deal with the elegant magic in the actual
493 # Makefile.
494
495 define INCLUDE_BY_MAKE
496 include $(1)
497 endef
498
499 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
500
501 clean-local: clean-gpg4win
502
503 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
504   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
505   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
506
507
508 # Prepare the versioninfo file.  The pipeline extracts the last
509 # occurrence of a package with the same name, sorts the entries and
510 # writes the file with DOS line endings.  This helps to avoid
511 # duplicate entries in case one package has been rebuild (which is
512 # common when developing a new version).
513 versioninfo.txt:
514         $(SHA1SUM) $(pkg_files) </dev/null > versioninfo.tmp
515         set -e; \
516         ( while read a b; do echo "$$a $$(basename $$b)"; \
517             done < versioninfo.tmp \
518           | sort -k2 -sf | tac | uniq -f1 ; \
519           echo '=========== SHA-1 checksum ============= == package ==' \
520          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
521         -rm versioninfo.tmp
522
523 NEWS.tmp : $(top_srcdir)/NEWS
524         sed -e '/^#/d' <$(top_srcdir)/NEWS >NEWS.tmp
525
526
527 installer-options.ini : $(top_srcdir)/src/installer-options.ini.in
528         cat $(top_srcdir)/src/installer-options.ini.in >installer-options.ini
529
530
531 # For some nut-crazy reason someone thought it would be a great idea
532 # if makensis changed to the directory of the source file at startup.
533 # So we have to pull a couple of strings to correct this.
534 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
535                         g4wihelp.dll gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
536                         $(foosum_exe) \
537                         $(README_files) $(HOWTO_files) \
538                         installer-options.ini versioninfo.txt
539         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
540            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi
541
542 gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
543                         g4wihelp.dll gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
544                         $(foosum_exe) \
545                         $(README_files) $(HOWTO_files) \
546                         installer-options.ini versioninfo.txt
547         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
548            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
549            -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
550
551 gpg4win-vanilla-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
552                         g4wihelp.dll gpgwrap.exe gpgwrap-2.exe \
553                         $(foosum_exe) \
554                         $(README_files) $(HOWTO_files) \
555                         installer-options.ini versioninfo.txt
556         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
557            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
558            -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi
559
560 gpg4win-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
561                         gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
562                         $(foosum_exe) \
563                         $(README_files) $(HOWTO_files) \
564                         versioninfo.txt
565         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
566                 --manifest gpg4win-$(VERSION).files \
567                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
568                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
569
570 gpg4win-light-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
571                         gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
572                         $(foosum_exe) \
573                         $(README_files) $(HOWTO_files) \
574                         versioninfo.txt
575         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
576                 --manifest gpg4win-light-$(VERSION).files \
577                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
578                 -DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi > $@
579
580 gpg4win-vanilla-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
581                         gpgwrap.exe gpgwrap-2.exe kleowrap.exe \
582                         $(foosum_exe) \
583                         $(README_files) $(HOWTO_files) \
584                         versioninfo.txt
585         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
586                 --manifest gpg4win-vanilla-$(VERSION).files \
587                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
588                 -DSRCDIR=$(srcdir) -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi > $@
589
590 .PHONY: msi
591 msi: gpg4win-$(VERSION).wix gpg4win-light-$(VERSION).wix \
592      gpg4win-vanilla-$(VERSION).wix
593
594
595 stamps/stamp-dist-self: versioninfo.txt
596         (set -e; cd ..; make dist-bzip2)
597         touch stamps/stamp-dist-self
598
599 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final \
600                             stamps/stamp-dist-self installer-options.ini
601         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
602           -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi
603
604 g4wihelp.dll: g4wihelp.c exdll.h
605         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
606            -lwinmm -lgdi32
607         $(STRIP) g4wihelp.dll
608
609 gpgwrap.exe: gpgwrap.c
610         $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -o $@ $^
611         $(STRIP) $@
612
613 gpgwrap-2.exe: gpgwrap.c
614         $(CC) -I. -I.. -DHAVE_CONFIG_H -DGPGWRAP_VARIANT=2 -O2 -o $@ $^
615         $(STRIP) $@
616
617 kleowrap.exe: kleowrap.c
618         $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -mwindows -o $@ $^
619         $(STRIP) $@
620
621 sha1sum.exe: sha1sum.c
622         $(CC) -O2 -o $@ $^
623         $(STRIP) $@
624
625 md5sum.exe: sha1sum.c
626         $(CC) -DBUILD_MD5SUM -O2 -o $@ $^
627         $(STRIP) $@
628
629 sha256sum.exe: sha1sum.c
630         $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
631         $(STRIP) $@
632
633
634 if BUILD_SOURCE_INSTALLER
635 all_src = gpg4win-src-$(VERSION).exe
636 else
637 all_src =
638 endif
639
640 if BUILD_LIGHT_INSTALLER
641 all_light = gpg4win-light-$(VERSION).exe
642 else
643 all_light =
644 endif
645
646 if BUILD_VANILLA_INSTALLER
647 all_vanilla = gpg4win-vanilla-$(VERSION).exe
648 else
649 all_vanilla =
650 endif
651
652 if BUILD_FULL_INSTALLER
653 all_full = gpg4win-$(VERSION).exe
654 else
655 all_full =
656 endif
657
658 all-local: $(all_full) $(all_light) $(all_vanilla) $(all_src)
659
660 clean-local:
661         rm -f gpg4win-$(VERSION).exe gpg4win-light-$(VERSION).exe \
662             gpg4win-vanilla-$(VERSION).exe gpg4win-src-$(VERSION).exe