From 16df10181dab7834370823efc7cce4a55db570c5 Mon Sep 17 00:00:00 2001 From: Michael Chaten Date: Sat, 13 Sep 2025 07:11:50 -0700 Subject: Update build to 0.15.0 --- build.zig | 176 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 90 insertions(+), 86 deletions(-) (limited to 'build.zig') diff --git a/build.zig b/build.zig index ca0eeef..67a009a 100644 --- a/build.zig +++ b/build.zig @@ -42,27 +42,33 @@ pub fn build(b: *std.Build) void { // Grapheme break const gbp_gen_exe = b.addExecutable(.{ .name = "gbp", - .root_source_file = b.path("codegen/gbp.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/gbp.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z"); const wbp_gen_exe = b.addExecutable(.{ .name = "wbp", - .root_source_file = b.path("codegen/wbp.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/wbp.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_wbp_gen_exe = b.addRunArtifact(wbp_gen_exe); const wbp_gen_out = run_wbp_gen_exe.addOutputFileArg("wbp.bin.z"); const dwp_gen_exe = b.addExecutable(.{ .name = "dwp", - .root_source_file = b.path("codegen/dwp.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/dwp.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); dwp_gen_exe.root_module.addOptions("options", dwp_options); const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); @@ -71,63 +77,77 @@ pub fn build(b: *std.Build) void { // Normalization properties const canon_gen_exe = b.addExecutable(.{ .name = "canon", - .root_source_file = b.path("codegen/canon.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/canon.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_canon_gen_exe = b.addRunArtifact(canon_gen_exe); const canon_gen_out = run_canon_gen_exe.addOutputFileArg("canon.bin.z"); const compat_gen_exe = b.addExecutable(.{ .name = "compat", - .root_source_file = b.path("codegen/compat.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/compat.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_compat_gen_exe = b.addRunArtifact(compat_gen_exe); const compat_gen_out = run_compat_gen_exe.addOutputFileArg("compat.bin.z"); const hangul_gen_exe = b.addExecutable(.{ .name = "hangul", - .root_source_file = b.path("codegen/hangul.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/hangul.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_hangul_gen_exe = b.addRunArtifact(hangul_gen_exe); const hangul_gen_out = run_hangul_gen_exe.addOutputFileArg("hangul.bin.z"); const normp_gen_exe = b.addExecutable(.{ .name = "normp", - .root_source_file = b.path("codegen/normp.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/normp.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe); const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.bin.z"); const ccc_gen_exe = b.addExecutable(.{ .name = "ccc", - .root_source_file = b.path("codegen/ccc.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/ccc.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe); const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z"); const gencat_gen_exe = b.addExecutable(.{ .name = "gencat", - .root_source_file = b.path("codegen/gencat.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/gencat.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z"); const fold_gen_exe = b.addExecutable(.{ .name = "fold", - .root_source_file = b.path("codegen/fold.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/fold.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe); const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z"); @@ -135,9 +155,11 @@ pub fn build(b: *std.Build) void { // Numeric types const num_gen_exe = b.addExecutable(.{ .name = "numeric", - .root_source_file = b.path("codegen/numeric.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/numeric.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_num_gen_exe = b.addRunArtifact(num_gen_exe); const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); @@ -145,9 +167,11 @@ pub fn build(b: *std.Build) void { // Letter case properties const case_prop_gen_exe = b.addExecutable(.{ .name = "case_prop", - .root_source_file = b.path("codegen/case_prop.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/case_prop.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); @@ -155,9 +179,11 @@ pub fn build(b: *std.Build) void { // Uppercase mappings const upper_gen_exe = b.addExecutable(.{ .name = "upper", - .root_source_file = b.path("codegen/upper.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/upper.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); @@ -165,36 +191,44 @@ pub fn build(b: *std.Build) void { // Lowercase mappings const lower_gen_exe = b.addExecutable(.{ .name = "lower", - .root_source_file = b.path("codegen/lower.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/lower.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); const scripts_gen_exe = b.addExecutable(.{ .name = "scripts", - .root_source_file = b.path("codegen/scripts.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/scripts.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z"); const core_gen_exe = b.addExecutable(.{ .name = "core", - .root_source_file = b.path("codegen/core_props.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/core_props.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_core_gen_exe = b.addRunArtifact(core_gen_exe); const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z"); const props_gen_exe = b.addExecutable(.{ .name = "props", - .root_source_file = b.path("codegen/props.zig"), - .target = b.graph.host, - .optimize = .Debug, + .root_module = b.createModule(.{ + .root_source_file = b.path("codegen/props.zig"), + .target = b.graph.host, + .optimize = .Debug, + }), }); const run_props_gen_exe = b.addRunArtifact(props_gen_exe); const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z"); @@ -212,8 +246,6 @@ pub fn build(b: *std.Build) void { const code_point_t = b.addTest(.{ .name = "code_point", .root_module = code_point, - .target = target, - .optimize = optimize, }); const code_point_tr = b.addRunArtifact(code_point_t); @@ -230,8 +262,6 @@ pub fn build(b: *std.Build) void { const grapheme_t = b.addTest(.{ .name = "Graphemes", .root_module = graphemes, - .target = target, - .optimize = optimize, }); const grapheme_tr = b.addRunArtifact(grapheme_t); @@ -247,8 +277,6 @@ pub fn build(b: *std.Build) void { const words_t = b.addTest(.{ .name = "WordBreak", .root_module = words, - .target = target, - .optimize = optimize, }); const words_tr = b.addRunArtifact(words_t); @@ -262,8 +290,6 @@ pub fn build(b: *std.Build) void { const ascii_t = b.addTest(.{ .name = "ascii", .root_module = ascii, - .target = target, - .optimize = optimize, }); const ascii_tr = b.addRunArtifact(ascii_t); @@ -282,8 +308,6 @@ pub fn build(b: *std.Build) void { const display_width_t = b.addTest(.{ .name = "display_width", .root_module = display_width, - .target = target, - .optimize = optimize, }); const display_width_tr = b.addRunArtifact(display_width_t); @@ -298,8 +322,6 @@ pub fn build(b: *std.Build) void { const ccc_data_t = b.addTest(.{ .name = "ccc_data", .root_module = ccc_data, - .target = target, - .optimize = optimize, }); const ccc_data_tr = b.addRunArtifact(ccc_data_t); @@ -314,8 +336,6 @@ pub fn build(b: *std.Build) void { const canon_data_t = b.addTest(.{ .name = "canon_data", .root_module = canon_data, - .target = target, - .optimize = optimize, }); const canon_data_tr = b.addRunArtifact(canon_data_t); @@ -330,8 +350,6 @@ pub fn build(b: *std.Build) void { const compat_data_t = b.addTest(.{ .name = "compat_data", .root_module = compat_data, - .target = target, - .optimize = optimize, }); const compat_data_tr = b.addRunArtifact(compat_data_t); @@ -345,8 +363,6 @@ pub fn build(b: *std.Build) void { const hangul_data_t = b.addTest(.{ .name = "hangul_data", .root_module = hangul_data, - .target = target, - .optimize = optimize, }); const hangul_data_tr = b.addRunArtifact(hangul_data_t); @@ -360,8 +376,6 @@ pub fn build(b: *std.Build) void { const normp_data_t = b.addTest(.{ .name = "normp_data", .root_module = normp_data, - .target = target, - .optimize = optimize, }); const normp_data_tr = b.addRunArtifact(normp_data_t); @@ -381,8 +395,6 @@ pub fn build(b: *std.Build) void { const norm_t = b.addTest(.{ .name = "norm", .root_module = norm, - .target = target, - .optimize = optimize, }); const norm_tr = b.addRunArtifact(norm_t); @@ -397,8 +409,6 @@ pub fn build(b: *std.Build) void { const gencat_t = b.addTest(.{ .name = "gencat", .root_module = gencat, - .target = target, - .optimize = optimize, }); const gencat_tr = b.addRunArtifact(gencat_t); @@ -415,8 +425,6 @@ pub fn build(b: *std.Build) void { const case_fold_t = b.addTest(.{ .name = "case_fold", .root_module = case_fold, - .target = target, - .optimize = optimize, }); const case_fold_tr = b.addRunArtifact(case_fold_t); @@ -434,8 +442,6 @@ pub fn build(b: *std.Build) void { const letter_case_t = b.addTest(.{ .name = "lettercase", .root_module = letter_case, - .target = target, - .optimize = optimize, }); const letter_case_tr = b.addRunArtifact(letter_case_t); @@ -450,8 +456,6 @@ pub fn build(b: *std.Build) void { const scripts_t = b.addTest(.{ .name = "scripts", .root_module = scripts, - .target = target, - .optimize = optimize, }); const scripts_tr = b.addRunArtifact(scripts_t); @@ -468,16 +472,16 @@ pub fn build(b: *std.Build) void { const properties_t = b.addTest(.{ .name = "properties", .root_module = properties, - .target = target, - .optimize = optimize, }); const properties_tr = b.addRunArtifact(properties_t); // Unicode Tests const unicode_tests = b.addTest(.{ - .root_source_file = b.path("src/unicode_tests.zig"), - .target = target, - .optimize = optimize, + .root_module = b.createModule(.{ + .root_source_file = b.path("src/unicode_tests.zig"), + .target = target, + .optimize = optimize, + }), }); unicode_tests.root_module.addImport("Graphemes", graphemes); unicode_tests.root_module.addImport("Normalize", norm); -- cgit v1.2.3 From 749197a3f9d25e211615960c02380a3d659b20f9 Mon Sep 17 00:00:00 2001 From: Michael Chaten Date: Sun, 14 Sep 2025 04:11:09 -0700 Subject: Embed data files in scripts rather than relying on filesystem access for easier packaging --- build.zig | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'build.zig') 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 { .optimize = .Debug, }), }); + gbp_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); + gbp_gen_exe.root_module.addAnonymousImport("GraphemeBreakProperty.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/GraphemeBreakProperty.txt") }); + gbp_gen_exe.root_module.addAnonymousImport("emoji-data.txt", .{ .root_source_file = b.path("data/unicode/emoji/emoji-data.txt") }); const run_gbp_gen_exe = b.addRunArtifact(gbp_gen_exe); const gbp_gen_out = run_gbp_gen_exe.addOutputFileArg("gbp.bin.z"); @@ -59,6 +62,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + wbp_gen_exe.root_module.addAnonymousImport("WordBreakProperty.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/WordBreakProperty.txt") }); const run_wbp_gen_exe = b.addRunArtifact(wbp_gen_exe); const wbp_gen_out = run_wbp_gen_exe.addOutputFileArg("wbp.bin.z"); @@ -70,6 +74,8 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + dwp_gen_exe.root_module.addAnonymousImport("DerivedEastAsianWidth.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedEastAsianWidth.txt") }); + dwp_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") }); dwp_gen_exe.root_module.addOptions("options", dwp_options); const run_dwp_gen_exe = b.addRunArtifact(dwp_gen_exe); const dwp_gen_out = run_dwp_gen_exe.addOutputFileArg("dwp.bin.z"); @@ -83,6 +89,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + canon_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); const run_canon_gen_exe = b.addRunArtifact(canon_gen_exe); const canon_gen_out = run_canon_gen_exe.addOutputFileArg("canon.bin.z"); @@ -94,6 +101,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + compat_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); const run_compat_gen_exe = b.addRunArtifact(compat_gen_exe); const compat_gen_out = run_compat_gen_exe.addOutputFileArg("compat.bin.z"); @@ -105,6 +113,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + hangul_gen_exe.root_module.addAnonymousImport("HangulSyllableType.txt", .{ .root_source_file = b.path("data/unicode/HangulSyllableType.txt") }); const run_hangul_gen_exe = b.addRunArtifact(hangul_gen_exe); const hangul_gen_out = run_hangul_gen_exe.addOutputFileArg("hangul.bin.z"); @@ -116,6 +125,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + normp_gen_exe.root_module.addAnonymousImport("DerivedNormalizationProps.txt", .{ .root_source_file = b.path("data/unicode/DerivedNormalizationProps.txt") }); const run_normp_gen_exe = b.addRunArtifact(normp_gen_exe); const normp_gen_out = run_normp_gen_exe.addOutputFileArg("normp.bin.z"); @@ -127,6 +137,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + ccc_gen_exe.root_module.addAnonymousImport("DerivedCombiningClass.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedCombiningClass.txt") }); const run_ccc_gen_exe = b.addRunArtifact(ccc_gen_exe); const ccc_gen_out = run_ccc_gen_exe.addOutputFileArg("ccc.bin.z"); @@ -138,6 +149,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + gencat_gen_exe.root_module.addAnonymousImport("DerivedGeneralCategory.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedGeneralCategory.txt") }); const run_gencat_gen_exe = b.addRunArtifact(gencat_gen_exe); const gencat_gen_out = run_gencat_gen_exe.addOutputFileArg("gencat.bin.z"); @@ -149,6 +161,8 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + fold_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); + fold_gen_exe.root_module.addAnonymousImport("CaseFolding.txt", .{ .root_source_file = b.path("data/unicode/CaseFolding.txt") }); const run_fold_gen_exe = b.addRunArtifact(fold_gen_exe); const fold_gen_out = run_fold_gen_exe.addOutputFileArg("fold.bin.z"); @@ -161,6 +175,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + num_gen_exe.root_module.addAnonymousImport("DerivedNumericType.txt", .{ .root_source_file = b.path("data/unicode/extracted/DerivedNumericType.txt") }); const run_num_gen_exe = b.addRunArtifact(num_gen_exe); const num_gen_out = run_num_gen_exe.addOutputFileArg("numeric.bin.z"); @@ -173,6 +188,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + case_prop_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); const run_case_prop_gen_exe = b.addRunArtifact(case_prop_gen_exe); const case_prop_gen_out = run_case_prop_gen_exe.addOutputFileArg("case_prop.bin.z"); @@ -185,6 +201,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + upper_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); const run_upper_gen_exe = b.addRunArtifact(upper_gen_exe); const upper_gen_out = run_upper_gen_exe.addOutputFileArg("upper.bin.z"); @@ -197,6 +214,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + lower_gen_exe.root_module.addAnonymousImport("UnicodeData.txt", .{ .root_source_file = b.path("data/unicode/UnicodeData.txt") }); const run_lower_gen_exe = b.addRunArtifact(lower_gen_exe); const lower_gen_out = run_lower_gen_exe.addOutputFileArg("lower.bin.z"); @@ -208,6 +226,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + scripts_gen_exe.root_module.addAnonymousImport("Scripts.txt", .{ .root_source_file = b.path("data/unicode/Scripts.txt") }); const run_scripts_gen_exe = b.addRunArtifact(scripts_gen_exe); const scripts_gen_out = run_scripts_gen_exe.addOutputFileArg("scripts.bin.z"); @@ -219,6 +238,7 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + core_gen_exe.root_module.addAnonymousImport("DerivedCoreProperties.txt", .{ .root_source_file = b.path("data/unicode/DerivedCoreProperties.txt") }); const run_core_gen_exe = b.addRunArtifact(core_gen_exe); const core_gen_out = run_core_gen_exe.addOutputFileArg("core_props.bin.z"); @@ -230,6 +250,8 @@ pub fn build(b: *std.Build) void { .optimize = .Debug, }), }); + + props_gen_exe.root_module.addAnonymousImport("PropList.txt", .{ .root_source_file = b.path("data/unicode/PropList.txt") }); const run_props_gen_exe = b.addRunArtifact(props_gen_exe); const props_gen_out = run_props_gen_exe.addOutputFileArg("props.bin.z"); @@ -483,6 +505,9 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }), }); + unicode_tests.root_module.addAnonymousImport("GraphemeBreakTest.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/GraphemeBreakTest.txt") }); + unicode_tests.root_module.addAnonymousImport("NormalizationTest.txt", .{ .root_source_file = b.path("data/unicode/NormalizationTest.txt") }); + unicode_tests.root_module.addAnonymousImport("WordBreakTest.txt", .{ .root_source_file = b.path("data/unicode/auxiliary/WordBreakTest.txt") }); unicode_tests.root_module.addImport("Graphemes", graphemes); unicode_tests.root_module.addImport("Normalize", norm); unicode_tests.root_module.addImport("Words", words); -- cgit v1.2.3