commit: 7d305a9657dd161df4e942dcf1536e02a594c4c5 Author: Brahmajit Das <listout <AT> listout <DOT> xyz> AuthorDate: Mon Feb 23 14:20:02 2026 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Mon Feb 23 16:50:29 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d305a96
app-misc/ddcutil: fix buidling with glibc 2.43 Closes: https://bugs.gentoo.org/970478 Signed-off-by: Brahmajit Das <listout <AT> listout.xyz> Part-of: https://codeberg.org/gentoo/gentoo/pulls/120 Merges: https://codeberg.org/gentoo/gentoo/pulls/120 Signed-off-by: Sam James <sam <AT> gentoo.org> app-misc/ddcutil/ddcutil-2.2.5-r1.ebuild | 110 ++++++++++++++ .../ddcutil-2.2.5-clang-fix-for-glibc-2.43.patch | 160 +++++++++++++++++++++ 2 files changed, 270 insertions(+) diff --git a/app-misc/ddcutil/ddcutil-2.2.5-r1.ebuild b/app-misc/ddcutil/ddcutil-2.2.5-r1.ebuild new file mode 100644 index 000000000000..ffa76fcad145 --- /dev/null +++ b/app-misc/ddcutil/ddcutil-2.2.5-r1.ebuild @@ -0,0 +1,110 @@ +# Copyright 1999-2026 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +# Check for bumps & cleanup with app-misc/ddcui + +inherit autotools linux-info udev + +DESCRIPTION="Program for querying and changing monitor settings" +HOMEPAGE="https://www.ddcutil.com/" +SRC_URI="https://github.com/rockowitz/ddcutil/archive/v${PV}.tar.gz -> ${P}.tar.gz" + +LICENSE="GPL-2+" +SLOT="0/5" +KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86" +IUSE="usb-monitor user-permissions video_cards_nvidia X" + +# In 2.2.0, DRM seems fairly embedded and non-optional even if the +# build system option exists. Fails to build. +RDEPEND=" + dev-libs/glib:2 + >=dev-libs/jansson-2 + sys-apps/i2c-tools + virtual/udev + x11-libs/libdrm + usb-monitor? ( + dev-libs/hidapi + virtual/libusb:1 + sys-apps/usbutils + ) + user-permissions? ( + acct-group/i2c + ) + X? ( + x11-libs/libXrandr + x11-libs/libX11 + ) +" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" +# doc? ( app-text/doxygen[dot] ) + +PATCHES=( + "${FILESDIR}"/${PN}-1.4.1-no-werror.patch + "${FILESDIR}"/${PN}-2.2.5-clang-fix-for-glibc-2.43.patch +) + +pkg_pretend() { + # This program needs /dev/ic2-* devices to communicate with the monitor. + CONFIG_CHECK="~I2C_CHARDEV" + ERROR_I2C_CHARDEV="You must enable I2C_CHARDEV in your kernel to continue" + if use usb-monitor; then + CONFIG_CHECK+=" ~HIDRAW ~USB_HIDDEV" + ERROR_HIDRAW="HIDRAW is needed to support USB monitors" + ERROR_I2C_CHARDEV="USB_HIDDEV is needed to support USB monitors" + fi + + # Now do the actual checks setup above + check_extra_config +} + +src_prepare() { + default + eautoreconf +} + +src_configure() { + local myeconfargs=( + # FAILS: doxyfile: No such file or directory + # $(use_enable doc doxygen) + --enable-drm + --enable-udev + $(use_enable usb-monitor usb) + --enable-lib + $(use_enable X x11) + ) + + econf "${myeconfargs[@]}" +} + +src_install() { + default + if use user-permissions; then + udev_dorules data/usr/lib/udev/rules.d/60-ddcutil-i2c.rules + fi +} + +pkg_postinst() { + if use user-permissions; then + einfo "To allow non-root users access to the /dev/i2c-* devices, add those" + einfo "users to the i2c group: usermod -aG i2c user" + einfo "Restart the computer or reload the i2c-dev module to activate" + einfo "the new udev rule." + einfo "For more information read: http://www.ddcutil.com/i2c_permissions/" + + udev_reload + fi + + if use video_cards_nvidia; then + ewarn "Please read the following webpage on proper usage with the nVidia " + ewarn "binary drivers, or it may not work: http://www.ddcutil.com/nvidia/" + fi +} + +pkg_postrm() { + if use user-permissions; then + udev_reload + fi +} diff --git a/app-misc/ddcutil/files/ddcutil-2.2.5-clang-fix-for-glibc-2.43.patch b/app-misc/ddcutil/files/ddcutil-2.2.5-clang-fix-for-glibc-2.43.patch new file mode 100644 index 000000000000..bbd57f644ba3 --- /dev/null +++ b/app-misc/ddcutil/files/ddcutil-2.2.5-clang-fix-for-glibc-2.43.patch @@ -0,0 +1,160 @@ +https://bugs.gentoo.org/970478 +https://github.com/rockowitz/ddcutil/commit/a4bc6aef24a2f91f5e5daeb6e1207637ecd55424 +From: Sanford Rockowitz <[email protected]> +Date: Sat, 31 Jan 2026 07:13:26 -0500 +Subject: [PATCH] fopen_mkdir(): fix for glibc 2.43 + +--- a/src/util/file_util.c ++++ b/src/util/file_util.c +@@ -921,13 +921,13 @@ fopen_mkdir( + + int rc = 0; + *fp_loc = NULL; +- char *sep = strrchr(path, '/'); ++ char *path0 = g_strdup(path); ++ char *sep = strrchr(path0, '/'); + if (sep) { +- char *path0 = g_strdup(path); +- path0[ sep - path ] = 0; ++ path0[ sep - path0 ] = 0; + rc = rek_mkdir(path0, ferr); +- free(path0); + } ++ g_free(path0); + if (!rc) { + *fp_loc = fopen(path,mode); + if (!*fp_loc) { + +https://github.com/rockowitz/ddcutil/commit/a587492200666c6da1bd63dcb35c466a914175bf +From: Sanford Rockowitz <[email protected]> +Date: Thu, 29 Jan 2026 01:35:09 -0500 +Subject: [PATCH] rek_mkdir(): build with glib 2.43 + +Alternative to change made in pull request #578 that +preserves const-ness of function arg +--- a/src/util/file_util.c ++++ b/src/util/file_util.c +@@ -2,7 +2,7 @@ + * File utility functions + */ + +-// Copyright (C) 2014-2024 Sanford Rockowitz <[email protected]> ++// Copyright (C) 2014-2026 Sanford Rockowitz <[email protected]> + // SPDX-License-Identifier: GPL-2.0-or-later + + /** \cond */ +@@ -890,24 +890,26 @@ int rek_mkdir( + if (debug) + printf("(%s) Starting, path=%s\n", __func__, path); + ++ char * path0 = strdup(path); // for building on glib 2.43 + int result = 0; +- if (!directory_exists(path)) { +- char *sep = strrchr(path, '/'); ++ if (!directory_exists(path0)) { ++ char *sep = strrchr(path0, '/'); + if (sep) { + *sep = 0; +- result = rek_mkdir(path, ferr); // create parent dir ++ result = rek_mkdir(path0, ferr); // create parent dir + *sep = '/'; + } + if (result == 0) { + if (debug) +- printf("(%s) Creating path %s\n", __func__, path); +- if ( mkdir(path, 0777) < 0) { ++ printf("(%s) Creating path %s\n", __func__, path0); ++ if ( mkdir(path0, 0777) < 0) { + result = -errno; + if (ferr) +- f0printf(ferr, "Unable to create '%s', %s\n", path, strerror(errno)); ++ f0printf(ferr, "Unable to create '%s', %s\n", path0, strerror(errno)); + } + } + } ++ free(path0); + + if (debug) + printf("(%s) Done. returning %d\n", __func__, result); + +https://github.com/rockowitz/ddcutil/commit/1b1ee00391330db41088db07d1010bd1c20435bb +From: Sanford Rockowitz <[email protected]> +Date: Wed, 28 Jan 2026 19:40:45 -0500 +Subject: [PATCH] extract_number_after_hyphen(): fix build with glibc 2.43 + +per pull request #578 ReillyBrogan +--- a/src/util/i2c_util.c ++++ b/src/util/i2c_util.c +@@ -3,7 +3,7 @@ + * I2C utility functions + */ + +-// Copyright (C) 2014-2023 Sanford Rockowitz <[email protected]> ++// Copyright (C) 2014-2026 Sanford Rockowitz <[email protected]> + // SPDX-License-Identifier: GPL-2.0-or-later + + #include "config.h" +@@ -60,7 +60,7 @@ int extract_number_after_hyphen(const char * name) { + int result = -1; + + if (name) { +- char * hyphen = strchr(name, '-'); ++ const char * hyphen = strchr(name, '-'); + if (hyphen && *(hyphen+1) != '\0') { + int ival; + if ( str_to_int(hyphen+1, &ival, 10) ) + +https://github.com/rockowitz/ddcutil/commit/b7514d6da709d0c950f8b377aef6e6789dfb1d82 +From: Sanford Rockowitz <[email protected]> +Date: Wed, 28 Jan 2026 19:44:29 -0500 +Subject: [PATCH] predicate_exact_D-00hh(): fix build with glibc 2.43 + +per pull request #578 ReillyBrogan +--- a/src/util/sysfs_filter_functions.c ++++ b/src/util/sysfs_filter_functions.c +@@ -1,6 +1,6 @@ + /** @file sysfs_filter_functions.c */ + +-// Copyright (C) 2021-2025 Sanford Rockowitz <[email protected]> ++// Copyright (C) 2021-2026 Sanford Rockowitz <[email protected]> + // SPDX-License-Identifier: GPL-2.0-or-later + + #include <assert.h> +@@ -183,7 +183,7 @@ bool predicate_exact_D_00hh(const char * value, const char * sbusno) { + bool b1 = compile_and_eval_regex(D_00hh_pattern, value); + if (b1) { + // our utilities don't support extracting match groups +- char * hypos = strchr(value, '-'); // must succeed because of regex match ++ const char * hypos = strchr(value, '-'); // must succeed because of regex match + char * s = substr(value, 0, (hypos-value)); + b1 = streq(s, sbusno); + free(s); + +https://github.com/rockowitz/ddcutil/commit/23d993829e8107ff9bcf0501a981910f972ba2ab +From: Sanford Rockowitz <[email protected]> +Date: Thu, 29 Jan 2026 01:26:44 -0500 +Subject: [PATCH] hiddev_name_to_number(): build on glib 2.43 + +Alternative coding of pull request #578, +retains const-ness of function argument +--- a/src/base/displays.c ++++ b/src/base/displays.c +@@ -1625,8 +1625,8 @@ void free_display_handle(Display_Handle * dh) { + */ + int hiddev_name_to_number(const char * hiddev_name) { + assert(hiddev_name); +- char * p = strstr(hiddev_name, "hiddev"); +- ++ char * hiddev_name_copy = strdup(hiddev_name); // for glib 2.43 ++ char * p = strstr(hiddev_name_copy, "hiddev"); + int hiddev_number = -1; + if (p) { + p = p + strlen("hiddev"); +@@ -1638,6 +1638,7 @@ int hiddev_name_to_number(const char * hiddev_name) { + hiddev_number = -1; // not necessary, but makes coverity happy + } + } ++ free(hiddev_name_copy); + // DBGMSG("hiddev_name = |%s|, returning: %d", hiddev_name, hiddev_number); + return hiddev_number; + }
