Included Sylpheed.
[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         libiconv.def libintl.def  gpg4win-splash.bmp gpg4win-splash.wav \
23         exdll.h g4wihelp.c g4wihelp.nsi loreley.mid
24
25 # Need to clean the dll because we bypassed automake.
26 CLEANFILES = g4wihelp.dll 
27
28 # Supported source packages.
29 gpg4win_spkgs := gnupg libgpg-error gpgme gpgol gpa winpt sylpheed-claws \
30                  eudoragpg man_novice_de man_advanced_de
31
32 # Extra options to configure for individual packages.
33 # We can use $(idir) here for the installation prefix.
34
35 # We would like to use --with-libiconv-prefix and
36 # --with-libintl-prefix, but these don't work with the cheesy
37 # non-"libfoo.la" versions of iconv and gettext that we are using.
38 #gpg4win_pkg_libgpg_error_configure = \
39 #  --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir)
40 gpg4win_pkg_libgpg_error_configure = \
41   CPPFLAGS=-I$(idir)/include LDFLAGS=-L$(idir)/lib
42
43 # Glib doesn't add the LDFLAGS automatically.
44 gpg4win_pkg_gpgme_configure = \
45   --with-gpg-error-prefix=$(idir) --without-gpgsm --enable-static \
46   --enable-w32-glib LDFLAGS=-L$(idir)/lib
47
48 gpg4win_pkg_gpa_configure = \
49   --with-libiconv-prefix=$(idir) --with-libintl-prefix=$(idir) \
50   --with-gpgme-prefix=$(idir) --with-zlib=$(idir)
51
52 gpg4win_pkg_gpgol_configure = \
53   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir)
54
55 gpg4win_pkg_winpt_configure = \
56   --with-gpgme-prefix=$(idir) --with-gpg-error-prefix=$(idir)
57
58 gpg4win_pkg_sylpheed_claws_configure = \
59   --with-lib-prefix=$(idir) --with-libiconv-prefix=$(idir) \
60   --with-gpg-error-prefix=$(idir) --with-gpgme-prefix=$(idir) \
61   --with-config-dir="Sylpheed-claws" \
62   --disable-libetpan --disable-aspell --disable-trayicon-plugin \
63   --disable-openssl --disable-dillo-viewer-plugin --disable-gnomeprint \
64   --disable-jpilot --disable-startup-notification --disable-ipv6 \
65   --disable-mathml-viewer-plugin --disable-clamav-plugin \
66   --disable-spamassassin-plugin
67
68 # Supported make-only source packages.
69 gpg4win_mpkgs :=  pthreads-w32
70
71 # Extra options for the make infocations for individual packages.
72 # make_flags is used fur building make_args_inst is used for installing.
73 gpg4win_pkg_pthreads_w32_make_args = \
74   prefix=$(idir) CROSS=$(host_alias)- clean GC
75
76 gpg4win_pkg_pthreads_w32_make_args_inst = \
77   prefix=$$$${pkgidir} CROSS=$(host_alias)- 
78
79
80 # Supported binary packages.
81 gpg4win_bpkgs :=  libiconv gettext pkgconfig zlib glib libpng pango atk gtk+ \
82                   gpgee crypt regex
83
84 # libiconv needs some special magic to generate a usable import
85 # library.
86 define gpg4win_pkg_libiconv_post_install
87 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
88 cd $$$${pkgidir}/lib;                                   \
89 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
90 endef
91
92 # libiconv needs some special magic to generate a usable import
93 # library.  Note that we include some internal symbols that are not
94 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
95 # configure test, but not used otherwise.
96 define gpg4win_pkg_gettext_post_install
97 (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;            \
98 cd $$$${pkgidir}/lib;                                   \
99 $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
100 endef
101
102
103 # Zlib needs some special magic to generate a libtool file.
104 define gpg4win_pkg_zlib_post_install
105 (cd $$$${pkgidir_dev};                                  \
106 echo "dlname='../bin/zlib1.dll'" > lib/libz.la; \
107 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
108 echo "old_library='libz.a'" >> lib/libz.la;             \
109 echo "dependency_libs=''" >> lib/libz.la;               \
110 echo "current=1" >> lib/libz.la;                        \
111 echo "age=2" >> lib/libz.la;                            \
112 echo "revision=3" >> lib/libz.la;                       \
113 echo "installed=yes" >> lib/libz.la;                    \
114 echo "shouldnotlink=no" >> lib/libz.la;                 \
115 echo "dlopen=''" >> lib/libz.la;                        \
116 echo "dlpreopen=''" >> lib/libz.la;                     \
117 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la;)
118 endef
119
120 # To make shure that we link against the static versions we need
121 # remove the import libs from crypt
122 define gpg4win_pkg_crypt_post_install
123 (cd $$$${pkgidir}/lib && rm libcrypt.dll.a libcrypt.lib)
124 endef
125
126 # To make shure that we link against the static versions we need
127 # remove the import libs from regex
128 define gpg4win_pkg_regex_post_install
129 (cd $$$${pkgidir}/lib && rm libregex.dll.a libregex.lib)
130 endef
131
132 # We need to fix the prefix in the various packages using pkgconfig,
133 # or we can't substitute it properly in our pkg-config wrapper.
134 define gpg4win_pkg_glib_post_install
135  (cd $$$${pkgidir_dev};                                                 \
136  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
137 endef
138
139 define gpg4win_pkg_atk_post_install
140  (cd $$$${pkgidir_dev};                                                 \
141  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
142 endef
143
144 define gpg4win_pkg_pango_post_install
145  (cd $$$${pkgidir_dev};                                                 \
146  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
147 endef
148
149 define gpg4win_pkg_gtk__post_install
150  (cd $$$${pkgidir_dev};                                                 \
151  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
152 endef
153
154 # In libpng, the pkg-config files are surprisingly found in the
155 # runtime package.
156 define gpg4win_pkg_libpng_post_install
157  (cd $$$${pkgidir};                                                     \
158  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
159 endef
160
161
162 # Now do the bunch of the work.  This is a bunch of dirty magic to
163 # integrate our special makefile into automake, while not actually
164 # including it (make should include it).  This is in turn necessary
165 # because automake can't deal with the elegant magic in the actual
166 # Makefile.
167
168 define INCLUDE_BY_MAKE
169 include $(1)
170 endef
171
172 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
173
174 clean-local: clean-gpg4win
175
176 common_nsi := inst-sections.nsi installer.nsi installer-finish.nsi      \
177   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
178   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
179
180 # For some nut-crazy reason someone thought it would be a great idea
181 # if makensis changed to the directory of the source file at startup.
182 # So we have to pull a couple of strings to correct this.
183 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
184                         g4wihelp.dll
185         $(MAKENSIS) -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
186                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi
187
188 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final
189         $(MAKENSIS) -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
190                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win-src.nsi
191
192 g4wihelp.dll: g4wihelp.c exdll.h
193         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c
194
195 all-local: gpg4win-$(VERSION).exe gpg4win-src-$(VERSION).exe
196
197 clean-local:
198         rm -f gpg4win-$(VERSION).exe gpg4win-src-$(VERSION).exe