File: meson.build

package info (click to toggle)
gnome-subtitles 1.8-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 103,144 kB
  • sloc: xml: 406,395; cs: 364,495; ansic: 3,104; perl: 1,477; sh: 769; python: 545; javascript: 500; makefile: 49
file content (171 lines) | stat: -rw-r--r-- 5,261 bytes parent folder | download
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
if host_machine.system() == 'windows'
  if host_machine.cpu() == 'amd64'
    add_project_arguments('-define:WIN64LONGS', language: 'cs')
  endif
endif


version = meson.project_version()
apiversion = '3.0.0.0'
mono_required_version = '>=3.2.0'
gtk_required_version='>=3.22.0'
glib_required_version='>=2.32.0'

csc = meson.get_compiler('cs')

runtime = ''
runtime_debug_flags = ''
if get_option('buildtype') == 'debug' or get_option('buildtype') == 'debugoptimized'
  runtime_debug_flags=' --debug'
endif

if csc.get_id() == 'mono'
    if not csc.version().version_compare(mono_required_version)
        error('Mono required version @0@ not found (@1@)'.format(
            mono_required_version, csc.version()))
    endif

    mono_runtime_dep = dependency('mono', required: false)
    if mono_runtime_dep.found()
        runtime = 'mono' + runtime_debug_flags
    endif

    add_project_arguments('-keyfile:' + join_paths(meson.current_source_dir(), 'gtk-sharp.snk'),
        language: ['cs'])
endif

install = get_option('install')
assemblyinfo='/AssemblyInfo.cs'

gacutil = find_program('gacutil', required: install)
diff = find_program('audit/test_abi.py')

glib_dep = dependency('glib-2.0', version: glib_required_version,
        fallback: ['glib', 'libglib_dep'])
gio_dep = dependency('gio-2.0', version: glib_required_version,
        fallback: ['glib', 'libgio_dep'])

# FIXME Check how to enabled debug flags (if at all needed).

# TODO monodoc

prefix = get_option('prefix')
assembly_data = configuration_data()
assembly_data.set('API_VERSION', apiversion)
assemblyinfo = configure_file(input: 'AssemblyInfo.cs.in', output: 'AssemblyInfo.cs', configuration : assembly_data)

policy_config = files('policy.config.in')
if host_machine.system() == 'darwin'
  lib_prefix=''
  lib_suffix='.dylib'
else
  lib_prefix='.so'
  lib_suffix=''
endif

remap_dl_data = configuration_data()
remap_dl_data.set('LIB_PREFIX', lib_prefix)
remap_dl_data.set('LIB_SUFFIX', lib_suffix)

pkg_version = meson.project_name() + '-3.0'
version_data = configuration_data()
version_data.set('VERSION', version)
version_data.set('PACKAGE_VERSION', pkg_version)

install_infos = []
nuget_infos = []
lib_install_dir = join_paths(get_option('libdir'), 'mono', pkg_version)
pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')
gapi_xml_installdir = join_paths(get_option('datadir'), 'gapi-3.0')

schema = join_paths(meson.current_source_dir(), 'gapi.xsd')


if host_machine.system() == 'windows'
    pathsep = ';'
else
    pathsep = ':'
endif
mono_path = ''
foreach d: [ 'glib',  'gio' ]
    mono_path += pathsep + join_paths(meson.current_build_dir(), d)
endforeach

subdir('parser')
subdir('generator')
subdir('glib')
subdir('gio')

cairo_dep = dependency('cairo', required: get_option('cairo'))
if cairo_dep.found()
    mono_path += pathsep + join_paths(meson.current_build_dir(), 'cairo')
    subdir('cairo')
else
    message('Cairo not found, not building')
endif

pango_dep = dependency('pango', required: get_option('pango'))
if pango_dep.found()
    mono_path += pathsep + join_paths(meson.current_build_dir(), 'pango')
    subdir('pango')
else
    message('Pango not found, not building')
endif

atk_dep = dependency('atk', required: get_option('atk'))
if atk_dep.found()
    mono_path += pathsep + join_paths(meson.current_build_dir(), 'atk')
    subdir('atk')
else
    message('Atk not found, not building')
endif

gdk_dep = dependency('gdk-3.0', version: gtk_required_version, required: get_option('gdk'))
if gdk_dep.found() and atk_dep.found() and pango_dep.found()
    mono_path += pathsep + join_paths(meson.current_build_dir(), 'gdk')
    subdir('gdk')
    has_gdk = true
else
    message('Gdk not found, not building')
    has_gdk = false
endif

gtk_dep = dependency('gtk+-3.0', version: gtk_required_version, required: get_option('gtk'))
if gtk_dep.found() and atk_dep.found() and pango_dep.found()
    mono_path += pathsep + join_paths(meson.current_build_dir(), 'gtk')
    subdir('gtk')
    subdir('sample/GtkDemo')
    subdir('sample/valtest')
    has_gtk = true
else
    has_gtk = false
    message('Gtk not found, not building')
endif

nuget = find_program('nuget.py')
license_path = 'https://github.com/gtk-sharp'
project_uri = 'https://github.com/gtk-sharp'
icon_uri = 'https://upload.wikimedia.org/wikipedia/en/5/5f/Gtk_Sharp_Logo.png'
license_uri = 'https://github.com/gtk-sharp/gtk-sharp/blob/master/COPYING'

deps = []
foreach nugetinfo: nuget_infos
    # FIXME - Pass proper '--owner' and '--author'
    cmd = [nuget, '--package-name', nugetinfo[0], '--assembly', nugetinfo[1].full_path(),
            '--project-url', project_uri, '--icon-url', icon_uri, '--license-url',
            license_uri, '--version', version, '--tags', 'gtk bindings',
            '--builddir', meson.current_build_dir()]

    foreach dep: nugetinfo[2]
        cmd += ['--dependency=' + dep + pathsep + version]
    endforeach

    deps += [custom_target(nugetinfo[0] + '-nugget', command: cmd,
        depends: [nugetinfo[1]] + deps,
        output: nugetinfo[0] + '.' + version + '.nupkg')]
endforeach

if install
    gacutil_install = join_paths(meson.current_source_dir(), 'gacutil_install.py')
    meson.add_install_script(gacutil_install, install_infos)
endif