diff --git a/games-util/joycond/Manifest b/games-util/joycond/Manifest index 77c7dadd3a32..c6fb1a0cc904 100644 --- a/games-util/joycond/Manifest +++ b/games-util/joycond/Manifest @@ -1 +1,2 @@ DIST joycond-0.1.0_p20220720.tar.gz 30009 BLAKE2B b3963a6d3e8047708d2aa258cb11a8018e263d91c4e1c5491b70eef9d22b4256002780adf897b809f87b101e2876086528389ce9649f34125b3fa226695b5e8f SHA512 b32be26a2d7184910d2d8c1e3ac356885f301d5a443b0d9c91431e37108bc77feb369e93db3c3f0a20a81c2287fd54baed785e5744a787a0bff9763815ffe655 +DIST joycond-0.1.0_p20250412.tar.gz 30530 BLAKE2B e2ff97784ac55e72762952f313b95c80bf21540db8c1a6679165691502e1c21e89495e720665220bf105ce40565d4b8cdfc378a590a9e1e98851d1a58dfb9a27 SHA512 628bfc132ae50d40866965c757dd812ef75caead9630e5f3e59296bc29cb797b9d3000fe1d1f158d31ca7ab879683fa4e4ce649bd25f13301c4319ef08d5abd8 diff --git a/games-util/joycond/files/joycond-dynamic-paths.patch b/games-util/joycond/files/joycond-dynamic-paths.patch new file mode 100644 index 000000000000..234cbaa195b5 --- /dev/null +++ b/games-util/joycond/files/joycond-dynamic-paths.patch @@ -0,0 +1,72 @@ +From b68e1c3a40aa116f0c6236114be79bd79f472258 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Fri, 17 Oct 2025 22:08:50 +0100 +Subject: [PATCH] cmake: Determine installation paths dynamically + +Use pkg-config data, then systemd-path, then respect GNUInstallDirs. +CMAKE_INSTALL_LIBDIR is not used because that is the +architecture-specific directory (e.g. lib64). + +Signed-off-by: James Le Cuirot +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,8 @@ + cmake_minimum_required(VERSION 3.13) + project(joycond) + ++include(GNUInstallDirs) ++ + set(CMAKE_CXX_STANDARD 17) + + # Generate compile_commands.json +@@ -25,19 +27,41 @@ target_link_libraries( + + add_subdirectory(src) + +-install(TARGETS joycond DESTINATION /usr/bin/ ++install(TARGETS joycond DESTINATION "${CMAKE_INSTALL_BINDIR}" + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) +-install(FILES udev/89-joycond.rules udev/72-joycond.rules DESTINATION /usr/lib/udev/rules.d/ +- PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ ++ ++pkg_get_variable(UDEV_RULES_PATH udev udev_dir) ++if(NOT UDEV_RULES_PATH) ++ set(UDEV_RULES_PATH "${CMAKE_INSTALL_PREFIX}/lib/udev") ++endif() ++install(FILES udev/89-joycond.rules udev/72-joycond.rules DESTINATION "${UDEV_RULES_PATH}/rules.d/" ++ PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + ) +-install(FILES systemd/joycond.service DESTINATION /usr/lib/systemd/system ++ ++pkg_get_variable(SYSTEMD_SYSTEM_UNIT_PATH systemd systemd_system_unit_dir) ++if(NOT SYSTEMD_SYSTEM_UNIT_PATH) ++ execute_process(COMMAND systemd-path systemd-system-unit OUTPUT_VARIABLE SYSTEMD_SYSTEM_UNIT_PATH OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE UNIT_RETVAL) ++ if(NOT UNIT_RETVAL EQUAL 0) ++ set(SYSTEMD_SYSTEM_UNIT_PATH "${CMAKE_INSTALL_PREFIX}/lib/systemd/system") ++ endif() ++endif() ++install(FILES systemd/joycond.service DESTINATION "${SYSTEMD_SYSTEM_UNIT_PATH}" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + ) +-install(FILES systemd/joycond.conf DESTINATION /etc/modules-load.d ++ ++pkg_get_variable(SYSTEMD_MODULES_LOAD_PATH systemd modules_load_dir) ++if(NOT SYSTEMD_MODULES_LOAD_PATH) ++ execute_process(COMMAND systemd-path modules-load OUTPUT_VARIABLE SYSTEMD_MODULES_LOAD_PATH OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE MODULES_RETVAL) ++ if(NOT MODULES_RETVAL EQUAL 0) ++ set(SYSTEMD_MODULES_LOAD_PATH "${CMAKE_INSTALL_PREFIX}/lib/modules-load.d") ++ endif() ++endif() ++install(FILES systemd/joycond.conf DESTINATION "${SYSTEMD_MODULES_LOAD_PATH}" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + ) ++ + install(FILES data/com.github.DanielOgorchock.joycond.metainfo.xml +- DESTINATION /usr/share/metainfo ++ DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/metainfo" + PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ + ) +-- +2.51.0 + diff --git a/games-util/joycond/files/joycond-gcc16.patch b/games-util/joycond/files/joycond-gcc16.patch new file mode 100644 index 000000000000..c42e7da509d5 --- /dev/null +++ b/games-util/joycond/files/joycond-gcc16.patch @@ -0,0 +1,26 @@ +From c43e5b13d0bd8f3f5fa1d44d92824ea2ca60c315 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Sun, 26 Oct 2025 22:28:19 +0000 +Subject: [PATCH] Fix -Warray-bounds warnings raised by GCC 16 + +Signed-off-by: James Le Cuirot +--- + src/ctlr_mgr.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/ctlr_mgr.cpp b/src/ctlr_mgr.cpp +index 2f6fbc4..9a2c20e 100644 +--- a/src/ctlr_mgr.cpp ++++ b/src/ctlr_mgr.cpp +@@ -164,7 +164,7 @@ void ctlr_mgr::add_ctlr(const std::string& devpath, const std::string& devname) + + if (!unpaired_controllers.count(devpath)) { + std::cout << "Creating new phys_ctlr for " << devname << std::endl; +- phys.reset(new phys_ctlr(devpath, devname)); ++ phys = std::make_shared(devpath, devname); + unpaired_controllers[devpath] = phys; + phys->blink_player_leds(); + subscribers[devpath] = std::make_shared(std::vector({phys->get_fd()}), +-- +2.51.0 + diff --git a/games-util/joycond/files/joycond-werror.patch b/games-util/joycond/files/joycond-werror.patch new file mode 100644 index 000000000000..240a623e1cc3 --- /dev/null +++ b/games-util/joycond/files/joycond-werror.patch @@ -0,0 +1,23 @@ +From 5c58b2b44982e6e4958444888bc5e5f8d1634887 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Fri, 17 Oct 2025 22:32:15 +0100 +Subject: [PATCH] cmake: Only apply -Werror to debug builds + +It is really unhelpful for end users and distributions who might not be +using the same toolchain version as you. + +Signed-off-by: James Le Cuirot +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,7 @@ pkg_check_modules(LIBEVDEV REQUIRED libevdev) + pkg_check_modules(LIBUDEV REQUIRED libudev) + + add_executable(joycond "") +-target_compile_options(joycond PRIVATE -Wall -Werror) ++target_compile_options(joycond PRIVATE -Wall $<$:-Werror>) + include_directories( + include/ + ${LIBEVDEV_INCLUDE_DIRS} +-- +2.51.0 + diff --git a/games-util/joycond/joycond-0.1.0_p20250412.ebuild b/games-util/joycond/joycond-0.1.0_p20250412.ebuild new file mode 100644 index 000000000000..19d19b6c4019 --- /dev/null +++ b/games-util/joycond/joycond-0.1.0_p20250412.ebuild @@ -0,0 +1,52 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit cmake linux-info udev + +COMMIT="39d5728d41b70840342ddc116a59125b337fbde2" +DESCRIPTION="Daemon that uses hid-nintendo evdev devices to implement joycon pairing" +HOMEPAGE="https://github.com/DanielOgorchock/joycond" +SRC_URI="https://github.com/DanielOgorchock/joycond/archive/${COMMIT}.tar.gz -> ${P}.tar.gz" +S="${WORKDIR}/${PN}-${COMMIT}" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~arm64" + +DEPEND=" + dev-libs/libevdev + virtual/udev +" + +RDEPEND=" + ${DEPEND} +" + +CONFIG_CHECK=" + ~HID + ~HID_NINTENDO + ~HIDRAW +" + +PATCHES=( + "${FILESDIR}"/${PN}-dynamic-paths.patch + "${FILESDIR}"/${PN}-systemd-paranoia.patch + "${FILESDIR}"/${PN}-werror.patch + "${FILESDIR}"/${PN}-gcc16.patch +) + +src_install() { + cmake_src_install + newinitd "${FILESDIR}"/${PN}.initd ${PN} + doman doc/${PN}.1 +} + +pkg_postinst() { + udev_reload +} + +pkg_postrm() { + udev_reload +}