1project('efl', ['c','cpp'],
2  version: '1.25.1',
3  default_options : ['buildtype=release', 'cpp_std=c++11'],
4  meson_version : '>=0.50'
5)
6
7if host_machine.system() == 'darwin'
8  add_languages('objc')
9endif
10
11pkgconfig = import('pkgconfig')
12
13version_arr = meson.project_version().split('.')
14
15version_major = version_arr[0]
16version_minor = version_arr[1]
17version_micro = version_arr[2]
18version_name = 'v-' + version_major + '.' + version_minor
19
20cc = meson.get_compiler('c')
21host_os = host_machine.system()
22
23if host_os == 'linux'
24  if cc.has_header_symbol('features.h', '__UCLIBC__')
25    host_os = 'linux-uclibc'
26  elif cc.has_header_symbol('features.h', '__dietlibc__')
27    host_os = 'linux-dietlibc'
28  else
29    host_os = 'linux-gnu'
30  endif
31endif
32
33#prepare a special linker args flag for binaries on macos
34bin_linker_args = []
35if host_machine.system() == 'darwin'
36  bin_linker_args = ['-pagezero_size', '10000', '-image_base', '100000000']
37endif
38
39windows = ['windows', 'cygwin']
40#bsd for meson 0.46 and 0.47
41bsd = ['bsd', 'freebsd', 'dragonfly', 'netbsd', 'openbsd']
42linux = ['linux']
43osx = ['darwin']
44sun = ['sunos']
45
46sys_linux = linux.contains(host_machine.system())
47sys_bsd = bsd.contains(host_machine.system())
48sys_windows = windows.contains(host_machine.system())
49sys_osx = osx.contains(host_machine.system())
50sys_sun = sun.contains(host_machine.system())
51
52module_files = []
53evas_loader_map = []
54
55#install paths
56dir_prefix    = get_option('prefix')
57dir_sysconf   = join_paths(dir_prefix, get_option('sysconfdir'))
58dir_bin       = join_paths(dir_prefix, get_option('bindir'))
59dir_data      = join_paths(dir_prefix, get_option('datadir'))
60dir_include   = join_paths(dir_prefix, get_option('includedir'))
61dir_lib       = join_paths(dir_prefix, get_option('libdir'))
62
63#local paths
64local_lib = join_paths('src', 'lib')
65local_bindings = join_paths('src', 'bindings')
66local_bin = join_paths('src', 'bin')
67local_module = join_paths('src', 'modules')
68local_tests = join_paths('src', 'tests')
69local_benchmark = join_paths('src', 'benchmarks')
70local_examples = join_paths('src', 'examples')
71local_scripts = join_paths('src', 'scripts')
72
73dev_cflags = []
74dev_cflags_try = [
75  '-fvisibility=hidden',
76  '-Wall',
77  '-Wfloat-compare',
78  '-Wpointer-arith',
79  '-Wunused-parameter',
80  '-Wsign-compare',
81  '-Wno-missing-field-initializers',
82]
83
84foreach cf: dev_cflags_try
85  if cc.has_argument(cf)
86    dev_cflags += cf
87  endif
88endforeach
89
90add_project_arguments(dev_cflags, language: 'c')
91add_project_arguments(dev_cflags, language: 'cpp')
92
93
94langs = ['c', 'objc', 'cpp']
95add_project_arguments('-DHAVE_CONFIG_H=1', language: langs)
96add_project_arguments('-D_GNU_SOURCE=1', language: langs)
97add_project_arguments('-DEFL_BETA_API_SUPPORT=1', language: langs)
98add_project_arguments('-DNEED_RUN_IN_TREE=1', language: langs)
99add_project_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: langs)
100if sys_windows
101  add_project_arguments('-D_POSIX_C_SOURCE=200809L', language: langs)
102  add_project_arguments('-DDLL_EXPORT=1', language: langs)
103  if get_option('windows-version') == 'vista'
104    add_project_arguments('-DWINVER=0x060', language: langs)
105    add_project_arguments('-D_WIN32_WINNT=0x0600', language: langs)
106  elif get_option('windows-version') == 'win7'
107    add_project_arguments('-DWINVER=0x0601', language: langs)
108    add_project_arguments('-D_WIN32_WINNT=0x0601', language: langs)
109  elif get_option('windows-version') == 'win8'
110    add_project_arguments('-DWINVER=0x0602', language: langs)
111    add_project_arguments('-D_WIN32_WINNT=0x0602', language: langs)
112  elif get_option('windows-version') == 'win81'
113    add_project_arguments('-DWINVER=0x0603', language: langs)
114    add_project_arguments('-D_WIN32_WINNT=0x0603', language: langs)
115  elif get_option('windows-version') == 'win10'
116    add_project_arguments('-DWINVER=0x0A00', language: langs)
117    add_project_arguments('-D_WIN32_WINNT=0x0A00', language: langs)
118  else
119    error('Version of targetted Windows incorrect')
120  endif
121  add_project_arguments('-D__USE_MINGW_ANSI_STDIO', language: langs)
122endif
123
124if sys_sun
125# for getpwuid_r()
126  add_global_arguments('-D_POSIX_PTHREAD_SEMANTICS', language: 'c')
127endif
128
129env = find_program('env', native: true)
130
131config_h = configuration_data()
132config_h.set_quoted('MODULE_ARCH', version_name)
133config_h.set_quoted('PACKAGE', meson.project_name())
134config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
135config_h.set_quoted('VERSION', meson.project_version())
136config_h.set_quoted('LOCALE_DIR', join_paths([dir_prefix, 'share/locale']))
137config_h.set_quoted('PACKAGE_URL', 'https://www.enlightenment.org')
138config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
139config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-devel@lists.sourceforge.net')
140config_h.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
141config_h.set_quoted('PACKAGE_NAME', meson.project_name())
142config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
143config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
144config_h.set_quoted('PACKAGE_SRC_DIR', meson.source_root())
145config_h.set_quoted('PACKAGE_BUILD_DIR', meson.current_build_dir())
146config_h.set_quoted('PACKAGE_SYSCONF_DIR', dir_sysconf)
147config_h.set_quoted('BINDIR', dir_bin)
148config_h.set10('EFL_HAVE_THREADS', true)
149config_h.set10('SLOPPY_SPEC', true)
150
151## have to get compiler again for this to work
152code = '''#define _GNU_SOURCE 1
153#include <unistd.h>
154#include <stdio.h>
155
156extern char **environ;
157
158void func(void) { printf("%p\n", environ); }
159'''
160if cc.compiles(code, args : '-lc', name : 'environ check')
161  config_h.set10('HAVE_ENVIRON', true)
162endif
163
164cpu_sse3 = false
165cpu_neon = false
166cpu_neon_intrinsics = false
167native_arch_opt_c_args = [ ]
168
169if host_machine.endian() == 'big'
170  config_h.set10('WORDS_BIGENDIAN', true)
171endif
172
173if get_option('native-arch-optimization')
174  if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
175    cpu_sse3 = true
176    config_h.set10('BUILD_MMX', true)
177    config_h.set10('BUILD_SSE3', true)
178    native_arch_opt_c_args = [ '-msse3' ]
179    message('x86 build - MMX + SSE3 enabled')
180  elif host_machine.cpu_family() == 'arm'
181    cpu_neon = true
182    config_h.set10('BUILD_NEON', true)
183    add_project_arguments('-mfpu=neon', language: 'c')
184    add_project_arguments('-ftree-vectorize', language: 'c')
185    message('ARM build - NEON enabled')
186  elif host_machine.cpu_family() == 'aarch64'
187    cpu_neon = true
188    cpu_neon_intrinsics = true
189    config_h.set10('BUILD_NEON', true)
190    config_h.set10('BUILD_NEON_INTRINSICS', true)
191    add_project_arguments('-ftree-vectorize', language: 'c')
192    native_arch_opt_c_args = [ '-ftree-vectorize' ]
193    message('ARM64 build - NEON + intrinsics enabled')
194  elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64'
195    config_h.set10('BUILD_ALTIVEC', true)
196    add_project_arguments('-ftree-vectorize', language: 'c')
197    add_project_arguments('-maltivec', language: 'c')
198    message('PPC/POWER build - ALTIVEC enabled')
199  endif
200endif
201
202config_dir = [include_directories('.')]
203eolian_include_directories = []
204
205if sys_linux or sys_bsd or sys_sun
206  sys_lib_extension = 'so'
207  sys_exe_extension = ''
208  sys_mod_extension = 'so'
209elif sys_windows
210  sys_lib_extension = 'dll'
211  sys_exe_extension = 'exe'
212  sys_mod_extension = 'dll'
213elif sys_osx
214  sys_lib_extension = 'dylib'
215  sys_exe_extension = ''
216  sys_mod_extension = 'so'
217  config_h.set('environ', '(*_NSGetEnviron())')
218else
219  error('System ' + host_machine.system() + ' not known')
220endif
221
222if host_os == 'freebsd' or host_os == 'dragonfly'
223  # This is necessary. We MUST use OpenSSL in base as bringing in from ports
224  # can cause major issues (2 copies of the same library).
225  crypto = declare_dependency(link_args : [ '-lssl', '-lcrypto'])
226  config_h.set('HAVE_OPENSSL', '1')
227elif get_option('crypto') == 'gnutls'
228  # gcrypt does not want to provide a pkg config file so we try the lib
229  crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
230  config_h.set('HAVE_GNUTLS', '1')
231elif get_option('crypto') == 'openssl'
232  crypto = dependency('openssl')
233  config_h.set('HAVE_OPENSSL', '1')
234endif
235
236if get_option('crypto') != ''
237  config_h.set('HAVE_CIPHER', '1')
238  config_h.set('HAVE_SIGNATURE', '1')
239endif
240
241config_h.set_quoted('SHARED_LIB_SUFFIX', '.' + sys_lib_extension)
242config_h.set_quoted('MOD_SUFFIX', '.' + sys_mod_extension)
243if sys_exe_extension == ''
244  config_h.set_quoted('EXE_SUFFIX', '')
245else
246  config_h.set_quoted('EXE_SUFFIX', '.' + sys_exe_extension)
247endif
248
249if get_option('tslib')
250  config_h.set('HAVE_TSLIB', '1')
251endif
252
253subdir('header_checks')
254subdir('po')
255
256if get_option('wl')
257  subdir(join_paths('src', 'wayland_protocol'))
258endif
259
260ecore_evas_wayland_engine_include_dir = []
261
262evas_static_list = []
263
264luaold_interpreters = [
265  ['lua',     ['>=5.1.0', '<5.3.0']],
266  ['lua51',   ['>=5.1.0', '<5.2.0']],
267  ['lua-5.1', ['>=5.1.0', '<5.2.0']],
268  ['lua5.1',  ['>=5.1.0', '<5.2.0']],
269  ['lua52',   ['>=5.2.0', '<5.3.0']],
270  ['lua-5.2', ['>=5.2.0', '<5.3.0']],
271  ['lua5.2',  ['>=5.2.0', '<5.3.0']],
272]
273
274lua_pc_name = ''
275have_elua = get_option('elua')
276
277if get_option('lua-interpreter') == 'lua'
278  config_h.set('ENABLE_LUA_OLD', '1')
279  foreach l : luaold_interpreters
280    lua = dependency(l[0], version: l[1], required:false)
281    lua_pc_name = l[0]
282    if lua.found()
283      break
284    endif
285  endforeach
286  if not lua.found()
287    error('Lua not found')
288  endif
289  if have_elua
290    message('Using experimental Elua with interpreter support...')
291  endif
292else
293  lua = dependency(get_option('lua-interpreter'))
294  lua_pc_name = 'luajit'
295endif
296
297if sys_osx and get_option('lua-interpreter') == 'luajit'
298  # luajit on macro is broken, this means we need to generate our own
299  # dependency with our arguments, a library later still needs to link to
300  # luajit for the pagesize argument thingy
301  lua = declare_dependency(
302    include_directories: include_directories(lua.get_pkgconfig_variable('includedir')),
303    link_args: ['-L' + lua.get_pkgconfig_variable('libdir'), '-l' + lua.get_pkgconfig_variable('libname')]
304  )
305endif
306
307subprojects = [
308  # name              |   option             | mod  | lib  | bin  | bench | tests | examples | true if build in efl-one | pkg-config options | name of static libs
309  ['evil'             ,[]                    , false,  true, false,  false,  false,     false,  true, [], []],
310  ['eina'             ,[]                    , false,  true,  true,   true,   true,      true,  true, [], []],
311  ['eolian'           ,[]                    , false,  true,  true,  false,   true,     false, false, ['eina'], []],
312  ['eo'               ,[]                    , false,  true, false,   true,   true,     false,  true, ['eina'], []],
313  ['efl'              ,[]                    , false,  true, false,  false,   true,     false,  true, ['eo'], []],
314  ['emile'            ,[]                    , false,  true, false,  false,   true,      true,  true, ['eina', 'efl'], ['lz4', 'rg_etc']],
315  ['eet'              ,[]                    , false,  true,  true,  false,   true,      true,  true, ['eina', 'emile', 'efl'], []],
316  ['ecore'            ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'eo', 'efl'], ['buildsystem']],
317  ['eldbus'           ,[]                    , false,  true,  true,  false,   true,      true,  true, ['eina', 'eo', 'efl'], []],
318  ['ecore'            ,[]                    ,  true, false, false,  false,   true,      true,  true, ['eina', 'eo', 'efl'], []], #ecores modules depend on eldbus
319  ['ecore_audio'      ,['audio']             , false,  true, false,  false,  false,     false,  true, ['eina', 'eo'], []],
320  ['ecore_avahi'      ,['avahi']             , false,  true, false,  false,  false,      true, false, ['eina', 'ecore'], []],
321  ['ecore_con'        ,[]                    , false,  true,  true,  false,   true,     false,  true, ['eina', 'eo', 'efl', 'ecore'], ['http-parser']],
322  ['ecore_file'       ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina'], []],
323  ['eeze'             ,['eeze']              ,  true,  true,  true,  false,   true,     false,  true, ['eina', 'efl'], []],
324  ['ecore_input'      ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'eo'], []],
325  ['ecore_x'          ,['x11']               , false,  true, false,  false,  false,     false,  true, ['eina', 'efl'], []],
326  ['ecore_fb'         ,['fb']                , false,  true, false,  false,  false,     false,  true, ['eina'], []],
327  ['ecore_wl2'        ,['wl']                ,  true,  true, false,  false,   true,     false,  true, ['eina'], ['libdrm']],
328  ['ecore_sdl'        ,['sdl']               , false,  true, false,  false,  false,     false,  true, ['eina'], []],
329  ['ecore_win32'      ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina'], []],
330  ['ecore_ipc'        ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina'], []],
331  ['ecore_buffer'     ,['buffer']            ,  true,  true,  true,  false,  false,     false,  true, ['eina'], []],
332  ['ector'            ,[]                    , false,  true, false,  false,   true,     false,  true, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']],
333  ['elput'            ,['drm']               , false,  true, false,  false,   true,     false,  true, ['eina', 'eldbus'], []],
334  ['ecore_drm2'       ,['drm']               , false,  true, false,  false,  false,     false,  true, ['ecore'], ['libdrm']],
335  ['ecore_cocoa'      ,['cocoa']             , false,  true, false,  false,  false,     false,  true, ['eina'], []],
336  ['evas'             ,[]                    ,  true,  true, false,  false,   true,      true,  true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']],
337  ['efreet'           ,[]                    , false,  true, false,  false,   true,     false,  true, ['eina', 'efl', 'eo'], []],
338  ['ecore_input_evas' ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'evas'], []],
339  ['ecore_evas'       ,[]                    ,  true,  true,  true,  false,  false,     false,  true, ['evas', 'ector'], []],
340  ['ecore_imf'        ,[]                    ,  true,  true, false,  false,  false,     false,  true, ['eina'], []],
341  ['embryo'           ,[]                    , false,  true,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
342  ['eio'              ,[]                    , false,  true, false,  false,   true,      true,  true, ['eina', 'eet'], []],
343  ['efreet'           ,[]                    , false, false,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
344  ['ecore_imf_evas'   ,[]                    , false,  true, false,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
345  ['ephysics'         ,['physics']           , false,  true, false,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
346  ['edje'             ,[]                    , false,  true,  true,  false,   true,      true,  true, ['evas', 'eo', 'efl', lua_pc_name], []],
347  ['emotion'          ,[]                    ,  true,  true, false,  false,   true,      true,  true, ['eina', 'efl', 'eo'], []],
348  ['ethumb'           ,[]                    ,  true,  true,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo'], []],
349  ['ethumb_client'    ,[]                    , false,  true,  true,  false,  false,      true,  true, ['eina', 'efl', 'eo', 'ethumb'], []],
350  ['elementary'       ,[]                    ,  true,  true,  true,   true,   true,      true,  true, ['eina', 'efl', 'eo', 'eet', 'evas', 'ecore', 'ecore-evas', 'ecore-file', 'ecore-input', 'edje', 'ethumb-client', 'emotion', 'ecore-imf', 'ecore-con', 'eldbus', 'efreet', 'efreet-mime', 'efreet-trash', 'eio'], ['atspi']],
351  ['efl_canvas_wl'    ,['wl']                , false,  true,  true,  false,  false,     false,  true, ['eina', 'efl', 'eo', 'evas', 'ecore'], []],
352  ['elua'             ,['elua']              , false,  true,  true,  false,   true,     false, false, ['eina', lua_pc_name], []],
353  ['ecore_wayland'    ,['wl-deprecated']     , false,  true, false,  false,  false,     false, false, ['eina'], []],
354  ['ecore_drm'        ,['drm-deprecated']    , false,  true, false,  false,  false,     false, false, ['eina'], []],
355  ['exactness'        ,[]                    , false,  false,  true, false,  false,     false, false, ['eina, evas, eet'], []],
356]
357
358# We generate Efl_Config.h and config.h later, they will be available here
359config_dir += include_directories('.')
360
361#we have to do that first, eina modules are required by eina
362#the other modules require theire package
363subdir(join_paths(local_module, 'eina'))
364
365# List of dependency objects that might be disabled due to configurations
366# If they are enabled, the object gets overwritten by the library file.
367ecore_audio = declare_dependency()
368
369test_dirs = []
370example_dirs = []
371efl_one_parts = []
372efl_one_deps = []
373efl_one_eo_deps = []
374efl_one_include_dirs = []
375efl_one_sub_dirs = []
376tmp_empty = declare_dependency()
377
378foreach package : subprojects
379  package_name = package[0]
380  package_version_name = '-'.join(package_name.split('_')) + '-' + version_major
381  automatic_pkgfile = true
382  if package[1].length() == 0 or get_option(package[1][0])
383    config_h.set('HAVE_' + package_name.to_upper().underscorify(), '1')
384
385    dir_package_include = join_paths(dir_include, package_version_name)
386    dir_package_modules = join_paths(dir_lib, package_name, 'modules')
387
388    # ensure that we really dont copy the eo file targets from a previous
389    # library Those are the variables that can be used to reflect the libraries
390    # speical handlings -> at the end is used to indicate where to find this
391    # variable outside of this for loop
392
393    # public eo and eot files - which probebly have to be used later for bindings
394    pub_eo_files = []           # -> package_name + '_eo_files'
395    pub_eo_types_files = []     # -> package_name + '_eot_files'
396    # All subdirs where eo files that are listed in the pub_* variables can be
397    # found
398    # For every element != '' a variable called package_name + '_' + subir + '_eot_files' and package_name + '_' + subir + '_eo_files' must exist.
399    package_eo_subdirs = ['']     # -> package_name + '_eo_subdirs'
400    # All subdirs that should be included in order to include every requried header
401    package_header_subdirs = [] # -> package_name + '_include_subdirs'
402    # eo file targets, this list of targets can be used to ensure the files are created before accessed
403    pub_eo_file_target = []
404    # private eo files target - never use this :)
405    priv_eo_file_target = []
406    # use this variable to store custom variables in that should be placed in the .pc file
407    package_pc_variables = []
408
409    foreach static_lib : package[10]
410      if get_variable(static_lib, tmp_empty) == tmp_empty
411        subdir(join_paths('src', 'static_libs', static_lib))
412      endif
413    endforeach
414
415    #package_c_args definition for lib and module
416    package_c_args = [
417      '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
418      '-DNEED_RUN_IN_TREE=1',
419      '-DEFL_BUILD=1',
420    ]
421    if package[3]
422      subdir(join_paths(local_lib, package_name))
423      set_variable(package_name + '_eo_files', pub_eo_files)
424      set_variable(package_name + '_eot_files', pub_eo_types_files)
425      set_variable(package_name + '_header_subdirs', package_header_subdirs)
426      set_variable(package_name + '_eo_subdirs', package_eo_subdirs)
427      if (package[8] and get_option('efl-one'))
428        src = get_variable(package_name+'_src')
429        external_deps = get_variable(package_name+'_ext_deps')
430        efl_one_include_dirs += [include_directories('.'), include_directories(join_paths(local_lib, package_name))]
431
432        foreach subdirs : package_eo_subdirs
433          efl_one_include_dirs += include_directories(join_paths(local_lib, package_name))
434        endforeach
435
436        tmp = static_library('efl_one_part_'+package_name,
437            src, pub_eo_file_target, priv_eo_file_target,
438            include_directories: efl_one_include_dirs,
439            dependencies: external_deps + efl_one_eo_deps,
440            c_args : package_c_args,
441        )
442        # dependency for all the .eo file targets
443        efl_one_eo_deps += declare_dependency(
444          sources: pub_eo_file_target + priv_eo_file_target, #this here *needs* to be public and private, because our binaries and modules do depend on internal headers
445        )
446        efl_one_deps += external_deps
447        efl_one_parts += tmp
448      endif
449    endif
450    #special case for eolian, this is never efl-one, but will be required in the library
451    if (package_name == 'eolian')
452      package_c_args = [
453        '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
454        '-DNEED_RUN_IN_TREE=1',
455      ]
456      if (package[4])
457         subdir(join_paths(local_bin, package_name))
458      endif
459    endif
460    if package[6]
461       test_dirs += [package_name]
462    endif
463    if package[7]
464       example_dirs += [package_name]
465    endif
466
467    set_variable('build_' + package_name.underscorify(), true)
468
469    # generate automatic pc files for libraries
470    if automatic_pkgfile and package[3]
471      tmp_lib = get_variable(package_name + '_lib')
472      tmp_deps = get_variable(package_name + '_deps')
473      tmp_pub_deps = get_variable(package_name + '_pub_deps')
474      tmp_package_subdirs = []
475
476      foreach subdir : package_header_subdirs
477        tmp_package_subdirs += join_paths(package_version_name, subdir)
478      endforeach
479      if (package[8] and get_option('efl-one'))
480        efl_one_sub_dirs += [package_version_name] + tmp_package_subdirs
481      endif
482      pkgconfig.generate(tmp_lib,
483        name : '-'.join(package_name.split('_')),
484        subdirs : [package_version_name] + tmp_package_subdirs,
485        version : version_major + '.' + version_minor + '.' + version_micro,
486        libraries : tmp_pub_deps,
487        requires : package[9],
488        variables : package_pc_variables
489      )
490      if package_name == 'ethumb_client'
491        pkgconfig.generate(tmp_lib,
492          name : package_name,
493          subdirs : [package_version_name] + tmp_package_subdirs,
494          version : version_major + '.' + version_minor + '.' + version_micro,
495          libraries : tmp_pub_deps,
496          requires : package[9],
497        )
498      endif
499    endif
500  else
501    message(package_name+' disabled!')
502  endif
503endforeach
504
505if (get_option('efl-one'))
506  #building efl-one
507  efl_one_lib = shared_library('efl-one',
508    link_whole : efl_one_parts,
509    install : true,
510    version : meson.project_version(),
511  )
512
513  efl_one = declare_dependency(
514    link_with: efl_one_lib,
515    include_directories : efl_one_include_dirs,
516    dependencies : [thread_dep, intl] + efl_one_eo_deps,
517    version: meson.project_version()
518  )
519
520  pkgconfig.generate(
521    name : 'efl-one',
522    subdirs : efl_one_sub_dirs,
523    description: 'Configureation for efl in one big fat .so',
524    libraries : [efl_one] + eina_pc_deps, #eina is a special case here which drags in m dl & threads
525  )
526
527  #overwrite all the dependencies of subprojects with efl-one, in order to link the modules and binaries to the correct .so
528  foreach package : subprojects
529    package_name = package[0]
530    if package[1].length() == 0 or get_option(package[1][0])
531      if (package[3])
532        if (package[8] and get_option('efl-one'))
533          set_variable(package_name, efl_one)
534        endif
535      endif
536    endif
537  endforeach
538endif
539
540#delayed build of bin, modules, and benchmarks
541foreach package : subprojects
542  package_name = package[0]
543  if package[1].length() == 0 or get_option(package[1][0])
544    dir_package_include = join_paths(dir_include, package_version_name)
545    dir_package_modules = join_paths(dir_lib, package_name, 'modules')
546    package_c_args = [
547      '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
548      '-DNEED_RUN_IN_TREE=1',
549      '-DEFL_BUILD=1',
550    ]
551    if (package[2])
552       subdir(join_paths(local_module, package_name))
553    endif
554    package_c_args = [
555      '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
556      '-DNEED_RUN_IN_TREE=1',
557    ]
558    if (package[4] and package_name != 'eolian')
559       subdir(join_paths(local_bin, package_name))
560    endif
561    if (package[5])
562       subdir(join_paths(local_benchmark, package_name))
563    endif
564  endif
565endforeach
566
567#build this later, as the debug services are depending on ecore
568subdir(join_paths('src', 'bin', 'efl'))
569
570subdir(join_paths('src', 'generic', 'evas'))
571subdir('cmakeconfig')
572subdir(join_paths('src', 'bindings'))
573subdir(join_paths('src', 'edje_external'))
574subdir(join_paths('data'))
575
576if get_option('build-tests')
577  check = dependency('check')
578
579  if (check.version() == '0.15.1')
580    error('There is a bug in check@0.15.1 which does not allow efl to be compiled with it. Please downgrade / upgrade or disable tests')
581  endif
582
583  test_env = environment()
584  test_env.set('EFL_RUN_IN_TREE', '1')
585
586  if get_option('b_sanitize') == 'address'
587    test_env.set('ASAN_OPTIONS', 'detect_leaks=0:detect_odr_violation=0')
588  endif
589
590  subdir(join_paths('src', 'tests'))
591  foreach test : test_dirs
592    package_c_args = [
593      '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, test)+'"',
594      '-DNEED_RUN_IN_TREE=1',
595    ]
596    subdir(join_paths(local_tests, test))
597  endforeach
598endif
599
600if get_option('build-examples')
601  foreach example : example_dirs
602    package_c_args = [
603      '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, example)+'"',
604      '-DNEED_RUN_IN_TREE=1',
605    ]
606    subdir(join_paths(local_examples, example))
607  endforeach
608endif
609
610subdir(join_paths(local_scripts))
611
612meson.add_install_script('meson/meson_modules.sh', module_files)
613
614foreach evas_loader_map_inst : evas_loader_map
615  evas_loader_original = evas_loader_map_inst[0]
616  evas_loader_link_types = evas_loader_map_inst[1]
617
618  meson.add_install_script('meson/evas_loader_conf.sh', evas_loader_original, evas_loader_link_types)
619endforeach
620
621doxygen = find_program('doxygen', required : false)
622
623if doxygen.found()
624  subdir('doc')
625endif
626
627#
628# Configure files
629#
630
631efl_config_h = configuration_data()
632efl_config_h.set('EFL_VERSION_MAJOR', version_major)
633efl_config_h.set('EFL_VERSION_MINOR', version_minor)
634efl_config_h.set('EFL_VERSION_MICRO', version_micro)
635efl_config_h.set('EFL_BUILD_ID', get_option('build-id'))
636
637# FIXME placeholder
638efl_config_h.set('EFL_API_LEGACY_DEF', '#define EFL_API_LEGACY_DEF "FIXME NOT IMPLEMENTED"')
639
640configure_file(
641  output: 'config.h',
642  configuration: config_h
643)
644
645configure_file(
646  input: join_paths('src','lib', 'efl', 'Efl_Config.h.in'),
647  output: 'Efl_Config.h',
648  install_dir : join_paths(dir_include,'eina-'+version_major),
649  configuration: efl_config_h
650)
651
652configure_file(
653  input: 'elm_intro.h.in',
654  output: 'elm_intro.h',
655  configuration: config_h,
656  install_dir : join_paths(dir_include,'elementary-'+version_major)
657)
658
659subdir(join_paths('systemd-services'))
660subdir(join_paths('dbus-services'))
661
662#output the three new efl-* .pc files
663efl_20_pc_files = {
664  'efl-ui' : ['elementary'],
665  'efl-core' : ['ecore', 'efl', 'emile'],
666  'efl-net' : ['ecore', 'ecore-con', 'emile'],
667}
668
669foreach name, libraries : efl_20_pc_files
670  pkgconfig.generate(
671    name : '-'.join(name.split('_')),
672    description: name+' configutation file',
673    requires : libraries,
674  )
675endforeach
676