projects/guix·blob python-team · refs

280 lines · 12.3 KiB

1Use guix-packaged libraries instead of the vendored code.
2
3diff --git a/meson.build b/meson.build
4index 2f1b24102..80422067b 100644
5--- a/meson.build
6+++ b/meson.build
7@@ -133,66 +133,16 @@ if not gles2_dep.found()
8 endif
9
10
11-# ── Vendored: fzy matcher (C fuzzy scoring) ──────────────────────────────────
12-_fzy_lib = static_library('fzy',
13- 'third_party/fzy/src/match.c',
14- c_args: ['-Wno-pedantic', '-Wno-conversion'],
15- override_options: ['warning_level=0'],
16-)
17-fzy_dep = declare_dependency(
18- link_whole: _fzy_lib,
19- include_directories: include_directories('third_party/fzy/src', is_system: true),
20-)
21-
22-# ── Vendored: Material Color Utilities (Google) ───────────────────────────────
23-# Upstream uses #include "cpp/..." prefixes, so the include root is the
24-# material_color_utilities/ dir itself. Built as a quiet static library.
25-_mcu_sources = files(
26- 'third_party/material_color_utilities/cpp/blend/blend.cc',
27- 'third_party/material_color_utilities/cpp/cam/cam.cc',
28- 'third_party/material_color_utilities/cpp/cam/hct.cc',
29- 'third_party/material_color_utilities/cpp/cam/hct_solver.cc',
30- 'third_party/material_color_utilities/cpp/cam/viewing_conditions.cc',
31- 'third_party/material_color_utilities/cpp/contrast/contrast.cc',
32- 'third_party/material_color_utilities/cpp/dislike/dislike.cc',
33- 'third_party/material_color_utilities/cpp/dynamiccolor/dynamic_color.cc',
34- 'third_party/material_color_utilities/cpp/dynamiccolor/dynamic_scheme.cc',
35- 'third_party/material_color_utilities/cpp/dynamiccolor/material_dynamic_colors.cc',
36- 'third_party/material_color_utilities/cpp/palettes/tones.cc',
37- 'third_party/material_color_utilities/cpp/quantize/celebi.cc',
38- 'third_party/material_color_utilities/cpp/quantize/lab.cc',
39- 'third_party/material_color_utilities/cpp/quantize/wsmeans.cc',
40- 'third_party/material_color_utilities/cpp/quantize/wu.cc',
41- 'third_party/material_color_utilities/cpp/scheme/scheme_content.cc',
42- 'third_party/material_color_utilities/cpp/scheme/scheme_expressive.cc',
43- 'third_party/material_color_utilities/cpp/scheme/scheme_fidelity.cc',
44- 'third_party/material_color_utilities/cpp/scheme/scheme_fruit_salad.cc',
45- 'third_party/material_color_utilities/cpp/scheme/scheme_monochrome.cc',
46- 'third_party/material_color_utilities/cpp/scheme/scheme_neutral.cc',
47- 'third_party/material_color_utilities/cpp/scheme/scheme_rainbow.cc',
48- 'third_party/material_color_utilities/cpp/scheme/scheme_tonal_spot.cc',
49- 'third_party/material_color_utilities/cpp/scheme/scheme_vibrant.cc',
50- 'third_party/material_color_utilities/cpp/score/score.cc',
51- 'third_party/material_color_utilities/cpp/temperature/temperature_cache.cc',
52- 'third_party/material_color_utilities/cpp/utils/utils.cc',
53-)
54-_mcu_lib = static_library('material_color_utilities',
55- _mcu_sources,
56- include_directories: include_directories('third_party/material_color_utilities', is_system: true),
57- cpp_args: ['-Wno-pedantic', '-Wno-conversion', '-Wno-shadow', '-Wno-unused-parameter'],
58- override_options: ['warning_level=0'],
59-)
60-mcu_dep = declare_dependency(
61- link_whole: _mcu_lib,
62- include_directories: include_directories('third_party/material_color_utilities', is_system: true),
63-)
64+# ── System: fzy and Material Color Utilities ────────────────────────────────
65+fzy_dep = cc.find_library('fzy', required: true)
66+mcu_dep = cc.find_library('material-color-utilities', required: true)
67
68 # ── System: stb_image_resize2 and stb_image_write (header-only) ─────────────────────────────────
69-if not cc.has_header('stb/stb_image_resize2.h')
70- error('stb/stb_image_resize2.h not found')
71+if not cc.has_header('stb_image_resize2.h')
72+ error('stb_image_resize2.h not found')
73 endif
74-if not cc.has_header('stb/stb_image_write.h')
75- error('stb/stb_image_write.h not found')
76+if not cc.has_header('stb_image_write.h')
77+ error('stb_image_write.h not found')
78 endif
79
80 # ── System: libwebp (WebP decode and thumbnail encode) ───────────────────────
81@@ -205,103 +155,25 @@ libjxl_threads_dep = dependency('libjxl_threads', required: true)
82 # ── System: libsndfile (sound effect decoding) ───────────────────────────────
83 sndfile_dep = dependency('sndfile', required: true)
84
85-# ── Vendored: Luau (Roblox's Lua fork) ────────────────────────────────────────
86-# Built as a quiet static library; only VM + Compiler + Bytecode + Ast + Common are vendored.
87-_luau_sources = files(
88- 'third_party/luau/Common/src/BytecodeWire.cpp',
89- 'third_party/luau/Common/src/StringUtils.cpp',
90- 'third_party/luau/Common/src/TimeTrace.cpp',
91- 'third_party/luau/Ast/src/Allocator.cpp',
92- 'third_party/luau/Ast/src/Ast.cpp',
93- 'third_party/luau/Ast/src/Confusables.cpp',
94- 'third_party/luau/Ast/src/Cst.cpp',
95- 'third_party/luau/Ast/src/Lexer.cpp',
96- 'third_party/luau/Ast/src/Location.cpp',
97- 'third_party/luau/Ast/src/Parser.cpp',
98- 'third_party/luau/Ast/src/PrettyPrinter.cpp',
99- 'third_party/luau/Bytecode/src/BytecodeBuilder.cpp',
100- 'third_party/luau/Bytecode/src/BytecodeGraph.cpp',
101- 'third_party/luau/Compiler/src/BuiltinFolding.cpp',
102- 'third_party/luau/Compiler/src/Builtins.cpp',
103- 'third_party/luau/Compiler/src/Compiler.cpp',
104- 'third_party/luau/Compiler/src/ConstantFolding.cpp',
105- 'third_party/luau/Compiler/src/CostModel.cpp',
106- 'third_party/luau/Compiler/src/lcode.cpp',
107- 'third_party/luau/Compiler/src/TableShape.cpp',
108- 'third_party/luau/Compiler/src/Types.cpp',
109- 'third_party/luau/Compiler/src/ValueTracking.cpp',
110- 'third_party/luau/VM/src/lapi.cpp',
111- 'third_party/luau/VM/src/laux.cpp',
112- 'third_party/luau/VM/src/lbaselib.cpp',
113- 'third_party/luau/VM/src/lbitlib.cpp',
114- 'third_party/luau/VM/src/lbuffer.cpp',
115- 'third_party/luau/VM/src/lbuflib.cpp',
116- 'third_party/luau/VM/src/lbuiltins.cpp',
117- 'third_party/luau/VM/src/lcorolib.cpp',
118- 'third_party/luau/VM/src/ldblib.cpp',
119- 'third_party/luau/VM/src/ldebug.cpp',
120- 'third_party/luau/VM/src/ldo.cpp',
121- 'third_party/luau/VM/src/lfunc.cpp',
122- 'third_party/luau/VM/src/lgc.cpp',
123- 'third_party/luau/VM/src/lgcdebug.cpp',
124- 'third_party/luau/VM/src/linit.cpp',
125- 'third_party/luau/VM/src/lintlib.cpp',
126- 'third_party/luau/VM/src/lclass.cpp',
127- 'third_party/luau/VM/src/lclasslib.cpp',
128- 'third_party/luau/VM/src/lmathlib.cpp',
129- 'third_party/luau/VM/src/lmem.cpp',
130- 'third_party/luau/VM/src/lnumprint.cpp',
131- 'third_party/luau/VM/src/lobject.cpp',
132- 'third_party/luau/VM/src/loslib.cpp',
133- 'third_party/luau/VM/src/lperf.cpp',
134- 'third_party/luau/VM/src/lstate.cpp',
135- 'third_party/luau/VM/src/lstring.cpp',
136- 'third_party/luau/VM/src/lstrlib.cpp',
137- 'third_party/luau/VM/src/ltable.cpp',
138- 'third_party/luau/VM/src/ltablib.cpp',
139- 'third_party/luau/VM/src/ltm.cpp',
140- 'third_party/luau/VM/src/ludata.cpp',
141- 'third_party/luau/VM/src/lutf8lib.cpp',
142- 'third_party/luau/VM/src/lveclib.cpp',
143- 'third_party/luau/VM/src/lvmexecute.cpp',
144- 'third_party/luau/VM/src/lvmload.cpp',
145- 'third_party/luau/VM/src/lvmutils.cpp',
146-)
147-_luau_inc = include_directories(
148- 'third_party/luau/Common/include',
149- 'third_party/luau/Ast/include',
150- 'third_party/luau/Bytecode/include',
151- 'third_party/luau/Compiler/include',
152- 'third_party/luau/VM/include',
153- 'third_party/luau/VM/src',
154- is_system: true,
155-)
156-_luau_lib = static_library('luau',
157- _luau_sources,
158- include_directories: _luau_inc,
159- cpp_args: ['-w'],
160- override_options: ['warning_level=0'],
161-)
162+# ── System: Luau ─────────────────────────────────────────────────────────────
163+luau_compiler_dep = cc.find_library('Luau.Compiler', required: true, static: true)
164+luau_ast_dep = cc.find_library('Luau.Ast', required: true, static: true)
165+luau_bytecode_dep = cc.find_library('Luau.Bytecode', required: true, static: true)
166+luau_vm_dep = cc.find_library('Luau.VM', required: true, static: true)
167+luau_common_dep = cc.find_library('Luau.Common', required: true, static: true)
168 luau_dep = declare_dependency(
169- link_whole: _luau_lib,
170- include_directories: _luau_inc,
171+ dependencies: [
172+ luau_compiler_dep,
173+ luau_ast_dep,
174+ luau_bytecode_dep,
175+ luau_vm_dep,
176+ luau_common_dep,
177+ ],
178 )
179
180-# Tests link vendored archives selectively. The application keeps link_whole so
181-# release LTO sees every member, but propagating that policy to every small test
182-# would embed all vendored code in every test executable.
183-_fzy_selective_dep = declare_dependency(
184- link_with: _fzy_lib,
185- include_directories: include_directories('third_party/fzy/src', is_system: true),
186-)
187-_mcu_selective_dep = declare_dependency(
188- link_with: _mcu_lib,
189- include_directories: include_directories('third_party/material_color_utilities', is_system: true),
190-)
191-_luau_selective_dep = declare_dependency(
192- link_with: _luau_lib,
193- include_directories: _luau_inc,
194-)
195+_fzy_selective_dep = fzy_dep
196+_mcu_selective_dep = mcu_dep
197+_luau_selective_dep = luau_dep
198
199 # ── Wayland protocol generation ───────────────────────────────────────────────
200 wayland_scanner = find_program('wayland-scanner')
201@@ -972,7 +844,6 @@ endif
202 # ── Include directories ────────────────────────────────────────────────────────
203 _noctalia_inc = [
204 include_directories('src'),
205- include_directories('third_party/wuffs', is_system: true),
206 # '.' adds both the source root and the corresponding build-dir root, so
207 # generated protocol headers (written to the build root) are found by #include.
208 include_directories('.'),
209diff --git a/src/capture/screenshot_service.cpp b/src/capture/screenshot_service.cpp
210index f7559bb5f..e446abad9 100644
211--- a/src/capture/screenshot_service.cpp
212+++ b/src/capture/screenshot_service.cpp
213@@ -34,7 +34,7 @@
214 #include <filesystem>
215 #include <format>
216 #include <fstream>
217-#include <stb/stb_image_resize2.h>
218+#include <stb_image_resize2.h>
219 #include <sys/wait.h>
220 #include <thread>
221 #include <unistd.h>
222diff --git a/src/render/core/image_encoder.cpp b/src/render/core/image_encoder.cpp
223index d7b61ae3d..bdce31aed 100644
224--- a/src/render/core/image_encoder.cpp
225+++ b/src/render/core/image_encoder.cpp
226@@ -1,7 +1,7 @@
227 #include "render/core/image_encoder.h"
228
229 #define STB_IMAGE_WRITE_IMPLEMENTATION
230-#include "stb/stb_image_write.h"
231+#include "stb_image_write.h"
232
233 #include <cstring>
234
235diff --git a/src/render/core/image_file_loader.cpp b/src/render/core/image_file_loader.cpp
236index d5764ba01..01ef2528c 100644
237--- a/src/render/core/image_file_loader.cpp
238+++ b/src/render/core/image_file_loader.cpp
239@@ -10,7 +10,7 @@
240 #include <cstdint>
241 #include <cstring>
242 #include <expected>
243-#include <stb/stb_image_resize2.h>
244+#include <stb_image_resize2.h>
245 #include <string_view>
246 #pragma GCC diagnostic push
247 #pragma GCC diagnostic ignored "-Wexpansion-to-defined"
248diff --git a/src/render/core/stb_image_resize_impl.cpp b/src/render/core/stb_image_resize_impl.cpp
249index 20dc1b3ff..2ba1cce54 100644
250--- a/src/render/core/stb_image_resize_impl.cpp
251+++ b/src/render/core/stb_image_resize_impl.cpp
252@@ -1,2 +1,2 @@
253 #define STB_IMAGE_RESIZE_IMPLEMENTATION
254-#include <stb/stb_image_resize2.h>
255+#include <stb_image_resize2.h>
256diff --git a/src/render/core/thumbnail_service.cpp b/src/render/core/thumbnail_service.cpp
257index 3debb1057..9b9f8bb28 100644
258--- a/src/render/core/thumbnail_service.cpp
259+++ b/src/render/core/thumbnail_service.cpp
260@@ -13,7 +13,7 @@
261 #include <filesystem>
262 #include <fstream>
263 #include <optional>
264-#include <stb/stb_image_resize2.h>
265+#include <stb_image_resize2.h>
266 #include <sys/eventfd.h>
267 #include <system_error>
268 #include <unistd.h>
269diff --git a/src/util/fuzzy_match.cpp b/src/util/fuzzy_match.cpp
270index 713fee25a..1875b2fc0 100644
271--- a/src/util/fuzzy_match.cpp
272+++ b/src/util/fuzzy_match.cpp
273@@ -1,6 +1,6 @@
274 #include "util/fuzzy_match.h"
275
276-#include "match.h"
277+#include <fzy/match.h>
278 #include "util/string_utils.h"
279
280 #include <cmath>