Getting Started with the xPack CMake
Overview
xPack CMake is a standalone, cross-platform (Windows, macOS, GNU/Linux) binary distribution of CMake, aimed at reproducible builds.
What are reproducible builds?
To be reproducible, an operation must remain stable over time and across different environments. In other words, if builds are repeated after some time, possibly on a different machine or platform, the resulting behaviour must be functionally equivalent.
CMake is a powerful Software Build System, the de-facto standard for building C++ code.
CMake is an open source project hosted on GitLab and mirrored on GitHub.
The open source xPack CMake project is hosted on GitHub as
xpack-dev-tools/cmake-xpack
;
it provides the platform specific binaries as
release assets.
In addition to the binary archives and the package metadata, this project also includes the build scripts.
What are xpm packages? (xPacks)
xpm packages, abbreviated as xPacks, are versatile, language-neutral software packages. They have been successfully utilised in C/C++ projects.
What the heck are xpm packages (xPacks)? Please, do not introduce another package format!
Although the initial appearance may seem complex, utilising xpm packages is, in fact, straightforward. The design rationale is to automate frequent operations that occur during software development, such as the installation of dependencies, and to ensure reproducibility.
These packages are managed by xpm (the xPack Project Manager), a programme that complements the npm CLI (the popular JavaScript package manager), with new language-neutral features.
The xPacks Framework does NOT introduce a new package format; instead,
it uses the same format as npm packages, which is a collection of
files/folders and a package.json
file with the package metadata.
xpm can install packages from the same repositories as npm, whether public or private.
The packages (usually regular archives, but also git repositories), are extracted into separate folders within the project.
Based on the content, there are two types of xpm packages:
- packages with source libraries (source xpm packages)
- packages with executables, usually platform-specific binary tools (binary xpm packages)
Source xpm packages are regular npm packages that include library source files, typically in C/C++, though there are no language restrictions.
Binary xpm packages are also regular npm packages, but with minimal
content, typically just the package.json
file. Since these packages
provide executables for multiple platforms, some of which are quite
large, it is not practical to include all binaries within the npm
package itself. Instead, the package.json
file contains references
(URLs) to platform-specific binary archives (e.g., .tar.gz
for Unix or
.zip
for Windows).
These archives are also expanded along with the package metadata.
Links/forwarders to
these executables are created in a .bin
folder,
eliminating the need to add multiple folders to the PATH
.
In summary, xpm packages can enhance and automate the installation process for source libraries and tools.
Features
All binaries are:
- Self-contained (include all required libraries).
- File-system relocatable (can be installed in any location).
- Built on slightly older systems (to ensure compatibility with both old and new systems).
Compatibility with older systems
Given that most operating systems maintain significant compatibility with older versions, building an application on an older system ensures that the same binary can run on newer versions. Conversely, building an application on a newer system may utilize library features that are not available in older versions, making backward compatibility less feasible.
Similarly to flatpacks or snap, but significantly simpler, xpm packages include all dependent shared libraries within the distributed archives, making the binaries independent of any similar libraries installed on the system. This ensures they can run on any system without needing specific libraries to be installed.
Also the builds are configured so that the binaries do not depend on being installed in specific folders, and can be installed in any location, including in user folders.
Benefits
The main advantages of using the xPack CMake are:
- A convenient, uniform and portable install/uninstall/upgrade procedure; the same procedure is used for all major platforms (x64 Windows, x64 macOS, arm64 macOS, x64 GNU/Linux, arm64 GNU/Linux, arm GNU/Linux).
- Multiple versions of the same package can be installed at the same time on the same system.
- No need to worry about dependent libraries, they are all included.
- Not affected by system updates that might change the versions of the dependent libraries.
- Significantly lighter and easier to use than Docker images that provide similar functionality and are GNU/Linux centric.
- Projects can be tied to specific tools versions; this provides a good reproducibility, especially useful in CI/CD environments.
Compatibility
The xPack CMake project is fully compatible with the upstream CMake.
Install
The executables and other related files can be installed automatically with xpm or manually by downloading the platform specific archives.
The details of installing the xPack CMake on various platforms are presented in the Install Guide.
Documentation
The original CMake documentation is available from the project web site:
Release schedule
This distribution generally follows the official CMake releases, but usually is one minor release behind (sometimes two).
Deciding when to make new xPack CMake releases is difficult, because CMake continues to fix issues for the last two minor releases, and there is no way to tell if a patch release is the final one.
In practical terms, based on past release schedule, when the new upstream 3.29.4 is released, the previous 3.28.X is probably no longer updated and can be released (where X is the latest patch available at that time).
Support & feedback
The quick advice for getting support and providing feedback is to use the GitHub Discussions.
For additional information, please refer to the Help Centre page.
Change log
The release and change log is available in the repository
CHANGELOG.md
file.
Maintainer & Developer information
For information on the workflow used to make releases, please see the Maintainer Info page.
For information on how to build the binaries, please see the Developer Info page.
However, the ultimate source for details are the build scripts themselves,
all available from the
cmake-xpack.git/build-assets/scripts
folder. The scripts include common code from the @xpack-dev-tools/xbb-helper
package.
License
Unless otherwise stated, the original content is released under the terms of the MIT License, with all rights reserved to Liviu Ionescu.
The binary distributions include several open-source components; the
corresponding licenses are available in each archive in the
distro-info/licenses
folder.
Releases
The list of releases is available in the Releases pages.
Credits
Special thanks to MacStadium, for providing the Apple Silicon development infrastructure as part of their generous Free and Open Source Software program.
Thanks to Shields IO for the badges.
Enjoyed Using This Project? Let Us Know!
If you enjoyed using this project, please let us know! Here are some ways you can show your support: