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