summaryrefslogtreecommitdiff
path: root/meson.build
blob: bfe14fbf0b4540855bcdd8a05cf8968975b6b047 (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
project('gnome-logs', 'c', version : '43.1', default_options : ['warning_level=1'], meson_version: '>= 0.59.0')

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 = [
    '-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', 'Logs'],
  ['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
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('gtk4', version : '>=4.6.0'),
    dependency('libadwaita-1', version : '>=1.2.alpha'),
    dependency('libsystemd')
]

# 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')

gnome.post_install(
  glib_compile_schemas: true,
  gtk_update_icon_cache: true,
  update_desktop_database: true,
)