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