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