Fields

install_tls: TopLevelStep,
uninstall_tls: TopLevelStep,
allocator: Allocator,
user_input_options: UserInputOptionsMap,
available_options_map: AvailableOptionsMap,
available_options_list: ArrayList(AvailableOption),
verbose: bool,
verbose_link: bool,
verbose_cc: bool,
verbose_air: bool,
verbose_llvm_ir: ?[]const u8,
verbose_llvm_bc: ?[]const u8,
verbose_cimport: bool,
verbose_llvm_cpu_features: bool,
reference_trace: ?u32 = null,
invalid_user_input: bool,
zig_exe: [:0]const u8,
default_step: *Step,
env_map: *EnvMap,
top_level_steps: field_call,
install_prefix: []const u8,
dest_dir: ?[]const u8,
lib_dir: []const u8,
exe_dir: []const u8,
h_dir: []const u8,
install_path: []const u8,
sysroot: ?[]const u8 = null,
search_prefixes: ArrayList([]const u8),
libc_file: ?[]const u8 = null,
installed_files: ArrayList(InstalledFile),
build_root: Cache.Directory,

Path to the directory containing build.zig.

cache_root: Cache.Directory,
global_cache_root: Cache.Directory,
cache: *Cache,
zig_lib_dir: ?LazyPath,
vcpkg_root: VcpkgRoot = .unattempted,
pkg_config_pkg_list: ?PkgConfigError![]const PkgConfigPkg = null,
args: ?[][]const u8 = null,
debug_log_scopes: []const []const u8 = ref,
debug_compile_errors: bool = false,
debug_pkg_config: bool = false,
enable_darling: bool = false,

Experimental. Use system Darling installation to run cross compiled macOS build artifacts.

enable_qemu: bool = false,

Use system QEMU installation to run cross compiled foreign architecture build artifacts.

enable_rosetta: bool = false,

Darwin. Use Rosetta to run x86_64 macOS build artifacts on arm64 macOS.

enable_wasmtime: bool = false,

Use system Wasmtime installation to run cross compiled wasm/wasi build artifacts.

enable_wine: bool = false,

Use system Wine installation to run cross compiled Windows build artifacts.

glibc_runtimes_dir: ?[]const u8 = null,

After following the steps in https://github.com/ziglang/zig/wiki/Updating-libc#glibc, this will be the directory $glibc-build-dir/install/glibcs Given the example of the aarch64 target, this is the directory that contains the path aarch64-linux-gnu/lib/ld-linux-aarch64.so.1.

Information about the native target. Computed before build() is invoked.

dep_prefix: []const u8 = "",
modules: field_call,
initialized_deps: *field_call,

A map from build root dirs to the corresponding *Dependency. This is shared with all child Builds.

Functions

fn addAssembly(b: *Build, options: AssemblyOptions) *Step.Compile

No documentation provided.

fn addCheckFile(b: *Build, file_source: LazyPath, options: Step.CheckFile.Options) *Step.CheckFile

No documentation provided.

fn addConfigHeader(b: *Build, options: Step.ConfigHeader.Options, values: anytype) *Step.ConfigHeader

Using the values provided, produces a C header file, possibly based on a temp…

Using the values provided, produces a C header file, possibly based on a template input file (e.g. config.h.in). When an input template file is provided, this function will fail the build when an option not found in the input file is provided in values, and when an option found in the input file is missing from values.

fn addExecutable(b: *Build, options: ExecutableOptions) *Step.Compile

No documentation provided.

fn addFmt(b: *Build, options: Step.Fmt.Options) *Step.Fmt

No documentation provided.

fn addInstallArtifact(self: *Build, artifact: *Step.Compile, options: Step.InstallArtifact.Options) *Step.InstallArtifact

This merely creates the step; it does not add it to the dependencies of the top…

This merely creates the step; it does not add it to the dependencies of the top-level install step.

fn addInstallBinFile(self: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile

dest_rel_path is relative to bin path

fn addInstallDirectory(self: *Build, options: InstallDirectoryOptions) *Step.InstallDir

No documentation provided.

fn addInstallFile(self: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile

dest_rel_path is relative to install prefix path

fn addInstallFileWithDir(self: *Build, source: LazyPath, install_dir: InstallDir, dest_rel_path: []const u8) *Step.InstallFile

No documentation provided.

fn addInstallHeaderFile(b: *Build, src_path: []const u8, dest_rel_path: []const u8) *Step.InstallFile

No documentation provided.

fn addInstallLibFile(self: *Build, source: LazyPath, dest_rel_path: []const u8) *Step.InstallFile

dest_rel_path is relative to lib path

fn addModule(b: *Build, name: []const u8, options: CreateModuleOptions) *Module

This function creates a module and adds it to the package’s module set, making …

This function creates a module and adds it to the package’s module set, making it available to other packages which depend on this one. createModule can be used instead to create a private module.

fn addObjCopy(b: *Build, source: LazyPath, options: Step.ObjCopy.Options) *Step.ObjCopy

No documentation provided.

fn addObject(b: *Build, options: ObjectOptions) *Step.Compile

No documentation provided.

fn addOptions(self: *Build) *Step.Options

No documentation provided.

fn addRemoveDirTree(self: *Build, dir_path: []const u8) *Step.RemoveDir

No documentation provided.

fn addRunArtifact(b: *Build, exe: *Step.Compile) *Step.Run

Creates a Step.Run with an executable built with addExecutable. Add command…

Creates a Step.Run with an executable built with addExecutable. Add command line arguments with methods of Step.Run.

fn addSearchPrefix(self: *Build, search_prefix: []const u8) void

No documentation provided.

fn addSharedLibrary(b: *Build, options: SharedLibraryOptions) *Step.Compile

No documentation provided.

fn addStaticLibrary(b: *Build, options: StaticLibraryOptions) *Step.Compile

No documentation provided.

fn addSystemCommand(self: *Build, argv: []const []const u8) *Step.Run

Initializes a Step.Run with argv, which must at least have the path to the ex…

Initializes a Step.Run with argv, which must at least have the path to the executable. More command line arguments can be added with addArg, addArgs, and addArtifactArg. Be careful using this function, as it introduces a system dependency. To run an executable built with zig build, see Step.Compile.run.

fn addTest(b: *Build, options: TestOptions) *Step.Compile

No documentation provided.

fn addTranslateC(self: *Build, options: Step.TranslateC.Options) *Step.TranslateC

No documentation provided.

fn addUserInputFlag(self: *Build, name_raw: []const u8) !bool

No documentation provided.

fn addUserInputOption(self: *Build, name_raw: []const u8, value_raw: []const u8) !bool

No documentation provided.

fn addWriteFile(self: *Build, file_path: []const u8, data: []const u8) *Step.WriteFile

No documentation provided.

fn addWriteFiles(b: *Build) *Step.WriteFile

No documentation provided.

fn anonymousDependency(b: *Build, relative_build_root: []const u8, comptime build_zig: type, args: anytype) *Dependency

No documentation provided.

fn constructCMacro(allocator: Allocator, name: []const u8, value: ?[]const u8) []const u8

Allocates a new string for assigning a value to a named macro. If the value is …

Allocates a new string for assigning a value to a named macro. If the value is omitted, it is set to 1. name and value need not live longer than the function call.

fn create(allocator: Allocator, zig_exe: [:0]const u8, build_root: Cache.Directory, cache_root: Cache.Directory, global_cache_root: Cache.Directory, host: NativeTargetInfo, cache: *Cache) !*Build

No documentation provided.

fn createModule(b: *Build, options: CreateModuleOptions) *Module

This function creates a private module, to be used by the current package, but …

This function creates a private module, to be used by the current package, but not exposed to other packages depending on this one. addModule can be used instead to create a public module.

fn dependency(b: *Build, name: []const u8, args: anytype) *Dependency

No documentation provided.

fn dependencyInner(b: *Build, name: []const u8, build_root_string: []const u8, comptime build_zig: type, args: anytype) *Dependency

No documentation provided.

fn destroy(b: *Build) void

No documentation provided.

fn dumpBadGetPathHelp(s: *Step, stderr: fs.File, src_builder: *Build, asking_step: ?*Step) anyerror!void

In this function the stderr mutex has already been locked.

fn dupe(self: *Build, bytes: []const u8) []u8

Allocator.dupe without the need to handle out of memory.

fn dupePath(self: *Build, bytes: []const u8) []u8

Duplicates a path and converts all slashes to the OS’s canonical path separator.

fn dupeStrings(self: *Build, strings: []const []const u8) [][]u8

Duplicates an array of strings without the need to handle out of memory.

fn exec(b: *Build, argv: []const []const u8) []u8

This is a helper function to be called from build.zig scripts, not from insid…

This is a helper function to be called from build.zig scripts, not from inside step make() functions. If any errors occur, it fails the build with a helpful message.

fn execAllowFail(self: *Build, argv: []const []const u8, out_code: *u8, stderr_behavior: std.ChildProcess.StdIo) ExecError![]u8

No documentation provided.

fn findProgram(self: *Build, names: []const []const u8, paths: []const []const u8) ![]const u8

No documentation provided.

fn fmt(self: *Build, comptime format: []const u8, args: anytype) []u8

No documentation provided.

fn getInstallPath(self: *Build, dir: InstallDir, dest_rel_path: []const u8) []const u8

No documentation provided.

fn getInstallStep(self: *Build) *Step

No documentation provided.

fn getUninstallStep(self: *Build) *Step

No documentation provided.

fn hex64(x: u64) [16]u8

There are a few copies of this function in miscellaneous places. Would be nice t…

There are a few copies of this function in miscellaneous places. Would be nice to find a home for them.

fn installArtifact(self: *Build, artifact: *Step.Compile) void

This creates the install step and adds it to the dependencies of the top-level …

This creates the install step and adds it to the dependencies of the top-level install step, using all the default options. See addInstallArtifact for a more flexible function.

fn installBinFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void

dest_rel_path is relative to bin path

fn installDirectory(self: *Build, options: InstallDirectoryOptions) void

No documentation provided.

fn installFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void

dest_rel_path is relative to prefix path

fn installLibFile(self: *Build, src_path: []const u8, dest_rel_path: []const u8) void

dest_rel_path is relative to lib path

fn makeTempPath(b: *Build) []const u8

This function is intended to be called in the configure phase only. It return…

This function is intended to be called in the configure phase only. It returns an absolute directory path, which is potentially going to be a source of API breakage in the future, so keep that in mind when using this function.

fn option(self: *Build, comptime T: type, name_raw: []const u8, description_raw: []const u8) ?T

No documentation provided.

fn pathFromRoot(b: *Build, p: []const u8) []u8

No documentation provided.

fn pathJoin(self: *Build, paths: []const []const u8) []u8

No documentation provided.

fn pushInstalledFile(self: *Build, dir: InstallDir, dest_rel_path: []const u8) void

deprecated: https://github.com/ziglang/zig/issues/14943

fn resolveInstallPrefix(self: *Build, install_prefix: ?[]const u8, dir_list: DirList) void

This function is intended to be called by lib/build_runner.zig, not a build.zig …

This function is intended to be called by lib/build_runner.zig, not a build.zig file.

fn runBuild(b: *Build, build_zig: anytype) anyerror!void

No documentation provided.

fn serializeCpu(allocator: Allocator, cpu: std.Target.Cpu) ![]const u8

No documentation provided.

fn standardOptimizeOption(self: *Build, options: StandardOptimizeOptionOptions) std.builtin.Mode

No documentation provided.

fn standardTargetOptions(self: *Build, args: StandardTargetOptionsArgs) CrossTarget

Exposes standard zig build options for choosing a target.

fn step(self: *Build, name: []const u8, description: []const u8) *Step

No documentation provided.

fn truncateFile(self: *Build, dest_path: []const u8) !void

No documentation provided.

fn validateUserInputDidItFail(self: *Build) bool

No documentation provided.

Values

Builder
type

deprecated: use Build.

ExecError
type

Error Sets