From 2ce0aee84ef22f6674abff00f429102e948a0a8f Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Sun, 5 Jul 2026 11:53:15 +0900 Subject: [PATCH 1/3] feat(build): Add system_stb option This allows building against the system stb library instead of the vendored one. The option is disabled by default to retain the default behavior. --- README.md | 4 ++-- meson.build | 10 +++++++--- meson_options.txt | 1 + 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ece402bd40..307bac3265 100644 --- a/README.md +++ b/README.md @@ -179,10 +179,10 @@ sudo xbps-install meson ninja pkg-config git \ ``` Vendored dependencies, with no system package needed: `Wuffs`, -`nlohmann/json`, `Luau`, `dr_wav`, `fzy`, `stb_image_resize2`, and Material Color Utilities. +`nlohmann/json`, `Luau`, `dr_wav`, `fzy`, and Material Color Utilities. Dependencies that are vendored by default, with a meson option to instead use the system package: `md4c`, -`tomlplusplus` +`tomlplusplus`, `stb` System packages required beyond the Wayland/GL stack: `libwebp` handles WebP decoding and thumbnail encoding. Wuffs handles the other supported raster image formats. `libqalculate` powers the launcher calculator (arithmetic, unit and diff --git a/meson.build b/meson.build index e5f71a802a..ecad1d66b8 100644 --- a/meson.build +++ b/meson.build @@ -174,9 +174,13 @@ mcu_dep = declare_dependency( ) # ── Vendored: stb_image_resize2 (header-only) ───────────────────────────────── -stb_dep = declare_dependency( - include_directories: include_directories('third_party/stb', is_system: true), -) +if get_option('system_stb') + stb_dep = dependency('stb', include_type: 'system') +else + stb_dep = declare_dependency( + include_directories: include_directories('third_party/stb', is_system: true), + ) +endif # ── Vendored: tomlplusplus (header-only) ───────────────────────────────── if get_option('system_tomlplusplus') diff --git a/meson_options.txt b/meson_options.txt index c93c01ce00..6c74192ca9 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,3 +2,4 @@ option('jemalloc', type: 'feature', value: 'auto', description: 'Use jemalloc on option('tests', type: 'feature', value: 'auto', description: 'Build unit tests (auto: on for unsanitized debug builds)') option('system_md4c', type: 'boolean', value: false, description: 'Use system md4c instead of vendored') option('system_tomlplusplus', type: 'boolean', value: false, description: 'Use system tomlplusplus instead of vendored') +option('system_stb', type: 'boolean', value: false, description: 'Use system tomlplusplus instead of vendored') From 87119e8f128fe16c2aaa36ddd661eba4b0caf0d0 Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Mon, 6 Jul 2026 08:27:33 +0900 Subject: [PATCH 2/3] Fix system_stb option description --- meson_options.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson_options.txt b/meson_options.txt index 6c74192ca9..1b26b6d3c1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,4 +2,4 @@ option('jemalloc', type: 'feature', value: 'auto', description: 'Use jemalloc on option('tests', type: 'feature', value: 'auto', description: 'Build unit tests (auto: on for unsanitized debug builds)') option('system_md4c', type: 'boolean', value: false, description: 'Use system md4c instead of vendored') option('system_tomlplusplus', type: 'boolean', value: false, description: 'Use system tomlplusplus instead of vendored') -option('system_stb', type: 'boolean', value: false, description: 'Use system tomlplusplus instead of vendored') +option('system_stb', type: 'boolean', value: false, description: 'Use system stb instead of vendored') From 897b5a0b01d4538e2849fcf38e58c2318fc9aef2 Mon Sep 17 00:00:00 2001 From: Nick Hastings Date: Mon, 6 Jul 2026 09:05:16 +0900 Subject: [PATCH 3/3] Update stb option Replace bool system_stb option with a string stb_headers option which can be used to specify an alternate path to the default `third_party/stb`. This would typically be set to /usr/include/stb to use the system stb headers. --- meson.build | 10 +++------- meson_options.txt | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index ecad1d66b8..fd39a345aa 100644 --- a/meson.build +++ b/meson.build @@ -174,13 +174,9 @@ mcu_dep = declare_dependency( ) # ── Vendored: stb_image_resize2 (header-only) ───────────────────────────────── -if get_option('system_stb') - stb_dep = dependency('stb', include_type: 'system') -else - stb_dep = declare_dependency( - include_directories: include_directories('third_party/stb', is_system: true), - ) -endif +stb_dep = declare_dependency( + include_directories: include_directories(get_option('stb_headers'), is_system: true), +) # ── Vendored: tomlplusplus (header-only) ───────────────────────────────── if get_option('system_tomlplusplus') diff --git a/meson_options.txt b/meson_options.txt index 1b26b6d3c1..30ac2ba224 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,4 +2,4 @@ option('jemalloc', type: 'feature', value: 'auto', description: 'Use jemalloc on option('tests', type: 'feature', value: 'auto', description: 'Build unit tests (auto: on for unsanitized debug builds)') option('system_md4c', type: 'boolean', value: false, description: 'Use system md4c instead of vendored') option('system_tomlplusplus', type: 'boolean', value: false, description: 'Use system tomlplusplus instead of vendored') -option('system_stb', type: 'boolean', value: false, description: 'Use system stb instead of vendored') +option('stb_headers', type: 'string', value: 'third_party/stb', description: 'Path to stb header files')