Skip to content

Commit 2f013dc

Browse files
authored
Meson updates (#113)
* meson: ignore subprojects/.wraplock Meson 1.9.0+ create it. * meson: update wraps to latest Fixes build failure in check if libsubunit is available. * meson: bump minimum version to 0.55 This is now sufficient for the oldest supported Debian and Ubuntu releases, and lets us assume dependency('foo') is sufficient for falling back to foo.wrap. Fixes Meson warning: WARNING: Project specifies a minimum meson_version '>=0.50' but uses features which were added in newer versions: * 0.54.0: {'fallback arg in dependency'} * workflows: configure with --fatal-meson-warnings Ensure Meson warnings are noticed, at the cost of occasionally allowing Meson updates to break CI. * meson: configure and run formatter Add a wrapper script to rerun it. * meson: sort file lists Convert file lists from arrays to files() so the formatter will sort them. * meson: don't build tests unless testing Meson 1.7.0+ respects build_by_default: false for tests.
1 parent c8b635c commit 2f013dc

8 files changed

Lines changed: 60 additions & 46 deletions

File tree

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ indent_size = 4
1313
[*.py]
1414
indent_style = space
1515
indent_size = 4
16+
17+
[meson.build]
18+
indent_size = 2
19+
20+
[meson_options.txt]
21+
indent_size = 2

.github/workflows/run_unit_tests.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ jobs:
5050

5151
- name: Install build and test dependencies (Windows)
5252
if: startsWith(matrix.os, 'windows')
53-
run: pip install meson ninja
53+
run: |
54+
# remove broken pkg-config that causes Meson warnings
55+
del 'C:\\Strawberry\\perl\\bin\\pkg-config'
56+
del 'C:\\Strawberry\\perl\\bin\\pkg-config.BAT'
57+
pip install meson ninja
5458
5559
- name: Build and install library
5660
shell: bash
@@ -76,7 +80,7 @@ jobs:
7680
esac
7781
;;
7882
esac
79-
meson setup builddir --werror $setup_args
83+
meson setup builddir --fatal-meson-warnings --werror $setup_args
8084
DEBUG_DICT=1 meson compile -C builddir
8185
$sudo meson install -C builddir
8286

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
tags
22
# Subprojects
3+
/subprojects/.wraplock
34
/subprojects/packagecache
45
/subprojects/check-*
56
/subprojects/uthash-*

meson.build

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@ project(
99
'buildtype=debugoptimized',
1010
],
1111
license : 'MIT',
12-
meson_version : '>=0.50',
13-
version : '1.2.0'
12+
meson_version : '>=0.55',
13+
version : '1.2.0',
1414
)
1515
if not meson.is_subproject()
16-
meson.add_dist_script(
17-
'scripts/dist.py'
18-
)
16+
meson.add_dist_script('scripts/dist.py')
1917
endif
2018

2119
# project version
@@ -46,7 +44,7 @@ abi_version = '@0@.@1@.@2@'.format(
4644
)
4745
darwin_library_versions = [
4846
abi_version_major + 1,
49-
'@0@.@1@'.format(abi_version_major + 1, abi_version_minor)
47+
'@0@.@1@'.format(abi_version_major + 1, abi_version_minor),
5048
]
5149

5250
# ready to be pasted into source files
@@ -68,32 +66,30 @@ if host_machine.system() == 'darwin' and not cc.has_header('stdio.h')
6866
# in advance.
6967
# https://github.com/mesonbuild/meson/issues/5290
7068
# https://github.com/mesonbuild/meson/issues/8206
71-
error('Basic environment check failed. Check compiler flags; building for multiple CPU architectures is not supported.')
69+
error(
70+
'Basic environment check failed. Check compiler flags; building for multiple CPU architectures is not supported.',
71+
)
7272
endif
7373
found_uthash = cc.check_header(
7474
'utarray.h',
75-
required : false
75+
required : false,
7676
) and cc.check_header(
7777
'uthash.h',
78-
required : false
78+
required : false,
7979
)
8080
if found_uthash
8181
uthash = declare_dependency()
8282
else
8383
# fall back to dependency() rather than subproject() so
8484
# --wrap-mode=nofallback works
85-
uthash = dependency(
86-
'uthash',
87-
fallback : ['uthash', 'uthash_dep'],
88-
)
85+
uthash = dependency('uthash')
8986
endif
9087
if get_option('tests')
9188
check = dependency(
9289
'check',
9390
default_options : [
9491
'warning_level=0',
9592
],
96-
fallback : ['check', 'check_dep'],
9793
version : '>=0.9.6',
9894
)
9995
endif
@@ -109,10 +105,10 @@ cfg.set_quoted(
109105
)
110106

111107
if cc.has_header('io.h')
112-
cfg.set('HAVE_IO_H', '1')
108+
cfg.set('HAVE_IO_H', '1')
113109
endif
114110
if cc.has_header('unistd.h')
115-
cfg.set('HAVE_UNISTD_H', '1')
111+
cfg.set('HAVE_UNISTD_H', '1')
116112
endif
117113

118114
configure_file(
@@ -134,9 +130,9 @@ add_project_arguments(
134130

135131
# include
136132
version_header = configure_file(
137-
input : 'include/dicom/version.h.in',
138-
output : 'version.h',
139-
configuration : version_data,
133+
input : 'include/dicom/version.h.in',
134+
output : 'version.h',
135+
configuration : version_data,
140136
)
141137

142138
install_headers(
@@ -150,7 +146,7 @@ library_includes = include_directories('include')
150146
library_options = ['-DBUILDING_LIBDICOM']
151147
dict_build = executable(
152148
'dicom-dict-build',
153-
['src/dicom-dict-build.c', 'src/dicom-dict-tables.c'],
149+
files('src/dicom-dict-build.c', 'src/dicom-dict-tables.c'),
154150
dependencies : [uthash],
155151
include_directories : library_includes,
156152
native : true,
@@ -160,17 +156,16 @@ dict_lookup = custom_target(
160156
command : [dict_build, '@OUTPUT@'],
161157
output : ['dicom-dict-lookup.c', 'dicom-dict-lookup.h'],
162158
)
163-
library_sources = [
164-
dict_lookup,
165-
'src/getopt.c',
166-
'src/dicom.c',
167-
'src/dicom-io.c',
159+
library_sources = [dict_lookup] + files(
168160
'src/dicom-data.c',
169-
'src/dicom-dict.c',
170161
'src/dicom-dict-tables.c',
162+
'src/dicom-dict.c',
171163
'src/dicom-file.c',
164+
'src/dicom-io.c',
172165
'src/dicom-parse.c',
173-
]
166+
'src/dicom.c',
167+
'src/getopt.c',
168+
)
174169
libdicom = library(
175170
'dicom',
176171
library_sources,
@@ -179,7 +174,7 @@ libdicom = library(
179174
version : abi_version,
180175
darwin_versions : darwin_library_versions,
181176
include_directories : library_includes,
182-
gnu_symbol_visibility: 'hidden',
177+
gnu_symbol_visibility : 'hidden',
183178
install : true,
184179
)
185180
import('pkgconfig').generate(
@@ -195,9 +190,7 @@ libdicom_dep = declare_dependency(
195190
include_directories : [library_includes, include_directories('.')],
196191
link_with : libdicom,
197192
)
198-
if meson.version().version_compare('>=0.54')
199-
meson.override_dependency('libdicom', libdicom_dep)
200-
endif
193+
meson.override_dependency('libdicom', libdicom_dep)
201194

202195
# tools
203196
executable(
@@ -233,7 +226,7 @@ subdir('doc/env/bin')
233226
custom_target(
234227
'html',
235228
command : [sphinx_build, '@SOURCE_ROOT@/doc/source', '@OUTPUT@'],
236-
input : [
229+
input : files(
237230
'doc/source/api.rst',
238231
'doc/source/conf.py',
239232
'doc/source/contributing.rst',
@@ -243,7 +236,7 @@ custom_target(
243236
'doc/source/tools.rst',
244237
'doc/source/usage.rst',
245238
'include/dicom/dicom.h',
246-
],
239+
),
247240
output : 'html',
248241
)
249242

@@ -253,6 +246,7 @@ if get_option('tests')
253246
'check_dicom',
254247
'tests/check_dicom.c',
255248
dependencies : [check, libdicom_dep],
249+
build_by_default : false,
256250
)
257251
test('check_dicom', check_dicom)
258252
endif

meson.format

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kwargs_force_multiline = true
2+
sort_files = true
3+
use_editor_config = true
4+
wide_colon = true

scripts/meson-format.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
3+
exec meson format -c meson.format -i -r

subprojects/check.wrap

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ directory = check-0.15.2
33
source_url = https://github.com/libcheck/check/archive/0.15.2.tar.gz
44
source_filename = check-0.15.2.tar.gz
55
source_hash = 998d355294bb94072f40584272cf4424571c396c631620ce463f6ea97aa67d2e
6-
patch_filename = check_0.15.2-4_patch.zip
7-
patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-4/get_patch
8-
patch_hash = 3e998eb0c475613e890c9e006420fb6da5dcee27aa2ba3f331f9253648691743
9-
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-4/check-0.15.2.tar.gz
10-
wrapdb_version = 0.15.2-4
6+
source_fallback_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-6/get_source/check-0.15.2.tar.gz
7+
patch_filename = check_0.15.2-6_patch.zip
8+
patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-6/get_patch
9+
patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-6/check_0.15.2-6_patch.zip
10+
patch_hash = ff3bebb5801fae479ab3686d95f91a77b572751eb891d9b9804933e8b9da94eb
11+
wrapdb_version = 0.15.2-6
1112

1213
[provide]
13-
check = check_dep
14+
dependency_names = check

subprojects/uthash.wrap

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ directory = uthash-2.3.0
33
source_url = https://github.com/troydhanson/uthash/archive/v2.3.0.tar.gz
44
source_filename = uthash-2.3.0.tar.gz
55
source_hash = e10382ab75518bad8319eb922ad04f907cb20cccb451a3aa980c9d005e661acc
6-
patch_filename = uthash_2.3.0-1_patch.zip
7-
patch_url = https://wrapdb.mesonbuild.com/v2/uthash_2.3.0-1/get_patch
8-
patch_hash = d0b7cf9788c3735ee6a08bb649c58be1f5fad4b95e50e7681cbdf44882da9d7e
6+
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/uthash_2.3.0-2/uthash-2.3.0.tar.gz
7+
patch_filename = uthash_2.3.0-2_patch.zip
8+
patch_url = https://wrapdb.mesonbuild.com/v2/uthash_2.3.0-2/get_patch
9+
patch_hash = d66806488ebd37246a160f62779e3eb3259b8cd35a978f7499daa0390923cd99
10+
wrapdb_version = 2.3.0-2
911

1012
[provide]
11-
uthash = uthash_dep
12-
13+
dependency_names = uthash

0 commit comments

Comments
 (0)