Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repair build.zig #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions awkbuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn addAwk(
.target = target,
.optimize = optimize,
});
const install = b.addInstallArtifact(exe);
const install = b.addInstallArtifact(exe, .{});
exe.step.dependOn(&repo.step);
// exe.step.dependOn(&config_step.step);
const repo_path = repo.getPath(&exe.step);
Expand All @@ -45,9 +45,9 @@ pub fn addAwk(
"-std=c11",
});

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/gnu");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/gnu" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down
56 changes: 28 additions & 28 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,14 @@ pub fn build(b: *std.build.Builder) void {

// re-implements Build.installArtifact but also returns it
fn installArtifact(b: *std.Build, artifact: anytype) *std.Build.Step.InstallArtifact {
const install = b.addInstallArtifact(artifact);
const install = b.addInstallArtifact(artifact, .{});
b.getInstallStep().dependOn(&install.step);
return install;
}

fn addPosix(artifact: *std.build.LibExeObjStep, zig_posix: *std.build.LibExeObjStep) void {
artifact.linkLibrary(zig_posix);
artifact.addIncludePath("inc" ++ std.fs.path.sep_str ++ "posix");
artifact.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "posix" });
}

fn addTest(
Expand All @@ -219,8 +219,8 @@ fn addTest(
.optimize = optimize,
});
exe.addCSourceFiles(&.{"test" ++ std.fs.path.sep_str ++ "expect.c"}, &[_][]const u8{});
exe.addIncludePath("inc" ++ std.fs.path.sep_str ++ "libc");
exe.addIncludePath("inc" ++ std.fs.path.sep_str ++ "posix");
exe.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "libc" });
exe.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "posix" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
// TODO: should libc_only_std_static and zig_start be able to add library dependencies?
Expand Down Expand Up @@ -256,7 +256,7 @@ fn addLibcTest(
.target = target,
.optimize = optimize,
});
lib.addIncludePath("inc" ++ std.fs.path.sep_str ++ "libc");
lib.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "libc" });
lib.step.dependOn(&libc_test_repo.step);
libc_test_step.dependOn(&lib.step);
}
Expand All @@ -276,9 +276,9 @@ fn addLibcTest(
});
exe.addCSourceFiles(common_src, &[_][]const u8{});
exe.step.dependOn(&libc_test_repo.step);
exe.addIncludePath(libc_inc_path);
exe.addIncludePath("inc" ++ std.fs.path.sep_str ++ "libc");
exe.addIncludePath("inc" ++ std.fs.path.sep_str ++ "posix");
exe.addIncludePath(.{ .path = libc_inc_path });
exe.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "libc" });
exe.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "posix" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(libc_only_posix);
Expand Down Expand Up @@ -328,10 +328,10 @@ fn addTinyRegexCTests(
exe.addCSourceFiles(files.toOwnedSlice() catch unreachable, &[_][]const u8{
"-std=c99",
});
exe.addIncludePath(repo_path);
exe.addIncludePath(.{ .path = repo_path });

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down Expand Up @@ -368,7 +368,7 @@ fn addLua(
.optimize = optimize,
});
lua_exe.step.dependOn(&lua_repo.step);
const install = b.addInstallArtifact(lua_exe);
const install = b.addInstallArtifact(lua_exe, .{});
// doesn't compile for windows for some reason
if (target.getOs().tag != .windows) {
b.getInstallStep().dependOn(&install.step);
Expand All @@ -392,13 +392,13 @@ fn addLua(
"-std=c99",
});

lua_exe.addIncludePath("inc" ++ std.fs.path.sep_str ++ "libc");
lua_exe.addIncludePath(.{ .path = "inc" ++ std.fs.path.sep_str ++ "libc" });
lua_exe.linkLibrary(libc_only_std_static);
lua_exe.linkLibrary(libc_only_posix);
lua_exe.linkLibrary(zig_start);
// TODO: should libc_only_std_static and zig_start be able to add library dependencies?
if (target.getOs().tag == .windows) {
lua_exe.addIncludePath("inc/win32");
lua_exe.addIncludePath(.{ .path = "inc/win32" });
lua_exe.linkSystemLibrary("ntdll");
lua_exe.linkSystemLibrary("kernel32");
}
Expand Down Expand Up @@ -462,9 +462,9 @@ fn addCmph(
"-std=c11",
});

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/gnu");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/gnu" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down Expand Up @@ -538,8 +538,8 @@ fn addYacc(
"-std=c90",
});

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down Expand Up @@ -590,10 +590,10 @@ fn addYabfc(
"-std=c99",
});

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/linux");
exe.addIncludePath("inc/gnu");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/linux" });
exe.addIncludePath(.{ .path = "inc/gnu" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down Expand Up @@ -631,7 +631,7 @@ fn addSecretGame(
.target = target,
.optimize = optimize,
});
const install = b.addInstallArtifact(exe);
const install = b.addInstallArtifact(exe, .{});
exe.step.dependOn(&repo.step);
const repo_path = repo.getPath(&exe.step);
var files = std.ArrayList([]const u8).init(b.allocator);
Expand All @@ -645,10 +645,10 @@ fn addSecretGame(
"-std=c90",
});

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/linux");
exe.addIncludePath("inc/gnu");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/linux" });
exe.addIncludePath(.{ .path = "inc/gnu" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down
10 changes: 5 additions & 5 deletions busybox/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn add(
.target = target,
.optimize = optimize,
});
const install = b.addInstallArtifact(exe);
const install = b.addInstallArtifact(exe, .{});
exe.step.dependOn(&prep.step);
const repo_path = repo.getPath(&exe.step);
var files = std.ArrayList([]const u8).init(b.allocator);
Expand All @@ -67,11 +67,11 @@ pub fn add(
exe.addCSourceFiles(files.toOwnedSlice() catch unreachable, &[_][]const u8{
"-std=c99",
});
exe.addIncludePath(b.pathJoin(&.{ repo_path, "include" }));
exe.addIncludePath(.{ .path = b.pathJoin(&.{ repo_path, "include" }) });

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/linux");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/linux" });
exe.linkLibrary(libc_only_std_static);
//exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down
12 changes: 6 additions & 6 deletions gnumakebuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub fn addGnuMake(
.target = target,
.optimize = optimize,
});
const install = b.addInstallArtifact(exe);
const install = b.addInstallArtifact(exe, .{});
exe.step.dependOn(&repo.step);
exe.step.dependOn(config_step);
const repo_path = repo.getPath(&exe.step);
Expand All @@ -82,7 +82,7 @@ pub fn addGnuMake(
files.append(b.pathJoin(&.{ repo_path, "src", src })) catch unreachable;
}

exe.addIncludePath(b.pathJoin(&.{ repo_path, "src" }));
exe.addIncludePath(.{ .path = b.pathJoin(&.{ repo_path, "src" }) });
exe.addCSourceFiles(files.toOwnedSlice() catch unreachable, &[_][]const u8{
"-std=c99",
"-DHAVE_CONFIG_H",
Expand All @@ -104,10 +104,10 @@ pub fn addGnuMake(
//"-Wlogical-op", "-Wformat-signedness", "-Wduplicated-cond",
});

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/gnu");
exe.addIncludePath("inc/alloca");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/gnu" });
exe.addIncludePath(.{ .path = "inc/alloca" });
exe.linkLibrary(libc_only_std_static);
exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down
14 changes: 7 additions & 7 deletions ncurses/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ pub fn add(
// b.pathJoin(&.{"include", "curses.head"}),
// .{ .subs = &.{ defs_sub } },
//);
const install = b.addInstallArtifact(exe);
const install = b.addInstallArtifact(exe, .{});
exe.step.dependOn(&prep.step);
const repo_path = repo.getPath(&exe.step);
var files = std.ArrayList([]const u8).init(b.allocator);
Expand All @@ -161,13 +161,13 @@ pub fn add(
exe.addCSourceFiles(files.toOwnedSlice() catch unreachable, &[_][]const u8{
"-std=c99",
});
exe.addIncludePath(b.pathJoin(&.{ repo_path, "include" }));
exe.addIncludePath(b.pathJoin(&.{ repo_path, "ncurses" }));
exe.addIncludePath(.{ .path = b.pathJoin(&.{ repo_path, "include" }) });
exe.addIncludePath(.{ .path = b.pathJoin(&.{ repo_path, "ncurses" }) });

exe.addIncludePath("inc/libc");
exe.addIncludePath("inc/posix");
exe.addIncludePath("inc/linux");
//exe.addIncludePath("inc/gnu");
exe.addIncludePath(.{ .path = "inc/libc" });
exe.addIncludePath(.{ .path = "inc/posix" });
exe.addIncludePath(.{ .path = "inc/linux" });
//exe.addIncludePath(.{.path="inc/gnu"});
exe.linkLibrary(libc_only_std_static);
//exe.linkLibrary(zig_start);
exe.linkLibrary(zig_posix);
Expand Down
14 changes: 7 additions & 7 deletions ziglibcbuild.zig
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ pub fn addLibc(builder: *std.build.Builder, opt: ZigLibcOptions) *std.build.LibE
};
modules_options.addOption(bool, "cstd", include_cstd);
if (include_cstd) {
lib.addCSourceFile(relpath("src" ++ std.fs.path.sep_str ++ "printf.c"), &c_flags);
lib.addCSourceFile(relpath("src" ++ std.fs.path.sep_str ++ "scanf.c"), &c_flags);
lib.addCSourceFile(.{ .file = .{ .path = relpath("src" ++ std.fs.path.sep_str ++ "printf.c") }, .flags = &c_flags });
lib.addCSourceFile(.{ .file = .{ .path = relpath("src" ++ std.fs.path.sep_str ++ "scanf.c") }, .flags = &c_flags }); //, }); //,
if (opt.target.getOsTag() == .linux) {
lib.addAssemblyFile(relpath("src/linux/jmp.s"));
lib.addAssemblyFile(.{ .path = relpath("src/linux/jmp.s") });
}
}
const include_posix = switch (opt.variant) {
Expand All @@ -112,24 +112,24 @@ pub fn addLibc(builder: *std.build.Builder, opt: ZigLibcOptions) *std.build.LibE
};
modules_options.addOption(bool, "posix", include_posix);
if (include_posix) {
lib.addCSourceFile(relpath("src" ++ std.fs.path.sep_str ++ "posix.c"), &c_flags);
lib.addCSourceFile(.{ .file = .{ .path = relpath("src" ++ std.fs.path.sep_str ++ "posix.c") }, .flags = &c_flags });
}
const include_linux = switch (opt.variant) {
.only_linux, .full => true,
else => false,
};
modules_options.addOption(bool, "linux", include_linux);
if (include_cstd or include_posix) {
lib.addIncludePath(relpath("inc" ++ std.fs.path.sep_str ++ "libc"));
lib.addIncludePath(relpath("inc" ++ std.fs.path.sep_str ++ "posix"));
lib.addIncludePath(.{ .path = relpath("inc" ++ std.fs.path.sep_str ++ "libc") });
lib.addIncludePath(.{ .path = relpath("inc" ++ std.fs.path.sep_str ++ "posix") });
}
const include_gnu = switch (opt.variant) {
.only_gnu, .full => true,
else => false,
};
modules_options.addOption(bool, "gnu", include_gnu);
if (include_gnu) {
lib.addIncludePath(relpath("inc" ++ std.fs.path.sep_str ++ "gnu"));
lib.addIncludePath(.{ .path = relpath("inc" ++ std.fs.path.sep_str ++ "gnu") });
}
return lib;
}