2005-11-17 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
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 \
30                  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
59 # Supported binary packages.
60 gpg4win_bpkgs :=  libiconv gettext pkgconfig zlib glib libpng pango atk gtk+ \
61                   gpgee
62
63 # libiconv needs some special magic to generate a usable import
64 # library.
65 define gpg4win_pkg_libiconv_post_install
66 (cp $(srcdir)/libiconv.def $$$${pkgidir}/lib;           \
67 cd $$$${pkgidir}/lib;                                   \
68 $(DLLTOOL) --output-lib libiconv.dll.a --def libiconv.def)
69 endef
70
71 # libiconv needs some special magic to generate a usable import
72 # library.  Note that we include some internal symbols that are not
73 # actually part of the DLL.  They are needed by the AM_GNU_GETTEXT
74 # configure test, but not used otherwise.
75 define gpg4win_pkg_gettext_post_install
76 (cp $(srcdir)/libintl.def $$$${pkgidir}/lib;            \
77 cd $$$${pkgidir}/lib;                                   \
78 $(DLLTOOL) --output-lib libintl.dll.a --def libintl.def)
79 endef
80
81
82 # Zlib needs some special magic to generate a libtool file.
83 define gpg4win_pkg_zlib_post_install
84 (cd $$$${pkgidir_dev};                                  \
85 echo "dlname='../bin/zlib1.dll'" > lib/libz.la; \
86 echo "library_names='libz.dll.a'" >> lib/libz.la;       \
87 echo "old_library='libz.a'" >> lib/libz.la;             \
88 echo "dependency_libs=''" >> lib/libz.la;               \
89 echo "current=1" >> lib/libz.la;                        \
90 echo "age=2" >> lib/libz.la;                            \
91 echo "revision=3" >> lib/libz.la;                       \
92 echo "installed=yes" >> lib/libz.la;                    \
93 echo "shouldnotlink=no" >> lib/libz.la;                 \
94 echo "dlopen=''" >> lib/libz.la;                        \
95 echo "dlpreopen=''" >> lib/libz.la;                     \
96 echo "libdir=\"$$$${pkgidir}/lib\"" >> lib/libz.la;)
97 endef
98
99
100 # We need to fix the prefix in the various packages using pkgconfig,
101 # or we can't substitute it properly in our pkg-config wrapper.
102 define gpg4win_pkg_glib_post_install
103  (cd $$$${pkgidir_dev};                                                 \
104  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
105 endef
106
107 define gpg4win_pkg_atk_post_install
108  (cd $$$${pkgidir_dev};                                                 \
109  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
110 endef
111
112 define gpg4win_pkg_pango_post_install
113  (cd $$$${pkgidir_dev};                                                 \
114  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
115 endef
116
117 define gpg4win_pkg_gtk__post_install
118  (cd $$$${pkgidir_dev};                                                 \
119  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
120 endef
121
122 # In libpng, the pkg-config files are surprisingly found in the
123 # runtime package.
124 define gpg4win_pkg_libpng_post_install
125  (cd $$$${pkgidir};                                                     \
126  perl -pi -e 's/^prefix=.*$$$$/prefix=\/usr/' `find . -name \*.pc`)
127 endef
128
129
130 # Now do the bunch of the work.  This is a bunch of dirty magic to
131 # integrate our special makefile into automake, while not actually
132 # including it (make should include it).  This is in turn necessary
133 # because automake can't deal with the elegant magic in the actual
134 # Makefile.
135
136 define INCLUDE_BY_MAKE
137 include $(1)
138 endef
139
140 $(eval $(call INCLUDE_BY_MAKE,gpg4win.mk))
141
142 clean-local: clean-gpg4win
143
144 common_nsi := inst-sections.nsi installer.nsi installer-finish.nsi      \
145   $(addsuffix .nsi,$(addprefix inst-,$(gpg4win_build_list)))            \
146   $(addsuffix .nsi,$(addprefix uninst-,$(gpg4win_build_list)))
147
148 # For some nut-crazy reason someone thought it would be a great idea
149 # if makensis changed to the directory of the source file at startup.
150 # So we have to pull a couple of strings to correct this.
151 gpg4win-$(VERSION).exe: gpg4win.nsi $(common_nsi) stamps/stamp-final \
152                         g4wihelp.dll
153         $(MAKENSIS) -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
154                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win.nsi
155
156 gpg4win-src-$(VERSION).exe: gpg4win-src.nsi $(common_nsi) stamps/stamp-final
157         $(MAKENSIS) -DBUILD_DIR=`pwd` -DTOP_SRCDIR=$(top_srcdir) \
158                 -DSRCDIR=$(srcdir) $(srcdir)/gpg4win-src.nsi
159
160 g4wihelp.dll: g4wihelp.c exdll.h
161         $(CC) -I. -shared -O2 -o g4wihelp.dll $(srcdir)/g4wihelp.c
162
163 all-local: gpg4win-$(VERSION).exe gpg4win-src-$(VERSION).exe
164
165 clean-local:
166         rm -f gpg4win-$(VERSION).exe gpg4win-src-$(VERSION).exe