Skip to content

Add a symlink field to build.zig.zon which supports keep, omit, and copy #22350

@andrewrk

Description

@andrewrk

This is a proposal to address the use case described in #17652.

The idea here is to add a new field to build.zig.zon when fetching a tarball that describes a symlink strategy when unpacking:

    .dependencies = .{
        .libz = .{
            .url = "https://github.com/allyourcodebase/zlib/archive/refs/tags/1.3.1-3.tar.gz",
            .hash = "1220138f4aba0c01e66b68ed9e1e1e74614c06e4743d88bc58af4f1c3dd0aae5fea7",
            .symlink_behavior = .keep,
        },

The enum:

/// Describes how to handle all symlinks when unpacking, before hash computation.
pub const SymlinkBehavior = enum {
    /// (default) create symlinks when unpacking
    keep,
    /// skip creation of all symlinks when unpacking
    omit,
    /// make copies of all files that would be symlinked. Uses hard linking when possible as an optimization.
    copy,
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementSolving this issue will likely involve adding new logic or components to the codebase.proposalThis issue suggests modifications. If it also has the "accepted" label then it is planned.zig build systemstd.Build, the build runner, `zig build` subcommand, package management

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions