From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: "Jan Alexander Steffens (heftig)" <heftig@archlinux.org>
Date: Sat, 5 Feb 2022 02:30:52 +0000
Subject: [PATCH] build: Fix version macros

The project version is a string. We need to split it into an array of
version components.
---
 libupower-glib/meson.build | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libupower-glib/meson.build b/libupower-glib/meson.build
index 1bab59b80390..2ff7baf51e85 100644
--- a/libupower-glib/meson.build
+++ b/libupower-glib/meson.build
@@ -1,7 +1,12 @@
+version_arr = meson.project_version().split('.')
+major_version = version_arr[0].to_int()
+minor_version = version_arr[1].to_int()
+micro_version = version_arr[2].to_int()
+
 cdata = configuration_data()
-cdata.set('UP_MAJOR_VERSION', meson.project_version()[0])
-cdata.set('UP_MINOR_VERSION', meson.project_version()[1])
-cdata.set('UP_MICRO_VERSION', meson.project_version()[2])
+cdata.set('UP_MAJOR_VERSION', major_version)
+cdata.set('UP_MINOR_VERSION', minor_version)
+cdata.set('UP_MICRO_VERSION', micro_version)
 
 up_version_h = configure_file(
     output: 'up-version.h',
