(sigil cli build-cmds)
(sigil cli build-cmds) - Build and bundle command implementations
Shared library used by both the user-facing CLI (cli.sgl) and the minimal bootstrap CLI (cli/boot.sgl). Holds the workspace-build engine plus its many helpers (external dep loading, build cache, package path resolution) and the build/bundle subcommand definitions.
Imports here define the bootstrap-required set: anything pulled in by this module (transitively) ends up in BOOTSTRAP_MODULES (Makefile). Keep the import list lean — sigil-cli's user-facing extras (test, format, watch, profile) belong in cli.sgl, not here.
Exports
require-config-or-fail!procedureFind source file for a module in source paths and load paths Returns absolute path or #f Exit with a clear error when the user asks for a build config that isn't declared in the workspace's package.sgl. Defined at module scope so callers where config-name is shadowed by a parameter can still reach the config-name struct accessor. See t-83fe.
make-default-configprocedureCreate a default config if none specified in package. Provides sensible defaults for common config names:
- dev: debug build, no optimization, dynamic linking
- debug: debug build with static linking (installable)
- release: optimized, dynamic linking, supports FFI/dlopen
- release-static: optimized, musl static, no FFI support
- prerelease: like release but marked as non-release
- prerelease-static: like release-static but marked as non-release
load-external-dep-packagesprocedureLoad external dependency packages from .sigil/deps/ (git deps) and resolve from-path deps directly (including transitive deps) Optional third argument is redirects to apply Returns (packages-alist . paths-alist) where: packages-alist: (pkg-name . package) pairs paths-alist: (pkg-name . path) pairs
load-git-deps-with-transitiveprocedureLoad git deps and their transitive dependencies Returns list of (pkg-name package path) tuples
load-single-git-depprocedureLoad a single git dep (redirected or not) Returns (pkg-name package path) or #f
get-transitive-git-depsprocedureGet transitive git deps from a package that need to be loaded Returns list of from-git deps (after applying redirects if within same workspace)
resolve-all-path-depsprocedureResolve all from-path deps and their transitive dependencies Returns list of (pkg-name package path) tuples
collect-transitive-path-depsprocedureCollect transitive dependencies that can be resolved from the same workspace Returns list of from-path records for deps found in the workspace
find-package-in-workspaceprocedureFind a package by name in a workspace Returns the path to the package directory, or #f if not found
add-external-lib-pathsprocedureAdd source directories of external packages to the library path This enables imports from external (redirected) dependencies during compilation Also handles workspaces: when an external path is a workspace, adds ALL package source dirs from that workspace (for transitive dependencies)
find-workspace-rootprocedureFind the workspace root for a package path (if it's part of a workspace)
add-workspace-lib-pathsprocedureAdd all package source directories from a workspace to the library path
workspace-buildprocedureBuild packages in a workspace with dependency resolution Returns an alist of (pkg-name . outputs) where outputs is: ((modules . path) (libs . path) (assets . path-or-#f))
find-package-pathprocedureFind the path to a package directory by name Searches: 1) external-paths (if provided), 2) workspace paths, 3) git deps in .sigil/deps/, 4) from-path deps external-paths is an alist of (pkg-name . path) for pre-resolved external deps
find-path-dep-pathprocedureFind a from-path dependency's path by name Returns the path or raises an error if not found
find-sigil-lib-from-siblingsprocedureFind sigil-lib path by looking for it as a sibling of resolved deps, or in the sigil repo that hosts the running sigil binary.
When sigil-lib isn't in the dependency chain (common for apps that only use sigil-stdlib / sigil-tls / sigil-crypto transitively), we can find it in a few places:
- For from-path deps (in
external-paths), check each dep's parent directory for a sigil-lib sibling. - For from-git deps,
.sigil/deps/<pkg>symlinks into the shared~/.sigil/deps/<repo>-<sha>/packages/<pkg>checkout, which contains sigil-lib as a sibling. Resolve the symlink target and check its parent directory too. - As a last resort, derive it from the running
sigilbinary's location: for an in-tree build the binary lives at<sigil-repo>/build/<config>/bin/sigil, so../../../packages/sigil-librelative to the binary directory points at the matching sigil-lib source tree. This makes native-entry builds work without the caller having to declare sigil-lib as a dep or supply --redirects.
build-single-packageprocedureBuild a single package Returns an artifacts alist: ((static-library path1 path2 ...) (bytecode path3 ...) ...)
find-taskprocedureFind a task by name in a package (includes default tasks)
find-task-in-workspaceprocedureCheck if a task exists in workspace-level tasks
task-runnerprocedureCommon task runner used by both 'run' and 'build' commands
build-handlerprocedureHandler for 'sigil build' - builds packages with dependency resolution
Usage: sigil build - In workspace: build all packages in dependency order In package: run the 'build' task sigil build <package> - In workspace: build specific package with deps sigil build --task <t> - Run specific task instead of 'build'
find-msb-filesprocedureFind all .msb files in a directory
find-static-baseprocedureFind static sigil executable
verbose-optvariable(No description)
help-optvariable(No description)
force-optvariable(No description)
config-optvariable(No description)
redirects-optvariable(No description)
bundle-handlervariable(No description)
build-cmdvariable(No description)
bundle-cmdvariable(No description)