1 |
commit: 8642c015c4c6d689766cce9f0e626d08b1478a53 |
2 |
Author: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Sep 23 23:26:37 2016 +0000 |
4 |
Commit: Alon Bar-Lev <alonbl <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 23 23:26:53 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8642c015 |
7 |
|
8 |
app-crypt/gpgme: add python bindings |
9 |
|
10 |
.../gpgme/files/gpgme-1.7.0-build-python.patch | 136 +++++++++++++++++++++ |
11 |
app-crypt/gpgme/gpgme-1.7.0.ebuild | 37 +++++- |
12 |
2 files changed, 170 insertions(+), 3 deletions(-) |
13 |
|
14 |
diff --git a/app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch b/app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch |
15 |
new file mode 100644 |
16 |
index 00000000..950813f |
17 |
--- /dev/null |
18 |
+++ b/app-crypt/gpgme/files/gpgme-1.7.0-build-python.patch |
19 |
@@ -0,0 +1,136 @@ |
20 |
+From a46cd3926d629da23b365b70b7bf24201c25d430 Mon Sep 17 00:00:00 2001 |
21 |
+From: Alon Bar-Lev <alon.barlev@×××××.com> |
22 |
+Date: Sat, 24 Sep 2016 01:26:19 +0300 |
23 |
+Subject: [PATCH] build: lang: python: cleanups |
24 |
+ |
25 |
+1. Make setup.py executable when generated. |
26 |
+ |
27 |
+2. Add prepare target to enable prepare the source tree without building |
28 |
+ anything. This is handy to enable standard distutils build outside of |
29 |
+ gpgme build system. |
30 |
+ |
31 |
+3. Treat data.h in similar manner as other VPATH issues, just copy it to |
32 |
+ the srcdir to simplify build, remove the CFLAGS requirement of |
33 |
+ distutils. |
34 |
+ |
35 |
+4. Add environment variable (binary_builddir) for setup to use alternate |
36 |
+ build directory so that for multiple targets same binaries may be |
37 |
+ used without rebuilding the C part. |
38 |
+ |
39 |
+The above does not alter the behavior of current build but supports the |
40 |
+following sequence: |
41 |
+ |
42 |
+$ mkdir common |
43 |
+$ cd common |
44 |
+$ ../configure --enable-languages= |
45 |
+$ make |
46 |
+$ cd .. |
47 |
+$ mkdir python |
48 |
+$ cd python |
49 |
+$ ../configure --enable-languages= |
50 |
+$ cd lang/python |
51 |
+$ make prepare |
52 |
+$ binary_builddir="../../../common" ./setup.py build |
53 |
+$ binary_builddir="../../../common" ./setup.py install |
54 |
+ |
55 |
+Notice the standard use of distutils which is required for package |
56 |
+manager to control the python selection and build process. |
57 |
+ |
58 |
+Signed-off-by: Alon Bar-Lev <alon.barlev@×××××.com> |
59 |
+--- |
60 |
+ configure.ac | 2 +- |
61 |
+ lang/python/Makefile.am | 11 ++++++----- |
62 |
+ lang/python/gpgme.i | 2 +- |
63 |
+ lang/python/setup.py.in | 9 +++++---- |
64 |
+ 4 files changed, 13 insertions(+), 11 deletions(-) |
65 |
+ |
66 |
+diff --git a/configure.ac b/configure.ac |
67 |
+index 4a29f2f..efa1f19 100644 |
68 |
+--- a/configure.ac |
69 |
++++ b/configure.ac |
70 |
+@@ -886,9 +886,9 @@ AC_CONFIG_FILES([lang/Makefile lang/cl/Makefile lang/cl/gpgme.asd]) |
71 |
+ AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([lang/qt/doc/Doxyfile])]) |
72 |
+ AC_CONFIG_FILES(lang/qt/doc/Makefile) |
73 |
+ AC_CONFIG_FILES([lang/python/Makefile |
74 |
+- lang/python/setup.py |
75 |
+ lang/python/pyme/version.py |
76 |
+ lang/python/tests/Makefile]) |
77 |
++AC_CONFIG_FILES([lang/python/setup.py], [chmod a+x lang/python/setup.py]) |
78 |
+ AC_OUTPUT |
79 |
+ |
80 |
+ echo " |
81 |
+diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am |
82 |
+index 2271ce0..fb1eebf 100644 |
83 |
+--- a/lang/python/Makefile.am |
84 |
++++ b/lang/python/Makefile.am |
85 |
+@@ -51,17 +51,18 @@ copystamp: $(COPY_FILES) $(COPY_FILES_PYME) |
86 |
+ cp -R $(COPY_FILES) . ; \ |
87 |
+ cp -R $(COPY_FILES_PYME) pyme ; \ |
88 |
+ fi |
89 |
++ cp "$(top_srcdir)/src/data.h" . |
90 |
+ touch $@ |
91 |
+ |
92 |
++prepare: copystamp |
93 |
++ |
94 |
+ all-local: copystamp |
95 |
+ for PYTHON in $(PYTHONS); do \ |
96 |
+- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \ |
97 |
+- $$PYTHON setup.py build --verbose ; \ |
98 |
++ $$PYTHON setup.py build --verbose ; \ |
99 |
+ done |
100 |
+ |
101 |
+ dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc: copystamp |
102 |
+- CFLAGS="$(CFLAGS) -I$(top_srcdir)" \ |
103 |
+- $(PYTHON) setup.py sdist --verbose |
104 |
++ $(PYTHON) setup.py sdist --verbose |
105 |
+ gpg2 --detach-sign --armor dist/pyme3-$(VERSION).tar.gz |
106 |
+ |
107 |
+ .PHONY: sdist |
108 |
+@@ -72,7 +73,7 @@ upload: dist/pyme3-$(VERSION).tar.gz dist/pyme3-$(VERSION).tar.gz.asc |
109 |
+ twine upload $^ |
110 |
+ |
111 |
+ CLEANFILES = gpgme.h errors.i gpgme_wrap.c pyme/gpgme.py \ |
112 |
+- copystamp |
113 |
++ data.h copystamp |
114 |
+ |
115 |
+ # Remove the rest. |
116 |
+ # |
117 |
+diff --git a/lang/python/gpgme.i b/lang/python/gpgme.i |
118 |
+index 84addae..ac666f4 100644 |
119 |
+--- a/lang/python/gpgme.i |
120 |
++++ b/lang/python/gpgme.i |
121 |
+@@ -183,7 +183,7 @@ |
122 |
+ representation of struct gpgme_data for an very efficient check if |
123 |
+ the buffer has been modified. */ |
124 |
+ %{ |
125 |
+-#include "src/data.h" /* For struct gpgme_data. */ |
126 |
++#include "data.h" /* For struct gpgme_data. */ |
127 |
+ %} |
128 |
+ #endif |
129 |
+ |
130 |
+diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in |
131 |
+index 31892c1..ce06758 100755 |
132 |
+--- a/lang/python/setup.py.in |
133 |
++++ b/lang/python/setup.py.in |
134 |
+@@ -32,13 +32,14 @@ library_dirs = [] |
135 |
+ in_tree = False |
136 |
+ extra_swig_opts = [] |
137 |
+ extra_macros = dict() |
138 |
++binary_builddir=os.environ.get('binary_builddir', '../..') |
139 |
+ |
140 |
+-if os.path.exists("../../src/gpgme-config"): |
141 |
++if os.path.exists(os.path.join(binary_builddir, "src/gpgme-config")): |
142 |
+ # In-tree build. |
143 |
+ in_tree = True |
144 |
+- gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags |
145 |
+- gpgme_h = "../../src/gpgme.h" |
146 |
+- library_dirs = ["../../src/.libs"] # XXX uses libtool internals |
147 |
++ gpgme_config = [os.path.join(binary_builddir, "src/gpgme-config")] + gpgme_config_flags |
148 |
++ gpgme_h = os.path.join(binary_builddir, "src/gpgme.h") |
149 |
++ library_dirs = [os.path.join(binary_builddir, "src/.libs")] # XXX uses libtool internals |
150 |
+ extra_macros.update( |
151 |
+ HAVE_DATA_H=1, |
152 |
+ IN_TREE_BUILD=1, |
153 |
+-- |
154 |
+2.7.3 |
155 |
+ |
156 |
|
157 |
diff --git a/app-crypt/gpgme/gpgme-1.7.0.ebuild b/app-crypt/gpgme/gpgme-1.7.0.ebuild |
158 |
index 2d507d5..7ea80be 100644 |
159 |
--- a/app-crypt/gpgme/gpgme-1.7.0.ebuild |
160 |
+++ b/app-crypt/gpgme/gpgme-1.7.0.ebuild |
161 |
@@ -4,7 +4,10 @@ |
162 |
|
163 |
EAPI="6" |
164 |
|
165 |
-inherit autotools eutils |
166 |
+PYTHON_COMPAT=( python2_7 python3_{3,4} ) |
167 |
+DISTUTILS_OPTIONAL=1 |
168 |
+ |
169 |
+inherit autotools distutils-r1 eutils |
170 |
|
171 |
DESCRIPTION="GnuPG Made Easy is a library for making GnuPG easier to use" |
172 |
HOMEPAGE="http://www.gnupg.org/related_software/gpgme" |
173 |
@@ -13,7 +16,7 @@ SRC_URI="mirror://gnupg/gpgme/${P}.tar.bz2" |
174 |
LICENSE="GPL-2 LGPL-2.1" |
175 |
SLOT="1/11" # subslot = soname major version |
176 |
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd ~x64-freebsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc64-solaris ~x64-solaris ~x86-solaris" |
177 |
-IUSE="common-lisp static-libs cxx qt5 test" |
178 |
+IUSE="common-lisp static-libs cxx python qt5 test" |
179 |
|
180 |
RDEPEND="app-crypt/gnupg |
181 |
>=dev-libs/libassuan-2.0.2 |
182 |
@@ -22,7 +25,8 @@ RDEPEND="app-crypt/gnupg |
183 |
dev-qt/qtcore:5 |
184 |
!kde-apps/gpgmepp:4 |
185 |
!kde-apps/kdepimlibs:4 |
186 |
- )" |
187 |
+ ) |
188 |
+ python? ( ${PYTHON_DEPS} )" |
189 |
#doc? ( app-doc/doxygen[dot] ) |
190 |
DEPEND="${RDEPEND} |
191 |
qt5? ( |
192 |
@@ -35,11 +39,21 @@ PATCHES=( |
193 |
"${FILESDIR}"/${PN}-1.1.8-et_EE.patch |
194 |
"${FILESDIR}"/${P}-build-tests.patch |
195 |
"${FILESDIR}"/${P}-build-tests-disable.patch |
196 |
+ "${FILESDIR}"/${P}-build-python.patch |
197 |
) |
198 |
|
199 |
+do_python() { |
200 |
+ if use python; then |
201 |
+ pushd lang/python > /dev/null || die |
202 |
+ binary_builddir="${S}" distutils-r1_src_${EBUILD_PHASE} |
203 |
+ popd > /dev/null |
204 |
+ fi |
205 |
+} |
206 |
+ |
207 |
src_prepare() { |
208 |
default |
209 |
eautoreconf |
210 |
+ do_python |
211 |
} |
212 |
|
213 |
src_configure() { |
214 |
@@ -56,9 +70,26 @@ src_configure() { |
215 |
--includedir="${EPREFIX}/usr/include/gpgme" \ |
216 |
--enable-languages="${languages[*]}" \ |
217 |
$(use_enable static-libs static) |
218 |
+ |
219 |
+ python_conf() { |
220 |
+ econf --enable-languages= |
221 |
+ } |
222 |
+ use python && python_foreach_impl python_conf |
223 |
+ do_python |
224 |
+} |
225 |
+ |
226 |
+src_compile() { |
227 |
+ default |
228 |
+ |
229 |
+ python_build() { |
230 |
+ make -C lang/python prepare |
231 |
+ } |
232 |
+ use python && python_foreach_impl python_build |
233 |
+ do_python |
234 |
} |
235 |
|
236 |
src_install() { |
237 |
default |
238 |
+ do_python |
239 |
prune_libtool_files |
240 |
} |