File: meson.build

package info (click to toggle)
totem-pl-parser 3.26.6-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 6,480 kB
  • sloc: ansic: 10,545; xml: 3,061; sh: 51; makefile: 13; php: 1
file content (243 lines) | stat: -rw-r--r-- 8,072 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
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
project('totem-pl-parser', 'c',
        version: '3.26.6', # Don't forget to also change plparser_lt_version!
        default_options: [
          'buildtype=debugoptimized',
          'warning_level=1',
        ],
        meson_version : '>= 0.40.1',
        license: 'LGPLv2.0+')

# Before making a release, the plparser_lt_version string should be modified.
# The string is of the form C:R:A.
# - If interfaces have been changed or added, but binary compatibility has
#   been preserved, change to C+1:0:A+1
# - If binary compatibility has been broken (eg removed or changed interfaces)
#   change to C+1:0:0
# - If the interface is the same as the previous version, change to C:R+1:A
plparser_lt_version='21:5:3'

plparse_version       = meson.project_version()
plparse_major_version = plparse_version.split('.')[0].to_int()
plparse_minor_version = plparse_version.split('.')[1].to_int()
plparse_micro_version = plparse_version.split('.')[2].to_int()

plparse_lt_current  = plparser_lt_version.split(':')[0].to_int()
plparse_lt_revision = plparser_lt_version.split(':')[1].to_int()
plparse_lt_age      = plparser_lt_version.split(':')[2].to_int()
plparse_soversion   = plparse_lt_current - plparse_lt_age
# Convert the lt_version to libtool library naming to maintain ABI compat with
# the old Autotools build. This can be changed with the next ABI break.
plparse_libversion  = '@0@.@1@.@2@'.format(plparse_soversion, plparse_lt_age, plparse_lt_revision)

# Requirements
glib_req    = '>= 2.56.0'
gio_req     = '>= 2.24.0'
archive_req = '>= 3.0'

# Dependencies
glib_dep = dependency('glib-2.0', version : glib_req)
gthread_dep = dependency('gthread-2.0', version : glib_req)
gio_dep = dependency('gio-2.0', version : gio_req)
xml_dep = dependency('libxml-2.0')

totem_pl_parser_deps = [glib_dep, xml_dep, gthread_dep, gio_dep]

# project-wide cflags
add_project_arguments('-D_GNU_SOURCE', language: 'c')

localedir = join_paths(get_option('prefix'), get_option('datadir'), 'locale')
add_project_arguments('-DGNOMELOCALEDIR="@0@"'.format(localedir), language: 'c')

# configuration data for config.h
cdata = configuration_data()
cdata.set_quoted('GETTEXT_PACKAGE', 'totem-pl-parser')

config_inc = include_directories('.')

# configuration data for pkg-config .pc.in files
pkgconf = configuration_data()

# common warning flags
cc = meson.get_compiler('c')

# Compiler flags
if cc.get_id() == 'msvc'
  # Compiler options taken from msvc_recommended_pragmas.h
  # in GLib, based on _Win32_Programming_ by Rector and Newcomer
  test_cflags = [
    '-we4002', # too many actual parameters for macro
    '-we4003', # not enough actual parameters for macro
    '-w14010', # single-line comment contains line-continuation character
    '-we4013', # 'function' undefined; assuming extern returning int
    '-w14016', # no function return type; using int as default
    '-we4020', # too many actual parameters
    '-we4021', # too few actual parameters
    '-we4027', # function declared without formal parameter list
    '-we4029', # declared formal parameter list different from definition
    '-we4033', # 'function' must return a value
    '-we4035', # 'function' : no return value
    '-we4045', # array bounds overflow
    '-we4047', # different levels of indirection
    '-we4049', # terminating line number emission
    '-we4053', # an expression of type void was used as an operand
    '-we4071', # no function prototype given
    '-we4819', # the file contains a character that cannot be represented in the current code page
  ]
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
  test_cflags = [
    '-fno-strict-aliasing',
    '-Wpointer-arith',
    '-Wmissing-declarations',
    '-Wimplicit-function-declaration',
    '-Wformat=2',
    '-Wformat-nonliteral',
    '-Wformat-security',
    '-Wstrict-prototypes',
    '-Wmissing-prototypes',
    '-Wnested-externs',
    '-Wold-style-definition',
    '-Wundef',
    '-Wunused',
    '-Wcast-align',
    '-Wmissing-noreturn',
    '-Wmissing-format-attribute',
    '-Wmissing-include-dirs',
    '-Wlogical-op',
    '-Wno-uninitialized',
    '-Wno-shadow',
    '-Wno-int-conversion',
    '-Wno-discarded-qualifiers',
    '-Werror=redundant-decls',
    '-Werror=implicit',
    '-Werror=nonnull',
    '-Werror=init-self',
    '-Werror=main',
    '-Werror=missing-braces',
    '-Werror=sequence-point',
    '-Werror=return-type',
    '-Werror=trigraphs',
    '-Werror=array-bounds',
    '-Werror=write-strings',
    '-Werror=address',
    '-Werror=int-to-pointer-cast',
    '-Werror=pointer-to-int-cast',
    '-Werror=empty-body',
    '-Werror=write-strings',
    '-Werror=maybe-uninitialized',
  ]
else
  test_cflags = []
endif

extra_warning_cflags = []
foreach cflag: test_cflags
  if cc.has_argument(cflag)
    extra_warning_cflags += [ cflag ]
  endif
endforeach

# uchardet dependency
enable_uchardet = get_option('enable-uchardet')
have_uchardet = false
if enable_uchardet != 'no'
  uchardet_dep = dependency('uchardet', required: false)
  if enable_uchardet == 'yes' and not uchardet_dep.found()
    error('uchardet support requested but not available.')
  endif
  if uchardet_dep.found()
    cdata.set('HAVE_UCHARDET', true,
      description: 'uchardet available in the system')
    have_uchardet = true
    totem_pl_parser_deps += [uchardet_dep]
  endif
endif

# libarchive dependency
enable_libarchive = get_option('enable-libarchive')
have_libarchive = false
pkgconf.set('ARCHIVE', '')
if enable_libarchive != 'no'
  libarchive_dep = dependency('libarchive', version: archive_req, required: false)
  if enable_libarchive == 'yes' and not libarchive_dep.found()
    error('libarchive support requested but not available.')
  endif
  if libarchive_dep.found()
    pkgconf.set('ARCHIVE', 'libarchive')
    cdata.set('HAVE_LIBARCHIVE', true,
      description: 'libarchive available in the system')
    have_libarchive = true
    totem_pl_parser_deps += [libarchive_dep]
  endif
endif

# libgcrypt dependency
enable_libgcrypt = get_option('enable-libgcrypt')
have_libgcrypt = false
pkgconf.set('GCRYPT', '')
if enable_libgcrypt != 'no'
  # presented without further comment: https://dev.gnupg.org/T2037
  libgcrypt_dep = cc.find_library('gcrypt', required : false)

  if enable_libgcrypt == 'yes' and not libgcrypt_dep.found()
    error('libgcrypt support requested but not available.')
  endif
  if libgcrypt_dep.found()
    # FIXME: we just assume it's in the standard path. We can't really parse
    # the output of libgcrypt-config in any meaningful way, since if any of
    # the paths have spaces in them it's all going to break.
    pkgconf.set('LIBGCRYPT_LIBS', '-lgcrypt')
    pkgconf.set('LIBGCRYPT_CFLAGS', '')
    cdata.set('HAVE_LIBGCRYPT', true,
      description: 'libgcrypt available in the system')
    have_libgcrypt = true
    totem_pl_parser_deps += [libgcrypt_dep]
  endif
endif

# subdirs

plparser_inc = include_directories('plparse')

subdir('lib')
subdir('plparse')
subdir('po')
if get_option('enable-gtk-doc')
  subdir('docs/reference')
endif

# config.h
configure_file(output: 'config.h', configuration: cdata)

# pkg-config files
pkgconf.set('prefix', get_option('prefix'))
pkgconf.set('exec_prefix', '${prefix}')
pkgconf.set('libdir', '${prefix}/@0@'.format(get_option('libdir')))
pkgconf.set('includedir', '${prefix}/@0@'.format(get_option('includedir')))
pkgconf.set('VERSION', meson.project_version())

pkg_install_dir = join_paths(get_option('libdir'), 'pkgconfig')

pkg_files = [
  'totem-plparser.pc',
  'totem-plparser-mini.pc',
]

foreach pkg: pkg_files
  configure_file(input: pkg + '.in',
                 output: pkg,
                 configuration: pkgconf,
                 install_dir: pkg_install_dir)
endforeach

# configuration summary
message('''

    Configuration summary:

      ISO detection with libarchive     : @0@
      AmazonAMZ decoding with libgcrypt : @1@
      uchardet encoding detection       : @2@
'''.format(have_libarchive.to_string('yes', 'no'),
           have_libgcrypt.to_string('yes', 'no'),
           have_uchardet.to_string('yes', 'no')))