From ac071d9c0d69e4330a06f171e3bddc713ecd97d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Sun, 8 Jul 2018 12:19:17 +0200 Subject: python: Enable build with the local build of the Olm C library. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch adds the ability to build the bindings without having a globally installed Olm C library. Provided that the C library is already built, the tests can be run now with make test. Signed-off-by: Damir Jelić --- python/olm_build.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'python/olm_build.py') diff --git a/python/olm_build.py b/python/olm_build.py index 5ffefc2..281a571 100644 --- a/python/olm_build.py +++ b/python/olm_build.py @@ -24,6 +24,15 @@ from cffi import FFI ffibuilder = FFI() PATH = os.path.dirname(__file__) +DEVELOP = os.environ.get("DEVELOP") + +compile_args = [] +link_args = [] + +if DEVELOP and DEVELOP.lower() in ["yes", "true", "1"]: + compile_args = ["-I../include"] + link_args = ['-Wl,-L=../build,-rpath=../build'] + ffibuilder.set_source( "_libolm", @@ -31,7 +40,10 @@ ffibuilder.set_source( #include #include #include - """, libraries=["olm"]) + """, + libraries=["olm"], + extra_compile_args=compile_args, + extra_link_args=link_args) with open(os.path.join(PATH, "include/olm/olm.h")) as f: ffibuilder.cdef(f.read(), override=True) -- cgit v1.2.3