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