summaryrefslogtreecommitdiff
path: root/meson.build
blob: 72c48b84866f50058fd5b46732be41d69b9c0ab3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
project('efl', ['c','cpp'],
  version: '1.21.99',
  default_options : ['buildtype=plain'],
  meson_version : '>=0.46'
)

if target_machine.system() == 'darwin'
  add_languages('objc')
endif


clean_check = run_command('meson/clean_check.sh')
if clean_check.returncode() == 0
  error('Meson build requires a clean source tree')
endif

pkgconfig = import('pkgconfig')

test_env = environment()
test_env.set('EFL_RUN_IN_TREE', '1')

version_arr = meson.project_version().split('.')

version_major = version_arr[0]
version_minor = version_arr[1]
version_micro = version_arr[2]
version_name = 'v-'+version_major + '.' + version_minor

cc = meson.get_compiler('c')
host_os = host_machine.system()

if host_os == 'linux'
  if cc.has_header_symbol('features.h', '__UCLIBC__')
    host_os = 'linux-uclibc'
  elif cc.has_header_symbol('features.h', '__dietlibc__')
    host_os = 'linux-dietlibc'
  else
    host_os = 'linux-gnu'
  endif
endif

#prepare a special linker args flag for binaries on macos
bin_linker_args = []
if target_machine.system() == 'darwin'
  bin_linker_args = ['-pagezero_size', '10000', '-image_base', '100000000']
endif

module_files = []
evas_loader_map = []

#install paths
dir_prefix    = get_option('prefix')
dir_sysconf   = join_paths(dir_prefix, get_option('sysconfdir'))
dir_bin       = join_paths(dir_prefix, get_option('bindir'))
dir_data      = join_paths(dir_prefix, get_option('datadir'))
dir_include   = join_paths(dir_prefix, get_option('includedir'))
dir_lib       = join_paths(dir_prefix, get_option('libdir'))

#local paths
local_lib = join_paths('src', 'lib')
local_bin = join_paths('src', 'bin')
local_module = join_paths('src', 'modules')
local_tests = join_paths('src', 'tests')
local_benchmark = join_paths('src', 'benchmarks')
local_examples = join_paths('src', 'examples')
local_scripts = join_paths('src', 'scripts')

add_global_arguments('-DHAVE_CONFIG_H=1', language: 'c')
add_global_arguments('-D_GNU_SOURCE=1', language: 'c')
add_global_arguments('-fPIC', language: 'c')

add_global_arguments('-DEFL_EO_API_SUPPORT=1', language: 'c')
add_global_arguments('-DEFL_BETA_API_SUPPORT=1', language: 'c')
add_global_arguments('-DNEED_RUN_IN_TREE=1', language: 'c')
add_global_arguments('-DEFL_BUILD=1', language: 'c')
add_global_arguments('-DEFL_BUILD=1', language: 'objc')
add_global_arguments('-DEFL_EO_API_SUPPORT=1', language: 'objc')
add_global_arguments('-DEFL_BETA_API_SUPPORT=1', language: 'objc')
add_global_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: 'c')

config_h = configuration_data()
config_h.set_quoted('MODULE_ARCH', version_name)
config_h.set_quoted('PACKAGE', meson.project_name())
config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('VERSION', meson.project_version())
config_h.set_quoted('LOCALE_DIR', join_paths([dir_prefix, 'share/locale']))
config_h.set_quoted('PACKAGE_URL', 'https://www.enlightenment.org')
config_h.set_quoted('PACKAGE_TARNAME', meson.project_name())
config_h.set_quoted('PACKAGE_BUGREPORT', 'enlightenment-devel@lists.sourceforge.net')
config_h.set_quoted('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
config_h.set_quoted('PACKAGE_NAME', meson.project_name())
config_h.set_quoted('PACKAGE_BIN_DIR', dir_bin)
config_h.set_quoted('PACKAGE_LIB_DIR', dir_lib)
config_h.set_quoted('PACKAGE_SRC_DIR', meson.source_root())
config_h.set_quoted('PACKAGE_BUILD_DIR', meson.current_build_dir())
config_h.set_quoted('PACKAGE_SYSCONF_DIR', dir_sysconf)
config_h.set_quoted('BINDIR', dir_bin)
config_h.set_quoted('DATADIR', dir_data)
config_h.set10('EFL_HAVE_THREADS', true)
config_h.set('NEED_RUN_IN_TREE', '1')

config_dir = [include_directories('.')]
eolian_include_directories = []

windows = ['windows', 'cygwin']
#bsd for meson 0.46 and 0.47
bsd = ['bsd', 'freebsd', 'dragonfly', 'netbsd']
linux = ['linux']
osx = ['darwin']

if linux.contains(target_machine.system()) or bsd.contains(target_machine.system())
  sys_lib_extension = 'so'
  sys_exe_extension = ''
  sys_mod_extension = 'so'
elif windows.contains(target_machine.system())
  sys_lib_extension = 'dll'
  sys_exe_extension = 'exe'
  sys_mod_extension = 'dll'
elif osx.contains(target_machine.system())
  sys_lib_extension = 'dylib'
  sys_exe_extension = ''
  sys_mod_extension = 'dylib'
else
  error('System '+target_machine.system()+' not known')
endif

if (get_option('crypto') == 'gnutls')
  # gcrypt does not want to provide a pkg config file so we try the lib
  crypto = [dependency('gnutls'), cc.find_library('gcrypt')]
  config_h.set('HAVE_GNUTLS', '1')
elif (get_option('crypto') == 'openssl')
  crypto = dependency('openssl')
  config_h.set('HAVE_OPENSSL', '1')
endif

config_h.set_quoted('SHARED_LIB_SUFFIX', '.'+sys_lib_extension)
config_h.set_quoted('MOD_SUFFIX', '.'+sys_mod_extension)
config_h.set_quoted('EXE_SUFFIX', '.'+sys_exe_extension)
config_h.set('EFL_BUILD', '1')

subdir('header_checks')
subdir('po')

if get_option('wl') == true
  subdir(join_paths('src', 'wayland_protocol'))
endif

ecore_evas_wayland_engine_include_dir = []

subprojects = [
# name              |   option              | mod  | lib  | bin  | bench | tests | examples | pkg-config options | name of static libs
['eina'             ,[]                    , false,  true,  true,  true,  true,  true, [], []],
['eolian'           ,[]                    , false,  true,  true, false,  true, false, ['eina'], []],
['eo'               ,[]                    , false,  true, false,  true,  true, false, ['eina'], []],
['efl'              ,[]                    , false,  true, false, false,  true, false, ['eo'], []],
['emile'            ,[]                    , false,  true, false, false,  true,  true, ['eina', 'efl'], ['lz4', 'rg_etc']],
['eet'              ,[]                    , false,  true,  true, false,  true,  true, ['eina', 'emile', 'efl'], []],
['ecore'            ,[]                    , false,  true, false, false, false, false, ['eina', 'eo', 'efl'], ['buildsystem']],
['eldbus'           ,[]                    , false,  true,  true, false,  true,  true, ['eina', 'eo', 'efl'], []],
['ecore'            ,[]                    ,  true, false, false, false,  true,  true, ['eina', 'eo', 'efl'], []], #ecores modules depend on eldbus
['ecore_audio'      ,[]                    , false,  true, false, false, false, false, ['eina', 'eo'], []],
['ecore_avahi'      ,['avahi']             , false,  true, false, false, false,  true, ['eina', 'ecore'], []],
['ecore_con'        ,[]                    , false,  true,  true, false,  true, false, ['eina', 'eo', 'efl', 'ecore'], ['http-parser']],
['ecore_file'       ,[]                    , false,  true, false, false, false, false, ['eina'], []],
['eeze'             ,['eeze']              ,  true,  true,  true, false,  true, false, ['eina', 'efl'], []],
['ecore_input'      ,[]                    , false,  true, false, false, false, false, ['eina', 'eo'], []],
['ecore_x'          ,['x11']               , false,  true, false, false, false, false, ['eina', 'efl'], []],
['ecore_fb'         ,['fb']                , false,  true, false, false, false, false, ['eina'], []],
['ecore_wl2'        ,['wl']                ,  true,  true, false, false, false, false, ['eina'], ['libdrm']],
['ecore_sdl'        ,['sdl']               , false,  true, false, false, false, false, ['eina'], []],
['ecore_ipc'        ,[]                    , false,  true, false, false, false, false, ['eina'], []],
['ecore_buffer'     ,['buffer']            ,  true,  true,  true, false, false, false, ['eina'], []],
['ector'            ,[]                    , false,  true, false, false,  true, false, ['eina', 'efl'], ['draw', 'triangulator', 'freetype']],
['elput'            ,['drm']               , false,  true, false, false,  true, false, ['eina', 'eldbus'], []],
['ecore_drm2'       ,['drm']               , false,  true, false, false, false, false, ['ecore'], ['libdrm']],
['ecore_cocoa'      ,['cocoa']             , false,  true, false, false, false, false, ['eina'], []],
['evas'             ,[]                    ,  true,  true, false, false,  true,  true, ['eina', 'efl', 'eo'], ['vg_common', 'libunibreak']],
['evas_goal'        ,[]                    , false,  true, false, false, false, false, ['eina', 'efl', 'eo'], []],
['ecore_input_evas' ,[]                    , false,  true, false, false, false, false, ['eina', 'evas'], []],
['ecore_evas'       ,[]                    ,  true,  true,  true, false, false, false, ['evas', 'ector'], []],
['ecore_imf'        ,[]                    ,  true,  true, false, false, false, false, ['eina'], []],
['embryo'           ,[]                    , false,  true,  true, false, false, false, ['eina', 'efl', 'eo'], []],
['efreet'           ,[]                    , false,  true, false, false,  true, false, ['eina', 'efl', 'eo'], []],
['eio'              ,[]                    , false,  true, false, false,  true,  true, ['eina', 'eet'], []],
['efreet'           ,[]                    , false, false,  true, false, false, false, ['eina', 'efl', 'eo'], []],
['ecore_imf_evas'   ,[]                    , false,  true, false, false, false, false, ['eina', 'efl', 'eo'], []],
['ephysics'         ,['physics']           , false,  true, false, false, false, false, ['eina', 'efl', 'eo'], []],
['edje'             ,[]                    , false,  true,  true, false,  true,  true, ['evas', 'eo', 'efl', 'luajit'], []],
['emotion'          ,[]                    ,  true,  true, false, false,  true,  true, ['eina', 'efl', 'eo'], []],
['ethumb'           ,[]                    ,  true,  true,  true, false, false, false, ['eina', 'efl', 'eo'], []],
['ethumb_client'    ,[]                    , false,  true,  true, false, false,  true, ['eina', 'efl', 'eo', 'ethumb'], []],
['elocation'        ,[]                    , false,  true, false, false, false, false, ['ecore', 'eldbus'], []],
['elementary'       ,[]                    ,  true,  true,  true, false,  true, false, ['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']],
['efl_wl'           ,['wl']                , false,  true,  true, false, false, false, ['evas', 'ecore'], []],
['elua'             ,['elua']              , false,  true,  true, false,  true, false, ['eina', 'luajit'], []],
['ecore_wayland'    ,['wl-deprecated']     , false,  true, false, false, false, false, ['eina'], []],
['ecore_drm'        ,['drm-deprecated']    , false,  true, false, false, false, false, ['eina'], []],
]

# We generate Efl_Config.h and config.h later, they will be available here
config_dir += include_directories('.')

#we have to do that first, eina modules are required by eina
#the other modules require theire package
subdir(join_paths(local_module, 'eina'))

test_dirs = []
example_dirs = []
tmp_empty = declare_dependency()


foreach package : subprojects
  package_name = package[0]
  package_version_name = '-'.join(package_name.split('_')) + '-' + version_major
  package_c_args = [
    '-DPACKAGE_DATA_DIR="'+ join_paths(dir_data, package_name)+'"',
    '-DNEED_RUN_IN_TREE=1'
  ]
  automatic_pkgfile = true
  if package[1].length() == 0 or get_option(package[1][0])
    config_h.set('HAVE_'+package_name.to_upper(), '1')

    dir_package_include = join_paths(dir_include, package_version_name)
    dir_package_modules = join_paths(dir_lib, package_name, 'modules')

    #ensure that we really dont copy the eo file targets from a previous library
    pub_eo_file_target = []
    priv_eo_file_target = []

    foreach static_lib : package[9]
      if get_variable(static_lib, tmp_empty) == tmp_empty
        subdir(join_paths('src', 'static_libs', static_lib))
      endif
    endforeach

    if (package[3])
       subdir(join_paths(local_lib, package_name))
    endif
    if (package[2])
       subdir(join_paths(local_module, package_name))
    endif
    if (package[4])
       subdir(join_paths(local_bin, package_name))
    endif
    if (package[5])
       subdir(join_paths(local_benchmark, package_name))
    endif
    if (package[6])
       test_dirs += [package_name]
    endif
    if (package[7])
       example_dirs += [package_name]
    endif

    set_variable('build_'+package_name, true)

    # generate automatic pc files for libraries
    if automatic_pkgfile == true and package[3]
      tmp_lib = get_variable(package_name+'_lib')
      tmp_deps = get_variable(package_name+'_deps')
      tmp_pub_deps = get_variable(package_name+'_pub_deps')

      pkgconfig.generate(tmp_lib,
        name : '-'.join(package_name.split('_')),
        subdirs : package_version_name,
        version : version_major + '.' + version_minor,
        libraries : tmp_pub_deps,
        requires : package[8],
      )
    endif
  else
    message(package_name+' disabled!')
  endif

endforeach

#build this later, as the debug services are depending on ecore
subdir(join_paths('src', 'bin', 'efl'))

subdir(join_paths('src', 'generic', 'evas'))
subdir(join_paths('src', 'generic', 'emotion'))

subdir(join_paths('src', 'bindings', 'luajit'))
subdir(join_paths('src', 'edje_external'))


subdir(join_paths('data'))

if get_option('build-tests')
  check = dependency('check')
  subdir(join_paths('src', 'tests'))
  foreach test : test_dirs
      subdir(join_paths(local_tests, test))
  endforeach
endif

if get_option('build-examples')
  foreach example : example_dirs
      subdir(join_paths(local_examples, example))
  endforeach
endif

subdir(join_paths(local_scripts))

meson.add_install_script('meson/meson_modules.sh', module_files)

foreach evas_loader_map_inst : evas_loader_map
  evas_loader_original = evas_loader_map_inst[0]
  evas_loader_link_types = evas_loader_map_inst[1]

  meson.add_install_script('meson/evas_loader_conf.sh', evas_loader_original, evas_loader_link_types)
endforeach

#
# Configure files
#

efl_config_h = configuration_data()
efl_config_h.set('EFL_VERSION_MAJOR', version_major)
efl_config_h.set('EFL_VERSION_MINOR', version_minor)
efl_config_h.set('EFL_VERSION_MICRO', version_micro)
efl_config_h.set('EFL_BUILD_ID', get_option('build-id'))

#FIXME placeholder
efl_config_h.set('EFL_API_EO_DEF', '#define EFL_API_EO_DEF "FIXME NOT IMPLEMENTED"')
efl_config_h.set('EFL_API_LEGACY_DEF', '#define EFL_API_LEGACY_DEF "FIXME NOT IMPLEMENTED"')

configure_file(
  output: 'config.h',
  install: false,
  configuration: config_h
)

configure_file(
  input: join_paths('src','lib', 'efl', 'Efl_Config.h.in'),
  output: 'Efl_Config.h',
  install_dir : join_paths(dir_include,'efl-'+version_major),
  configuration: efl_config_h
)

configure_file(
  input: 'elm_intro.h.in',
  output: 'elm_intro.h',
  configuration: config_h,
  install_dir : join_paths(dir_include,'elementary-'+version_major)
)