sfdk-build-requires
List build requirements for source code
TLDR
Run a subcommand refreshing the cache
Run a subcommand without refreshing the cache
Install or update the build-time dependencies
Install or update the build-time dependencies, omitting all extra ones
Show the difference between current and clean build environments
SYNOPSIS
sfdk-build-requires [OPTIONS] <SRPM_FILE_OR_PROJECT_PATH>
PARAMETERS
-s <file>, --srpm=<file>
Specifies the path to the source RPM (.src.rpm) file for which to determine build requirements. This is an alternative to specifying a project path.
-p <path>, --project=<path>
Specifies the path to the Sailfish OS project directory (e.g., containing 'rpm' or 'packaging' subdirectory) for which to determine build requirements. This is an alternative to specifying an SRPM file.
-r <release>, --release=<release>
Defines the target Sailfish OS release (e.g., '4.5.0.19') for dependency resolution. This ensures dependencies are resolved against the correct OS version's repositories.
-a <arch>, --arch=<arch>
Specifies the target architecture (e.g., 'armv7hl', 'aarch64', 'i486') for which to resolve dependencies. This is crucial for cross-compilation scenarios to ensure correct architecture-specific dependencies are identified.
--repo-dir=<path>
Specifies an alternative directory where repositories (e.g., RPMs or metadata) are located. This is useful for custom or offline build environments.
--chroot-name=<name>
Selects a specific named chroot or build target within the SDK to query for dependency information. Essential when multiple build environments are configured.
--verbose
Increases the verbosity of the output, providing more detailed information about the dependency resolution process and what packages are being considered.
--help
Displays a help message and exits, showing all available options and usage examples for the command.
DESCRIPTION
The sfdk-build-requires command is a crucial utility within the Sailfish OS SDK, designed to streamline the package building process. Its primary function is to analyze a given Sailfish OS project directory or a source RPM (SRPM) file and determine all the necessary build-time dependencies. These dependencies are a set of packages (e.g., development libraries, header files, build tools) that must be installed in the build environment for the compilation, linking, and packaging of the software to succeed.
By accurately identifying these requirements, developers can ensure that their build environments are correctly configured, preventing compilation failures due to missing components. The command typically queries the SDK's configured repositories and build targets to resolve these dependencies, providing a list of package names that can then be installed using a package manager like Zypper or DNF. This automation greatly simplifies cross-compilation and dependency management for Sailfish OS development.
CAVEATS
The sfdk-build-requires command relies heavily on a properly configured Sailfish OS SDK environment, including accessible repositories and defined build targets. It may not function correctly if the SDK is not initialized, if required repository metadata is missing or outdated, or if the specified SRPM/project path is invalid.
It primarily identifies dependencies explicitly listed in the package's spec file (e.g., BuildRequires, Requires sections). It generally cannot account for implicit dependencies or host system tools not managed by the target package manager within the SDK's build environment.
INTEGRATION WITH BUILD WORKFLOW
This command is typically the first step in a Sailfish OS package build process. Developers often run sfdk-build-requires to get a list of missing dependencies, then use a package manager (e.g., zypper install or dnf install) to install them into their build environment before initiating the actual package build with a command like sfdk build. This ensures a clean and successful compilation.
OUTPUT FORMAT
The command usually outputs a simple list of package names, one per line, to standard output. This format is designed for easy scripting and automation, allowing the output to be directly piped as input to package managers for bulk installation of missing dependencies.
HISTORY
The sfdk-build-requires command, as part of the Sailfish OS SDK (sfdk) suite, was developed by Jolla Ltd. and the broader Sailfish OS community. Its evolution has paralleled the development of Sailfish OS itself, focusing on providing robust and efficient tools for developers to build applications and system components for the mobile platform. It emerged from the need to simplify the complex process of managing build dependencies in a Linux-based cross-compilation environment, especially for RPM-based packaging workflows, thereby becoming an indispensable part of the Sailfish OS development toolchain.