summaryrefslogtreecommitdiff
path: root/meson.build
blob: 4ec2fb0da817e7ae36e4839b4abdfcfecc632180 (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
project('forecasts', 'c')

e = dependency('enlightenment')

dir_module_e = e.get_pkgconfig_variable('modules')
release = e.get_pkgconfig_variable('release')
host_os = host_machine.system()
cc = meson.get_compiler('c')

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
module_arch = '@0@-@1@-@2@'.format(host_os, host_machine.cpu_family(), release)
edje_cmd = find_program('edje_cc')

install_mod_dir = join_paths(dir_module_e, meson.project_name())
install_dir = join_paths(install_mod_dir, module_arch)
locale_dir = join_paths(get_option('prefix'), get_option('localedir'))

config_data = configuration_data()
config_data.set_quoted('PACKAGE', meson.project_name())
config_data.set_quoted('MODULE_DIR', install_dir)
config_data.set_quoted('LOCALE_DIR', locale_dir)
config_dir = include_directories('.')

use_translations = false
intl_lib = cc.find_library('intl', required: false)
if intl_lib.found()
  config_data.set('ENABLE_NLS', 1)
  use_translations = true
else
  gettext_code = '''
  #include <libintl.h>
  int main(int argc, char *argv[]) {
      (void)ngettext("", "", 0);
      return 0;
  }
  '''
  if cc.links(gettext_code)
    config_data.set('ENABLE_NLS', 1)
    use_translations = true
  endif
endif

subdir('src')

configure_file(output: 'forecast_config.h', install: false, configuration: config_data)

install_data('module.desktop', install_dir : install_mod_dir)

cmd = [ edje_cmd,
        '-id', join_paths(meson.source_root(), 'images'),
        '@INPUT@', '@OUTPUT@'
      ]
custom_target('e-module-forecasts.edj',
              input      : 'e-module-forecasts.edc',
              output     : 'e-module-forecasts.edj',
              command    : cmd,
              install_dir: install_mod_dir,
              install    : true
             )
custom_target('forecasts.edj',
              input      : 'forecasts.edc',
              output     : 'forecasts.edj',
              command    : cmd,
              install_dir: install_mod_dir,
              install    : true
             )
if use_translations
  subdir('po')
endif

subdir('places')