Packaging for Arch Linux
Relevant source files
The following files were used as context for generating this wiki page:
The steam-online-fix-launcher project provides support for creating a native Arch Linux package (.pkg.tar.zst). This is managed through a PKGBUILD file and an accompanying build script, build.sh, located in the packaging/arch/ directory. The process is designed to be run on an Arch Linux system and can be integrated into CI/CD pipelines.
The Arch Linux package is one of several distribution formats supported, alongside Debian (.deb) and Flatpak, providing users with multiple installation options. The build process is automated to ensure consistency and ease of use for packagers and developers.
Sources: packaging/README.md, packaging/arch/build.sh
Core Components
The Arch Linux packaging system consists of two main components working together.
Sources: packaging/arch/build.sh, scripts/update_version.sh
packaging/arch/build.sh
This is the primary shell script responsible for orchestrating the entire package build process. It automates the steps required to generate a source tarball and then uses Arch Linux's native makepkg utility to create the final package. The script is designed to be executed directly on an Arch Linux system or within a compatible container.
Sources: packaging/arch/build.sh:3
PKGBUILD
This is the standard Arch Linux package build recipe file. While its full content is not provided, its structure and manipulation are detailed in the build scripts. It defines the package metadata, dependencies, and build steps. The build.sh and update_version.sh scripts interact with this file, primarily to update the package version (pkgver).
Sources: packaging/arch/build.sh:105-106, scripts/update_version.sh:29-32
Build Process
The build process is initiated by running the packaging/arch/build.sh script. It follows a structured sequence of operations to ensure a clean and successful package build.
Sources: packaging/arch/build.sh
Execution Flow
The diagram below illustrates the step-by-step execution flow of the build.sh script.
This flowchart shows the logic within build.sh, from initial checks to the final package creation.
Sources: packaging/arch/build.sh
Key Stages
- Prerequisite Check: The script first verifies that
makepkgis available, exiting if it's not found, as this is essential for building Arch packages.
Sources: packaging/arch/build.sh:13-23 - Source Tarball Creation: It creates a source tarball (
.tar.gz) of the project. If run within a git repository, it usesgit archive. Otherwise, it creates a tarball from the current directory after cleaning build artifacts.
Sources: packaging/arch/build.sh:47-71 - Working Directory Setup: A temporary build directory (
arch-build-$VERSION) is created in the output directory. ThePKGBUILDfile is copied here to avoid modifying the original file in the repository.
Sources: packaging/arch/build.sh:74-84 - Version Update: The script uses
sedto update thepkgverfield in the copiedPKGBUILDto match the version passed to the script.
Sources: packaging/arch/build.sh:105-106 makepkgExecution: The script configures several environment variables (SRCDEST,PKGDEST) to control wheremakepkgstores sources and final packages. It then runsmakepkg -f --noconfirmto build the package. To adhere to best practices, if the script is run as root, it creates a temporary 'builder' user to runmakepkgwithout privileges.
Sources: packaging/arch/build.sh:112-152- Output: The final
.pkg.tar.zstpackage and the source tarball are placed in the specified output directory (defaults todist/).
Sources: packaging/arch/build.sh:113-114, packaging/arch/build.sh:159-165
Script Parameters and Environment
The build.sh script can be configured with parameters and environment variables.
| Parameter/Variable | Description | Default Value | Source File |
|---|---|---|---|
VERSION (arg 1) | The package version to build. | 0.0.3 | packaging/arch/build.sh:7 |
OUTPUT_DIR (arg 2) | The directory to place the final package and source tarball. | ../../dist | packaging/arch/build.sh:9 |
SRCDEST | Environment variable directing makepkg where to download/store source files. | $OUTPUT_DIR | packaging/arch/build.sh:112 |
PKGDEST | Environment variable directing makepkg where to place the built package. | $OUTPUT_DIR | packaging/arch/build.sh:113 |
PACKAGER | Sets the packager metadata in the built package. | CI Builder <ci@localhost> | packaging/arch/build.sh:129 |
ALLOW_SKIP_INTEG | If set to true, disables makepkg integrity checks via the --skipinteg flag. Not for production. | false | packaging/arch/build.sh:138-142 |
Sources: packaging/arch/build.sh
Integration with Build System
The Arch packaging script is part of a larger, unified build system. The scripts/build_all.sh script can be used to build packages for all supported formats, including Arch.
This diagram shows how the different scripts and files interact during a full build cycle.
Version Management
The version for all package types is centralized. The scripts/update_version.sh script is responsible for propagating the version number from meson.build to all packaging files, including the pkgver field in the Arch PKGBUILD. This ensures version consistency across all distributable formats.
Sources: scripts/update_version.sh:29-32, scripts/build_all.sh:31-32
Unified Build Command
A developer can build all packages, including for Arch, with a single command. The build_all.sh script handles calling the specific build script for each requested package type.
# Build all packages with a specific version
./scripts/build_all.sh 1.0.0
# Build only the Arch package
./scripts/build_all.sh 1.0.0 "arch"
Sources: packaging/README.md:12, scripts/build_all.sh:4-5
Installation
Once the package is built, it can be installed on an Arch Linux system using pacman. The project's README.md also suggests manual installation using makepkg -si after downloading the PKGBUILD.
Sources: packaging/README.md:100-102, README.md
Summary
The Arch Linux packaging for steam-online-fix-launcher is a well-defined and automated process. It leverages standard Arch tools like makepkg and PKGBUILD while providing a high-level build script (build.sh) for ease of use and integration. The system is designed for consistency, with centralized version management and inclusion in a unified, multi-format build script (build_all.sh), making it suitable for both local development and automated CI/CD workflows.
Sources: packaging/arch/build.sh, scripts/build_all.sh