mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-01-14 21:22:03 +01:00
61 lines
2.7 KiB
Diff
61 lines
2.7 KiB
Diff
- set pie
|
|
- linklibc so the output is not static
|
|
- don't use stage1
|
|
diff --git a/build.zig b/build.zig
|
|
index 1d33de7..16fe2f9 100644
|
|
--- a/build.zig
|
|
+++ b/build.zig
|
|
@@ -7,19 +7,18 @@ const zls_version = std.builtin.Version{ .major = 0, .minor = 10, .patch = 0 };
|
|
pub fn build(b: *std.build.Builder) !void {
|
|
const current_zig = builtin.zig_version;
|
|
const min_zig = std.SemanticVersion.parse("0.10.0-dev.4057+349d78a44") catch return; // std.zig.tokenizer.Token.Tag.number_literal added
|
|
- if (current_zig.order(min_zig).compare(.lt)) @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{current_zig, min_zig}));
|
|
+ if (current_zig.order(min_zig).compare(.lt)) @panic(b.fmt("Your Zig version v{} does not meet the minimum build requirement of v{}", .{ current_zig, min_zig }));
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
const mode = b.standardReleaseOptions();
|
|
const exe = b.addExecutable("zls", "src/main.zig");
|
|
- exe.use_stage1 = true;
|
|
const exe_options = b.addOptions();
|
|
exe.addOptions("build_options", exe_options);
|
|
|
|
const enable_tracy = b.option(bool, "enable_tracy", "Whether tracy should be enabled.") orelse false;
|
|
const coverage = b.option(bool, "generate_coverage", "Generate coverage data with kcov") orelse false;
|
|
- const coverage_output_dir = b.option([]const u8, "coverage_output_dir", "Output directory for coverage data") orelse b.pathJoin(&.{b.install_prefix, "kcov"});
|
|
+ const coverage_output_dir = b.option([]const u8, "coverage_output_dir", "Output directory for coverage data") orelse b.pathJoin(&.{ b.install_prefix, "kcov" });
|
|
|
|
exe_options.addOption(
|
|
shared.ZigVersion,
|
|
@@ -115,6 +114,8 @@ pub fn build(b: *std.build.Builder) !void {
|
|
|
|
exe.setTarget(target);
|
|
exe.setBuildMode(mode);
|
|
+ exe.pie = true;
|
|
+ exe.linkLibC();
|
|
exe.install();
|
|
|
|
const test_step = b.step("test", "Run all the tests");
|
|
@@ -122,10 +123,10 @@ pub fn build(b: *std.build.Builder) !void {
|
|
|
|
var tests = b.addTest("tests/tests.zig");
|
|
|
|
- if(coverage) {
|
|
- const src_dir = b.pathJoin(&.{b.build_root, "src"});
|
|
+ if (coverage) {
|
|
+ const src_dir = b.pathJoin(&.{ b.build_root, "src" });
|
|
const include_pattern = b.fmt("--include-pattern={s}", .{src_dir});
|
|
-
|
|
+
|
|
tests.setExecCmd(&[_]?[]const u8{
|
|
"kcov",
|
|
include_pattern,
|
|
@@ -134,7 +135,6 @@ pub fn build(b: *std.build.Builder) !void {
|
|
});
|
|
}
|
|
|
|
- tests.use_stage1 = true;
|
|
tests.addPackage(.{ .name = "zls", .source = .{ .path = "src/zls.zig" }, .dependencies = exe.packages.items });
|
|
tests.setBuildMode(.Debug);
|
|
tests.setTarget(target);
|