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