rpmbuild
Build RPM packages from source files
TLDR
Build binary and source packages
Build a binary package without source package
Specify additional variables when building a package
SYNOPSIS
rpmbuild [OPTIONS]
PARAMETERS
-ba
Builds the package from the spec file. Creates both source and binary RPM packages.
-bs
Builds a source RPM package only.
-bb
Builds a binary RPM package only.
-bc
Performs the 'build' stage of the build process only.
-bi
Performs the 'install' stage of the build process only.
-bl
Performs a 'list' stage of the build process to verify files.
-bp
Performs the 'prepare' stage of the build process only.
--clean
Removes the build directory after the build process.
--short-circuit
Skip the build stage. Useful for testing installation procedures.
--target
Specifies the target architecture for the build.
-D
Defines a macro with a specified value.
--define
Defines a macro with a specified value (alternative syntax).
--nodeps
Do not check for build dependencies.
--sign
Sign the resulting package(s).
DESCRIPTION
The rpmbuild command is a powerful tool used to build RPM (Red Hat Package Manager) software packages from source code and specifications. It reads a spec file, which contains instructions on how to build the software, including dependencies, build commands, file locations, and installation procedures.
rpmbuild automates the process of compiling, installing, and packaging software into a distributable RPM package. It simplifies software distribution and management by creating standardized packages that can be easily installed, updated, and removed on systems using RPM. rpmbuild provides a structured approach to software development and deployment, ensuring consistency and simplifying the management of software across multiple systems. It provides various options to build different parts of the rpm package, such as the source package (.src.rpm), the binary package (.rpm) or both.
CAVEATS
Requires a properly formatted spec file to function correctly. Build environment setup is crucial. Incorrect dependencies or build commands in the spec file can lead to build failures.
SPEC FILE STRUCTURE
The spec file is a text file that describes how to build an RPM package.
It contains sections such as 'Name', 'Version', 'Release', 'Summary', 'Description', 'License', 'URL', 'Source', 'BuildRequires', 'Requires', 'Build', 'Install', and 'Files'.
Each section provides specific instructions for the build process.
BUILD ENVIRONMENT
rpmbuild typically operates within a controlled build environment, often a dedicated directory structure with specific subdirectories for sources, build files, RPMS, and SRPMS. This helps isolate the build process and prevent conflicts with the system's core files.
HISTORY
RPM was originally created by Red Hat, and rpmbuild is the primary tool for creating RPM packages. Over time, RPM and rpmbuild have become widely adopted by other Linux distributions and have evolved to support various features, including dependency management, package signing, and more.
SEE ALSO
rpm(8), rpmquery(1), rpmsign(1)