summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2016-04-11 22:22:06 +0200
committerDave Andreoli <dave@gurumeditation.it>2016-04-11 22:22:06 +0200
commit04b846b0f9e5396b7ca847d75a37d60e0d8dab40 (patch)
tree78585baea76375b630c268512b9a232404b85719
parentab0175925219d5365d0ed185883a1f2abe11b9cb (diff)
Use pkg-config to find efl headers
-rw-r--r--efl2/cffi/build_efl.py54
1 files changed, 24 insertions, 30 deletions
diff --git a/efl2/cffi/build_efl.py b/efl2/cffi/build_efl.py
index ea89593..6977951 100644
--- a/efl2/cffi/build_efl.py
+++ b/efl2/cffi/build_efl.py
@@ -4,6 +4,19 @@
4 4
5from cffi import FFI 5from cffi import FFI
6import os 6import os
7import subprocess
8
9script_path = os.path.dirname(os.path.abspath(__file__))
10
11
12# use pkg-config to find efl installed headers
13call = subprocess.Popen(['pkg-config', '--cflags-only-I', 'elementary'],
14 stdout=subprocess.PIPE)
15out, err = call.communicate()
16if call.returncode != 0:
17 raise SystemExit('Did not find efl with "pkg-config".')
18include_dirs = [ i[2:] for i in out.decode('utf-8').strip().split() ]
19
7 20
8 21
9ffi = FFI() 22ffi = FFI()
@@ -15,30 +28,7 @@ ffi.set_source(
15 ('EFL_BETA_API_SUPPORT', 1), 28 ('EFL_BETA_API_SUPPORT', 1),
16 ('EFL_EO_API_SUPPORT', 1), 29 ('EFL_EO_API_SUPPORT', 1),
17 ], 30 ],
18 31 include_dirs=include_dirs,
19 include_dirs=[
20 '/usr/local/include/efl-1',
21 '/usr/local/include/eina-1',
22 '/usr/local/include/eina-1/eina',
23 '/usr/local/include/eo-1',
24 '/usr/local/include/ecore-1',
25 '/usr/local/include/eet-1',
26 '/usr/local/include/emile-1',
27 '/usr/local/include/evas-1',
28 '/usr/local/include/ecore-evas-1',
29 '/usr/local/include/ecore-file-1',
30 '/usr/local/include/ecore-input-1',
31 '/usr/local/include/ecore-imf-1',
32 '/usr/local/include/ecore-con-1',
33 '/usr/local/include/edje-1',
34 '/usr/local/include/eldbus-1',
35 '/usr/local/include/efreet-1',
36 '/usr/local/include/ethumb-client-1',
37 '/usr/local/include/ethumb-1',
38 '/usr/local/include/elocation-1',
39 '/usr/local/include/elementary-1',
40 ], # TODO FIXME
41
42 source=""" 32 source="""
43 #include <Eina.h> 33 #include <Eina.h>
44 #include <Eo.h> 34 #include <Eo.h>
@@ -49,14 +39,18 @@ ffi.set_source(
49 """ 39 """
50) 40)
51 41
42# manually written headers
43headers = ['eina.h', 'eo.h']
52 44
53# TODO: read all the *.h files instead !!! 45# + all the generated headers
54# for header in 'eina.h', 'eo.h', 'efl.h', 'evas.h', 'ecore.h', 'elementary.h': 46for f in os.listdir(script_path):
55for header in 'eina.h', 'eo.h', 'ecore_mainloop.h', 'ecore_timer.h': 47 if f.endswith('.h') and not f in headers:
56 with open(os.path.join(os.path.dirname(__file__), header)) as f: 48 headers.append(f)
57 ffi.cdef(f.read())
58
59 49
50# all in a big cdef
51for header in headers:
52 with open(os.path.join(script_path, header)) as f:
53 ffi.cdef(f.read())
60 54
61if __name__ == '__main__': 55if __name__ == '__main__':
62 ffi.compile() 56 ffi.compile()