Effortless RPM packaging with CPack

Sergei Golubchik

Playlists: 'froscon2023' videos starting here / audio

CMake+CPack support a surprisingly robust build environment for building RPM packages. Building for any RPM-based distribution from the source tree with no or very minimal tweaking, building RPM packages on non-RPM-based distribution, auto-adapting to changes in the source code, optional RPM packages - this and many more is possible with CPack. And the best part? Once configured it just works, it adapts to your evolving project automatically. Even for very big project with complex packaging requirements. Why not give it a try?

MariaDB Server is a big project with complex packaging. We build RPM packages anywhere from CentOS 7 to Fedora 38, to SLES 15, to Rocky9 on Aarch64. With different dependencies and different sets of packages on different distributions. Everything from one .cmake file with very few distribution-specific checks.

Summarizing eight years of building MariaDB, this talk will show how to use CMake and CPack to create RPM packages. How to let CPack automatically generate all .spec files for you, for the correct set of packages (that may vary between builds), correct set of files (that may vary too), different versions, vendors, licenses, scriptlets, dependencies. How to build debuginfo RPMs and source RPM with automatically determined build dependencies. It will guide you from a basic setup to fairly advanced CPack hacking. It works very well for MariaDB Server — it will probably work for your project even better.

Download

Embed

Share:

Tags