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