Build with -e
[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 \
21         config.site config.nsi.in \
22         installer-options.ini.in libiconv.def libintl.def loreley.mid \
23         gpg4win-splash.wav exdll.h g4wihelp.c g4wihelp.nsi \
24         inst-sections.nsi installer.nsi installer-finish.nsi  \
25         zlib.pc sha1sum.c mkportable.c     \
26         mkportable-vanilla.h mkportable-light.h mkportable-full.h \
27         potomo Memento.nsh \
28         inst-gpg4win.nsi           uninst-gpg4win.nsi         \
29         inst-atk.nsi               uninst-atk.nsi             \
30         inst-expat.nsi             uninst-expat.nsi           \
31         inst-freetype.nsi          uninst-freetype.nsi        \
32         inst-fontconfig.nsi        uninst-fontconfig.nsi      \
33         inst-cairo.nsi             uninst-cairo.nsi           \
34         inst-gettext.nsi           uninst-gettext.nsi         \
35         inst-libffi.nsi            uninst-libffi.nsi          \
36         inst-glib.nsi              uninst-glib.nsi            \
37         inst-gnupg-w32.nsi         uninst-gnupg-w32.nsi       \
38         inst-gpa.nsi               uninst-gpa.nsi             \
39         inst-gpgme.nsi             uninst-gpgme.nsi           \
40         inst-paperkey.nsi          uninst-paperkey.nsi        \
41         inst-gpgol.nsi             uninst-gpgol.nsi           \
42         inst-gpgex.nsi             uninst-gpgex.nsi           \
43         inst-gdk-pixbuf.nsi        uninst-gdk-pixbuf.nsi      \
44         inst-gtk+.nsi              uninst-gtk+.nsi            \
45         inst-libassuan.nsi         uninst-libassuan.nsi       \
46         inst-libgpg-error.nsi      uninst-libgpg-error.nsi    \
47         inst-libiconv.nsi          uninst-libiconv.nsi        \
48         inst-libpng.nsi            uninst-libpng.nsi          \
49         inst-compendium.nsi        uninst-compendium.nsi   \
50         inst-man_advanced_de.nsi   uninst-man_advanced_de.nsi \
51         inst-man_advanced_en.nsi   uninst-man_advanced_en.nsi \
52         inst-man_novice_de.nsi     uninst-man_novice_de.nsi   \
53         inst-man_novice_en.nsi     uninst-man_novice_en.nsi   \
54         inst-pango.nsi             uninst-pango.nsi           \
55         inst-pinentry.nsi          uninst-pinentry.nsi        \
56         inst-pkgconfig.nsi         uninst-pkgconfig.nsi       \
57         inst-w32pth.nsi            uninst-w32pth.nsi          \
58         inst-zlib.nsi              uninst-zlib.nsi            \
59         inst-kconfig.nsi        uninst-kconfig.nsi              \
60         inst-kleopatra.nsi         uninst-kleopatra.nsi       \
61         inst-bzip2.nsi             uninst-bzip2.nsi           \
62         uninst-claws-mail.nsi uninst-claws-mail-cmds.nsi \
63         inst-qtbase.nsi uninst-qtbase.nsi \
64         inst-ki18n.nsi uninst-ki18n.nsi \
65         inst-gpgmepp.nsi uninst-gpgmepp.nsi \
66         inst-kwidgetsaddons.nsi uninst-kwidgetsaddons.nsi \
67         inst-kcompletion.nsi uninst-kcompletion.nsi \
68         inst-kwindowsystem.nsi uninst-kwindowsystem.nsi \
69         inst-libkleo.nsi uninst-libkleo.nsi \
70         inst-kcoreaddons.nsi uninst-kcoreaddons.nsi \
71         inst-kcodecs.nsi uninst-kcodecs.nsi \
72         inst-kconfigwidgets.nsi uninst-kconfigwidgets.nsi \
73         inst-kxmlgui.nsi uninst-kxmlgui.nsi \
74         inst-kiconthemes.nsi uninst-kiconthemes.nsi \
75         inst-breeze-icons.nsi uninst-breeze-icons.nsi \
76         inst-kitemviews.nsi uninst-kitemviews.nsi \
77         inst-kguiaddons.nsi uninst-kguiaddons.nsi \
78         inst-kmime.nsi uninst-kmime.nsi \
79         inst-kde-l10n.nsi uninst-kde-l10n.nsi \
80         inst-qtsvg.nsi uninst-qtsvg.nsi \
81         inst-qttools.nsi uninst-qttools.nsi \
82         inst-boost.nsi uninst-boost.nsi \
83         inst-extra-cmake-modules.nsi uninst-extra-cmake-modules.nsi \
84         inst-final.nsi index.theme
85
86 SUBDIRS = dictionaries
87
88 gpg4win_readme_ll = en de ar es fr ru pt
89
90 README_files = $(addsuffix .txt,$(addprefix README.,$(gpg4win_readme_ll)))
91
92 gpg4win_howto_smime_ll = en de
93
94 HOWTO_files = $(addsuffix .txt, \
95                 $(addprefix HOWTO-SMIME.,$(gpg4win_howto_smime_ll)))
96
97 foosum_exe = sha1sum.exe md5sum.exe sha256sum.exe mkportable.exe
98
99 # Need to clean the dll because we bypassed automake.
100 CLEANFILES = g4wihelp.dll versioninfo.txt $(README_files) $(HOWTO_files) \
101              installer-options.ini NEWS.tmp COMPONENTS-list.tmp \
102              license.blurb cdversioninfo.tmp \
103              $(foosum_exe)
104
105 # Supported source packages.
106 gpg4win_spkgs = glib libffi gdk-pixbuf gtk+ \
107                 libgpg-error gpgme gpgol gpgex libpng \
108                 gpa opencdk \
109                 pinentry libassuan \
110                 w32pth paperkey regex libiconv gettext \
111                 qtbase qttools boost qtwinextras qtsvg
112
113 # Source packages following the KDE pattern
114 gpg4win_kdepkgs = kconfig kwidgetsaddons gpgmepp ki18n extra-cmake-modules \
115                   kcompletion kwindowsystem kcoreaddons libkleo kcodecs \
116                   kmime kconfigwidgets kxmlgui kguiaddons kitemviews \
117                   kiconthemes kleopatra breeze-icons
118
119 # Supported source packages to build in an additional architecture
120 gpg4win_expkgs = libgpg-error libassuan libiconv gettext w32pth gpgex gpgol \
121                  gpgme
122
123 # Extra options to configure for individual packages.
124 # We can use $(idir) here for the installation prefix.
125
126 gpg4win_pkg_libiconv_ex_configure = \
127         --enable-shared=no --enable-static=yes
128
129 gpg4win_pkg_gettext_configure = \
130   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
131   CPPFLAGS=-I$(idir)/include CFLAGS=-O2 LDFLAGS=-L$(idir)/lib
132
133 gpg4win_pkg_gettext_ex_configure = \
134   --with-lib-prefix=$(ex_idir) --with-libiconv-prefix=$(ex_idir) \
135   CPPFLAGS=-I$(ex_idir)/include CFLAGS=-O2 LDFLAGS=-L$(ex_idir)/lib
136
137 # We only need gettext-runtime and there is sadly no top level
138 # configure option for this
139 gpg4win_pkg_gettext_make_dir = gettext-runtime
140 gpg4win_pkg_gettext_make_dir_inst = gettext-runtime
141 gpg4win_pkg_gettext_ex_make_dir = gettext-runtime
142 gpg4win_pkg_gettext_ex_make_dir_inst = gettext-runtime
143
144 gpg4win_pkg_glib_configure = \
145   --disable-modular-tests \
146   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
147   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib CCC=$(host)-g++
148 gpg4win_pkg_glib_extracflags = -march=i486
149
150 gpg4win_pkg_gdk_pixbuf_configure = \
151   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
152   --with-included-loaders=yes \
153   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
154
155 gpg4win_pkg_gtk__configure = \
156   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib --disable-cups
157
158 # The GnuPG package provides man pages which we have to convert.
159 # We also create the MO files here.
160 define gpg4win_pkg_gnupg2_post_install
161 (for i in gpg2 gpgv2 gpgsm gpg-agent scdaemon gpg-connect-agent gpgconf ; \
162   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
163     sed `printf "s/_\b//g;s/\b.//g"` | \
164     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
165  done ; \
166  for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
167      $(mkdir_p) $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES || true; \
168      rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo 2>/dev/null \
169        || true; \
170      $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
171               $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/gnupg2.mo; \
172  done)
173 endef
174
175 # Paperkey comes with a man pages which we have to convert.
176 define gpg4win_pkg_paperkey_post_install
177 (for i in paperkey ; \
178   do man -Tlatin1 -l $$$${pkgidir}/share/man/man1/$$$${i}.1 | \
179     sed `printf "s/_\b//g;s/\b.//g"` | \
180     sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/$$$${i}.man ; \
181  done)
182 endef
183
184
185
186 # Build the reference manual.
187 define gpg4win_pkg_gpgol_post_install
188 ( cd $$$${pkgbdir}/doc; make pdf )
189 endef
190
191 # We would like to use --with-libiconv-prefix and
192 # --with-libintl-prefix, but these don't work with the cheesy
193 # non-"libfoo.la" versions of iconv and gettext that we are using.
194 #gpg4win_pkg_libgpg_error_configure = \
195 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
196 gpg4win_pkg_libgpg_error_configure = --silent \
197   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib \
198   --enable-static
199
200 gpg4win_pkg_libgpg_error_ex_configure = --silent \
201   --enable-static
202
203 # We convert the PO files to UTF-8.  FIXME: This should be done in
204 # libgpg-error proper.
205 define gpg4win_pkg_libgpg_error_post_install
206 (for i in `$(tsdir)/src/potomo --get-linguas $$$${pkgsdir}/po` ; do \
207    rm $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo \
208        2>/dev/null|| true; \
209    $(tsdir)/src/potomo $$$${pkgsdir}/po/$$$${i}.po \
210              $$$${pkgidir}/share/locale/$$$${i}/LC_MESSAGES/libgpg-error.mo; \
211  done)
212 endef
213
214 gpg4win_pkg_libassuan_configure =  --silent --enable-static
215
216 gpg4win_pkg_libassuan_ex_configure =  --silent --enable-static
217
218 gpg4win_pkg_libpng_configure = HAVE_SOLARIS_LD_FALSE=yes CPPFLAGS=\"-I$(idir)/include -DPNG_BUILD_DLL\" LDFLAGS=\"-L$(idir)/lib\" LIBPNG_DEFINES=\"-DPNG_BUILD_DLL\"
219
220 # We would like to use --with-libiconv-prefix and
221 # --with-libintl-prefix, but these don't work with the cheesy
222 # non-"libfoo.la" versions of iconv and gettext that we are using.
223 if BUILD_FULL_INSTALLER
224 pinentry_enable_disable= --enable-pinentry-qt
225 endif
226 gpg4win_pkg_pinentry_configure = \
227   $(pinentry_enable_disable) \
228   --enable-pinentry-gtk2 \
229   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
230 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
231
232 # The LDFLAGS is needed for -lintl for glib.  The QT4 variables work
233 # around the lack of cross compilation support in qt-dev.
234 gpg4win_pkg_gpgme_configure = --silent \
235   --with-gpg-error-prefix=$(idir) --enable-static \
236   `test -n "@HAVE_PKG_GLIB@" && echo "--enable-w32-glib"` \
237   --disable-w32-qt CFLAGS=-I$(idir)/include/glib-2.0/ \
238   LDFLAGS=-L$(idir)/lib
239
240 gpg4win_pkg_gpgme_ex_configure = --silent \
241   --with-gpg-error-prefix=$(ex_idir) --enable-static \
242   --with-libassuan-prefix=$(ex_idir) \
243   LDFLAGS=-L$(ex_idir)/lib
244
245 gpg4win_pkg_gpa_configure = --silent \
246   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
247   --with-gpgme-prefix=$(idir) --with-zlib=$(idir) \
248   --with-libassuan-prefix=$(idir) --with-gpg-error-prefix=$(idir)
249
250 gpg4win_pkg_gpgol_configure = --silent \
251   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir) \
252   --with-libassuan-prefix=$(idir) --enable-mime-send \
253   --enable-gpg4win-3-reg-keys
254
255 gpg4win_pkg_gpgol_ex_configure = --silent \
256   --with-gpgme-prefix=$(ex_idir) --with-gpg-error-prefix=$(ex_idir) \
257   --with-libassuan-prefix=$(ex_idir) --enable-mime-send \
258   --enable-gpg4win-3-reg-keys
259
260 gpg4win_pkg_gpgex_configure = --silent \
261   --with-gpg-error-prefix=$(idir) \
262   --with-libassuan-prefix=$(idir)
263
264 gpg4win_pkg_gpgex_ex_configure = --silent \
265   --with-gpg-error-prefix=$(ex_idir) \
266   --with-libassuan-prefix=$(ex_idir)
267
268 gpg4win_pkg_paperkey_configure = --silent
269
270 gpg4win_pkg_ki18n_configure = -DBUILD_WITH_QTSCRIPT=OFF
271
272 gpg4win_pkg_qtbase_configure = -opensource \
273             -confirm-license \
274             -xplatform win32-g++ \
275             -device-option CROSS_COMPILE=$(host)- \
276             -device-option PKG_CONFIG='$(host)-pkg-config' \
277             -force-pkg-config \
278             -no-use-gold-linker \
279             -release \
280             -shared \
281             -prefix $$$${pkgidir} \
282             -I '$(idir)/include' \
283             -L '$(idir)/lib' \
284             -no-icu \
285             -opengl desktop \
286             -no-glib \
287             -accessibility \
288             -nomake examples \
289             -nomake tests \
290             -no-sql-mysql \
291             -no-sql-sqlite \
292             -no-sql-odbc \
293             -no-sql-psql \
294             -no-sql-tds \
295             -qt-zlib \
296             -system-libpng \
297             -qt-libjpeg \
298             -fontconfig \
299             -system-freetype \
300             -qt-pcre \
301             -no-openssl \
302             -no-dbus
303
304 # invoke qmake with removed debug options as a workaround for
305 # https://bugreports.qt-project.org/browse/QTBUG-30898
306 gpg4win_pkg_qtbase_make_args = \
307     QMAKE='$$$${pkgsdir}/bin/qmake CONFIG-="debug debug_and_release"'
308
309 # Qmake still writes debug names in pkgconfig files.
310 define gpg4win_pkg_qtbase_post_install
311  (cd $$$${pkgidir}; \
312  sed -i 's/-lQt5\(\w*\)d/-lQt5\1/g' `find . -name \*.pc`)
313 endef
314
315 # Qmake does not support setting the installation path.
316 # really https://bugreports.qt.io/browse/QTBUG-12341
317 define gpg4win_pkg_qttools_post_install
318  (cd $$$${pkgbdir}; \
319   make uninstall; \
320   mkdir $$$${pkgidir}; \
321   cp -r bin lib include $$$${pkgidir};)
322 endef
323
324 define gpg4win_pkg_qtwinextras_post_install
325  (cd $$$${pkgbdir}; \
326   make uninstall; \
327   mkdir $$$${pkgidir}; \
328   cp -r lib include $$$${pkgidir}; \
329   mkdir $$$${pkgidir}/bin; \
330   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin;)
331 endef
332
333 define gpg4win_pkg_qtsvg_post_install
334  (cd $$$${pkgbdir}; \
335   make uninstall; \
336   mkdir $$$${pkgidir}; \
337   cp -r lib include plugins $$$${pkgidir}; \
338   mkdir $$$${pkgidir}/bin; \
339   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin;)
340 endef
341
342 gpg4win_pkg_kleopatra_configure = \
343     -DFORCE_DISABLE_KCMUTILS=ON \
344     -DDISABLE_KWATCHGNUPG=ON
345
346 gpg4win_pkg_kxmlgui_configure = \
347     -DFORCE_DISABLE_KGLOBALACCEL=ON \
348     -DFORCE_DISABLE_DBUS=ON
349
350 # Supported make-only source packages.
351 gpg4win_mpkgs = bzip2 zlib
352
353 # Extra options for the make invocations for individual packages.
354 # make_flags is used for building, make_args_inst is used for installing.
355 gpg4win_pkg_bzip2_make_args = \
356   CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
357
358 gpg4win_pkg_bzip2_make_args_inst = \
359   PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
360
361 gpg4win_pkg_zlib_make_args = \
362   -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
363
364 gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \
365         BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \
366         LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a
367
368 # Supported binary packages.
369 gpg4win_bpkgs = pkgconfig pango expat freetype fontconfig \
370                 cairo atk gnupg-w32 kde-l10n
371
372 # libiconv needs some special magic to generate a usable import
373 # library.
374 # define gpg4win_pkg_libiconv_post_install
375 # (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;         \
376 # cd $$$${pkgidir}/lib;                                 \
377 # $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
378 # endef
379
380 # libiconv needs some special magic to generate a usable import
381 # library.  Note that we include some internal symbols that are not
382 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
383 # configure test, but not used otherwise.
384 # define gpg4win_pkg_gettext_post_install
385 # (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;          \
386 # cd $$$${pkgidir}/lib;                                 \
387 # $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
388 # endef
389
390
391 # Zlib needs some special magic to generate a libtool file.
392 # We also install the pc file here.
393 define gpg4win_pkg_zlib_post_install
394 (mkdir $$$${pkgidir}/lib/pkgconfig || true;             \
395 cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/;  \
396 cd $$$${pkgidir};                                       \
397 echo "# Generated by libtool" > lib/libz.la             \
398 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
399 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
400 echo "old_library='libz.a'" >> lib/libz.la;             \
401 echo "dependency_libs=''" >> lib/libz.la;               \
402 echo "current=1" >> lib/libz.la;                        \
403 echo "age=2" >> lib/libz.la;                            \
404 echo "revision=5" >> lib/libz.la;                       \
405 echo "installed=yes" >> lib/libz.la;                    \
406 echo "shouldnotlink=no" >> lib/libz.la;                 \
407 echo "dlopen=''" >> lib/libz.la;                        \
408 echo "dlpreopen=''" >> lib/libz.la;                     \
409 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la)
410 endef
411
412 # We need to fix the prefix in the various packages using pkgconfig,
413 # or we can't substitute it properly in our pkg-config wrapper.
414 # glib also installs an empty charset.alias for mingw which creates
415 # a stow conflict with the one from iconv.
416 define gpg4win_pkg_glib_post_install
417  (cd $$$${pkgidir};                                                     \
418  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`; \
419  rm $$$${pkgidir}/lib/charset.alias)
420 endef
421
422 define gpg4win_pkg_libffi_post_install
423  (cd $$$${pkgidir};                                                     \
424  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
425 endef
426
427 define gpg4win_pkg_gdk_pixbuf_post_install
428  (cd $$$${pkgidir};                                                     \
429  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
430 endef
431
432 define gpg4win_pkg_atk_post_install
433  (cd $$$${pkgidir_dev};                                                 \
434  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
435 endef
436
437 define gpg4win_pkg_freetype_post_install
438  (cd $$$${pkgidir_dev};                                                 \
439  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
440 endef
441
442 define gpg4win_pkg_fontconfig_post_install
443  (cd $$$${pkgidir_dev};                                                 \
444  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
445 endef
446
447 define gpg4win_pkg_cairo_post_install
448  (cd $$$${pkgidir_dev};                                                 \
449  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
450 endef
451
452 define gpg4win_pkg_pango_post_install
453  (cd $$$${pkgidir_dev};                                                 \
454  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
455 endef
456
457 define gpg4win_pkg_libpng_post_install
458  (cd $$$${pkgidir};                                                     \
459  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
460 endef
461
462
463 # We don't use khelpcenter in kleopatra so remove the help links and
464 # point to the correct common folder
465 # TODO Needs to be fixed with current doc
466 #define gpg4win_pkg_kleopatra_post_install
467 # (for i in de en ; do \
468 #    (cd $$$${pkgidir}/share/doc/HTML/$$$${i}; \
469 #     perl -pi -e 's/help:\///g' `find . -name \*.html`; \
470 #     perl -pi -e 's@common/@../../common/@g' `find . -name \*.html`); \
471 # done)
472 #endef
473
474
475 #define gpg4win_pkg_libiconv_post_install
476 #(cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;          \
477 #cd $$$${pkgidir}/lib;                                  \
478 #$(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
479 #endef
480
481 # Supported internal packages.  Internal packages do not require any
482 # special support.  Thus, this variable is actually unused, and no
483 # rules are added in gpg4win.mk.
484 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \
485                 compendium
486
487
488 # Now do the bunch of the work.  This is a bunch of dirty magic to
489 # integrate our special makefile into automake, while not actually
490 # including it (make should include it).  This is in turn necessary
491 # because automake can't deal with the elegant magic in the actual
492 # Makefile.
493
494 define INCLUDE_BY_MAKE
495 include $(1)
496 endef
497
498 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
499
500 clean-local: clean-gpg4win
501
502 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
503   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
504   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
505
506
507 # Prepare the versioninfo file.  The pipeline extracts the last
508 # occurrence of a package with the same name, sorts the entries and
509 # writes the file with DOS line endings.  This helps to avoid
510 # duplicate entries in case one package has been rebuild (which is
511 # common when developing a new version).
512 versioninfo.txt:
513         $(SHA1SUM) $(pkg_files) </dev/null > versioninfo.tmp
514         set -e; \
515         ( while read a b; do echo "$$a $$(basename $$b)"; \
516             done < versioninfo.tmp \
517           | sort -k2 -sf | tac | uniq -f1 ; \
518           echo '=========== SHA-1 checksum ============= == package ==' \
519          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
520         -rm versioninfo.tmp
521
522 NEWS.tmp : $(top_srcdir)/NEWS
523          awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
524              !skip { sub(/^\(en\)/,"   *"); print }' \
525              <$(top_srcdir)/NEWS >NEWS.tmp
526
527 COMPONENTS-list.tmp : $(top_srcdir)/NEWS
528         awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print "    "$$0}' \
529             < $(top_srcdir)/NEWS > COMPONENTS-list.tmp
530
531 installer-options.ini : $(top_srcdir)/src/installer-options.ini.in
532         cat $(top_srcdir)/src/installer-options.ini.in >installer-options.ini
533
534
535 # For some nut-crazy reason someone thought it would be a great idea
536 # if makensis changed to the directory of the source file at startup.
537 # So we have to pull a couple of strings to correct this.
538 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
539                         g4wihelp.dll \
540                         $(foosum_exe) \
541                         $(README_files) $(HOWTO_files) \
542                         license.blurb installer-options.ini versioninfo.txt
543         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
544            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi
545
546 gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
547                         g4wihelp.dll \
548                         $(foosum_exe) \
549                         $(README_files) $(HOWTO_files) \
550                         license.blurb installer-options.ini versioninfo.txt
551         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
552            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
553            -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
554
555 gpg4win-vanilla-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
556                         g4wihelp.dll  \
557                         $(foosum_exe) \
558                         $(README_files) $(HOWTO_files) \
559                         license.blurb installer-options.ini versioninfo.txt
560         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
561            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
562            -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi
563
564 gpg4win-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
565                         $(foosum_exe) \
566                         $(README_files) $(HOWTO_files) \
567                         versioninfo.txt
568         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
569                 --manifest gpg4win-$(VERSION).files \
570                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
571                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
572
573 gpg4win-light-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
574                         $(foosum_exe) \
575                         $(README_files) $(HOWTO_files) \
576                         versioninfo.txt
577         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
578                 --manifest gpg4win-light-$(VERSION).files \
579                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
580                 -DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi > $@
581
582 gpg4win-vanilla-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
583                         $(foosum_exe) \
584                         $(README_files) $(HOWTO_files) \
585                         versioninfo.txt
586         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
587                 --manifest gpg4win-vanilla-$(VERSION).files \
588                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
589                 -DSRCDIR=$(srcdir) -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi > $@
590
591 .PHONY: msi
592 msi: gpg4win-$(VERSION).wix gpg4win-light-$(VERSION).wix \
593      gpg4win-vanilla-$(VERSION).wix
594
595
596 stamps/stamp-dist-self: versioninfo.txt
597         (set -e; cd ..; make dist-bzip2)
598         touch stamps/stamp-dist-self
599
600 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final \
601                             stamps/stamp-dist-self installer-options.ini \
602                             license.blurb
603         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
604           -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi
605
606 license.blurb: $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3
607         cat $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 >$@
608
609 g4wihelp.dll: g4wihelp.c exdll.h
610         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
611            -lwinmm -lgdi32
612         $(STRIP) g4wihelp.dll
613
614 sha1sum.exe: sha1sum.c
615         $(CC) -O2 -o $@ $^
616         $(STRIP) $@
617
618 md5sum.exe: sha1sum.c
619         $(CC) -DBUILD_MD5SUM -O2 -o $@ $^
620         $(STRIP) $@
621
622 sha256sum.exe: sha1sum.c
623         $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
624         $(STRIP) $@
625
626 mkportable.exe: mkportable.c \
627                 mkportable-vanilla.h mkportable-light.h mkportable-full.h
628         $(CC) -O2 -o $@ $(srcdir)/mkportable.c
629         $(STRIP) $@
630
631 if BUILD_SOURCE_INSTALLER
632 all_src = gpg4win-src-$(VERSION).exe
633 else
634 all_src =
635 endif
636
637 if BUILD_LIGHT_INSTALLER
638 all_light = gpg4win-light-$(VERSION).exe
639 else
640 all_light =
641 endif
642
643 if BUILD_VANILLA_INSTALLER
644 all_vanilla = gpg4win-vanilla-$(VERSION).exe
645 else
646 all_vanilla =
647 endif
648
649 if BUILD_FULL_INSTALLER
650 all_full = gpg4win-$(VERSION).exe
651 else
652 all_full =
653 endif
654
655 all-local: $(all_full) $(all_light) $(all_vanilla) $(all_src)
656
657 clean-local:
658         rm -f gpg4win-$(VERSION).exe gpg4win-light-$(VERSION).exe \
659             gpg4win-vanilla-$(VERSION).exe gpg4win-src-$(VERSION).exe