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