Merge pull request #175 from dwilliam62/fix/lua-header-mismatch
Browse files
[BUG] Build failed on Arch lua header mismatch
+11 −5 build.zig
| @@ -4,6 +4,8 @@ const zon = @import("build.zig.zon"); | ||
| 4 | 4 | pub fn build(b: *std.Build) void { |
| 5 | 5 | const target = b.standardTargetOptions(.{}); |
| 6 | 6 | const optimize = b.standardOptimizeOption(.{}); |
| 7 | + const lua_dep = b.dependency("lua", .{}); | |
| 8 | + const lua_headers = lua_dep.path("src/"); | |
| 7 | 9 | |
| 8 | 10 | const exe = b.addExecutable(.{ |
| 9 | 11 | .name = "oxwm", |
| @@ -24,7 +26,7 @@ pub fn build(b: *std.Build) void { | ||
| 24 | 26 | |
| 25 | 27 | exe.use_lld = false; |
| 26 | 28 | |
| 27 | - const lua = buildLua(b, target, optimize); | |
| 29 | + const lua = buildLua(b, lua_dep, target, optimize); | |
| 28 | 30 | exe.linkLibrary(lua); |
| 29 | 31 | exe.linkSystemLibrary("X11"); |
| 30 | 32 | exe.linkSystemLibrary("Xinerama"); |
| @@ -61,6 +63,7 @@ pub fn build(b: *std.Build) void { | ||
| 61 | 63 | }), |
| 62 | 64 | }); |
| 63 | 65 | src_main_unit_tests.use_lld = false; |
| 66 | + src_main_unit_tests.root_module.addIncludePath(lua_headers); | |
| 64 | 67 | src_main_unit_tests.linkLibrary(lua); |
| 65 | 68 | src_main_unit_tests.linkSystemLibrary("X11"); |
| 66 | 69 | src_main_unit_tests.linkSystemLibrary("Xinerama"); |
| @@ -77,11 +80,14 @@ pub fn build(b: *std.Build) void { | ||
| 77 | 80 | }), |
| 78 | 81 | }); |
| 79 | 82 | lua_config_tests.use_lld = false; |
| 80 | - lua_config_tests.root_module.addImport("lua", b.createModule(.{ | |
| 83 | + lua_config_tests.root_module.addIncludePath(lua_headers); | |
| 84 | + const lua_config_module = b.createModule(.{ | |
| 81 | 85 | .root_source_file = b.path("src/config/lua.zig"), |
| 82 | 86 | .target = target, |
| 83 | 87 | .optimize = optimize, |
| 84 | - })); | |
| 88 | + }); | |
| 89 | + lua_config_module.addIncludePath(lua_headers); | |
| 90 | + lua_config_tests.root_module.addImport("lua", lua_config_module); | |
| 85 | 91 | lua_config_tests.linkLibrary(lua); |
| 86 | 92 | lua_config_tests.linkLibC(); |
| 87 | 93 | test_step.dependOn(&b.addRunArtifact(lua_config_tests).step); |
| @@ -159,8 +165,8 @@ fn addXwaylandRun(b: *std.Build, exe: *std.Build.Step.Compile) *std.Build.Step.R | ||
| 159 | 165 | return run_wm; |
| 160 | 166 | } |
| 161 | 167 | |
| 162 | -fn buildLua(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Step.Compile { | |
| 163 | - const lua_src = b.dependency("lua", .{}); | |
| 168 | +fn buildLua(b: *std.Build, lua_dep: *std.Build.Dependency, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode) *std.Build.Step.Compile { | |
| 169 | + const lua_src = lua_dep; | |
| 164 | 170 | const lua = b.addLibrary(.{ |
| 165 | 171 | .name = "lua", |
| 166 | 172 | .root_module = b.createModule(.{ |