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