Fix mkportable depenendcy
[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-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 endef
323
324
325 gpg4win_pkg_qttools_configure = \
326         "$(idir)/bin/qmake" ../$$$${pkg_version}
327
328 define gpg4win_pkg_qttools_post_install
329          (cd $$$${pkgbdir}; \
330           mkdir -p $$$${pkgidir}; \
331           cp -r bin lib include $$$${pkgidir})
332 endef
333
334 # Qmake does not support setting the installation path.
335 # really https://bugreports.qt.io/browse/QTBUG-12341
336 gpg4win_pkg_qtwinextras_configure = \
337         "$(idir)/bin/qmake" ../$$$${pkg_version}
338
339 define gpg4win_pkg_qtwinextras_post_install
340  (cd $$$${pkgbdir}; \
341   mkdir -p $$$${pkgidir}/bin; \
342   cp -r lib include $$$${pkgidir}; \
343   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin;)
344 endef
345
346 gpg4win_pkg_qtsvg_configure = \
347         "$(idir)/bin/qmake" ../$$$${pkg_version}
348
349 # XXX Adding the qtconf after qtsvg is a weird hack
350 # because somhow (yay qmake) zlib is not linked if
351 # the qt conf exists before that. The qt conf is
352 # needed for qttranslations to find the correct path
353 # of the translation tools.
354 define gpg4win_pkg_qtsvg_post_install
355  (cd $$$${pkgbdir}; \
356   mkdir -p $$$${pkgidir}; \
357   cp -r lib include plugins $$$${pkgidir}; \
358   mkdir -p $$$${pkgidir}/bin; \
359   mv $$$${pkgidir}/lib/*.dll $$$${pkgidir}/bin; \
360   echo "[Paths]" > $$$${pkgidir}/bin/qt.conf; \
361   echo "Prefix = .." >> $$$${pkgidir}/bin/qt.conf)
362 endef
363
364 gpg4win_pkg_qttranslations_configure = \
365         "$(idir)/bin/qmake" ../$$$${pkg_version}
366
367 define gpg4win_pkg_qttranslations_post_install
368  ( rm -f $$$${pkgidir}/qttranslations; \
369    mkdir -p $$$${pkgidir}; \
370    cp -r $$$${pkgbdir}/translations $$$${pkgidir}/qttranslations;)
371 endef
372
373 gpg4win_pkg_kleopatra_configure = \
374     -DFORCE_DISABLE_KCMUTILS=ON \
375     -DDISABLE_KWATCHGNUPG=ON \
376     -DKLEOPATRA_VERSION_SUFFIX=-gpg4win-$(VERSION)
377
378 gpg4win_pkg_kxmlgui_configure = \
379     -DFORCE_DISABLE_KGLOBALACCEL=ON \
380     -DFORCE_DISABLE_DBUS=ON
381
382 gpg4win_pkg_breeze_icons_configure = \
383     -DBINARY_ICONS_RESOURCE=OFF
384
385 # Supported make-only source packages.
386 gpg4win_mpkgs = bzip2 zlib
387
388 # Extra options for the make invocations for individual packages.
389 # make_flags is used for building, make_args_inst is used for installing.
390 gpg4win_pkg_bzip2_make_args = \
391   CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
392
393 gpg4win_pkg_bzip2_make_args_inst = \
394   PREFIX=$$$${pkgidir} CC=$(CC) AR=$(AR) RANLIB=$(RANLIB)
395
396 gpg4win_pkg_zlib_make_args = \
397   -fwin32/Makefile.gcc PREFIX=$(host)- IMPLIB=libz.dll.a
398
399 gpg4win_pkg_zlib_make_args_inst = -fwin32/Makefile.gcc install \
400         BINARY_PATH=$$$${pkgidir}/bin INCLUDE_PATH=$$$${pkgidir}/include \
401         LIBRARY_PATH=$$$${pkgidir}/lib SHARED_MODE=1 IMPLIB=libz.dll.a
402
403 # Supported binary packages.
404 gpg4win_bpkgs = pkgconfig pango expat freetype fontconfig \
405                 cairo atk gnupg-w32 kde-l10n
406
407 # libiconv needs some special magic to generate a usable import
408 # library.
409 # define gpg4win_pkg_libiconv_post_install
410 # (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;         \
411 # cd $$$${pkgidir}/lib;                                 \
412 # $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
413 # endef
414
415 # libiconv needs some special magic to generate a usable import
416 # library.  Note that we include some internal symbols that are not
417 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
418 # configure test, but not used otherwise.
419 # define gpg4win_pkg_gettext_post_install
420 # (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;          \
421 # cd $$$${pkgidir}/lib;                                 \
422 # $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
423 # endef
424
425
426 # Zlib needs some special magic to generate a libtool file.
427 # We also install the pc file here.
428 define gpg4win_pkg_zlib_post_install
429 (mkdir $$$${pkgidir}/lib/pkgconfig || true;             \
430 cp $(abs_srcdir)/zlib.pc $$$${pkgidir}/lib/pkgconfig/;  \
431 cd $$$${pkgidir};                                       \
432 echo "# Generated by libtool" > lib/libz.la             \
433 echo "dlname='../bin/zlib1.dll'" >> lib/libz.la;        \
434 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
435 echo "old_library='libz.a'" >> lib/libz.la;             \
436 echo "dependency_libs=''" >> lib/libz.la;               \
437 echo "current=1" >> lib/libz.la;                        \
438 echo "age=2" >> lib/libz.la;                            \
439 echo "revision=5" >> lib/libz.la;                       \
440 echo "installed=yes" >> lib/libz.la;                    \
441 echo "shouldnotlink=no" >> lib/libz.la;                 \
442 echo "dlopen=''" >> lib/libz.la;                        \
443 echo "dlpreopen=''" >> lib/libz.la;                     \
444 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la)
445 endef
446
447 # We need to fix the prefix in the various packages using pkgconfig,
448 # or we can't substitute it properly in our pkg-config wrapper.
449 # glib also installs an empty charset.alias for mingw which creates
450 # a stow conflict with the one from iconv.
451 define gpg4win_pkg_glib_post_install
452  (cd $$$${pkgidir};                                                     \
453  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`; \
454  rm $$$${pkgidir}/lib/charset.alias)
455 endef
456
457 define gpg4win_pkg_libffi_post_install
458  (cd $$$${pkgidir};                                                     \
459  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
460 endef
461
462 define gpg4win_pkg_gdk_pixbuf_post_install
463  (cd $$$${pkgidir};                                                     \
464  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
465 endef
466
467 define gpg4win_pkg_atk_post_install
468  (cd $$$${pkgidir_dev};                                                 \
469  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
470 endef
471
472 define gpg4win_pkg_freetype_post_install
473  (cd $$$${pkgidir_dev};                                                 \
474  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
475 endef
476
477 define gpg4win_pkg_fontconfig_post_install
478  (cd $$$${pkgidir_dev};                                                 \
479  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
480 endef
481
482 define gpg4win_pkg_cairo_post_install
483  (cd $$$${pkgidir_dev};                                                 \
484  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
485 endef
486
487 define gpg4win_pkg_pango_post_install
488  (cd $$$${pkgidir_dev};                                                 \
489  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
490 endef
491
492 define gpg4win_pkg_libpng_post_install
493  (cd $$$${pkgidir};                                                     \
494  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
495 endef
496
497
498 # We don't use khelpcenter in kleopatra so remove the help links and
499 # point to the correct common folder
500 # TODO Needs to be fixed with current doc
501 #define gpg4win_pkg_kleopatra_post_install
502 # (for i in de en ; do \
503 #    (cd $$$${pkgidir}/share/doc/HTML/$$$${i}; \
504 #     perl -pi -e 's/help:\///g' `find . -name \*.html`; \
505 #     perl -pi -e 's@common/@../../common/@g' `find . -name \*.html`); \
506 # done)
507 #endef
508
509
510 #define gpg4win_pkg_libiconv_post_install
511 #(cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;          \
512 #cd $$$${pkgidir}/lib;                                  \
513 #$(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
514 #endef
515
516 # Supported internal packages.  Internal packages do not require any
517 # special support.  Thus, this variable is actually unused, and no
518 # rules are added in gpg4win.mk.
519 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en \
520                 compendium
521
522
523 # Now do the bunch of the work.  This is a bunch of dirty magic to
524 # integrate our special makefile into automake, while not actually
525 # including it (make should include it).  This is in turn necessary
526 # because automake can't deal with the elegant magic in the actual
527 # Makefile.
528
529 define INCLUDE_BY_MAKE
530 include $(1)
531 endef
532
533 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
534
535 clean-local: clean-gpg4win
536
537 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
538   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
539   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
540
541
542 # Prepare the versioninfo file.  The pipeline extracts the last
543 # occurrence of a package with the same name, sorts the entries and
544 # writes the file with DOS line endings.  This helps to avoid
545 # duplicate entries in case one package has been rebuild (which is
546 # common when developing a new version).
547 versioninfo.txt:
548         $(SHA1SUM) $(pkg_files) </dev/null > versioninfo.tmp
549         set -e; \
550         ( while read a b; do echo "$$a $$(basename $$b)"; \
551             done < versioninfo.tmp \
552           | sort -k2 -sf | tac | uniq -f1 ; \
553           echo '=========== SHA-1 checksum ============= == package ==' \
554          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
555         -rm versioninfo.tmp
556
557 NEWS.tmp : $(top_srcdir)/NEWS
558          awk '/^#/ {next} /^\(de\)/ {skip=1;next} /^[^[:space:]]/ {skip=0} \
559              !skip { sub(/^\(en\)/,"   *"); print }' \
560              <$(top_srcdir)/NEWS >NEWS.tmp
561
562 COMPONENTS-list.tmp : $(top_srcdir)/NEWS
563         awk '/^~~~~~~~~~~~/ { ok++; next} ok==1 {print "    "$$0}' \
564             < $(top_srcdir)/NEWS > COMPONENTS-list.tmp
565
566 # For some nut-crazy reason someone thought it would be a great idea
567 # if makensis changed to the directory of the source file at startup.
568 # So we have to pull a couple of strings to correct this.
569 installers/gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
570                         g4wihelp.dll \
571                         $(foosum_exe) \
572                         $(README_files) $(HOWTO_files) \
573                         license.blurb versioninfo.txt
574         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
575            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win.nsi && \
576                    mv gpg4win-$(VERSION).exe installers/gpg4win-$(VERSION).exe
577
578 installers/gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
579                         g4wihelp.dll \
580                         $(foosum_exe) \
581                         $(README_files) $(HOWTO_files) \
582                         license.blurb versioninfo.txt
583         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
584            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
585            -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi && \
586                    mv gpg4win-light-$(VERSION).exe installers/gpg4win-light-$(VERSION).exe
587
588
589 installers/gpg4win-vanilla-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
590                         g4wihelp.dll  \
591                         $(foosum_exe) \
592                         $(README_files) $(HOWTO_files) \
593                         license.blurb versioninfo.txt
594         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
595            -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) \
596            -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi && \
597                    mv gpg4win-vanilla-$(VERSION).exe installers/gpg4win-vanilla-$(VERSION).exe
598
599 gpg4win-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
600                         $(foosum_exe) \
601                         $(README_files) $(HOWTO_files) \
602                         versioninfo.txt
603         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
604                 --manifest gpg4win-$(VERSION).files \
605                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
606                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi > $@
607
608 gpg4win-light-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
609                         $(foosum_exe) \
610                         $(README_files) $(HOWTO_files) \
611                         versioninfo.txt
612         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
613                 --manifest gpg4win-light-$(VERSION).files \
614                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
615                 -DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi > $@
616
617 gpg4win-vanilla-$(VERSION).wix: gpg4win.nsi $(common_nsi) stamps/stamp-final \
618                         $(foosum_exe) \
619                         $(README_files) $(HOWTO_files) \
620                         versioninfo.txt
621         perl make-msi.pl --guids $(srcdir)/make-msi.guids \
622                 --manifest gpg4win-vanilla-$(VERSION).files \
623                 -DBUILD_DIR=. -DTOP_SRCDIR=$(top_srcdir) \
624                 -DSRCDIR=$(srcdir) -DGPG4WIN_VANILLA=1 $(srcdir)/gpg4win.nsi > $@
625
626 .PHONY: msi
627 msi: gpg4win-$(VERSION).wix gpg4win-light-$(VERSION).wix \
628      gpg4win-vanilla-$(VERSION).wix
629
630
631 stamps/stamp-dist-self: versioninfo.txt
632         (set -e; cd ..; make dist-bzip2)
633         touch stamps/stamp-dist-self
634
635 installers/gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsii) \
636                             stamps/stamp-final \
637                             stamps/stamp-dist-self \
638                             license.blurb
639         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
640           -DSRCDIR=$(srcdir) $(EXTRA_MAKENSIS_FLAGS) $(srcdir)/gpg4win-src.nsi && \
641         mv gpg4win-src-$(VERSION).exe installers/gpg4win-src-$(VERSION).exe
642
643 license.blurb: $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3
644         cat $(top_srcdir)/doc/license-page $(top_srcdir)/doc/GPLv3 >$@
645
646 g4wihelp.dll: slideshow.cpp desktopshellrun.cpp g4wihelp.c exdll.h
647         $(CC) -static-libgcc -I. -O2 -c -o desktopshellrun.o $(srcdir)/desktopshellrun.cpp
648         $(CC) -static-libgcc -I. -O2 -c -o slideshow.o $(srcdir)/slideshow.cpp
649         $(CC) -static-libgcc -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
650           desktopshellrun.o slideshow.o -lwinmm -lgdi32 -luserenv -lshell32 \
651           -lole32 -loleaut32 -lshlwapi -lmsimg32
652         $(STRIP) g4wihelp.dll
653
654 sha1sum.exe: sha1sum.c
655         $(CC) -O2 -o $@ $^
656         $(STRIP) $@
657
658 md5sum.exe: sha1sum.c
659         $(CC) -DBUILD_MD5SUM -O2 -o $@ $^
660         $(STRIP) $@
661
662 sha256sum.exe: sha1sum.c
663         $(CC) -DBUILD_SHA256SUM -O2 -o $@ $^
664         $(STRIP) $@
665
666 mkportable.exe: mkportable.c \
667                 mkportable-vanilla.h mkportable-full.h
668         $(CC) -O2 -o $@ $(srcdir)/mkportable.c
669         $(STRIP) $@
670
671 if BUILD_SOURCE_INSTALLER
672 all_src = installers/gpg4win-src-$(VERSION).exe
673 else
674 all_src =
675 endif
676
677 if BUILD_LIGHT_INSTALLER
678 all_light = installers/gpg4win-light-$(VERSION).exe
679 else
680 all_light =
681 endif
682
683 if BUILD_VANILLA_INSTALLER
684 all_vanilla = installers/gpg4win-vanilla-$(VERSION).exe
685 else
686 all_vanilla =
687 endif
688
689 if BUILD_FULL_INSTALLER
690 all_full = installers/gpg4win-$(VERSION).exe
691 else
692 all_full =
693 endif
694
695 all-local: $(all_full) $(all_light) $(all_vanilla) $(all_src)
696         @echo "###################################################"
697         @echo " Gpg4win $(VERSION) successfully build!"
698         @echo " Installers can be found under src/installers"
699         @echo "###################################################"
700
701 clean-local:
702         rm -f installers/gpg4win-$(VERSION).exe \
703                   installers/gpg4win-light-$(VERSION).exe \
704                   installers/gpg4win-vanilla-$(VERSION).exe \
705                   installers/gpg4win-src-$(VERSION).exe