Add a few more binaries
[gpg4win.git] / src / Makefile.am
1 # Makefile.am - Installer for GnuPG 4 Windows Makefile.
2 # Copyright (C) 2005, 2006, 2007 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, write to the Free Software
18 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
19
20
21 EXTRA_DIST = pkg-config $(common_nsi) gpg4win.nsi gpg4win-src.nsi \
22         inst-gpg4win.nsi uninst-gpg4win.nsi installer-options.ini.in \
23         libiconv.def libintl.def  gpg4win-splash.wav gpgwrap.c \
24         exdll.h g4wihelp.c g4wihelp.nsi config.site loreley.mid \
25         inst-man_novice_en.nsi inst-man_advanced_en.nsi \
26         uninst-man_novice_en.nsi uninst-man_advanced_en.nsi
27
28 # Need to clean the dll because we bypassed automake.
29 CLEANFILES = g4wihelp.dll versioninfo.txt README.en.txt README.de.txt \
30              installer-options.ini NEWS.tmp gpgwrap.exe
31
32 # Supported source packages.
33 gpg4win_spkgs = glib gnupg libgpg-error gpgme gpgol gpa winpt sylpheed-claws \
34                 gnupg2 pinentry libassuan libksba libgcrypt w32pth
35
36 # Extra options to configure for individual packages.
37 # We can use $(idir) here for the installation prefix.
38
39 gpg4win_pkg_glib_configure = \
40   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
41   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
42
43 # The GnuPG package provides man pages which we have to convert.
44 # We also create the MO files here.
45 define gpg4win_pkg_gnupg_post_install   
46 (man -Tlatin1 -l $$$${pkgidir}/share/man/man1/gpg.1 | \
47  sed `printf "s/_\b//g;s/\b.//g"` | \
48  sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/gpg.man; \
49 man -Tlatin1 -l $$$${pkgidir}/share/man/man1/gpgv.1 | \
50  sed `printf "s/_\b//g;s/\b.//g"` | \
51  sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man1/gpgv.man; \
52 man -Tlatin1 -l $$$${pkgidir}/share/man/man7/gnupg.7 | \
53  sed `printf "s/_\b//g;s/\b.//g"` | \
54  sed -e 's/$$$$/\r/' > $$$${pkgidir}/share/man/man7/gnupg.man; \
55 for i in de; do \
56  msgfmt --output-file=$$$${pkgidir}/share/gnupg/$$$${i}.mo \
57                                $$$${pkgsdir}/po/$$$${i}.po; \
58  done)
59 endef
60
61
62 # The fields FAQ and faq.html conflict with those in GnuPG1.
63 # For now removes them.
64 define gpg4win_pkg_gnupg2_post_install  
65 ( rm $$$${pkgidir}/share/gnupg/FAQ; \
66   rm $$$${pkgidir}/share/gnupg/faq.html )
67 endef
68
69 # We would like to use --with-libiconv-prefix and
70 # --with-libintl-prefix, but these don't work with the cheesy
71 # non-"libfoo.la" versions of iconv and gettext that we are using.
72 #gpg4win_pkg_libgpg_error_configure = \
73 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
74 gpg4win_pkg_libgpg_error_configure = --silent \
75   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
76
77 gpg4win_pkg_libassuan_configure =  --silent \
78   --disable-shared \
79   --with-pth-prefix=$(idir)
80
81 gpg4win_pkg_libksba_configure = --silent \
82   --with-gpg-error-prefix=$(idir)
83
84 gpg4win_pkg_libgcrypt_configure = --silent \
85   --with-gpg-error-prefix=$(idir)
86
87 gpg4win_pkg_gnupg2_configure = \
88   --with-gpg-error-prefix=$(idir) \
89   --with-ksba-prefix=$(idir) \
90   --with-libgcrypt-prefix=$(idir) \
91   --with-libassuan-prefix=$(idir) \
92   --with-zlib=$(idir) \
93   --with-pth-prefix=$(idir) \
94   --without-included-gettext \
95   --disable-regex
96
97 gpg4win_pkg_pinentry_configure = \
98   --disable-pinentry-gtk \
99   --disable-pinentry-gtk2 \
100   --disable-pinentry-qt 
101
102
103 # Glib doesn't add the LDFLAGS automatically.
104 gpg4win_pkg_gpgme_configure = --silent \
105   --with-gpg-error-prefix=$(idir) --without-gpgsm --enable-static \
106   --enable-w32-glib LDFLAGS=-L$(idir)/lib
107
108 gpg4win_pkg_gpa_configure = --silent \
109   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
110   --with-gpgme-prefix=$(idir) --with-zlib=$(idir)
111
112 gpg4win_pkg_gpgol_configure = --silent \
113   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir)
114
115 gpg4win_pkg_winpt_configure = --silent \
116   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir)
117
118 gpg4win_pkg_sylpheed_claws_configure = --silent \
119   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
120   --with-gpg-error-prefix=$(idir) --with-gpgme-prefix=$(idir) \
121   --with-config-dir="Sylpheed-claws" --disable-pthread \
122   --disable-libetpan --disable-aspell --disable-trayicon-plugin \
123   --disable-openssl --disable-dillo-viewer-plugin --disable-gnomeprint \
124   --disable-jpilot --disable-startup-notification --disable-ipv6 \
125   --disable-mathml-viewer-plugin --disable-clamav-plugin \
126   --disable-spamassassin-plugin
127
128 # Supported make-only source packages.
129 gpg4win_mpkgs =  pthreads-w32
130
131 # Extra options for the make infocations for individual packages.
132 # make_flags is used fur building make_args_inst is used for installing.
133 gpg4win_pkg_pthreads_w32_make_args = \
134   prefix=$(idir) CROSS=$(host_alias)- clean GC-inlined
135
136 gpg4win_pkg_pthreads_w32_make_args_inst = \
137   prefix=$$$${pkgidir} CROSS=$(host_alias)- 
138
139
140 # Supported binary packages.
141 gpg4win_bpkgs =  libiconv gettext pkgconfig zlib libpng jpeg pango cairo \
142                   atk gtk+ gpgee crypt regex 
143
144 # libiconv needs some special magic to generate a usable import
145 # library.
146 define gpg4win_pkg_libiconv_post_install
147 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
148 cd $$$${pkgidir}/lib;                                   \
149 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
150 endef
151
152 # libiconv needs some special magic to generate a usable import
153 # library.  Note that we include some internal symbols that are not
154 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
155 # configure test, but not used otherwise.
156 define gpg4win_pkg_gettext_post_install
157 (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;            \
158 cd $$$${pkgidir}/lib;                                   \
159 $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
160 endef
161
162
163 # Zlib needs some special magic to generate a libtool file.
164 define gpg4win_pkg_zlib_post_install
165 (cd $$$${pkgidir_dev};                                  \
166 echo "dlname='../bin/zlib1.dll'" > lib/libz.la; \
167 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
168 echo "old_library='libz.a'" >> lib/libz.la;             \
169 echo "dependency_libs=''" >> lib/libz.la;               \
170 echo "current=1" >> lib/libz.la;                        \
171 echo "age=2" >> lib/libz.la;                            \
172 echo "revision=3" >> lib/libz.la;                       \
173 echo "installed=yes" >> lib/libz.la;                    \
174 echo "shouldnotlink=no" >> lib/libz.la;                 \
175 echo "dlopen=''" >> lib/libz.la;                        \
176 echo "dlpreopen=''" >> lib/libz.la;                     \
177 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la;)
178 endef
179
180 # To make shure that we link against the static versions we need
181 # remove the import libs from crypt
182 define gpg4win_pkg_crypt_post_install
183 (cd $$$${pkgidir}/lib && rm libcrypt.dll.a libcrypt.lib)
184 endef
185
186 # To make shure that we link against the static versions we need
187 # remove the import libs from regex
188 define gpg4win_pkg_regex_post_install
189 (cd $$$${pkgidir}/lib && rm libregex.dll.a libregex.lib)
190 endef
191
192 # We need to fix the prefix in the various packages using pkgconfig,
193 # or we can't substitute it properly in our pkg-config wrapper.
194 define gpg4win_pkg_glib_post_install
195  (cd $$$${pkgidir_dev};                                                 \
196  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
197 endef
198
199 define gpg4win_pkg_atk_post_install
200  (cd $$$${pkgidir_dev};                                                 \
201  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
202 endef
203
204 define gpg4win_pkg_cairo_post_install
205  (cd $$$${pkgidir_dev};                                                 \
206  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
207 endef
208
209 define gpg4win_pkg_pango_post_install
210  (cd $$$${pkgidir_dev};                                                 \
211  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
212 endef
213
214 define gpg4win_pkg_gtk__post_install
215  (cd $$$${pkgidir_dev};                                                 \
216  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
217 endef
218
219 # In libpng, the pkg-config files are surprisingly found in the
220 # runtime package.
221 define gpg4win_pkg_libpng_post_install
222  (cd $$$${pkgidir};                                                     \
223  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
224 endef
225
226
227 # Supported internal packages.  Internal packages do not require any
228 # special support.  Thus, this variable is actually unused, and no
229 # rules are added in gpg4win.mk.
230 gpg4win_ipkgs = man_novice_de man_advanced_de man_novice_en man_advanced_en
231
232
233 # Now do the bunch of the work.  This is a bunch of dirty magic to
234 # integrate our special makefile into automake, while not actually
235 # including it (make should include it).  This is in turn necessary
236 # because automake can't deal with the elegant magic in the actual
237 # Makefile.
238
239 define INCLUDE_BY_MAKE
240 include $(1)
241 endef
242
243 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
244
245 clean-local: clean-gpg4win
246
247 common_nsi = inst-sections.nsi installer.nsi installer-finish.nsi       \
248   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
249   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
250
251
252 # Prepare the versioninfo file.  The pipeline extracts the last
253 # occurrence of a package with the same name, sorts the entries and
254 # writes the file with DOS line endings.  This helps to avoid
255 # duplicate entries in case one package has been rebuild (which is
256 # common when developing a new version).
257 versioninfo.txt : playground/build/versioninfo.txt
258         set -e; \
259         ( while read a b; do echo "$$a $$(basename $$b)"; \
260             done < playground/build/versioninfo.txt \
261           | sort -k2 -sf | tac | uniq -f1 ; \
262           echo '=========== SHA-1 checksum ============= == package ==' \
263          ) | tac | awk '{printf "%s\r\n", $$0}' > versioninfo.txt
264
265 NEWS.tmp : $(top_srcdir)/NEWS
266         sed -e '/^#/d' <$(top_srcdir)/NEWS >NEWS.tmp
267
268 README.en.txt : versioninfo.txt NEWS.tmp $(top_srcdir)/doc/README.en.txt
269         sed -e '/^;.*/d;/!VERSIONINFO!/{r versioninfo.txt' -e 'd;}' \
270         -e '/!NEWSFILE!/{r NEWS.tmp' -e 'd;}' \
271         -e '/!PKG-COPYRIGHT!/{r $(top_srcdir)/doc/pkg-copyright.txt' -e 'd;}' \
272         -e 's,!VERSION!,$(VERSION),g' \
273            < $(top_srcdir)/doc/README.en.txt \
274            | awk '{printf "%s\r\n", $$0}' >README.en.txt
275
276 installer-options.ini : $(top_srcdir)/src/installer-options.ini.in
277         cat $(top_srcdir)/src/installer-options.ini.in >installer-options.ini
278
279 README.de.txt : versioninfo.txt NEWS.tmp $(top_srcdir)/doc/README.de.txt
280         sed -e '/^;.*/d;/!VERSIONINFO!/{r versioninfo.txt' -e 'd;}' \
281         -e '/!NEWSFILE!/{r NEWS.tmp' -e 'd;}' \
282         -e '/!PKG-COPYRIGHT!/{r $(top_srcdir)/doc/pkg-copyright.txt' -e 'd;}' \
283         -e 's,!VERSION!,$(VERSION),g' \
284            < $(top_srcdir)/doc/README.de.txt \
285            | awk '{printf "%s\r\n", $$0}' >README.de.txt
286
287 # For some nut-crazy reason someone thought it would be a great idea
288 # if makensis changed to the directory of the source file at startup.
289 # So we have to pull a couple of strings to correct this.
290 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
291                         g4wihelp.dll gpgwrap.exe README.en.txt README.de.txt \
292                         installer-options.ini versioninfo.txt
293         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
294                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi
295
296 gpg4win-light-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
297                         g4wihelp.dll gpgwrap.exe README.en.txt README.de.txt \
298                         installer-options.ini versioninfo.txt
299         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
300                 -DSRCDIR=$(srcdir) -DGPG4WIN_LIGHT=1 $(srcdir)/gpg4win.nsi
301
302 stamps/stamp-dist-self: versioninfo.txt
303         (set -e; cd ..; make dist-bzip2)
304         touch stamps/stamp-dist-self
305
306 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final \
307                             stamps/stamp-dist-self installer-options.ini
308         $(MAKENSIS) -V3 -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
309                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win-src.nsi
310
311 g4wihelp.dll: g4wihelp.c exdll.h
312         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c \
313            -lwinmm -lgdi32
314         $(STRIP) g4wihelp.dll
315
316 gpgwrap.exe: gpgwrap.c
317         $(CC) -I. -I.. -DHAVE_CONFIG_H -O2 -o gpgwrap.exe $(srcdir)/gpgwrap.c 
318         $(STRIP) gpgwrap.exe
319
320 if BUILD_SOURCE_INSTALLER
321 all_src = gpg4win-src-$(VERSION).exe
322 else
323 all_src =
324 endif
325
326 if BUILD_LIGHT_INSTALLER
327 all_light = gpg4win-light-$(VERSION).exe
328 else
329 all_light =
330 endif
331
332 all-local: gpg4win-$(VERSION).exe $(all_light) $(all_src)
333
334 clean-local:
335         rm -f gpg4win-$(VERSION).exe gpg4win-light-$(VERSION).exe \
336             gpg4win-src-$(VERSION).exe