1 project('efl', ['c','cpp'],
3 default_options : ['buildtype=release', 'cpp_std=c++11'],
4 meson_version : '>=0.47'
7 if host_machine.system() == 'darwin'
11 clean_check = run_command('meson/clean_check.sh')
12 if clean_check.returncode() == 0
13 error('Meson build requires a clean source tree')
16 pkgconfig = import('pkgconfig')
18 test_env = environment()
19 test_env.set('EFL_RUN_IN_TREE', '1')
21 version_arr = meson.project_version().split('.')
23 version_major = version_arr[0]
24 version_minor = version_arr[1]
25 version_micro = version_arr[2]
26 version_name = 'v-'+version_major + '.' + version_minor
28 cc = meson.get_compiler('c')
29 host_os = host_machine.system()
32 if cc.has_header_symbol('features.h', '__UCLIBC__')
33 host_os = 'linux-uclibc'
34 elif cc.has_header_symbol('features.h', '__dietlibc__')
35 host_os = 'linux-dietlibc'
41 #prepare a special linker args flag for binaries on macos
43 if host_machine.system() == 'darwin'
44 bin_linker_args = ['-pagezero_size', '10000', '-image_base', '100000000']
47 windows = ['windows', 'cygwin']
48 #bsd for meson 0.46 and 0.47
49 bsd = ['bsd', 'freebsd', 'dragonfly', 'netbsd']
53 sys_linux = linux.contains(host_machine.system())
54 sys_bsd = bsd.contains(host_machine.system())
55 sys_windows = windows.contains(host_machine.system())
56 sys_osx = osx.contains(host_machine.system())
62 dir_prefix = get_option('prefix')
63 dir_sysconf = join_paths(dir_prefix, get_option('sysconfdir'))
64 dir_bin = join_paths(dir_prefix, get_option('bindir'))
65 dir_data = join_paths(dir_prefix, get_option('datadir'))
66 dir_include = join_paths(dir_prefix, get_option('includedir'))
67 dir_lib = join_paths(dir_prefix, get_option('libdir'))
70 local_lib = join_paths('src', 'lib')
71 local_bindings = join_paths('src', 'bindings')
72 local_bin = join_paths('src', 'bin')
73 local_module = join_paths('src', 'modules')
74 local_tests = join_paths('src', 'tests')
75 local_benchmark = join_paths('src', 'benchmarks')
76 local_examples = join_paths('src', 'examples')
77 local_scripts = join_paths('src', 'scripts')
81 '-fvisibility=hidden',
85 '-Wno-missing-field-initializers',
88 foreach cf: dev_cflags_try
89 if cc.has_argument(cf) == true
93 add_global_arguments(dev_cflags, language: 'c')
94 add_global_arguments(dev_cflags, language: 'cpp')
97 foreach lang : ['c', 'objc', 'cpp']
98 add_global_arguments('-DHAVE_CONFIG_H=1', language: lang)
99 add_global_arguments('-D_GNU_SOURCE=1', language: lang)
100 add_global_arguments('-DEFL_EO_API_SUPPORT=1', language: lang)
101 add_global_arguments('-DEFL_BETA_API_SUPPORT=1', language: lang)
102 add_global_arguments('-DNEED_RUN_IN_TREE=1', language: lang)
103 add_global_arguments('-DEFL_BUILD=1', language: lang)
104 add_global_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: lang)
105 if sys_windows == true
106 if (get_option('windows-version') == 'vista')
107 add_global_arguments('-DWINVER=0x060', language: lang)
108 add_global_arguments('-D_WIN32_WINNT=0x0600', language: lang)
109 elif (get_option('windows-version') == 'win7')
110 add_global_arguments('-DWINVER=0x0601', language: lang)
111 add_global_arguments('-D_WIN32_WINNT=0x0601', language: lang)
112 elif (get_option('windows-version') == 'win8')
113 add_global_arguments('-DWINVER=0x0602', language: lang)
114 add_global_arguments('-D_WIN32_WINNT=0x0602', language: lang)
115 elif (get_option('windows-version') == 'win81')
116 add_global_arguments('-DWINVER=0x0603', language: lang)
117 add_global_arguments('-D_WIN32_WINNT=0x0603', language: lang)
118 elif (get_option('windows-version') == 'win10')
119 add_global_arguments('-DWINVER=0x0A00', language: lang)
120 add_global_arguments('-D_WIN32_WINNT=0x0A00', language: lang)
122 error('Version of targetted Windows incorrect')
127 config_h = configuration_data()
128 config_h.set_quoted('MODULE_ARCH', version_name)
129 config_h.set_quoted('PACKAGE', meson.project_name())
130 config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
131 config_h.set_quoted('VERSION', meson.project_version())
132 config_h.set_quoted('LOCALE_DIR', join_paths([dir_prefix, 'share/locale']))
133 config_h.set_quoted('PACKAGE_URL', 'https://www.enlightenment.org')
134 config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
135 config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-devel@lists.sourceforge.net')
136 config_h.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
137 config_h.set_quoted('PACKAGE_NAME', meson.project_name())
138 config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
139 config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
140 config_h.set_quoted('PACKAGE_SRC_DIR', meson.source_root())
141 config_h.set_quoted('PACKAGE_BUILD_DIR', meson.current_build_dir())
142 config_h.set_quoted('PACKAGE_SYSCONF_DIR', dir_sysconf)
143 config_h.set_quoted('BINDIR', dir_bin)
144 config_h.set10('EFL_HAVE_THREADS', true)
145 config_h.set10('SLOPPY_SPEC', true)
147 ## have to get compiler again for this to work
148 code = '''#define _GNU_SOURCE 1
152 extern char **environ;
154 void func(void) { printf("%p\n", environ); }
156 if cc.compiles(code, args : '-lc', name : 'environ check') == true
157 config_h.set10('HAVE_ENVIRON', true)
162 cpu_neon_intrinsics = false
163 native_arch_opt_c_args = [ ]
165 if host_machine.endian() == 'big'
166 config_h.set10('WORDS_BIGENDIAN', true)
169 if get_option('native-arch-optimization')
170 if host_machine.cpu_family() == 'x86' or host_machine.cpu_family() == 'x86_64'
172 config_h.set10('BUILD_MMX', true)
173 config_h.set10('BUILD_SSE3', true)
174 native_arch_opt_c_args = [ '-msse3' ]
175 message('x86 build - MMX + SSE3 enabled')
176 elif host_machine.cpu_family() == 'arm'
178 config_h.set10('BUILD_NEON', true)
179 add_global_arguments('-mfpu=neon', language: 'c')
180 add_global_arguments('-ftree-vectorize', language: 'c')
181 message('ARM build - NEON enabled')
182 elif host_machine.cpu_family() == 'aarch64'
184 cpu_neon_intrinsics = true
185 config_h.set10('BUILD_NEON', true)
186 config_h.set10('BUILD_NEON_INTRINSICS', true)
187 add_global_arguments('-ftree-vectorize', language: 'c')
188 native_arch_opt_c_args = [ '-ftree-vectorize' ]
189 message('ARM64 build - NEON + intrinsics enabled')
190 elif host_machine.cpu_family() == 'ppc' or host_machine.cpu_family() == 'ppc64'
191 config_h.set10('BUILD_ALTIVEC', true)
192 add_global_arguments('-ftree-vectorize', language: 'c')
193 add_global_arguments('-maltivec', language: 'c')
194 message('PPC/POWER build - ALTIVEC enabled')
198 config_dir = [include_directories('.')]
199 eolian_include_directories = []
201 if sys_linux == true or sys_bsd == true
202 sys_lib_extension = 'so'
203 sys_exe_extension = ''
204 sys_mod_extension = 'so'
205 elif sys_windows == true
206 sys_lib_extension = 'dll'
207 sys_exe_extension = 'exe'
208 sys_mod_extension = 'dll'
210 sys_lib_extension = 'dylib'
211 sys_exe_extension = ''
212 sys_mod_extension = 'dylib'
213 config_h.set('environ', '(*_NSGetEnviron())')
215 error('System '+host_machine.system()+' not known')
218 if (get_option('crypto') == 'gnutls')
219 # gcrypt does not want to provide a pkg config file so we try the lib
220 crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
221 config_h.set('HAVE_GNUTLS', '1')
222 elif (get_option('crypto') == 'openssl')
223 crypto = dependency('openssl')
224 config_h.set('HAVE_OPENSSL', '1')
227 config_h.set_quoted('SHARED_LIB_SUFFIX', '.'+sys_lib_extension)
228 config_h.set_quoted('MOD_SUFFIX', '.'+sys_mod_extension)
229 config_h.set_quoted('EXE_SUFFIX', '.'+sys_exe_extension)
230 config_h.set('EFL_BUILD', '1')
232 if get_option('tslib') == true
233 config_h.set('HAVE_TSLIB', '1')
236 subdir('header_checks')
239 if get_option('wl') == true
240 subdir(join_paths('src', 'wayland_protocol'))
243 ecore_evas_wayland_engine_include_dir = []
245 boot_strap_eolian = [
246 ['evil' ,[] , false, true, false, false, false, false, [], []],
247 ['eina' ,[] , false, true, false, false, false, false, [], []],
248 ['eolian' ,[] , false, true, true, false, false, false, ['eina'], []],
252 # name | option | mod | lib | bin | bench | tests | examples | pkg-config options | name of static libs
253 ['evil' ,[] , false, true, false, false, false, false, [], []],
254 ['eina' ,[] , false, true, true, true, true, true, [], []],
255 ['eolian' ,[] , false, true, true, false, true, false, ['eina'], []],
256 ['eo' ,[] , false, true, false, true, true, false, ['eina'], []],
257 ['efl' ,[] , false, true, false, false, true, false, ['eo'], []],
258 ['emile' ,[] , false, true, false, false, true, true, ['eina', 'efl'], ['lz4', 'rg_etc']],
259 ['eet' ,[] , false, true, true, false, true, true, ['eina', 'emile', 'efl'], []],
260 ['ecore' ,[] , false, true, false, false, false, false, ['eina', 'eo', 'efl'], ['buildsystem']],
261 ['eldbus' ,[] , false, true, true, false, true, true, ['eina', 'eo', 'efl'], []],
262 ['ecore' ,[] , true, false, false, false, true, true, ['eina', 'eo', 'efl'], []], #ecores modules depend on eldbus
263 ['ecore_audio' ,[] , false, true, false, false, false, false, ['eina', 'eo'], []],
264 ['ecore_avahi' ,['avahi'] , false, true, false, false, false, true, ['eina', 'ecore'], []],
265 ['ecore_con' ,[] , false, true, true, false, true, false, ['eina', 'eo', 'efl', 'ecore'], ['http-parser']],
266 ['ecore_file' ,[] , false, true, false, false, false, false, ['eina'], []],
267 ['eeze' ,['eeze'] , true, true, true, false, true, false, ['eina', 'efl'], []],
268 ['ecore_input' ,[] , false, true, false, false, false, false, ['eina', 'eo'], []],
269 ['ecore_x' ,['x11'] , false, true, false, false, false, false, ['eina', 'efl'], []],
270 ['ecore_fb' ,['fb'] , false, true, false, false, false, false, ['eina'], []],
271 ['ecore_wl2' ,['wl'] , true, true, false, false, false, false, ['eina'], ['libdrm']],
272 ['ecore_sdl' ,['sdl'] , false, true, false, false, false, false, ['eina'], []],
273 ['ecore_ipc' ,[] , false, true, false, false, false, false, ['eina'], []],
274 ['ecore_buffer' ,['buffer'] , true, true, true, false, false, false, ['eina'], []],
275 ['ector' ,[] , false, true, false, false, true, false, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']],
276 ['elput' ,['drm'] , false, true, false, false, true, false, ['eina', 'eldbus'], []],
277 ['ecore_drm2' ,['drm'] , false, true, false, false, false, false, ['ecore'], ['libdrm']],
278 ['ecore_cocoa' ,['cocoa'] , false, true, false, false, false, false, ['eina'], []],
279 ['evas' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']],
280 ['evas_goal' ,[] , false, true, false, false, false, false, ['eina', 'efl', 'eo'], []],
281 ['ecore_input_evas' ,[] , false, true, false, false, false, false, ['eina', 'evas'], []],
282 ['ecore_evas' ,[] , true, true, true, false, false, false, ['evas', 'ector'], []],
283 ['ecore_imf' ,[] , true, true, false, false, false, false, ['eina'], []],
284 ['embryo' ,[] , false, true, true, false, false, false, ['eina', 'efl', 'eo'], []],
285 ['efreet' ,[] , false, true, false, false, true, false, ['eina', 'efl', 'eo'], []],
286 ['eio' ,[] , false, true, false, false, true, true, ['eina', 'eet'], []],
287 ['efreet' ,[] , false, false, true, false, false, false, ['eina', 'efl', 'eo'], []],
288 ['ecore_imf_evas' ,[] , false, true, false, false, false, false, ['eina', 'efl', 'eo'], []],
289 ['ephysics' ,['physics'] , false, true, false, false, false, false, ['eina', 'efl', 'eo'], []],
290 ['edje' ,[] , false, true, true, false, true, true, ['evas', 'eo', 'efl', get_option('lua-interpreter')], []],
291 ['emotion' ,[] , true, true, false, false, true, true, ['eina', 'efl', 'eo'], []],
292 ['ethumb' ,[] , true, true, true, false, false, false, ['eina', 'efl', 'eo'], []],
293 ['ethumb_client' ,[] , false, true, true, false, false, true, ['eina', 'efl', 'eo', 'ethumb'], []],
294 ['elocation' ,[] , false, true, false, false, false, false, ['ecore', 'eldbus'], []],
295 ['elementary' ,[] , 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', 'elocation'], ['atspi']],
296 ['efl_wl' ,['wl'] , false, true, true, false, false, false, ['evas', 'ecore'], []],
297 ['elua' ,['elua'] , false, true, true, false, true, false, ['eina', 'luajit'], []],
298 ['ecore_wayland' ,['wl-deprecated'] , false, true, false, false, false, false, ['eina'], []],
299 ['ecore_drm' ,['drm-deprecated'] , false, true, false, false, false, false, ['eina'], []],
302 # We generate Efl_Config.h and config.h later, they will be available here
303 config_dir += include_directories('.')
305 #we have to do that first, eina modules are required by eina
306 #the other modules require theire package
307 subdir(join_paths(local_module, 'eina'))
311 tmp_empty = declare_dependency()
313 if get_option('eolian-bootstrap')
314 subprojects = boot_strap_eolian
317 foreach package : subprojects
318 package_name = package[0]
319 package_version_name = '-'.join(package_name.split('_')) + '-' + version_major
321 '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
322 '-DNEED_RUN_IN_TREE=1',
324 automatic_pkgfile = true
325 if package[1].length() == 0 or get_option(package[1][0])
326 config_h.set('HAVE_'+package_name.to_upper(), '1')
328 dir_package_include = join_paths(dir_include, package_version_name)
329 dir_package_modules = join_paths(dir_lib, package_name, 'modules')
331 #ensure that we really dont copy the eo file targets from a previous library
332 #Those are the variables that can be used to reflect the libraries speical handlings
333 # -> at the end is used to indicate where to find this variable outside of this for loop
335 #public eo and eot files - which probebly have to be used later for bindings
336 pub_eo_files = [] # -> package_name + '_eo_files'
337 pub_eo_types_files = [] # -> package_name + '_eot_files'
338 #All subdirs where eo files that are listed in the pub_* variables can be found
339 #For every element != '' a variable called package_name + '_' + subir + '_eot_files' and package_name + '_' + subir + '_eo_files' must exist.
340 package_eo_subdirs = [''] # -> package_name + '_eo_subdirs'
341 #All subdirs that should be included in order to include every requried header
342 package_header_subdirs = [] # -> package_name + '_include_subdirs'
343 #eo file targets, this list of targets can be used to ensure the files are created before accessed
344 pub_eo_file_target = []
345 #private eo files target - never use this :)
346 priv_eo_file_target = []
347 #use this variable to store custom variables in that should be placed in the .pc file
348 package_pc_variables = []
350 foreach static_lib : package[9]
351 if get_variable(static_lib, tmp_empty) == tmp_empty
352 subdir(join_paths('src', 'static_libs', static_lib))
357 subdir(join_paths(local_lib, package_name))
358 set_variable(package_name + '_eo_files', pub_eo_files)
359 set_variable(package_name + '_eot_files', pub_eo_types_files)
360 set_variable(package_name + '_header_subdirs', package_header_subdirs)
361 set_variable(package_name + '_eo_subdirs', package_eo_subdirs)
364 subdir(join_paths(local_module, package_name))
367 subdir(join_paths(local_bin, package_name))
370 subdir(join_paths(local_benchmark, package_name))
373 test_dirs += [package_name]
376 example_dirs += [package_name]
379 set_variable('build_'+package_name, true)
381 # generate automatic pc files for libraries
382 if automatic_pkgfile == true and package[3]
383 tmp_lib = get_variable(package_name+'_lib')
384 tmp_deps = get_variable(package_name+'_deps')
385 tmp_pub_deps = get_variable(package_name+'_pub_deps')
386 tmp_package_subdirs = []
388 foreach subdir : package_header_subdirs
389 tmp_package_subdirs += join_paths(package_version_name, subdir)
392 pkgconfig.generate(tmp_lib,
393 name : '-'.join(package_name.split('_')),
394 subdirs : [package_version_name] + tmp_package_subdirs,
395 version : version_major + '.' + version_minor + '.' + version_micro,
396 libraries : tmp_pub_deps,
397 requires : package[8],
398 variables : package_pc_variables
400 if package_name == 'ethumb_client'
401 pkgconfig.generate(tmp_lib,
403 subdirs : [package_version_name] + tmp_package_subdirs,
404 version : version_major + '.' + version_minor + '.' + version_micro,
405 libraries : tmp_pub_deps,
406 requires : package[8],
411 message(package_name+' disabled!')
416 subdir('cmakeconfig')
417 #build this later, as the debug services are depending on ecore
418 if get_option('eolian-bootstrap') == false
419 subdir(join_paths('src', 'bin', 'efl'))
421 subdir(join_paths('src', 'generic', 'evas'))
422 subdir(join_paths('src', 'generic', 'emotion'))
424 bindings = get_option('bindings')
426 foreach binding : bindings
427 subdir(join_paths('src', 'bindings', binding))
430 subdir(join_paths('src', 'edje_external'))
431 subdir(join_paths('data'))
434 if get_option('build-tests')
435 check = dependency('check')
436 subdir(join_paths('src', 'tests'))
437 foreach test : test_dirs
438 subdir(join_paths(local_tests, test))
442 if get_option('build-examples')
443 foreach example : example_dirs
444 subdir(join_paths(local_examples, example))
448 subdir(join_paths(local_scripts))
450 meson.add_install_script('meson/meson_modules.sh', module_files)
452 foreach evas_loader_map_inst : evas_loader_map
453 evas_loader_original = evas_loader_map_inst[0]
454 evas_loader_link_types = evas_loader_map_inst[1]
456 meson.add_install_script('meson/evas_loader_conf.sh', evas_loader_original, evas_loader_link_types)
463 efl_config_h = configuration_data()
464 efl_config_h.set('EFL_VERSION_MAJOR', version_major)
465 efl_config_h.set('EFL_VERSION_MINOR', version_minor)
466 efl_config_h.set('EFL_VERSION_MICRO', version_micro)
467 efl_config_h.set('EFL_BUILD_ID', get_option('build-id'))
470 efl_config_h.set('EFL_API_EO_DEF', '#define EFL_API_EO_DEF "FIXME NOT IMPLEMENTED"')
471 efl_config_h.set('EFL_API_LEGACY_DEF', '#define EFL_API_LEGACY_DEF "FIXME NOT IMPLEMENTED"')
476 configuration: config_h
480 input: join_paths('src','lib', 'efl', 'Efl_Config.h.in'),
481 output: 'Efl_Config.h',
482 install_dir : join_paths(dir_include,'efl-'+version_major),
483 configuration: efl_config_h
487 input: 'elm_intro.h.in',
488 output: 'elm_intro.h',
489 configuration: config_h,
490 install_dir : join_paths(dir_include,'elementary-'+version_major)
493 subdir(join_paths('systemd-services'))
494 subdir(join_paths('dbus-services'))
496 #output the three new efl-* .pc files
498 ['efl-ui', ['elementary']],
499 ['efl-core', ['ecore', 'efl', 'emile']],
500 ['efl-net', ['ecore', 'ecore-con', 'emile']],
503 foreach pc_file : efl_20_pc_files
505 libraries = pc_file[1]
507 name : '-'.join(name.split('_')),
508 description: name+' configutation file',
509 requires : libraries,