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