summaryrefslogtreecommitdiff
path: root/meson.build
blob: 6e61d52693b0794db669e30966ee5236bcfffe3a (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
project('gnome-logs', 'c', version : '3.33.1')

gl_name = meson.project_name()
gl_version = meson.project_version()

gl_prefix = get_option('prefix')
gl_bindir = join_paths(gl_prefix, get_option('bindir'))
gl_libexecdir = join_paths(gl_prefix, get_option('libexecdir'))
gl_localedir = join_paths(gl_prefix, get_option('localedir'))
gl_datadir = join_paths(gl_prefix, get_option('datadir'))
gl_mandir = join_paths(gl_prefix, get_option('mandir'), 'man1')
gl_pkgdatadir = join_paths(gl_datadir, gl_name)

# warning cflags
warning_cflags = [
    '-Wall',
    '-Wstrict-prototypes',
    '-Wnested-externs',
    '-Werror=missing-prototypes',
    '-Werror=implicit-function-declaration',
    '-Werror=pointer-arith',
    '-Werror=init-self',
    '-Werror=format-security',
    '-Werror=format=2',
    '-Werror=missing-include-dirs',
    '-Werror=return-type'
]
c_compiler = meson.get_compiler('c')
supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags)
add_global_arguments(supported_warning_cflags, language : 'c')

config_h = configuration_data()

# defines
set_defines = [
  # package
  ['PACKAGE', gl_name],
  ['PACKAGE_BUGREPORT', 'http://bugzilla.gnome.org/enter_bug.cgi?product=' + gl_name],
  ['PACKAGE_NAME', gl_name],
  ['PACKAGE_STRING', '@0@ @1@'.format(gl_name, gl_version)],
  ['PACKAGE_TARNAME', gl_name],
  ['PACKAGE_URL', 'https://wiki.gnome.org/Apps/Logs'],
  ['PACKAGE_VERSION', gl_version],
  ['VERSION', gl_version],
  # i18n
  ['GETTEXT_PACKAGE', gl_name],
]

foreach define: set_defines
  config_h.set_quoted(define[0], define[1])
endforeach
configure_file(output : 'config.h',
               configuration : config_h)

# Dependencies
dependency('pkg-config', version : '>= 0.24')

message('checking for glib-mkenums script...')
glib_mkenums = run_command('pkg-config', ['--variable=glib_mkenums', 'glib-2.0'])
if not glib_mkenums.stdout().contains('glib-mkenums')
    error('glib-mkenums not listed in glib-2.0 pkg-config file')
else
    message(glib_mkenums.stdout().strip())
endif

gsettings_desktop_schemas = dependency('gsettings-desktop-schemas', required : false)
if not gsettings_desktop_schemas.found()
    message('gsettings-desktop-schemas is required at runtime')
endif

gl_deps = [
    dependency('gio-unix-2.0', version : '>=2.43.90'),
    dependency('gtk+-3.0', version : '>=3.22.0'),
    dependency('libsystemd')
]

# Testing utilities
have_desktop_file_validate = false
if get_option('tests')
    desktop_file_validate = find_program('desktop-file-validate', required : false)
    if desktop_file_validate.found()
        have_desktop_file_validate = true
    else
        have_desktop_file_validate = false
    endif
else
    have_desktop_file_validate = false
endif

if have_desktop_file_validate == true
    testing_utilities = true
else
    testing_utilities = false
    if get_option('tests')
        error('tests were requested but the required utilities were not found')
    endif
endif

if testing_utilities
    logs_enable_tests = true
else
    logs_enable_tests = false
endif

# Manpage
have_xsltproc = false
have_manutils = false
if get_option('man')
    # TODO: check xsl stylesheets as well#

    xsltproc = find_program('xsltproc', required : false)
    if xsltproc.found()
        have_xsltproc = true
    else
        have_xsltproc = false
    endif
endif

if have_xsltproc
    have_manutils = true
else
    if get_option('man')
        error('manpage generation requested but required utilities were not found')
        have_manutils = false
    endif
endif

if have_manutils
    logs_enable_man = true
else
    logs_enable_man = false
endif

# i18n
gnome = import('gnome')
i18n = import('i18n')

data_dir = join_paths(meson.source_root(), 'data')
po_dir = join_paths(meson.source_root(), 'po')

top_inc = include_directories('.')
src_inc = include_directories('src')

subdir('data')
subdir('src')
subdir('po')
subdir('help')
subdir('tests')

meson.add_install_script('meson_post_install.py')