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

Feature Request: subpath derived FileSource in build.zig #16067

Open
Javyre opened this issue Jun 16, 2023 · 0 comments
Open

Feature Request: subpath derived FileSource in build.zig #16067

Javyre opened this issue Jun 16, 2023 · 0 comments
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Milestone

Comments

@Javyre
Copy link

Javyre commented Jun 16, 2023

Hey, I'd like to get a FileSource relative to another FileSource representing a directory in build.zig.

Example Use-Case:
I am unzipping some binaries and want to then install/link some subdirectories/files from the unzip.
Im trying to avoid implementing a custom Step and just use the builtin ones in a Makeish way.

    ...
    const fetch_skia_zip = b.addSystemCommand(&.{ "curl", "-L", "-o" });
    const skia_zip = fetch_skia_zip.addOutputFileArg("skia-bin.zip");
    fetch_skia_zip.addArg(skia_zip_url);

    const unzip_skia_zip = b.addSystemCommand(&.{"unzip"});
    unzip_skia_zip.step.dependOn(skia_zip);
    unzip_skia_zip.addFileSourceArg(skia_zip);
    unzip_skia_zip.addArg("-d");
    const skia_dir = unzip_skia_zip.addOutputFileArg("skia-bin");

    // want to:
    // install skia_dir/out/.../libskia.a and others
    // link above libskia.a with my zig project
    // add the skia_dir/include directory to the include for my zig project
    
    // would be awesome:
    const skia_include_dir = skia_dir.subPath("include"); // This produces a new FileSource relative to skia_dir.
    ...
@andrewrk andrewrk added enhancement Solving this issue will likely involve adding new logic or components to the codebase. contributor friendly This issue is limited in scope and/or knowledge of Zig internals. zig build system std.Build, the build runner, `zig build` subcommand, package management labels Jun 18, 2023
@andrewrk andrewrk added this to the 0.12.0 milestone Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor friendly This issue is limited in scope and/or knowledge of Zig internals. enhancement Solving this issue will likely involve adding new logic or components to the codebase. zig build system std.Build, the build runner, `zig build` subcommand, package management
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants