| ... | ... | @@ -238,6 +238,18 @@ pub fn printSteps(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void { |
| 238 | 238 | } |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | pub fn printUsageWithoutConfiguration(zig_exe: []const u8, w: *Writer, reason: []const u8) Writer.Error!void { |
| 242 | try w.print( |
| 243 | \\Usage: {s} build [steps] [options] |
| 244 | \\ |
| 245 | \\Steps: (unavailable due to {s}) |
| 246 | \\Project-Specific Options: (unavailable due to {s}) |
| 247 | \\{s} |
| 248 | \\ (unavailable due to {s}) |
| 249 | \\{s} |
| 250 | , .{ zig_exe, reason, reason, system_integration_usage, reason, general_usage }); |
| 251 | } |
| 252 | |
| 241 | 253 | pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void { |
| 242 | 254 | const arena = graph.arena; |
| 243 | 255 | |
| ... | ... | @@ -274,37 +286,7 @@ pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void { |
| 274 | 286 | } |
| 275 | 287 | } |
| 276 | 288 | |
| 277 | | try w.writeAll( |
| 278 | | \\ |
| 279 | | \\System Integration Options: |
| 280 | | \\ --search-prefix [path] Add a path to look for binaries, libraries, headers |
| 281 | | \\ --sysroot [path] Set the system root directory (usually /) |
| 282 | | \\ --libc [file] Provide a file which specifies libc paths |
| 283 | | \\ |
| 284 | | \\ --system [pkgdir] Disable package fetching; enable all integrations |
| 285 | | \\ -fsys=[name] Enable a system integration |
| 286 | | \\ -fno-sys=[name] Disable a system integration |
| 287 | | \\ |
| 288 | | \\ -fdarling, -fno-darling Integration with system-installed Darling to |
| 289 | | \\ execute macOS programs on Linux hosts |
| 290 | | \\ (default: no) |
| 291 | | \\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute |
| 292 | | \\ foreign-architecture programs on Linux hosts |
| 293 | | \\ (default: no) |
| 294 | | \\ --libc-runtimes [path] Enhances QEMU integration by providing dynamic libc |
| 295 | | \\ (e.g. glibc or musl) built for multiple foreign |
| 296 | | \\ architectures, allowing execution of non-native |
| 297 | | \\ programs that link with libc. |
| 298 | | \\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on |
| 299 | | \\ ARM64 macOS hosts. (default: no) |
| 300 | | \\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to |
| 301 | | \\ execute WASI binaries. (default: no) |
| 302 | | \\ -fwine, -fno-wine Integration with system-installed Wine to execute |
| 303 | | \\ Windows programs on Linux hosts. (default: no) |
| 304 | | \\ |
| 305 | | \\ Available System Integrations: Enabled: |
| 306 | | \\ |
| 307 | | ); |
| 289 | try w.writeAll(system_integration_usage); |
| 308 | 290 | if (sc.configuration.system_integrations.len == 0) { |
| 309 | 291 | try w.writeAll(" (none) -\n"); |
| 310 | 292 | } else { |
| ... | ... | @@ -318,92 +300,127 @@ pub fn printUsage(sc: *const ScannedConfig, graph: *Graph, w: *Writer) !void { |
| 318 | 300 | } |
| 319 | 301 | } |
| 320 | 302 | |
| 321 | | try w.writeAll( |
| 322 | | \\ |
| 323 | | \\General Options: |
| 324 | | \\ -h, --help Print this help to stdout and exit |
| 325 | | \\ -l, --list-steps Print available steps to stdout and exit |
| 326 | | \\ |
| 327 | | \\ -p, --prefix [path] Where to install files (default: zig-out) |
| 328 | | \\ --prefix-lib-dir [path] Where to install libraries |
| 329 | | \\ --prefix-exe-dir [path] Where to install executables |
| 330 | | \\ --prefix-include-dir [path] Where to install C header files |
| 331 | | \\ --release[=mode] Request release mode, optionally specifying a |
| 332 | | \\ preferred optimization mode: fast, safe, small |
| 333 | | \\ |
| 334 | | \\ --verbose Print commands before executing them |
| 335 | | \\ --color [auto|off|on] Enable or disable colored error messages |
| 336 | | \\ --error-style [style] Control how build errors are printed |
| 337 | | \\ verbose (Default) Report errors with full context |
| 338 | | \\ minimal Report errors after summary, excluding context like command lines |
| 339 | | \\ verbose_clear Like 'verbose', but clear the terminal at the start of each update |
| 340 | | \\ minimal_clear Like 'minimal', but clear the terminal at the start of each update |
| 341 | | \\ --multiline-errors [style] Control how multi-line error messages are printed |
| 342 | | \\ indent (Default) Indent non-initial lines to align with initial line |
| 343 | | \\ newline Include a leading newline so that the error message is on its own lines |
| 344 | | \\ none Print as usual so the first line is misaligned |
| 345 | | \\ --summary [mode] Control the printing of the build summary |
| 346 | | \\ all Print the build summary in its entirety |
| 347 | | \\ new Omit cached steps |
| 348 | | \\ failures (Default if short-lived) Only print failed steps |
| 349 | | \\ line (Default if long-lived) Only print the single-line summary |
| 350 | | \\ none Do not print the build summary |
| 351 | | \\ -j<N> Limit concurrent jobs (default is to use all CPU cores) |
| 352 | | \\ --maxrss <bytes> Limit memory usage (default is to use available memory) |
| 353 | | \\ --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss |
| 354 | | \\ --test-timeout <timeout> Limit execution time of unit tests, terminating if exceeded. |
| 355 | | \\ The timeout must include a unit: ns, us, ms, s, m, h |
| 356 | | \\ --watch Continuously rebuild when source files are modified |
| 357 | | \\ --debounce <ms> Delay before rebuilding after changed file detected |
| 358 | | \\ --webui[=ip] Enable the web interface on the given IP address |
| 359 | | \\ --fuzz[=limit] Continuously search for unit test failures with an optional |
| 360 | | \\ limit to the max number of iterations. The argument supports |
| 361 | | \\ an optional 'K', 'M', or 'G' suffix (e.g. '10K'). Implies |
| 362 | | \\ '--webui' when no limit is specified. |
| 363 | | \\ --listen=- Enable the build server protocol on stdio |
| 364 | | \\ --time-report Force full rebuild and provide detailed information on |
| 365 | | \\ compilation time of Zig source code (implies '--webui') |
| 366 | | \\ -fincremental Enable incremental compilation |
| 367 | | \\ -fno-incremental Disable incremental compilation |
| 368 | | \\ |
| 369 | | \\Package Management Options: |
| 370 | | \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit |
| 371 | | \\ needed (Default) Lazy dependencies are fetched as needed |
| 372 | | \\ all Lazy dependencies are always fetched |
| 373 | | \\ --fork=[path], --fork [path] Override one or more projects from dependency tree |
| 374 | | \\ |
| 375 | | \\Advanced Options: |
| 376 | | \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error |
| 377 | | \\ -fno-reference-trace Disable reference trace |
| 378 | | \\ -fallow-so-scripts Allows .so files to be GNU ld scripts |
| 379 | | \\ -fno-allow-so-scripts (default) .so files must be ELF files |
| 380 | | \\ --error-limit [num] Set the maximum amount of distinct error values |
| 381 | | \\ --build-file [file] Override path to build.zig |
| 382 | | \\ --cache-dir [path] Override path to local Zig cache directory |
| 383 | | \\ --zig-lib=[arg] Override path to Zig lib directory |
| 384 | | \\ --seed [integer] For shuffling dependency traversal order (default: random) |
| 385 | | \\ --cache-poison[=mode] Override configuration caching behavior |
| 386 | | \\ pure (default) Avoid false positive cache hits |
| 387 | | \\ poisoned Don't cache the configuration |
| 388 | | \\ disallowed Panics when cache would be poisoned |
| 389 | | \\ ignored A little poison never hurt anybody |
| 390 | | \\ --print-configuration Render configuration as .zon to stdout |
| 391 | | \\ --print-configuration-path Print the path to the binary configuration file to stdout |
| 392 | | \\ --build-id[=style] At a minor link-time expense, embeds a build ID in binaries |
| 393 | | \\ fast 8-byte non-cryptographic hash (COFF, ELF, WASM) |
| 394 | | \\ sha1, tree 20-byte cryptographic hash (ELF, WASM) |
| 395 | | \\ md5 16-byte cryptographic hash (ELF) |
| 396 | | \\ uuid 16-byte random UUID (ELF, WASM) |
| 397 | | \\ 0x[hexstring] Constant ID, maximum 32 bytes (ELF, WASM) |
| 398 | | \\ none (default) No build ID |
| 399 | | \\ --debug-log [scope] Enable debugging the compiler |
| 400 | | \\ --debug-pkg-config Fail if unknown pkg-config flags encountered |
| 401 | | \\ --verbose-link Enable compiler debug output for linking |
| 402 | | \\ --verbose-air Enable compiler debug output for Zig AIR |
| 403 | | \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR |
| 404 | | \\ --verbose-cimport Enable compiler debug output for C imports |
| 405 | | \\ --verbose-cc Enable compiler debug output for C compilation |
| 406 | | \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features |
| 407 | | \\ |
| 408 | | ); |
| 303 | try w.writeAll(general_usage); |
| 304 | } |
| 305 | |
| 306 | const system_integration_usage = |
| 307 | \\ |
| 308 | \\System Integration Options: |
| 309 | \\ --search-prefix [path] Add a path to look for binaries, libraries, headers |
| 310 | \\ --sysroot [path] Set the system root directory (usually /) |
| 311 | \\ --libc [file] Provide a file which specifies libc paths |
| 312 | \\ |
| 313 | \\ --system [pkgdir] Disable package fetching; enable all integrations |
| 314 | \\ -fsys=[name] Enable a system integration |
| 315 | \\ -fno-sys=[name] Disable a system integration |
| 316 | \\ |
| 317 | \\ -fdarling, -fno-darling Integration with system-installed Darling to |
| 318 | \\ execute macOS programs on Linux hosts |
| 319 | \\ (default: no) |
| 320 | \\ -fqemu, -fno-qemu Integration with system-installed QEMU to execute |
| 321 | \\ foreign-architecture programs on Linux hosts |
| 322 | \\ (default: no) |
| 323 | \\ --libc-runtimes [path] Enhances QEMU integration by providing dynamic libc |
| 324 | \\ (e.g. glibc or musl) built for multiple foreign |
| 325 | \\ architectures, allowing execution of non-native |
| 326 | \\ programs that link with libc. |
| 327 | \\ -frosetta, -fno-rosetta Rely on Rosetta to execute x86_64 programs on |
| 328 | \\ ARM64 macOS hosts. (default: no) |
| 329 | \\ -fwasmtime, -fno-wasmtime Integration with system-installed wasmtime to |
| 330 | \\ execute WASI binaries. (default: no) |
| 331 | \\ -fwine, -fno-wine Integration with system-installed Wine to execute |
| 332 | \\ Windows programs on Linux hosts. (default: no) |
| 333 | \\ |
| 334 | \\ Available System Integrations: Enabled: |
| 335 | \\ |
| 336 | ; |
| 337 | |
| 338 | const general_usage = |
| 339 | \\ |
| 340 | \\General Options: |
| 341 | \\ -h, --help Print this help to stdout and exit |
| 342 | \\ -l, --list-steps Print available steps to stdout and exit |
| 343 | \\ |
| 344 | \\ -p, --prefix [path] Where to install files (default: zig-out) |
| 345 | \\ --prefix-lib-dir [path] Where to install libraries |
| 346 | \\ --prefix-exe-dir [path] Where to install executables |
| 347 | \\ --prefix-include-dir [path] Where to install C header files |
| 348 | \\ --release[=mode] Request release mode, optionally specifying a |
| 349 | \\ preferred optimization mode: fast, safe, small |
| 350 | \\ |
| 351 | \\ --verbose Print commands before executing them |
| 352 | \\ --color [auto|off|on] Enable or disable colored error messages |
| 353 | \\ --error-style [style] Control how build errors are printed |
| 354 | \\ verbose (Default) Report errors with full context |
| 355 | \\ minimal Report errors after summary, excluding context like command lines |
| 356 | \\ verbose_clear Like 'verbose', but clear the terminal at the start of each update |
| 357 | \\ minimal_clear Like 'minimal', but clear the terminal at the start of each update |
| 358 | \\ --multiline-errors [style] Control how multi-line error messages are printed |
| 359 | \\ indent (Default) Indent non-initial lines to align with initial line |
| 360 | \\ newline Include a leading newline so that the error message is on its own lines |
| 361 | \\ none Print as usual so the first line is misaligned |
| 362 | \\ --summary [mode] Control the printing of the build summary |
| 363 | \\ all Print the build summary in its entirety |
| 364 | \\ new Omit cached steps |
| 365 | \\ failures (Default if short-lived) Only print failed steps |
| 366 | \\ line (Default if long-lived) Only print the single-line summary |
| 367 | \\ none Do not print the build summary |
| 368 | \\ -j<N> Limit concurrent jobs (default is to use all CPU cores) |
| 369 | \\ --maxrss <bytes> Limit memory usage (default is to use available memory) |
| 370 | \\ --skip-oom-steps Instead of failing, skip steps that would exceed --maxrss |
| 371 | \\ --test-timeout <timeout> Limit execution time of unit tests, terminating if exceeded. |
| 372 | \\ The timeout must include a unit: ns, us, ms, s, m, h |
| 373 | \\ --watch Continuously rebuild when source files are modified |
| 374 | \\ --debounce <ms> Delay before rebuilding after changed file detected |
| 375 | \\ --webui[=ip] Enable the web interface on the given IP address |
| 376 | \\ --fuzz[=limit] Continuously search for unit test failures with an optional |
| 377 | \\ limit to the max number of iterations. The argument supports |
| 378 | \\ an optional 'K', 'M', or 'G' suffix (e.g. '10K'). Implies |
| 379 | \\ '--webui' when no limit is specified. |
| 380 | \\ --listen=- Enable the build server protocol on stdio |
| 381 | \\ --time-report Force full rebuild and provide detailed information on |
| 382 | \\ compilation time of Zig source code (implies '--webui') |
| 383 | \\ -fincremental Enable incremental compilation |
| 384 | \\ -fno-incremental Disable incremental compilation |
| 385 | \\ |
| 386 | \\Package Management Options: |
| 387 | \\ --fetch[=mode] Fetch dependency tree (optionally choose laziness) and exit |
| 388 | \\ needed (Default) Lazy dependencies are fetched as needed |
| 389 | \\ all Lazy dependencies are always fetched |
| 390 | \\ --fork=[path], --fork [path] Override one or more projects from dependency tree |
| 391 | \\ |
| 392 | \\Advanced Options: |
| 393 | \\ -freference-trace[=num] How many lines of reference trace should be shown per compile error |
| 394 | \\ -fno-reference-trace Disable reference trace |
| 395 | \\ -fallow-so-scripts Allows .so files to be GNU ld scripts |
| 396 | \\ -fno-allow-so-scripts (default) .so files must be ELF files |
| 397 | \\ --error-limit [num] Set the maximum amount of distinct error values |
| 398 | \\ --build-file [file] Override path to build.zig |
| 399 | \\ --cache-dir [path] Override path to local Zig cache directory |
| 400 | \\ --zig-lib=[arg] Override path to Zig lib directory |
| 401 | \\ --seed [integer] For shuffling dependency traversal order (default: random) |
| 402 | \\ --cache-poison[=mode] Override configuration caching behavior |
| 403 | \\ pure (default) Avoid false positive cache hits |
| 404 | \\ poisoned Don't cache the configuration |
| 405 | \\ disallowed Panics when cache would be poisoned |
| 406 | \\ ignored A little poison never hurt anybody |
| 407 | \\ --print-configuration Render configuration as .zon to stdout |
| 408 | \\ --print-configuration-path Print the path to the binary configuration file to stdout |
| 409 | \\ --build-id[=style] At a minor link-time expense, embeds a build ID in binaries |
| 410 | \\ fast 8-byte non-cryptographic hash (COFF, ELF, WASM) |
| 411 | \\ sha1, tree 20-byte cryptographic hash (ELF, WASM) |
| 412 | \\ md5 16-byte cryptographic hash (ELF) |
| 413 | \\ uuid 16-byte random UUID (ELF, WASM) |
| 414 | \\ 0x[hexstring] Constant ID, maximum 32 bytes (ELF, WASM) |
| 415 | \\ none (default) No build ID |
| 416 | \\ --debug-log [scope] Enable debugging the compiler |
| 417 | \\ --debug-pkg-config Fail if unknown pkg-config flags encountered |
| 418 | \\ --verbose-link Enable compiler debug output for linking |
| 419 | \\ --verbose-air Enable compiler debug output for Zig AIR |
| 420 | \\ --verbose-llvm-ir Enable compiler debug output for LLVM IR |
| 421 | \\ --verbose-cimport Enable compiler debug output for C imports |
| 422 | \\ --verbose-cc Enable compiler debug output for C compilation |
| 423 | \\ --verbose-llvm-cpu-features Enable compiler debug output for LLVM CPU features |
| 424 | \\ |
| 425 | ; |
| 409 | 426 | } |