commit: 00d7f2a3d8a295d79c9f300dcbfa12cb6a4d0ae4 Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Fri Oct 17 11:00:52 2025 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Fri Oct 17 13:09:13 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=00d7f2a3
x11-libs/tslib: Fix CMake <3.10 warning, build w/ 32-bit and printf UB Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> x11-libs/tslib/files/tslib-1.23-cmake4-1.patch | 30 +++ .../tslib-1.23-fix-64bit-time_t-printf-ub.patch | 213 +++++++++++++++++++++ x11-libs/tslib/tslib-1.23-r1.ebuild | 62 ++++++ 3 files changed, 305 insertions(+) diff --git a/x11-libs/tslib/files/tslib-1.23-cmake4-1.patch b/x11-libs/tslib/files/tslib-1.23-cmake4-1.patch new file mode 100644 index 000000000000..b8c28114ca82 --- /dev/null +++ b/x11-libs/tslib/files/tslib-1.23-cmake4-1.patch @@ -0,0 +1,30 @@ +From eaa4a100fdcb5e2eac02d8b44a73cd6ad9caafd8 Mon Sep 17 00:00:00 2001 +From: Andreas Sturmlechner <[email protected]> +Date: Fri, 17 Oct 2025 12:44:25 +0200 +Subject: [PATCH] Bump minimum CMAKE_MINIMUM_REQUIRED version to 3.5, set range + up to 3.31 + +CMake 3.31 started to warn about removing < 3.10 compatibility in the future. +CMake 4 dropped < 3.5 compatibility. + +Signed-off-by: Andreas Sturmlechner <[email protected]> +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 269ea77..6bacc4f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -8,7 +8,7 @@ + # + # + +-cmake_minimum_required(VERSION 3.3) ++cmake_minimum_required(VERSION 3.10..3.31) + + project(tslib LANGUAGES C) + +-- +2.51.0 + diff --git a/x11-libs/tslib/files/tslib-1.23-fix-64bit-time_t-printf-ub.patch b/x11-libs/tslib/files/tslib-1.23-fix-64bit-time_t-printf-ub.patch new file mode 100644 index 000000000000..392d56e4f418 --- /dev/null +++ b/x11-libs/tslib/files/tslib-1.23-fix-64bit-time_t-printf-ub.patch @@ -0,0 +1,213 @@ +Source: + [PATCH 1/2]: git master + [PATCH 2/2]: https://github.com/libts/tslib/pull/229 + +From acc471e96693b3f772b42687c5378591f0ed54ae Mon Sep 17 00:00:00 2001 +From: steini2001 <[email protected]> +Date: Tue, 12 Nov 2024 14:25:15 +0100 +Subject: [PATCH 1/2] Fix build on 32bit arches with 64bit time_t and debug + enabled + +commit a7a39a6 forgot this one +--- + plugins/input-raw.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/plugins/input-raw.c b/plugins/input-raw.c +index 0e8a22f..da22720 100644 +--- a/plugins/input-raw.c ++++ b/plugins/input-raw.c +@@ -650,8 +650,8 @@ static int ts_input_read_mt(struct tslib_module_info *inf, + #ifdef DEBUG + printf("INPUT-RAW: read type %d code %3d value %4d time %ld.%ld\n", + i->ev[it].type, i->ev[it].code, +- i->ev[it].value, (long)i->ev[it].time.tv_sec, +- (long)i->ev[it].time.tv_usec); ++ i->ev[it].value, (long)i->ev[it].input_event_sec, ++ (long)i->ev[it].input_event_usec); + #endif + switch (i->ev[it].type) { + case EV_KEY: +-- +2.51.0 + + +From 32cf8d1b9e38b5eada97b00c73999af48be2d1cb Mon Sep 17 00:00:00 2001 +From: steini2001 <[email protected]> +Date: Tue, 12 Nov 2024 15:02:31 +0100 +Subject: [PATCH 2/2] fix printf with 64bit time_t + +Printing long long with %ld is UB. Converting long long to long could overflow. +To be compatible with 32bit time_t we need an explicit cast to long long. +--- + README.md | 6 +++--- + plugins/input-evdev-raw.c | 14 +++++++------- + plugins/input-raw.c | 12 ++++++------ + tests/ts_print.c | 2 +- + tests/ts_print_mt.c | 6 +++--- + tests/ts_print_raw.c | 2 +- + tests/ts_test.c | 2 +- + tests/ts_test_mt_sdl.c | 6 +++--- + 8 files changed, 25 insertions(+), 25 deletions(-) + +diff --git a/README.md b/README.md +index aaec82d..1d781b8 100644 +--- a/README.md ++++ b/README.md +@@ -585,9 +585,9 @@ This is a complete example program, similar to `ts_print_mt.c`: + continue; + #endif + +- printf("%ld.%06ld: (slot %d) %6d %6d %6d\n", +- samp_mt[j][i].tv.tv_sec, +- samp_mt[j][i].tv.tv_usec, ++ printf("%lld.%06lld: (slot %d) %6d %6d %6d\n", ++ (long long)samp_mt[j][i].tv.tv_sec, ++ (long long)samp_mt[j][i].tv.tv_usec, + samp_mt[j][i].slot, + samp_mt[j][i].x, + samp_mt[j][i].y, +diff --git a/plugins/input-evdev-raw.c b/plugins/input-evdev-raw.c +index d187645..24208cf 100644 +--- a/plugins/input-evdev-raw.c ++++ b/plugins/input-evdev-raw.c +@@ -461,11 +461,11 @@ static int ts_input_read(struct tslib_module_info *inf, + samp->tv = ev.time; + #ifdef DEBUG + fprintf(stderr, +- "RAW nr %d ---------------------> %d %d %d %ld.%ld\n", ++ "RAW nr %d ---------------------> %d %d %d %lld.%06lld\n", + total, + samp->x, samp->y, samp->pressure, +- (long)samp->tv.tv_sec, +- (long)samp->tv.tv_usec); ++ (long long)samp->tv.tv_sec, ++ (long long)samp->tv.tv_usec); + #endif /* DEBUG */ + samp++; + total++; +@@ -651,11 +651,11 @@ static int ts_input_read_mt(struct tslib_module_info *inf, + } + + #ifdef DEBUG +- printf("INPUT-RAW nr %d: read type %d code %3d value %4d time %ld.%ld\n", ++ printf("INPUT-RAW nr %d: read type %d code %3d value %4d time %lld.%06lld\n", + total, +- ev.type, ev.code, +- ev.value, (long)ev.time.tv_sec, +- (long)ev.time.tv_usec); ++ ev.type, ev.code, ev.value, ++ (long long)ev.time.tv_sec, ++ (long long)ev.time.tv_usec); + #endif + switch (ev.type) { + case EV_KEY: +diff --git a/plugins/input-raw.c b/plugins/input-raw.c +index da22720..ae0cad6 100644 +--- a/plugins/input-raw.c ++++ b/plugins/input-raw.c +@@ -393,10 +393,10 @@ static int ts_input_read(struct tslib_module_info *inf, + samp->tv.tv_usec = ev.input_event_usec; + #ifdef DEBUG + fprintf(stderr, +- "RAW---------------------> %d %d %d %ld.%ld\n", ++ "RAW---------------------> %d %d %d %lld.%06lld\n", + samp->x, samp->y, samp->pressure, +- (long)samp->tv.tv_sec, +- (long)samp->tv.tv_usec); ++ (long long)samp->tv.tv_sec, ++ (long long)samp->tv.tv_usec); + #endif /* DEBUG */ + samp++; + total++; +@@ -648,10 +648,10 @@ static int ts_input_read_mt(struct tslib_module_info *inf, + + for (it = 0; it < rd / sizeof(struct input_event); it++) { + #ifdef DEBUG +- printf("INPUT-RAW: read type %d code %3d value %4d time %ld.%ld\n", ++ printf("INPUT-RAW: read type %d code %3d value %4d time %lld.%06lld\n", + i->ev[it].type, i->ev[it].code, +- i->ev[it].value, (long)i->ev[it].input_event_sec, +- (long)i->ev[it].input_event_usec); ++ i->ev[it].value, (long long)i->ev[it].input_event_sec, ++ (long long)i->ev[it].input_event_usec); + #endif + switch (i->ev[it].type) { + case EV_KEY: +diff --git a/tests/ts_print.c b/tests/ts_print.c +index e9e6c4f..406a087 100644 +--- a/tests/ts_print.c ++++ b/tests/ts_print.c +@@ -106,7 +106,7 @@ int main(int argc, char **argv) + if (ret != 1) + continue; + +- printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure); ++ printf("%lld.%06lld: %6d %6d %6d\n", (long long)samp.tv.tv_sec, (long long)samp.tv.tv_usec, samp.x, samp.y, samp.pressure); + + } + +diff --git a/tests/ts_print_mt.c b/tests/ts_print_mt.c +index 6f18c67..5779ca2 100644 +--- a/tests/ts_print_mt.c ++++ b/tests/ts_print_mt.c +@@ -254,10 +254,10 @@ int main(int argc, char **argv) + if (!(samp_mt[j][i].valid & TSLIB_MT_VALID)) + continue; + +- printf(YELLOW "sample %d - %ld.%06ld -" RESET " (slot %d) %6d %6d %6d\n", ++ printf(YELLOW "sample %d - %lld.%06lld -" RESET " (slot %d) %6d %6d %6d\n", + j, +- samp_mt[j][i].tv.tv_sec, +- samp_mt[j][i].tv.tv_usec, ++ (long long)samp_mt[j][i].tv.tv_sec, ++ (long long)samp_mt[j][i].tv.tv_usec, + samp_mt[j][i].slot, + samp_mt[j][i].x, + samp_mt[j][i].y, +diff --git a/tests/ts_print_raw.c b/tests/ts_print_raw.c +index b9e9466..a4dae3d 100644 +--- a/tests/ts_print_raw.c ++++ b/tests/ts_print_raw.c +@@ -83,7 +83,7 @@ int main(int argc, char **argv) + if (ret != 1) + continue; + +- printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, samp.x, samp.y, samp.pressure); ++ printf("%lld.%06lld: %6d %6d %6d\n", (long long)samp.tv.tv_sec, (long long)samp.tv.tv_usec, samp.x, samp.y, samp.pressure); + + } + +diff --git a/tests/ts_test.c b/tests/ts_test.c +index c9ced73..4d6a5ca 100644 +--- a/tests/ts_test.c ++++ b/tests/ts_test.c +@@ -202,7 +202,7 @@ int main(int argc, char **argv) + quit_pressed = 1; + } + +- printf("%ld.%06ld: %6d %6d %6d\n", samp.tv.tv_sec, samp.tv.tv_usec, ++ printf("%lld.%06lld: %6d %6d %6d\n", (long long)samp.tv.tv_sec, (long long)samp.tv.tv_usec, + samp.x, samp.y, samp.pressure); + + if (samp.pressure > 0) { +diff --git a/tests/ts_test_mt_sdl.c b/tests/ts_test_mt_sdl.c +index 556c949..bc4808a 100644 +--- a/tests/ts_test_mt_sdl.c ++++ b/tests/ts_test_mt_sdl.c +@@ -200,9 +200,9 @@ int main(int argc, char **argv) + samp_mt[0][i].x, samp_mt[0][i].y); + + if (verbose) { +- printf("%ld.%06ld: (slot %d) %6d %6d %6d\n", +- samp_mt[0][i].tv.tv_sec, +- samp_mt[0][i].tv.tv_usec, ++ printf("%lld.%06lld: (slot %d) %6d %6d %6d\n", ++ (long long)samp_mt[0][i].tv.tv_sec, ++ (long long)samp_mt[0][i].tv.tv_usec, + samp_mt[0][i].slot, + samp_mt[0][i].x, + samp_mt[0][i].y, +-- +2.51.0 + diff --git a/x11-libs/tslib/tslib-1.23-r1.ebuild b/x11-libs/tslib/tslib-1.23-r1.ebuild new file mode 100644 index 000000000000..6a9d962ecebe --- /dev/null +++ b/x11-libs/tslib/tslib-1.23-r1.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake-multilib + +DESCRIPTION="Touchscreen Access Library" +HOMEPAGE="https://github.com/kergoth/tslib" +SRC_URI="https://github.com/libts/tslib/releases/download/${PV}/${P}.tar.xz" + +LICENSE="LGPL-2 uinput? ( GPL-2+ )" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" +IUSE="evdev sdl uinput" + +DEPEND=" + evdev? ( dev-libs/libevdev[${MULTILIB_USEDEP}] ) + sdl? ( media-libs/libsdl2[${MULTILIB_USEDEP}] ) +" +RDEPEND="${DEPEND}" +BDEPEND="evdev? ( virtual/pkgconfig )" + +DOCS=( AUTHORS NEWS README{,.md} ) + +PATCHES=( + "${FILESDIR}/${PN}-1.21-optional-utils.patch" + "${FILESDIR}/${P}-cmake4-1.patch" # bug 955696 + "${FILESDIR}/${P}-fix-64bit-time_t-printf-ub.patch" +) + +src_configure() { + my_configure() { + local mycmakeargs=( + -Denable-input-evdev=$(usex evdev) + -DENABLE_TOOLS=$(usex uinput $(multilib_is_native_abi && echo ON || echo OFF) OFF) + -DENABLE_UTILS=$(multilib_is_native_abi && echo ON || echo OFF) + -Denable-arctic2=ON + -Denable-collie=ON + -Denable-corgi=ON + -Denable-cy8mrln-palmpre=ON + -Denable-dejitter=ON + -Denable-dmc=ON + -Denable-dmc_dus3000=ON + -Denable-galax=ON + -Denable-h3600=ON + -Denable-input=ON + -Denable-linear-h2200=ON + -Denable-linear=ON + -Denable-mk712=ON + -Denable-one-wire-ts-input=ON + -Denable-pthres=ON + -Denable-tatung=ON + -Denable-ucb1x00=ON + -Denable-variance=ON + ) + multilib_is_native_abi && mycmakeargs+=( -Dwith-sdl=$(usex sdl) ) + + cmake_src_configure + } + multilib_parallel_foreach_abi my_configure +}
