From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BA711158041 for ; Fri, 12 Apr 2024 16:45:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 07891E2A06; Fri, 12 Apr 2024 16:45:03 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E2E09E2A06 for ; Fri, 12 Apr 2024 16:45:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 25189343176 for ; Fri, 12 Apr 2024 16:45:02 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 683A116B3 for ; Fri, 12 Apr 2024 16:45:00 +0000 (UTC) From: "Adrian Ratiu" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Adrian Ratiu" Message-ID: <1712940280.1525837f407ffd338515ca42a0f349df824e74c0.adrian.ratiu@gentoo> Subject: [gentoo-commits] repo/proj/guru:dev commit in: dev-libs/libtypec/, dev-libs/libtypec/files/ X-VCS-Repository: repo/proj/guru X-VCS-Files: dev-libs/libtypec/Manifest dev-libs/libtypec/files/libtypec-0.5.0-CMakeLists.txt-fix-pkgconfig-install-path.patch dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-define-feature-test-macro-for-nft.patch dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch dev-libs/libtypec/libtypec-0.5.0.ebuild dev-libs/libtypec/metadata.xml X-VCS-Directories: dev-libs/libtypec/files/ dev-libs/libtypec/ X-VCS-Committer: adrian.ratiu X-VCS-Committer-Name: Adrian Ratiu X-VCS-Revision: 1525837f407ffd338515ca42a0f349df824e74c0 X-VCS-Branch: dev Date: Fri, 12 Apr 2024 16:45:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 530cb498-514f-4e10-88e9-7bd3be92a85f X-Archives-Hash: 8a0f455593f334de1b6388b1484d21ee commit: 1525837f407ffd338515ca42a0f349df824e74c0 Author: Adrian Ratiu collabora com> AuthorDate: Fri Mar 8 10:46:19 2024 +0000 Commit: Adrian Ratiu collabora com> CommitDate: Fri Apr 12 16:44:40 2024 +0000 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=1525837f dev-libs/libtypec: new package, add 0.5 thesamesam suggested on github [1] we add this ebuild to GURU first, to get more testing before we eventually add it to the main repo. I'm in the process of upstreaming the 3 patches added in this ebuild [2]. [1] https://github.com/gentoo/gentoo/pull/35666 [2] https://github.com/Rajaram-Regupathy/libtypec/pull/32 Closes: https://bugs.gentoo.org/910433 Signed-off-by: Adrian Ratiu collabora.com> dev-libs/libtypec/Manifest | 1 + ...CMakeLists.txt-fix-pkgconfig-install-path.patch | 26 ++++++++++ ...sfs_ops-define-feature-test-macro-for-nft.patch | 45 ++++++++++++++++++ ...-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch | 55 ++++++++++++++++++++++ dev-libs/libtypec/libtypec-0.5.0.ebuild | 30 ++++++++++++ dev-libs/libtypec/metadata.xml | 15 ++++++ 6 files changed, 172 insertions(+) diff --git a/dev-libs/libtypec/Manifest b/dev-libs/libtypec/Manifest new file mode 100644 index 0000000000..3e3836b094 --- /dev/null +++ b/dev-libs/libtypec/Manifest @@ -0,0 +1 @@ +DIST libtypec-0.5.0-Source.tar.gz 41621 BLAKE2B 09b7e592b4e52f5b6f568675335dc2366902fa8e2d67c5f1c6d2895345d4f4e2e880fc5336ae849133da7794ab457c7cd2dd31111655a68247a15b45d1a6fca6 SHA512 a5f404400f6a08f67f026bbc115fa2278586a0c6b8e9f3766162967d43c111e8985563692a1648efb3a3d3a4cd5047dd903f8733d72a40a175c7bb6be130dcb3 diff --git a/dev-libs/libtypec/files/libtypec-0.5.0-CMakeLists.txt-fix-pkgconfig-install-path.patch b/dev-libs/libtypec/files/libtypec-0.5.0-CMakeLists.txt-fix-pkgconfig-install-path.patch new file mode 100644 index 0000000000..7412d6a537 --- /dev/null +++ b/dev-libs/libtypec/files/libtypec-0.5.0-CMakeLists.txt-fix-pkgconfig-install-path.patch @@ -0,0 +1,26 @@ +From 8614051a1ff9856c3de932045dc149e758c2b0b1 Mon Sep 17 00:00:00 2001 +From: Adrian Ratiu +Date: Fri, 12 Apr 2024 17:08:09 +0300 +Subject: [PATCH] CMakeLists.txt: fix pkgconfig install path + +pkgconfig pc files need to go under libdir instead of datadir. + +Suggested-by: Sam James +Upstream-Status: In-Progress [https://github.com/Rajaram-Regupathy/libtypec/pull/32] +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9d533ab..aecf4e5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -59,4 +59,4 @@ configure_file( + ) + + install(FILES ${CMAKE_BINARY_DIR}/libtypec.pc +- DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig) ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) +-- +2.43.2 + diff --git a/dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-define-feature-test-macro-for-nft.patch b/dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-define-feature-test-macro-for-nft.patch new file mode 100644 index 0000000000..ea83dcf7d1 --- /dev/null +++ b/dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-define-feature-test-macro-for-nft.patch @@ -0,0 +1,45 @@ +From f1ecf54f8190351b6b1c2f163375405c4b238f64 Mon Sep 17 00:00:00 2001 +From: Adrian Ratiu +Date: Fri, 12 Apr 2024 17:42:38 +0300 +Subject: [PATCH] libtypec_sysfs_ops: define feature test macro for nftw +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +According to the man page [1], the definiton of nftw() is +hidden behind the _XOPEN_SOURCE 500 feature test, so we +must enable it to avoid warnings or errors (if the toolchain +is configured to treat them as errors) like this: + +/var/tmp/portage/dev-libs/libtypec-0.5.0/work/libtypec-0.5.0-Source/libtypec_sysfs_ops.c:1059:13: +warning: implicit declaration of function ‘nftw’; did you mean ‘ftw’? +[-Wimplicit-function-declaration] + 1059 | if (nftw ("/dev/bus/usb/", count_billbrd_if, fd_limit, 0) != 0) + | ^~~~ + | ftw + +[1] https://linux.die.net/man/3/nftw +Upstream-Status: In-Progress [https://github.com/Rajaram-Regupathy/libtypec/pull/32] +--- + libtypec_sysfs_ops.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/libtypec_sysfs_ops.c b/libtypec_sysfs_ops.c +index 747b562..bfb5246 100644 +--- a/libtypec_sysfs_ops.c ++++ b/libtypec_sysfs_ops.c +@@ -29,6 +29,11 @@ SOFTWARE. + * @brief Functions for libtypec sysfs based operations + */ + ++/** ++ * required for enalbing nftw(), which is part of SUSv1. ++ */ ++#define _XOPEN_SOURCE 500 ++ + #include "libtypec_ops.h" + #include + #include +-- +2.43.2 + diff --git a/dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch b/dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch new file mode 100644 index 0000000000..01ed6d674a --- /dev/null +++ b/dev-libs/libtypec/files/libtypec-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch @@ -0,0 +1,55 @@ +From d11cd006700bada6ac09da4d58794474018650e4 Mon Sep 17 00:00:00 2001 +From: Adrian Ratiu +Date: Fri, 12 Apr 2024 18:36:15 +0300 +Subject: [PATCH] libtypec_sysfs_ops: fix nftw() fun pointer def +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +According to the __ntfw_func_t definiton [1], and ftw +documentation [2], ntfw() is being passed a wrong fun +argument, which is expected for the deprecated ftw(), +not for ntfw(). + +This got hidden by the fact that _XOPEN_SOURCE >= 500 +feature flag was disabled, so the C compilers just +issued an implicit declaration warning/error. + +Example: + +/var/tmp/portage/dev-libs/libtypec-0.5.0/work/libtypec-0.5.0-Source/libtypec_sysfs_ops.c:1064:36: +warning: passing argument 2 of ‘nftw’ from incompatible pointer type +[-Wincompatible-pointer-types] + 1064 | if (nftw ("/dev/bus/usb/", count_billbrd_if, fd_limit, 0) != 0) + | ^~~~~~~~~~~~~~~~ + | | + | int (*)(const char *, const struct stat *, int) +In file included from /var/tmp/portage/dev-libs/libtypec-0.5.0/work/libtypec-0.5.0-Source/libtypec_sysfs_ops.c:48: +/usr/include/ftw.h:179:51: note: expected ‘__nftw_func_t’ {aka ‘int (*)(const char *, const struct stat *, int, struct FTW *)’} but argument is of type ‘int (*)(const char *, const struct stat *, int)’ + 179 | extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, + | ~~~~~~~~~~~~~~^~~~~~ + +[1] +https://www.gnu.org/software/libc/manual/html_node/Working-with-Directory-Trees.html#index-_005f_005fnftw_005ffunc_005ft +[2] https://man7.org/linux/man-pages/man3/ftw.3.html +Upstream-Status: In-Progress [https://github.com/Rajaram-Regupathy/libtypec/pull/32] +--- + libtypec_sysfs_ops.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libtypec_sysfs_ops.c b/libtypec_sysfs_ops.c +index bfb5246..e496e5f 100644 +--- a/libtypec_sysfs_ops.c ++++ b/libtypec_sysfs_ops.c +@@ -476,7 +476,7 @@ static unsigned int get_fixed_supply_pdo(char *path, int src_snk) + + } + +-static int count_billbrd_if(const char *usb_path, const struct stat *sb, int typeflag) ++static int count_billbrd_if(const char *usb_path, const struct stat *sb, int typeflag, struct FTW *ftw) + { + FILE *fd; + +-- +2.43.2 + diff --git a/dev-libs/libtypec/libtypec-0.5.0.ebuild b/dev-libs/libtypec/libtypec-0.5.0.ebuild new file mode 100644 index 0000000000..02697c52d9 --- /dev/null +++ b/dev-libs/libtypec/libtypec-0.5.0.ebuild @@ -0,0 +1,30 @@ +# Copyright 2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake + +DESCRIPTION="Library to interface with USB Type-c/Power Delivery devices" +HOMEPAGE="https://github.com/Rajaram-Regupathy/libtypec" +SRC_URI="https://github.com/Rajaram-Regupathy/libtypec/releases/download/${P}/${P}-Source.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64" + +S="${WORKDIR}/${P}-Source" + +PATCHES=( + "${FILESDIR}/${PN}-0.5.0-CMakeLists.txt-fix-pkgconfig-install-path.patch" + "${FILESDIR}/${PN}-0.5.0-sysfs_ops-define-feature-test-macro-for-nft.patch" + "${FILESDIR}/${PN}-0.5.0-sysfs_ops-fix-nftw-fun-pointer-def.patch" +) + +src_configure() { + # don't force CFLAGS to allow Gentoo toolchain to set them + local mycmakeargs=( + -DLIBTYPEC_STRICT_CFLAGS=OFF + ) + cmake_src_configure +} diff --git a/dev-libs/libtypec/metadata.xml b/dev-libs/libtypec/metadata.xml new file mode 100644 index 0000000000..67b3cc5f8c --- /dev/null +++ b/dev-libs/libtypec/metadata.xml @@ -0,0 +1,15 @@ + + + + + “libtypec” is aimed to provide a generic interface abstracting all + platform complexity for user space to develop tools for efficient + USB-C port management. The library can also enable development of + diagnostic and debug tools to debug system issues around USB-C/USB + PD topology. + + + + Rajaram-Regupathy/libtypec + +