diff --git a/extra/upower/0001-build-Fix-default-udevrulesdir.patch b/extra/upower/0001-build-Fix-default-udevrulesdir.patch new file mode 100644 index 000000000..ad70b1ca0 --- /dev/null +++ b/extra/upower/0001-build-Fix-default-udevrulesdir.patch @@ -0,0 +1,23 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +Date: Sat, 5 Feb 2022 02:26:48 +0000 +Subject: [PATCH] build: Fix default udevrulesdir + +We need to append 'rules.d' to the udev_dir. +--- + meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/meson.build b/meson.build +index f87de19b98cf..3858cbe0afdf 100644 +--- a/meson.build ++++ b/meson.build +@@ -90,7 +90,7 @@ endif + udevrulesdir = get_option('udevrulesdir') + if udevrulesdir == 'auto' + udev_dep = dependency('udev', required: true) +- udevrulesdir = udev_dep.get_pkgconfig_variable('udev_dir') ++ udevrulesdir = udev_dep.get_pkgconfig_variable('udev_dir') / 'rules.d' + endif + + dbusdir = get_option('datadir') / 'dbus-1' diff --git a/extra/upower/0002-build-Fix-version-macros.patch b/extra/upower/0002-build-Fix-version-macros.patch new file mode 100644 index 000000000..97b5aaf20 --- /dev/null +++ b/extra/upower/0002-build-Fix-version-macros.patch @@ -0,0 +1,31 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: "Jan Alexander Steffens (heftig)" +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', diff --git a/extra/upower/PKGBUILD b/extra/upower/PKGBUILD new file mode 100644 index 000000000..788075f29 --- /dev/null +++ b/extra/upower/PKGBUILD @@ -0,0 +1,57 @@ +# Maintainer: Jan Alexander Steffens (heftig) +# Maintainer: Jan de Groot + +# ALARM: Kevin Mihelich +# - patch to add libm to fix v7 FTBFS + +pkgname=upower +pkgver=0.99.14 +pkgrel=1 +pkgdesc="Abstraction for enumerating power devices, listening to device events and querying history and statistics" +url="https://upower.freedesktop.org" +arch=(x86_64) +license=(GPL) +depends=(systemd libimobiledevice libgudev) +makedepends=(docbook-xsl gobject-introspection python git gtk-doc meson) +checkdepends=(python-{dbus,dbusmock,gobject} umockdev) +backup=(etc/UPower/UPower.conf) +_commit=ab9520a7aad3795be7975e021577093a6e85946c # tags/v0.99.14^0 +source=("git+https://gitlab.freedesktop.org/upower/upower.git#commit=$_commit" + 0001-build-Fix-default-udevrulesdir.patch + 0002-build-Fix-version-macros.patch + math.patch) +sha256sums=('SKIP' + '8891e9baddca739f41a9323da94fd38c61f42e9267b0b42597f69fb3f4d8bf69' + '68a916b1058dcc7b21e8e7568e6998bf929bb586b94500124739c1059107e256' + '83ade36649dcc98c175d9a5a0e7e74cc8392b613c93d1655c292a405cad29873') + +pkgver() { + cd upower + git describe --tags | sed -e 's/^v\|^UPOWER_//;s/_/\./g;s/[^-]*-g/r&/;s/-/+/g' +} + +prepare() { + cd upower + + # meson fixes + git apply -3 ../0001-build-Fix-default-udevrulesdir.patch + git apply -3 ../0002-build-Fix-version-macros.patch + + patch -p1 -i ../math.patch +} + +build() { + arch-meson upower build + meson compile -C build +} + +check() { + meson test -C build --print-errorlogs +} + +package() { + depends+=(libg{lib,object,io}-2.0.so) + provides+=(libupower-glib.so) + + meson install -C build --destdir "$pkgdir" +} diff --git a/extra/upower/math.patch b/extra/upower/math.patch new file mode 100644 index 000000000..0ea8192d1 --- /dev/null +++ b/extra/upower/math.patch @@ -0,0 +1,26 @@ +diff --git a/meson.build b/meson.build +index 3858cbe..d407be7 100644 +--- a/meson.build ++++ b/meson.build +@@ -48,6 +48,8 @@ gio_unix_dep = dependency('gio-unix-2.0', version: '>=' + glib_min_version) + + xsltproc = find_program('xsltproc', required: get_option('gtk-doc') or get_option('man')) + ++libm = cc.find_library('m', required : false) ++ + # Resolve OS backend + os_backend = get_option('os_backend') + if os_backend == 'auto' +diff --git a/src/meson.build b/src/meson.build +index d0d8141..0732370 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -6,7 +6,7 @@ upowerd_deps = declare_dependency( + include_directories('../dbus'), + ], + dependencies: [ +- glib_dep, gobject_dep, gio_dep, gio_unix_dep, libupower_glib_dep, upowerd_dbus_dep ++ glib_dep, gobject_dep, gio_dep, gio_unix_dep, libupower_glib_dep, upowerd_dbus_dep, libm + ], + compile_args: [ + '-DUP_COMPILATION',