From cc4b348e1e954ebb8984a45256d6f34712dc45fb Mon Sep 17 00:00:00 2001 From: Yisus7u7 Date: Wed, 15 Dec 2021 10:37:21 -0500 Subject: [PATCH] picom: fix timespec error --- x11-packages/picom/build.sh | 5 ++--- x11-packages/picom/log.c.patch | 35 ++++++++++++++++++++++++++++++++++ x11-packages/picom/log.h.patch | 21 ++++++++++++++++++++ 3 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 x11-packages/picom/log.c.patch create mode 100644 x11-packages/picom/log.h.patch diff --git a/x11-packages/picom/build.sh b/x11-packages/picom/build.sh index f9935311e..8ab542989 100644 --- a/x11-packages/picom/build.sh +++ b/x11-packages/picom/build.sh @@ -3,12 +3,11 @@ TERMUX_PKG_DESCRIPTION="A lightweight compositor for X11" TERMUX_PKG_LICENSE="MIT,MPL-2.0" TERMUX_PKG_MAINTAINER="Rafael Kitover " 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 } diff --git a/x11-packages/picom/log.c.patch b/x11-packages/picom/log.c.patch new file mode 100644 index 000000000..2c7402642 --- /dev/null +++ b/x11-packages/picom/log.c.patch @@ -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; diff --git a/x11-packages/picom/log.h.patch b/x11-packages/picom/log.h.patch new file mode 100644 index 000000000..8e2e8695e --- /dev/null +++ b/x11-packages/picom/log.h.patch @@ -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 + #include ++#include + + #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,