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