mach icon indicating copy to clipboard operation
mach copied to clipboard

build-system: add system_sdk option to disable/ignore system SDK

Open mitchellh opened this issue 3 years ago • 1 comments

The system SDK process is unfriendly to Nix packaging because Nix packages happen in a readonly environment with minimal dependencies. I don't want my build process to be able to use "git" but I can work around that. Unfortunately, I can't workaround system_sdk running git fetch and so on and trying to write to a read-only filesystem.

For the purpose of specific OS packages, I'd prefer to just have the option to disable the system SDK inclusion and rely (or fail) on local system packages.

Alternatively: I've tried making SDK_PATH work as a workaround and it works but this still calls git fetch. So an alternate approach is perhaps to support specifying a non-Git checkout of the system SDK.

mitchellh avatar Jul 26 '22 16:07 mitchellh

Yup, I'd like to support this use case more nicely.

The workaround for now would be to use:

SDK_PATH=$(pwd)/.. zig build

And have a clone of the relevant SDK repos in the parent dir.

If you specify SDK_PATH, no git fetch or git reset commands (which try to ensure the SDK checkout is at the right revision) should be executed. But it looks like we're missing a conditional like this:

if (std.process.getEnvVarOwned(allocator, "SDK_PATH")) |sdk_path| {

Around this line of code: https://github.com/hexops/mach/blob/eecbad403ca4205ed90ef97f3cd07a3da8def671/glfw/system_sdk.zig#L214-L223


Separately, I'd also happily accept an env var flag MACH_USE_SDK and if set to false, simply make this function return immediately: https://github.com/hexops/mach/blob/eecbad403ca4205ed90ef97f3cd07a3da8def671/glfw/system_sdk.zig#L66

emidoots avatar Jul 27 '22 17:07 emidoots

system SDK has been removed entirely in favor of Zig package manager

emidoots avatar Jul 04 '23 05:07 emidoots