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