From e4097dfc1f53941b38b719378dabbf031d8ab3d9 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 19:25:51 -0700 Subject: [PATCH 1/7] meson: ignore subprojects/.wraplock Meson 1.9.0+ create it. --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a0edbfb..3b59162 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ tags # Subprojects +/subprojects/.wraplock /subprojects/packagecache /subprojects/check-* /subprojects/uthash-* From 65c162721edcd3003c6bf867001f6f5e4801a277 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 19:27:49 -0700 Subject: [PATCH 2/7] meson: update wraps to latest Fixes build failure in check if libsubunit is available. --- subprojects/check.wrap | 13 +++++++------ subprojects/uthash.wrap | 11 ++++++----- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/subprojects/check.wrap b/subprojects/check.wrap index 0d93bc5..a053e54 100644 --- a/subprojects/check.wrap +++ b/subprojects/check.wrap @@ -3,11 +3,12 @@ directory = check-0.15.2 source_url = https://github.com/libcheck/check/archive/0.15.2.tar.gz source_filename = check-0.15.2.tar.gz source_hash = 998d355294bb94072f40584272cf4424571c396c631620ce463f6ea97aa67d2e -patch_filename = check_0.15.2-4_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-4/get_patch -patch_hash = 3e998eb0c475613e890c9e006420fb6da5dcee27aa2ba3f331f9253648691743 -source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-4/check-0.15.2.tar.gz -wrapdb_version = 0.15.2-4 +source_fallback_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-6/get_source/check-0.15.2.tar.gz +patch_filename = check_0.15.2-6_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/check_0.15.2-6/get_patch +patch_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/check_0.15.2-6/check_0.15.2-6_patch.zip +patch_hash = ff3bebb5801fae479ab3686d95f91a77b572751eb891d9b9804933e8b9da94eb +wrapdb_version = 0.15.2-6 [provide] -check = check_dep +dependency_names = check diff --git a/subprojects/uthash.wrap b/subprojects/uthash.wrap index 7108052..e834dad 100644 --- a/subprojects/uthash.wrap +++ b/subprojects/uthash.wrap @@ -3,10 +3,11 @@ directory = uthash-2.3.0 source_url = https://github.com/troydhanson/uthash/archive/v2.3.0.tar.gz source_filename = uthash-2.3.0.tar.gz source_hash = e10382ab75518bad8319eb922ad04f907cb20cccb451a3aa980c9d005e661acc -patch_filename = uthash_2.3.0-1_patch.zip -patch_url = https://wrapdb.mesonbuild.com/v2/uthash_2.3.0-1/get_patch -patch_hash = d0b7cf9788c3735ee6a08bb649c58be1f5fad4b95e50e7681cbdf44882da9d7e +source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/uthash_2.3.0-2/uthash-2.3.0.tar.gz +patch_filename = uthash_2.3.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/uthash_2.3.0-2/get_patch +patch_hash = d66806488ebd37246a160f62779e3eb3259b8cd35a978f7499daa0390923cd99 +wrapdb_version = 2.3.0-2 [provide] -uthash = uthash_dep - +dependency_names = uthash From 6839f59340e1f01400e556537e3fdf358690bfa4 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 19:32:48 -0700 Subject: [PATCH 3/7] 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'} --- meson.build | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index 07fd96f..79179df 100644 --- a/meson.build +++ b/meson.build @@ -9,7 +9,7 @@ project( 'buildtype=debugoptimized', ], license : 'MIT', - meson_version : '>=0.50', + meson_version : '>=0.55', version : '1.2.0' ) if not meson.is_subproject() @@ -82,10 +82,7 @@ if found_uthash else # fall back to dependency() rather than subproject() so # --wrap-mode=nofallback works - uthash = dependency( - 'uthash', - fallback : ['uthash', 'uthash_dep'], - ) + uthash = dependency('uthash') endif if get_option('tests') check = dependency( @@ -93,7 +90,6 @@ if get_option('tests') default_options : [ 'warning_level=0', ], - fallback : ['check', 'check_dep'], version : '>=0.9.6', ) endif @@ -195,9 +191,7 @@ libdicom_dep = declare_dependency( include_directories : [library_includes, include_directories('.')], link_with : libdicom, ) -if meson.version().version_compare('>=0.54') - meson.override_dependency('libdicom', libdicom_dep) -endif +meson.override_dependency('libdicom', libdicom_dep) # tools executable( From e6dc563eede3be2fc72216ba4b4bd9135a9c1798 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 19:36:42 -0700 Subject: [PATCH 4/7] workflows: configure with --fatal-meson-warnings Ensure Meson warnings are noticed, at the cost of occasionally allowing Meson updates to break CI. --- .github/workflows/run_unit_tests.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_unit_tests.yml b/.github/workflows/run_unit_tests.yml index f8a5c2f..b00214a 100644 --- a/.github/workflows/run_unit_tests.yml +++ b/.github/workflows/run_unit_tests.yml @@ -50,7 +50,11 @@ jobs: - name: Install build and test dependencies (Windows) if: startsWith(matrix.os, 'windows') - run: pip install meson ninja + run: | + # remove broken pkg-config that causes Meson warnings + del 'C:\\Strawberry\\perl\\bin\\pkg-config' + del 'C:\\Strawberry\\perl\\bin\\pkg-config.BAT' + pip install meson ninja - name: Build and install library shell: bash @@ -76,7 +80,7 @@ jobs: esac ;; esac - meson setup builddir --werror $setup_args + meson setup builddir --fatal-meson-warnings --werror $setup_args DEBUG_DICT=1 meson compile -C builddir $sudo meson install -C builddir From 5996352c3d671f9895171dd47a43dc0053963ac1 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 19:58:28 -0700 Subject: [PATCH 5/7] meson: configure and run formatter Add a wrapper script to rerun it. --- .editorconfig | 6 ++++++ meson.build | 28 ++++++++++++++-------------- meson.format | 4 ++++ scripts/meson-format.sh | 3 +++ 4 files changed, 27 insertions(+), 14 deletions(-) create mode 100644 meson.format create mode 100755 scripts/meson-format.sh diff --git a/.editorconfig b/.editorconfig index 866dff8..c936dfc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -13,3 +13,9 @@ indent_size = 4 [*.py] indent_style = space indent_size = 4 + +[meson.build] +indent_size = 2 + +[meson_options.txt] +indent_size = 2 diff --git a/meson.build b/meson.build index 79179df..f8acc74 100644 --- a/meson.build +++ b/meson.build @@ -10,12 +10,10 @@ project( ], license : 'MIT', meson_version : '>=0.55', - version : '1.2.0' + version : '1.2.0', ) if not meson.is_subproject() - meson.add_dist_script( - 'scripts/dist.py' - ) + meson.add_dist_script('scripts/dist.py') endif # project version @@ -46,7 +44,7 @@ abi_version = '@0@.@1@.@2@'.format( ) darwin_library_versions = [ abi_version_major + 1, - '@0@.@1@'.format(abi_version_major + 1, abi_version_minor) + '@0@.@1@'.format(abi_version_major + 1, abi_version_minor), ] # ready to be pasted into source files @@ -68,14 +66,16 @@ if host_machine.system() == 'darwin' and not cc.has_header('stdio.h') # in advance. # https://github.com/mesonbuild/meson/issues/5290 # https://github.com/mesonbuild/meson/issues/8206 - error('Basic environment check failed. Check compiler flags; building for multiple CPU architectures is not supported.') + error( + 'Basic environment check failed. Check compiler flags; building for multiple CPU architectures is not supported.', + ) endif found_uthash = cc.check_header( 'utarray.h', - required : false + required : false, ) and cc.check_header( 'uthash.h', - required : false + required : false, ) if found_uthash uthash = declare_dependency() @@ -105,10 +105,10 @@ cfg.set_quoted( ) if cc.has_header('io.h') - cfg.set('HAVE_IO_H', '1') + cfg.set('HAVE_IO_H', '1') endif if cc.has_header('unistd.h') - cfg.set('HAVE_UNISTD_H', '1') + cfg.set('HAVE_UNISTD_H', '1') endif configure_file( @@ -130,9 +130,9 @@ add_project_arguments( # include version_header = configure_file( - input : 'include/dicom/version.h.in', - output : 'version.h', - configuration : version_data, + input : 'include/dicom/version.h.in', + output : 'version.h', + configuration : version_data, ) install_headers( @@ -175,7 +175,7 @@ libdicom = library( version : abi_version, darwin_versions : darwin_library_versions, include_directories : library_includes, - gnu_symbol_visibility: 'hidden', + gnu_symbol_visibility : 'hidden', install : true, ) import('pkgconfig').generate( diff --git a/meson.format b/meson.format new file mode 100644 index 0000000..20d5416 --- /dev/null +++ b/meson.format @@ -0,0 +1,4 @@ +kwargs_force_multiline = true +sort_files = true +use_editor_config = true +wide_colon = true diff --git a/scripts/meson-format.sh b/scripts/meson-format.sh new file mode 100755 index 0000000..0ad97bf --- /dev/null +++ b/scripts/meson-format.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +exec meson format -c meson.format -i -r From f96178be4a480b608d3ee84f4b740ff945312e31 Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 20:01:31 -0700 Subject: [PATCH 6/7] meson: sort file lists Convert file lists from arrays to files() so the formatter will sort them. --- meson.build | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index f8acc74..32d8bfe 100644 --- a/meson.build +++ b/meson.build @@ -146,7 +146,7 @@ library_includes = include_directories('include') library_options = ['-DBUILDING_LIBDICOM'] dict_build = executable( 'dicom-dict-build', - ['src/dicom-dict-build.c', 'src/dicom-dict-tables.c'], + files('src/dicom-dict-build.c', 'src/dicom-dict-tables.c'), dependencies : [uthash], include_directories : library_includes, native : true, @@ -156,17 +156,16 @@ dict_lookup = custom_target( command : [dict_build, '@OUTPUT@'], output : ['dicom-dict-lookup.c', 'dicom-dict-lookup.h'], ) -library_sources = [ - dict_lookup, - 'src/getopt.c', - 'src/dicom.c', - 'src/dicom-io.c', +library_sources = [dict_lookup] + files( 'src/dicom-data.c', - 'src/dicom-dict.c', 'src/dicom-dict-tables.c', + 'src/dicom-dict.c', 'src/dicom-file.c', + 'src/dicom-io.c', 'src/dicom-parse.c', -] + 'src/dicom.c', + 'src/getopt.c', +) libdicom = library( 'dicom', library_sources, @@ -227,7 +226,7 @@ subdir('doc/env/bin') custom_target( 'html', command : [sphinx_build, '@SOURCE_ROOT@/doc/source', '@OUTPUT@'], - input : [ + input : files( 'doc/source/api.rst', 'doc/source/conf.py', 'doc/source/contributing.rst', @@ -237,7 +236,7 @@ custom_target( 'doc/source/tools.rst', 'doc/source/usage.rst', 'include/dicom/dicom.h', - ], + ), output : 'html', ) From bfc7bcae7c2789b186f9205e255663d91677761d Mon Sep 17 00:00:00 2001 From: Benjamin Gilbert Date: Thu, 19 Mar 2026 20:06:46 -0700 Subject: [PATCH 7/7] meson: don't build tests unless testing Meson 1.7.0+ respects build_by_default: false for tests. --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 32d8bfe..a7c8751 100644 --- a/meson.build +++ b/meson.build @@ -246,6 +246,7 @@ if get_option('tests') 'check_dicom', 'tests/check_dicom.c', dependencies : [check, libdicom_dep], + build_by_default : false, ) test('check_dicom', check_dicom) endif