mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-05-05 12:18:13 +02:00
Some distributions are known to have shipped dbus 1.15.x as though it was a stable release, and it isn't clear whether they knew that we use the odd/even versioning convention like GLib does. If we add a -alpha, -beta, -rc suffix to development versions starting from 1.17.0, then distros that know we use odd/even versioning will know that our development versions are not a stable-branch, and so will distros that mistakenly think we use the "semantic versioning" versioning convention popularized by <https://semver.org/>. (We intentionally do not use semver, because semver would require us to ship a new minor version every time we add new API, and we do not have the resources to provide security support for an unlimited number of minor versions in parallel: we need to be able to nominate a subset of our releases as having longer-term security support, in a way that signals to distros that these are the releases they should prefer to ship.) CMake's `project()` doesn't allow this version number format[1], but we intend to use version numbers where the (major, minor, micro) tuple is enough to uniquely identify a release, so we can just tell CMake our version number without the suffix and there will be no ambiguity. Similarly, the dash is not allowed in GNU ld version scripts, so use the form of the version number without the suffix there. [1] https://gitlab.kitware.com/cmake/cmake/-/issues/16716 Helps: dbus#530 Signed-off-by: Simon McVittie <smcv@collabora.com>
53 lines
2.9 KiB
CMake
53 lines
2.9 KiB
CMake
#
|
|
# cmake package for meson support
|
|
#
|
|
# SPDX-FileCopyrightText: © 2023 Ralf Habacker
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
#
|
|
# load meson build file into an internal list named _meson_build
|
|
#
|
|
macro(meson_init config)
|
|
set(_meson_build_name ${config})
|
|
file(READ ${config} _meson_build_raw)
|
|
# Convert file contents into a CMake list (where each element in the list
|
|
# is one line of the file)
|
|
string(REGEX REPLACE ";" "\\\\;" _meson_build "${_meson_build_raw}")
|
|
string(REGEX REPLACE "\n" ";" _meson_build "${_meson_build}")
|
|
endmacro()
|
|
|
|
# extracts version information from autoconf config file
|
|
# and set related cmake variables
|
|
#
|
|
# returns
|
|
# ${prefix}_VERSION
|
|
# ${prefix}_VERSION_STRING
|
|
# ${prefix}_MAJOR_VERSION
|
|
# ${prefix}_MINOR_VERSION
|
|
# ${prefix}_MICRO_VERSION
|
|
# ${prefix}_LIBRARY_AGE
|
|
# ${prefix}_LIBRARY_REVISION
|
|
# ${prefix}_LIBRARY_CURRENT
|
|
#
|
|
macro(meson_version prefix)
|
|
set(WS "[ \t\r\n]")
|
|
string(TOUPPER ${prefix} prefix_upper)
|
|
string(REGEX REPLACE ".*${WS}version:${WS}*'([0-9.]+(-[-a-zA-Z0-9.]+)?)'.*" "\\1" ${prefix_upper}_VERSION ${_meson_build_raw})
|
|
string(REGEX REPLACE "-.*" "" ${prefix_upper}_VERSION_NO_SUFFIX ${${prefix_upper}_VERSION})
|
|
string(REPLACE "." ";" VERSION_LIST ${${prefix_upper}_VERSION_NO_SUFFIX})
|
|
list(GET VERSION_LIST 0 ${prefix_upper}_MAJOR_VERSION)
|
|
list(GET VERSION_LIST 1 ${prefix_upper}_MINOR_VERSION)
|
|
list(GET VERSION_LIST 2 ${prefix_upper}_MICRO_VERSION)
|
|
set(${prefix_upper}_VERSION_STRING "${${prefix_upper}_VERSION}")
|
|
string(REGEX REPLACE ".*${WS}lt_age${WS}*=${WS}*([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_AGE ${_meson_build_raw})
|
|
string(REGEX REPLACE ".*${WS}lt_current${WS}*=*${WS}*([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_CURRENT ${_meson_build_raw})
|
|
string(REGEX REPLACE ".*${WS}lt_revision${WS}*=${WS}*([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_REVISION ${_meson_build_raw})
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_VERSION = ${${prefix_upper}_VERSION} ")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_VERSION_STRING = ${${prefix_upper}_VERSION_STRING} ")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_MAJOR_VERSION = ${${prefix_upper}_MAJOR_VERSION} ")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_MINOR_VERSION = ${${prefix_upper}_MINOR_VERSION} ")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_MICRO_VERSION = ${${prefix_upper}_MICRO_VERSION} ")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_LIBRARY_AGE = ${${prefix_upper}_LIBRARY_AGE} ")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_LIBRARY_REVISION = ${${prefix_upper}_LIBRARY_REVISION}")
|
|
message(STATUS "fetched variable from meson.build - ${prefix_upper}_LIBRARY_CURRENT = ${${prefix_upper}_LIBRARY_CURRENT} ")
|
|
endmacro()
|