RPM Toolchain#
This toolchain is responsible for generating RPMs from any given Bazel build target.
Setup#
MODULE.bazel#
git_override(
module_name = "rules_rpm",
remote = "https://github.com/eclipse-score/os_autosd.git",
branch = "main"
)
bazel_dep(name = "rules_rpm", version = "0.1.0")
rpm_toolchain = use_extension("@rules_rpm//toolchain:extensions.bzl", "rpm_toolchain")
use_repo(rpm_toolchain, "rpm_toolchain")
register_toolchains(
"@rules_rpm//toolchain:linux_x86_64",
"@rules_rpm//toolchain:linux_aarch64",
)
Usage#
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("@rules_rpm//:defs.bzl", "rpm_package")
cc_binary(
name = "hello_world",
srcs = ["main.cpp"],
)
rpm_package(
name = "hello_world_rpm",
binaries = [":hello_world"],
version = "1.0.0",
summary = "Hello World application",
requires = ["systemd", "openssl"], # Optional dependencies
)
Build#
bazel build //:hello_world_rpm
rpm -qpil bazel-bin/hello_world_rpm-1.0.0-1.x86_64.rpm
Attributes#
Attribute |
Type |
Default |
Description |
|---|---|---|---|
|
|
|
Binary files to include |
|
|
|
Library files to include |
|
|
|
Header files to include |
|
|
|
Configuration files |
|
|
|
Data files |
|
|
required |
Package version |
|
|
|
Short description |
|
|
|
Detailed description |
|
|
|
Package dependencies |
|
|
Include transitive headers from |
|
|
|
rule name |
Override package name |
|
|
|
Release number |
|
|
|
Package license |
|
|
|
Target architecture |
|
|
|
RPM package group |
|
|
|
Package vendor |
|
|
|
Package maintainer |
|
|
|
Project homepage |
|
|
|
Binary install directory |
|
|
|
Library install directory |
|
|
|
Header install directory |
|
|
|
Config install directory |
|
|
|
Data install directory |
|
|
|
List of commands to run after installation |