avoid failures on 32-bit platforms
Daniel Kahn Gillmor
7 years ago
0 | From: Justus Winter <justus@g10code.com> | |
1 | Date: Mon, 26 Sep 2016 11:35:40 +0200 | |
2 | Subject: python: Include 'config.h'. | |
3 | ||
4 | * lang/python/Makefile.am: Pass 'top_builddir' to 'setup.py'. | |
5 | * lang/python/gpgme.i: Include 'config.h'. | |
6 | * lang/python/helpers.c: Likewise. | |
7 | * lang/python/helpers.h: Likewise. | |
8 | * lang/python/setup.py.in: Make sure that 'config.h' can be found. | |
9 | -- | |
10 | Fixes build on 32 bit platforms with large file support. | |
11 | ||
12 | Signed-off-by: Justus Winter <justus@g10code.com> | |
13 | --- | |
14 | lang/python/Makefile.am | 1 + | |
15 | lang/python/gpgme.i | 8 ++++++++ | |
16 | lang/python/helpers.c | 4 ++++ | |
17 | lang/python/helpers.h | 4 ++++ | |
18 | lang/python/setup.py.in | 7 ++++++- | |
19 | 5 files changed, 23 insertions(+), 1 deletion(-) | |
20 | ||
21 | diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am | |
22 | index 2271ce0..1d7aee8 100644 | |
23 | --- a/lang/python/Makefile.am | |
24 | +++ b/lang/python/Makefile.am | |
25 | @@ -56,6 +56,7 @@ copystamp: $(COPY_FILES) $(COPY_FILES_PYME) | |
26 | all-local: copystamp | |
27 | for PYTHON in $(PYTHONS); do \ | |
28 | CFLAGS="$(CFLAGS) -I$(top_srcdir)" \ | |
29 | + top_builddir="$(top_builddir)" \ | |
30 | $$PYTHON setup.py build --verbose ; \ | |
31 | done | |
32 | ||
33 | diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i | |
34 | index 84addae..a4672e1 100644 | |
35 | --- a/lang/python/gpgme.i | |
36 | +++ b/lang/python/gpgme.i | |
37 | @@ -547,6 +547,10 @@ | |
38 | some structs, which we provide prior to including the version for | |
39 | SWIG. */ | |
40 | %{ | |
41 | +#ifdef HAVE_CONFIG_H | |
42 | +#include "config.h" | |
43 | +#endif | |
44 | + | |
45 | #include <gpgme.h> | |
46 | %} | |
47 | ||
48 | @@ -575,6 +579,10 @@ struct _gpgme_sig_notation | |
49 | ||
50 | /* Now include our local modified version. Any structs defined above | |
51 | are ignored. */ | |
52 | +#ifdef HAVE_CONFIG_H | |
53 | +%include "config.h" | |
54 | +#endif | |
55 | + | |
56 | %include "gpgme.h" | |
57 | ||
58 | %include "errors.i" | |
59 | diff --git a/lang/python/helpers.c b/lang/python/helpers.c | |
60 | index f9aec91..3724752 100644 | |
61 | --- a/lang/python/helpers.c | |
62 | +++ b/lang/python/helpers.c | |
63 | @@ -18,6 +18,10 @@ | |
64 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
65 | */ | |
66 | ||
67 | +#ifdef HAVE_CONFIG_H | |
68 | +#include "config.h" | |
69 | +#endif | |
70 | + | |
71 | #include <assert.h> | |
72 | #include <stdio.h> | |
73 | #include <gpgme.h> | |
74 | diff --git a/lang/python/helpers.h b/lang/python/helpers.h | |
75 | index 9200f93..67d23b2 100644 | |
76 | --- a/lang/python/helpers.h | |
77 | +++ b/lang/python/helpers.h | |
78 | @@ -18,6 +18,10 @@ | |
79 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
80 | */ | |
81 | ||
82 | +#ifdef HAVE_CONFIG_H | |
83 | +#include "config.h" | |
84 | +#endif | |
85 | + | |
86 | #include <gpgme.h> | |
87 | #include "Python.h" | |
88 | ||
89 | diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in | |
90 | index 31892c1..7af2d48 100755 | |
91 | --- a/lang/python/setup.py.in | |
92 | +++ b/lang/python/setup.py.in | |
93 | @@ -28,6 +28,7 @@ gpg_error_config = ["gpg-error-config"] | |
94 | gpgme_config_flags = ["--thread=pthread"] | |
95 | gpgme_config = ["gpgme-config"] + gpgme_config_flags | |
96 | gpgme_h = "" | |
97 | +include_dirs = [os.getcwd()] | |
98 | library_dirs = [] | |
99 | in_tree = False | |
100 | extra_swig_opts = [] | |
101 | @@ -38,8 +39,13 @@ if os.path.exists("../../src/gpgme-config"): | |
102 | in_tree = True | |
103 | gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags | |
104 | gpgme_h = "../../src/gpgme.h" | |
105 | + if 'top_builddir' in os.environ: | |
106 | + include_dirs.append(os.environ['top_builddir']) | |
107 | + # Make sure that SWIG finds config.h when processing gpgme.i. | |
108 | + extra_swig_opts.append("-I{0}".format(os.environ['top_builddir'])) | |
109 | library_dirs = ["../../src/.libs"] # XXX uses libtool internals | |
110 | extra_macros.update( | |
111 | + HAVE_CONFIG_H=1, | |
112 | HAVE_DATA_H=1, | |
113 | IN_TREE_BUILD=1, | |
114 | ) | |
115 | @@ -94,7 +100,6 @@ subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpgme_h], | |
116 | subprocess.check_call([sys.executable, "gpgme-h-clean.py", gpg_error_h], | |
117 | stdout=open("errors.i", "w")) | |
118 | ||
119 | -include_dirs = [os.getcwd()] | |
120 | define_macros = [] | |
121 | libs = getconfig('libs') | |
122 |