picom: fix timespec error

This commit is contained in:
Yisus7u7 2021-12-15 10:37:21 -05:00 committed by Yaksh Bariya
parent e45577cc4b
commit cc4b348e1e
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
3 changed files with 58 additions and 3 deletions

View File

@ -3,12 +3,11 @@ TERMUX_PKG_DESCRIPTION="A lightweight compositor for X11"
TERMUX_PKG_LICENSE="MIT,MPL-2.0"
TERMUX_PKG_MAINTAINER="Rafael Kitover <rkitover@gmail.com>"
TERMUX_PKG_VERSION=8.2
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/yshui/picom/archive/refs/tags/v8.2.tar.gz
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/yshui/picom/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=9d0c2533985e9670ff175e717a42b5bf1a2a00ccde5cac1e1009f5d6ee7912ec
TERMUX_PKG_DEPENDS="libx11, libxcb, xcb-util, xcb-util-image, xcb-util-renderutil, libxext, xorgproto, libpixman, dbus, libconfig, mesa, pcre, libev, uthash"
termux_step_pre_configure() {
sed -i "s/^\(host_system *= *\).*/\1'linux'/" src/meson.build
sed -i 's/timespec_get(&ts, TIME_UTC);/clock_gettime(CLOCK_REALTIME, \&ts);/' src/log.c
}

View File

@ -0,0 +1,35 @@
diff --git a/src/log.c b/src/log.c
index 0b663e7..7fcbbd7 100644
--- a/src/log.c
+++ b/src/log.c
@@ -18,6 +18,30 @@
#include "log.h"
#include "utils.h"
+//#if defined(__TIMESPEC_GET_WRAPPER__)
+int timespec_get_wrapper(struct timespec *ts, int base)
+{
+
+#if !defined(CLOCK_REALTIME)
+ struct timeval tv;
+#endif
+
+ if (base != TIME_UTC)
+ {
+ return 0;
+ }
+
+#if defined(CLOCK_REALTIME)
+ base = (clock_gettime(CLOCK_REALTIME, ts) == 0) ? base : 0;
+#else
+ gettimeofday(&tv, NULL);
+ ts->tv_sec = (time_t)tv.tv_sec;
+ ts->tv_nsec = 1000L * (long)tv.tv_usec;
+#endif
+ return base;
+}
+//#endif
+
thread_local struct log *tls_logger;
struct log_target;

View File

@ -0,0 +1,21 @@
diff --git a/src/log.h b/src/log.h
index e40fe3c..720b58d 100644
--- a/src/log.h
+++ b/src/log.h
@@ -4,9 +4,16 @@
#pragma once
#include <assert.h>
#include <stdio.h>
+#include <time.h>
#include "compiler.h"
+#if __ANDROID_API__ < 29
+#define __TIMESPEC__GET_WRAPPER__
+int timespec_get_wrapper(struct timespec *ts, int base);
+#define timespec_get timespec_get_wrapper
+#endif
+
enum log_level {
LOG_LEVEL_INVALID = -1,
LOG_LEVEL_TRACE = 0,