sysutils/upower: update to 1.90.0.
switches to meson, add patches from upstream MR #163, #164 & #165 ok ajacoutot@
This commit is contained in:
parent
1a538a3ead
commit
a0d49455ba
@ -2,15 +2,15 @@ ONLY_FOR_ARCHS =${APM_ARCHS}
|
||||
|
||||
COMMENT = userland power management interface
|
||||
|
||||
V = 0.99.13
|
||||
DISTNAME = upower-UPOWER_${V:S/./_/g}
|
||||
PKGNAME = upower-${V}
|
||||
V = v1.90.0
|
||||
DISTNAME = upower-${V}
|
||||
PKGNAME = upower-${V:S/v//}
|
||||
|
||||
CATEGORIES = sysutils
|
||||
SHARED_LIBS += upower-glib 2.1 # 3.1
|
||||
SHARED_LIBS += upower-glib 3.0
|
||||
|
||||
HOMEPAGE = https://upower.freedesktop.org/
|
||||
MASTER_SITES = https://gitlab.freedesktop.org/upower/upower/-/archive/UPOWER_${V:S/./_/g}/
|
||||
MASTER_SITES = https://gitlab.freedesktop.org/upower/upower/-/archive/${V}/
|
||||
|
||||
MAINTAINER = Landry Breuil <landry@openbsd.org>
|
||||
|
||||
@ -19,21 +19,17 @@ PERMIT_PACKAGE= Yes
|
||||
|
||||
WANTLIB += c gio-2.0 glib-2.0 gobject-2.0 m
|
||||
|
||||
AUTOCONF_VERSION = 2.69
|
||||
AUTOMAKE_VERSION = 1.16
|
||||
CONFIGURE_STYLE = autoreconf
|
||||
CONFIGURE_ARGS += --enable-introspection \
|
||||
--enable-man-pages \
|
||||
--with-historydir=/var/db/upower \
|
||||
--with-backend=openbsd \
|
||||
--without-idevice
|
||||
MODULES = devel/meson
|
||||
CONFIGURE_ARGS =-Dintrospection=enabled \
|
||||
-Dhistorydir=/var/db/upower \
|
||||
-Dos_backend=openbsd \
|
||||
-Dudevrulesdir=disabled \
|
||||
-Dudevhwdbdir=disabled \
|
||||
-Dsystemdsystemunitdir=no \
|
||||
-Didevice=disabled
|
||||
|
||||
CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \
|
||||
LDFLAGS="-L${LOCALBASE}/lib"
|
||||
|
||||
FAKE_FLAGS = sysconfdir=${PREFIX}/share/examples/upower
|
||||
|
||||
USE_GMAKE = Yes
|
||||
# gtk-doc is disabled because otherwise xsltproc fetches from net
|
||||
CONFIGURE_ARGS +=-Dgtk-doc=false
|
||||
|
||||
LIB_DEPENDS = devel/glib2
|
||||
BUILD_DEPENDS = devel/gettext,-tools \
|
||||
@ -44,7 +40,10 @@ BUILD_DEPENDS = devel/gettext,-tools \
|
||||
# /usr/local/share/dbus-1/system-services/
|
||||
RUN_DEPENDS += x11/dbus,-suid
|
||||
|
||||
post-extract:
|
||||
touch ${WRKSRC}/gtk-doc.make
|
||||
post-install:
|
||||
# stupid udev rules
|
||||
rm -Rf ${PREFIX}/disabled
|
||||
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/upower/
|
||||
mv ${WRKINST}${SYSCONFDIR}/UPower ${PREFIX}/share/examples/upower/
|
||||
|
||||
.include <bsd.port.mk>
|
||||
|
@ -1,2 +1,2 @@
|
||||
SHA256 (upower-UPOWER_0_99_13.tar.gz) = M5jZWs+7R6YEd253NR6VA2GrO3kaJoJPafeBLkmwuvw=
|
||||
SIZE (upower-UPOWER_0_99_13.tar.gz) = 184658
|
||||
SHA256 (upower-v1.90.0.tar.gz) = y2Ao8JWCRCLFnZizyZA+LtoqlvxhPxGCTwtjed5++i4=
|
||||
SIZE (upower-v1.90.0.tar.gz) = 170168
|
||||
|
@ -5,7 +5,7 @@ Fix with base gcc:
|
||||
Index: libupower-glib/up-device.c
|
||||
--- libupower-glib/up-device.c.orig
|
||||
+++ libupower-glib/up-device.c
|
||||
@@ -279,10 +279,7 @@ up_device_to_text (UpDevice *device)
|
||||
@@ -280,10 +280,7 @@ up_device_to_text (UpDevice *device)
|
||||
/* get a human readable time */
|
||||
t = (time_t) up_exported_device_get_update_time (priv->proxy_device);
|
||||
time_tm = localtime (&t);
|
||||
|
@ -1,11 +1,159 @@
|
||||
https://gitlab.freedesktop.org/upower/upower/-/issues/201
|
||||
|
||||
Index: src/openbsd/up-backend.c
|
||||
--- src/openbsd/up-backend.c.orig
|
||||
+++ src/openbsd/up-backend.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "up-backend.h"
|
||||
#include "up-daemon.h"
|
||||
#include "up-device.h"
|
||||
+#include "up-backend-bsd-private.h"
|
||||
#include <string.h> /* strcmp() */
|
||||
@@ -33,6 +33,7 @@ static void up_backend_init (UpBackend *backend);
|
||||
static void up_backend_finalize (GObject *object);
|
||||
|
||||
static void up_backend_class_init (UpBackendClass *klass);
|
||||
static gboolean up_backend_apm_get_power_info(struct apm_power_info*);
|
||||
+static gpointer up_backend_apm_event_thread(gpointer object);
|
||||
UpDeviceState up_backend_apm_get_battery_state_value(u_char battery_state);
|
||||
static void up_backend_update_acpibat_state(UpDevice*, struct sensordev);
|
||||
static void up_backend_update_lid_status(UpDaemon*);
|
||||
@@ -127,10 +128,63 @@ up_apm_device_get_online (UpDevice *device, gboolean *
|
||||
gboolean
|
||||
up_backend_coldplug (UpBackend *backend, UpDaemon *daemon)
|
||||
{
|
||||
- backend->priv->daemon = g_object_ref (daemon);
|
||||
+ GError *err = NULL;
|
||||
+ UpDeviceClass *device_class;
|
||||
+ gint64 current_time;
|
||||
|
||||
+ backend->priv = up_backend_get_instance_private (backend);
|
||||
+ backend->priv->daemon = g_object_ref (daemon);
|
||||
+ backend->priv->is_laptop = up_native_is_laptop();
|
||||
+ g_debug("is_laptop:%d",backend->priv->is_laptop);
|
||||
if (backend->priv->is_laptop)
|
||||
{
|
||||
+ UpApmNative *acnative = NULL;
|
||||
+ UpApmNative *battnative = NULL;
|
||||
+
|
||||
+ acnative = up_apm_native_new("/ac");
|
||||
+ battnative = up_apm_native_new("/batt");
|
||||
+
|
||||
+ backend->priv->ac = UP_DEVICE(up_device_new (backend->priv->daemon, G_OBJECT(acnative)));
|
||||
+ backend->priv->battery = UP_DEVICE(up_device_new (backend->priv->daemon, G_OBJECT(battnative)));
|
||||
+
|
||||
+ g_object_unref (acnative);
|
||||
+ g_object_unref (battnative);
|
||||
+
|
||||
+ device_class = UP_DEVICE_GET_CLASS (backend->priv->battery);
|
||||
+ device_class->get_on_battery = up_apm_device_get_on_battery;
|
||||
+ device_class->get_online = up_apm_device_get_online;
|
||||
+ device_class->refresh = up_apm_device_refresh;
|
||||
+ device_class = UP_DEVICE_GET_CLASS (backend->priv->ac);
|
||||
+ device_class->get_on_battery = up_apm_device_get_on_battery;
|
||||
+ device_class->get_online = up_apm_device_get_online;
|
||||
+ device_class->refresh = up_apm_device_refresh;
|
||||
+ /* creates thread */
|
||||
+ if((backend->priv->apm_thread = (GThread*) g_thread_try_new("apm-poller",(GThreadFunc)up_backend_apm_event_thread, (void*) backend, &err)) == NULL)
|
||||
+ {
|
||||
+ g_warning("Thread create failed: %s", err->message);
|
||||
+ g_error_free (err);
|
||||
+ }
|
||||
+
|
||||
+ /* setup dummy */
|
||||
+ current_time = g_get_real_time () / G_USEC_PER_SEC;
|
||||
+ g_object_set (backend->priv->battery,
|
||||
+ "type", UP_DEVICE_KIND_BATTERY,
|
||||
+ "power-supply", TRUE,
|
||||
+ "is-present", TRUE,
|
||||
+ "is-rechargeable", TRUE,
|
||||
+ "has-history", TRUE,
|
||||
+ "state", UP_DEVICE_STATE_UNKNOWN,
|
||||
+ "percentage", 0.0f,
|
||||
+ "time-to-empty", (gint64) 0,
|
||||
+ "update-time", (guint64) current_time,
|
||||
+ (void*) NULL);
|
||||
+ g_object_set (backend->priv->ac,
|
||||
+ "type", UP_DEVICE_KIND_LINE_POWER,
|
||||
+ "online", TRUE,
|
||||
+ "power-supply", TRUE,
|
||||
+ "update-time", (guint64) current_time,
|
||||
+ (void*) NULL);
|
||||
+
|
||||
up_backend_update_lid_status(daemon);
|
||||
if (!g_initable_init (G_INITABLE (backend->priv->ac), NULL, NULL))
|
||||
g_warning ("failed to coldplug ac");
|
||||
@@ -142,7 +196,6 @@ up_backend_coldplug (UpBackend *backend, UpDaemon *dae
|
||||
else
|
||||
g_signal_emit (backend, signals[SIGNAL_DEVICE_ADDED], 0, backend->priv->battery);
|
||||
}
|
||||
-
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -259,7 +312,7 @@ up_backend_update_battery_state(UpDevice* device)
|
||||
gdouble percentage;
|
||||
gboolean ret, is_present;
|
||||
struct sensordev sdev;
|
||||
- UpDeviceState cur_state, new_state;
|
||||
+ UpDeviceState cur_state, new_state = UP_DEVICE_STATE_UNKNOWN;
|
||||
gint64 cur_time_to_empty, new_time_to_empty;
|
||||
struct apm_power_info a;
|
||||
|
||||
@@ -597,63 +650,7 @@ up_backend_class_init (UpBackendClass *klass)
|
||||
static void
|
||||
up_backend_init (UpBackend *backend)
|
||||
{
|
||||
- GError *err = NULL;
|
||||
- UpDeviceClass *device_class;
|
||||
- gint64 current_time;
|
||||
-
|
||||
backend->priv = up_backend_get_instance_private (backend);
|
||||
- backend->priv->is_laptop = up_native_is_laptop();
|
||||
- g_debug("is_laptop:%d",backend->priv->is_laptop);
|
||||
- if (backend->priv->is_laptop)
|
||||
- {
|
||||
- UpApmNative *acnative = NULL;
|
||||
- UpApmNative *battnative = NULL;
|
||||
-
|
||||
- acnative = up_apm_native_new("/ac");
|
||||
- battnative = up_apm_native_new("/batt");
|
||||
-
|
||||
- backend->priv->ac = UP_DEVICE(up_device_new (backend->priv->daemon, G_OBJECT(acnative)));
|
||||
- backend->priv->battery = UP_DEVICE(up_device_new (backend->priv->daemon, G_OBJECT(battnative)));
|
||||
-
|
||||
- g_object_unref (acnative);
|
||||
- g_object_unref (battnative);
|
||||
-
|
||||
- device_class = UP_DEVICE_GET_CLASS (backend->priv->battery);
|
||||
- device_class->get_on_battery = up_apm_device_get_on_battery;
|
||||
- device_class->get_online = up_apm_device_get_online;
|
||||
- device_class->refresh = up_apm_device_refresh;
|
||||
- device_class = UP_DEVICE_GET_CLASS (backend->priv->ac);
|
||||
- device_class->get_on_battery = up_apm_device_get_on_battery;
|
||||
- device_class->get_online = up_apm_device_get_online;
|
||||
- device_class->refresh = up_apm_device_refresh;
|
||||
- /* creates thread */
|
||||
- if((backend->priv->apm_thread = (GThread*) g_thread_try_new("apm-poller",(GThreadFunc)up_backend_apm_event_thread, (void*) backend, &err)) == NULL)
|
||||
- {
|
||||
- g_warning("Thread create failed: %s", err->message);
|
||||
- g_error_free (err);
|
||||
- }
|
||||
-
|
||||
- /* setup dummy */
|
||||
- current_time = g_get_real_time () / G_USEC_PER_SEC;
|
||||
- g_object_set (backend->priv->battery,
|
||||
- "type", UP_DEVICE_KIND_BATTERY,
|
||||
- "power-supply", TRUE,
|
||||
- "is-present", TRUE,
|
||||
- "is-rechargeable", TRUE,
|
||||
- "has-history", TRUE,
|
||||
- "state", UP_DEVICE_STATE_UNKNOWN,
|
||||
- "percentage", 0.0f,
|
||||
- "time-to-empty", (gint64) 0,
|
||||
- "update-time", (guint64) current_time,
|
||||
- (void*) NULL);
|
||||
- g_object_set (backend->priv->ac,
|
||||
- "type", UP_DEVICE_KIND_LINE_POWER,
|
||||
- "online", TRUE,
|
||||
- "power-supply", TRUE,
|
||||
- "update-time", (guint64) current_time,
|
||||
- (void*) NULL);
|
||||
- }
|
||||
-
|
||||
backend->priv->config = up_config_new ();
|
||||
backend->priv->seat_manager_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
|
||||
0,
|
||||
|
31
sysutils/upower/patches/patch-src_up-device-battery_c
Normal file
31
sysutils/upower/patches/patch-src_up-device-battery_c
Normal file
@ -0,0 +1,31 @@
|
||||
https://gitlab.freedesktop.org/upower/upower/-/merge_requests/164
|
||||
|
||||
Index: src/up-device-battery.c
|
||||
--- src/up-device-battery.c.orig
|
||||
+++ src/up-device-battery.c
|
||||
@@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
+#include <math.h>
|
||||
|
||||
#include "up-constants.h"
|
||||
#include "up-config.h"
|
||||
@@ -125,7 +126,7 @@ up_device_battery_estimate_power (UpDeviceBattery *sel
|
||||
continue;
|
||||
|
||||
/* Stop searching if the new reference is further away from the long timeout. */
|
||||
- if (abs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - abs (td)) > abs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
|
||||
+ if (llabs(UP_DAEMON_LONG_TIMEOUT * G_USEC_PER_SEC - llabs (td)) > llabs(UP_DAEMON_SHORT_TIMEOUT * G_USEC_PER_SEC - ref_td))
|
||||
break;
|
||||
|
||||
ref_td = td;
|
||||
@@ -155,7 +156,7 @@ up_device_battery_estimate_power (UpDeviceBattery *sel
|
||||
*/
|
||||
if (cur->state == UP_DEVICE_STATE_UNKNOWN) {
|
||||
/* Consider a rate of 0.5W as "no change", otherwise set CHARGING/DISCHARGING */
|
||||
- if (abs(energy_rate) < 0.5)
|
||||
+ if (fabs(energy_rate) < 0.5)
|
||||
return;
|
||||
else if (energy_rate < 0.0)
|
||||
cur->state = UP_DEVICE_STATE_DISCHARGING;
|
@ -8,13 +8,9 @@ include/libupower-glib/up-history-item.h
|
||||
include/libupower-glib/up-stats-item.h
|
||||
include/libupower-glib/up-types.h
|
||||
include/libupower-glib/up-version.h
|
||||
include/libupower-glib/up-wakeup-item.h
|
||||
include/libupower-glib/up-wakeups.h
|
||||
include/libupower-glib/upower.h
|
||||
lib/girepository-1.0/
|
||||
lib/girepository-1.0/UPowerGlib-1.0.typelib
|
||||
@static-lib lib/libupower-glib.a
|
||||
lib/libupower-glib.la
|
||||
@lib lib/libupower-glib.so.${LIBupower-glib_VERSION}
|
||||
lib/pkgconfig/upower-glib.pc
|
||||
@bin libexec/upowerd
|
||||
@ -24,7 +20,6 @@ lib/pkgconfig/upower-glib.pc
|
||||
share/dbus-1/interfaces/
|
||||
share/dbus-1/interfaces/org.freedesktop.UPower.Device.xml
|
||||
share/dbus-1/interfaces/org.freedesktop.UPower.KbdBacklight.xml
|
||||
share/dbus-1/interfaces/org.freedesktop.UPower.Wakeups.xml
|
||||
share/dbus-1/interfaces/org.freedesktop.UPower.xml
|
||||
share/dbus-1/system-services/org.freedesktop.UPower.service
|
||||
share/dbus-1/system.d/org.freedesktop.UPower.conf
|
||||
|
Loading…
x
Reference in New Issue
Block a user