summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar Michael Chaten2025-09-14 04:11:09 -0700
committerGravatar Michael Chaten2025-09-14 04:11:09 -0700
commit749197a3f9d25e211615960c02380a3d659b20f9 (patch)
tree9c892349f0a7136edb150f27f549dc182f7699bb /build.zig
parentUpdate codebase to Zig 0.15.1. (diff)
downloadzg-749197a3f9d25e211615960c02380a3d659b20f9.tar.gz
zg-749197a3f9d25e211615960c02380a3d659b20f9.tar.xz
zg-749197a3f9d25e211615960c02380a3d659b20f9.zip
Embed data files in scripts rather than relying on filesystem access for easier packaging
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index 67a009a..5678cd1 100644
--- a/build.zig
+++ b/build.zig
@@ -48,6 +48,9 @@ pub fn build(b: *std.Build) void {
48 .optimize = .Debug, 48 .optimize = .Debug,
49 }), 49 }),
50 }); 50 });
51 gbp_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
52 gbp_gen_exe.root_module.addAnonymousImport("GraphemeBreakProperty.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/GraphemeBreakProperty.txt") });
53 gbp_gen_exe.root_module.addAnonymousImport("emoji-data.txt", .{ .root_source_file = b.path("data/unicode/emoji/emoji-data.txt") });
51 const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); 54 const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe);
52 const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z"); 55 const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z");
53 56
@@ -59,6 +62,7 @@ pub fn build(b: *std.Build) void {
59 .optimize = .Debug, 62 .optimize = .Debug,
60 }), 63 }),
61 }); 64 });
65 wbp_gen_exe.root_module.addAnonymousImport("WordBreakProperty.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/WordBreakProperty.txt") });
62 const run_wbp_gen_exe = b.addRunArtifact(wbp_gen_exe); 66 const run_wbp_gen_exe = b.addRunArtifact(wbp_gen_exe);
63 const wbp_gen_out = run_wbp_gen_exe.addOutputFileArg("wbp.bin.z"); 67 const wbp_gen_out = run_wbp_gen_exe.addOutputFileArg("wbp.bin.z");
64 68
@@ -70,6 +74,8 @@ pub fn build(b: *std.Build) void {
70 .optimize = .Debug, 74 .optimize = .Debug,
71 }), 75 }),
72 }); 76 });
77 dwp_gen_exe.root_module.addAnonymousImport("DerivedEastAsianWidth.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedEastAsianWidth.txt") });
78 dwp_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") });
73 dwp_gen_exe.root_module.addOptions("options", dwp_options); 79 dwp_gen_exe.root_module.addOptions("options", dwp_options);
74 const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); 80 const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe);
75 const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.bin.z"); 81 const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.bin.z");
@@ -83,6 +89,7 @@ pub fn build(b: *std.Build) void {
83 .optimize = .Debug, 89 .optimize = .Debug,
84 }), 90 }),
85 }); 91 });
92 canon_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
86 const run_canon_gen_exe = b.addRunArtifact(canon_gen_exe); 93 const run_canon_gen_exe = b.addRunArtifact(canon_gen_exe);
87 const canon_gen_out = run_canon_gen_exe.addOutputFileArg("canon.bin.z"); 94 const canon_gen_out = run_canon_gen_exe.addOutputFileArg("canon.bin.z");
88 95
@@ -94,6 +101,7 @@ pub fn build(b: *std.Build) void {
94 .optimize = .Debug, 101 .optimize = .Debug,
95 }), 102 }),
96 }); 103 });
104 compat_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
97 const run_compat_gen_exe = b.addRunArtifact(compat_gen_exe); 105 const run_compat_gen_exe = b.addRunArtifact(compat_gen_exe);
98 const compat_gen_out = run_compat_gen_exe.addOutputFileArg("compat.bin.z"); 106 const compat_gen_out = run_compat_gen_exe.addOutputFileArg("compat.bin.z");
99 107
@@ -105,6 +113,7 @@ pub fn build(b: *std.Build) void {
105 .optimize = .Debug, 113 .optimize = .Debug,
106 }), 114 }),
107 }); 115 });
116 hangul_gen_exe.root_module.addAnonymousImport("HangulSyllableType.txt", .{ .root_source_file = b.path("data/unicode/HangulSyllableType.txt") });
108 const run_hangul_gen_exe = b.addRunArtifact(hangul_gen_exe); 117 const run_hangul_gen_exe = b.addRunArtifact(hangul_gen_exe);
109 const hangul_gen_out = run_hangul_gen_exe.addOutputFileArg("hangul.bin.z"); 118 const hangul_gen_out = run_hangul_gen_exe.addOutputFileArg("hangul.bin.z");
110 119
@@ -116,6 +125,7 @@ pub fn build(b: *std.Build) void {
116 .optimize = .Debug, 125 .optimize = .Debug,
117 }), 126 }),
118 }); 127 });
128 normp_gen_exe.root_module.addAnonymousImport("DerivedNormalizationProps.txt", .{ .root_source_file = b.path("data/unicode/DerivedNormalizationProps.txt") });
119 const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe); 129 const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe);
120 const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.bin.z"); 130 const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.bin.z");
121 131
@@ -127,6 +137,7 @@ pub fn build(b: *std.Build) void {
127 .optimize = .Debug, 137 .optimize = .Debug,
128 }), 138 }),
129 }); 139 });
140 ccc_gen_exe.root_module.addAnonymousImport("DerivedCombiningClass.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedCombiningClass.txt") });
130 const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe); 141 const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe);
131 const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z"); 142 const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z");
132 143
@@ -138,6 +149,7 @@ pub fn build(b: *std.Build) void {
138 .optimize = .Debug, 149 .optimize = .Debug,
139 }), 150 }),
140 }); 151 });
152 gencat_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") });
141 const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); 153 const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe);
142 const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z"); 154 const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z");
143 155
@@ -149,6 +161,8 @@ pub fn build(b: *std.Build) void {
149 .optimize = .Debug, 161 .optimize = .Debug,
150 }), 162 }),
151 }); 163 });
164 fold_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
165 fold_gen_exe.root_module.addAnonymousImport("CaseFolding.txt", .{ .root_source_file = b.path("data/unicode/CaseFolding.txt") });
152 const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe); 166 const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe);
153 const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z"); 167 const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z");
154 168
@@ -161,6 +175,7 @@ pub fn build(b: *std.Build) void {
161 .optimize = .Debug, 175 .optimize = .Debug,
162 }), 176 }),
163 }); 177 });
178 num_gen_exe.root_module.addAnonymousImport("DerivedNumericType.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedNumericType.txt") });
164 const run_num_gen_exe = b.addRunArtifact(num_gen_exe); 179 const run_num_gen_exe = b.addRunArtifact(num_gen_exe);
165 const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); 180 const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z");
166 181
@@ -173,6 +188,7 @@ pub fn build(b: *std.Build) void {
173 .optimize = .Debug, 188 .optimize = .Debug,
174 }), 189 }),
175 }); 190 });
191 case_prop_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
176 const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); 192 const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe);
177 const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); 193 const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z");
178 194
@@ -185,6 +201,7 @@ pub fn build(b: *std.Build) void {
185 .optimize = .Debug, 201 .optimize = .Debug,
186 }), 202 }),
187 }); 203 });
204 upper_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
188 const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); 205 const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe);
189 const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); 206 const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z");
190 207
@@ -197,6 +214,7 @@ pub fn build(b: *std.Build) void {
197 .optimize = .Debug, 214 .optimize = .Debug,
198 }), 215 }),
199 }); 216 });
217 lower_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") });
200 const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); 218 const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe);
201 const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); 219 const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z");
202 220
@@ -208,6 +226,7 @@ pub fn build(b: *std.Build) void {
208 .optimize = .Debug, 226 .optimize = .Debug,
209 }), 227 }),
210 }); 228 });
229 scripts_gen_exe.root_module.addAnonymousImport("Scripts.txt", .{ .root_source_file = b.path("data/unicode/Scripts.txt") });
211 const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); 230 const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe);
212 const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z"); 231 const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z");
213 232
@@ -219,6 +238,7 @@ pub fn build(b: *std.Build) void {
219 .optimize = .Debug, 238 .optimize = .Debug,
220 }), 239 }),
221 }); 240 });
241 core_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") });
222 const run_core_gen_exe = b.addRunArtifact(core_gen_exe); 242 const run_core_gen_exe = b.addRunArtifact(core_gen_exe);
223 const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z"); 243 const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z");
224 244
@@ -230,6 +250,8 @@ pub fn build(b: *std.Build) void {
230 .optimize = .Debug, 250 .optimize = .Debug,
231 }), 251 }),
232 }); 252 });
253
254 props_gen_exe.root_module.addAnonymousImport("PropList.txt", .{ .root_source_file = b.path("data/unicode/PropList.txt") });
233 const run_props_gen_exe = b.addRunArtifact(props_gen_exe); 255 const run_props_gen_exe = b.addRunArtifact(props_gen_exe);
234 const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z"); 256 const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z");
235 257
@@ -483,6 +505,9 @@ pub fn build(b: *std.Build) void {
483 .optimize = optimize, 505 .optimize = optimize,
484 }), 506 }),
485 }); 507 });
508 unicode_tests.root_module.addAnonymousImport("GraphemeBreakTest.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/GraphemeBreakTest.txt") });
509 unicode_tests.root_module.addAnonymousImport("NormalizationTest.txt", .{ .root_source_file = b.path("data/unicode/NormalizationTest.txt") });
510 unicode_tests.root_module.addAnonymousImport("WordBreakTest.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/WordBreakTest.txt") });
486 unicode_tests.root_module.addImport("Graphemes", graphemes); 511 unicode_tests.root_module.addImport("Graphemes", graphemes);
487 unicode_tests.root_module.addImport("Normalize", norm); 512 unicode_tests.root_module.addImport("Normalize", norm);
488 unicode_tests.root_module.addImport("Words", words); 513 unicode_tests.root_module.addImport("Words", words);