#help with build system cache

1 messages · Page 1 of 1 (latest)

serene phoenix
#

i have problems with my build system where it doesnt cache correctly and doesnt work
i got told some direction of what to do but i am not sure how to do it:

two main issues I see:
1, the files in sysroot/ are never added as dependencies so any changes to them won’t retrigger anything  (make them a LazyPath with b.path to make them automatically handled by the cache system)
2, you never add a dependency to building the image for the qemu command, don’t just have it depend on `zig-out/`, have it depend on the `out_file` LazyPath instead using `addInputArg`

my code is in https://github.com/cat1000101/NyaOS/blob/main/build.zig
if anyone has time to help tyvm

#

did do
out_file.addStepDependencies(install_iso);

but still doesnt work

#

i am just not sure how shouldi approch the sysroot part

#

also the sysroot is somehting that i make dynamicly? like it doesnt exist until i copy things into it in the writeFile thing

fast patrol
# serene phoenix i have problems with my build system where it doesnt cache correctly and doesnt ...
mkiso.addDirectoryArg(b.path("sysroot/"));

and maybe something like this?

const install_iso = &b.addInstallFileWithDir(nyaos_iso_file, .prefix, "NyaOS.iso").step;
nyaos_iso_file.addStepDependencies(install_iso);
install_iso.dependOn(kernel_step);
...
// step and commands to run the iso in qemu
const run_cmd_args = [_][]const u8{"qemu-system-i386"} ++ common_qemu_args;
const run_cmd = b.addSystemCommand(&run_cmd_args);
run_cmd.addArg("-cdrom");
run_cmd.addFileArg(nyaos_iso_file);
run_cmd.step.dependOn(install_iso);

its kind of a mess
in general prefer using LazyPath with b.path() or with the output of a step rather than using strings as paths.

serene phoenix
#

but sysroot is not a path that exists?

#

oh ok i can make it in the wf thing?

#

but how should i do it?
i found the wf.add but it doesnt have docs and i am not sure what is the bytes and how to use it

fast patrol
# serene phoenix but sysroot is not a path that exists?

My recommendations are based on the directions the other person told you
I know how the build system works pretty ok but I have no idea how to build an operating system so maybe mkiso.addArgs(&.{"sysroot/"}); is right for your situation

serene phoenix
#

doesnt seam to work -_-

#

also this is the add signiture it seams like the thing that i need:

pub fn add(write_file: *WriteFile, sub_path: []const u8, bytes: []const u8) std.Build.LazyPath {
    const b = write_file.step.owner;
    const gpa = b.allocator;
    const file = File{
        .sub_path = b.dupePath(sub_path),
        .contents = .{ .bytes = b.dupe(bytes) },
    };
    write_file.files.append(gpa, file) catch @panic("OOM");
    write_file.maybeUpdateName();
    return .{
        .generated = .{
            .file = &write_file.generated_directory,
            .sub_path = file.sub_path,
        },
    };
}
#

but also at the same time it is not the root problem because no matter what i do it doesnt recompile the kernel

#

the build one for the kernel

#

it onkly has a function that returns the kernel exe and step?