sfdk-build-shell
Create build environment for Salesforce DX projects
TLDR
Launch interactive shell in the build engine
Run a specified command in the build shell
Launch interactive shell in the build engine in maintenance mode, when inspecting or modifying the build environment
SYNOPSIS
sfdk-build-shell [options] <target_name> [command]
PARAMETERS
<target_name>
The name of the pre-configured Sailfish OS build target (e.g., SailfishOS-4.5.0.19-armv7hl). This specifies which OS version and architecture the build environment should be configured for.
[command]
An optional command to execute non-interactively within the build shell. If provided, the shell will execute this command and then exit, rather than providing an interactive session.
--list-targets, -l
Lists all available Sailfish OS build targets configured in the SDK.
--shell=<shell_path>
Specifies the path to the desired shell executable to use inside the build environment (e.g., sfdk-build-shell --shell=/bin/zsh SailfishOS-4.5.0.19-armv7hl).
--cwd=<path>
Sets the initial working directory inside the build environment. This path should be accessible within the chroot/container.
--no-shell-init
Prevents the build shell from sourcing default initialization files (like .profile or .bashrc), which can be useful for specific scripting scenarios.
--sdk-only
Ensures that the shell environment is strictly confined to SDK tools and the target's root filesystem, preventing access to host system binaries.
--verbose, -v
Increases the verbosity of the command's output, showing more details about the environment setup process.
--help, -h
Displays a help message for the sfdk-build-shell command.
DESCRIPTION
The sfdk-build-shell command is an essential utility within the Sailfish OS Software Development Kit (SDK). Its primary function is to launch an interactive shell environment specifically configured for developing and building applications, packages, and components for Sailfish OS. This environment typically takes the form of a chroot or a container, providing a clean, isolated, and consistent build setup that includes the correct cross-compilation toolchains, libraries, and header files corresponding to a particular Sailfish OS target architecture and version. By using sfdk-build-shell, developers can compile their source code, run tests, and create distributable packages within an environment that closely mimics the actual device, ensuring compatibility and reproducibility. It abstracts away the complexities of setting up build dependencies manually, making the development workflow streamlined and efficient.
CAVEATS
The use of sfdk-build-shell requires a properly installed and configured Sailfish OS SDK. It relies on pre-configured build targets; if targets are missing or corrupted, the command may fail. Network access from within the build shell might be restricted depending on the SDK setup. Changes made within the build shell are typically isolated to the chroot/container and do not affect the host system directly; persistent changes usually involve modifying the host's SDK configuration or project files.
ENVIRONMENT VARIABLES
When entering the sfdk-build-shell, several environment variables are set to correctly configure the build environment, including PATH, PKG_CONFIG_PATH, LD_LIBRARY_PATH, and cross-compilation specific variables like CC, CXX, and AR. These variables point to the appropriate toolchain components within the target's root filesystem.
INTEGRATION WITH IDES
While sfdk-build-shell is a command-line tool, it forms the backbone for build processes initiated from integrated development environments (IDEs) like Qt Creator when configured for Sailfish OS development. Qt Creator often uses sfdk commands internally to manage build targets and execute compilation steps within these isolated shells.
HISTORY
The sfdk-build-shell command, like the rest of the Sailfish OS SDK tools, has evolved with the development of Sailfish OS itself. From its early days, the SDK emphasized providing a robust and isolated build environment to cater to different hardware architectures (e.g., armv7hl, aarch64) and various Sailfish OS versions. This tool specifically emerged to simplify the process of entering such environments, abstracting away the manual setup of chroot or container commands. Its continuous refinement has focused on improving build reproducibility, streamlining the developer experience, and supporting new target platforms as Sailfish OS has matured.
SEE ALSO
sfdk(1), sfdk-deploy(1), sfdk-config(1), chroot(8)