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