commit:     3f7b4b2fba5aa60adcd170aae8e4f46eb382137d
Author:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  8 19:35:41 2023 +0000
Commit:     Patrick McLean <chutzpah <AT> gentoo <DOT> org>
CommitDate: Fri Dec  8 19:35:51 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3f7b4b2f

app-misc/ltunify: add 0.3, drop 0.2-r2

Closes: https://bugs.gentoo.org/722406
Signed-off-by: Patrick McLean <chutzpah <AT> gentoo.org>

 app-misc/ltunify/Manifest                          |  2 +-
 .../files/ltunify-0.3-compiler-warning.patch       | 26 ++++++++++++++++
 app-misc/ltunify/files/ltunify-0.3-ldflags.patch   | 19 ++++++++++++
 .../{ltunify-0.2-r2.ebuild => ltunify-0.3.ebuild}  | 35 +++++++++++++++++-----
 4 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/app-misc/ltunify/Manifest b/app-misc/ltunify/Manifest
index 9926d623d7e5..c1df75508a4b 100644
--- a/app-misc/ltunify/Manifest
+++ b/app-misc/ltunify/Manifest
@@ -1 +1 @@
-DIST ltunify-0.2.tar.gz 28897 BLAKE2B 
5a8b7b86515f41d939b4774afc8c97d7600f6c1c58203a58ec46027138ffc60fc1f0f917c915642ccc5561a311b8d45da39370a71af13b03e51249792d233360
 SHA512 
e6eaf5c3ef555712219a3edd74d8d8edd3380908cd08dc5168a07111ddb7bf7d0e3d1a5eaf90f6e7ac9faf0474c31827ba0f9f511f170ab8900f0b90f65aa85a
+DIST ltunify-0.3.tar.gz 32456 BLAKE2B 
be6d9540372dd667572f23648d2625ac6747af49792f1e6ef4de3b562b6746120e4c840042a689daffdefc555fd9883c2e936b02fe07cb070d88033613d6cce6
 SHA512 
f876de44b1b893bba2d8d44336f4936e639bd700d9dd22b46ef7ae11b731a6710c1154546272dd01c45d0e50d07c692c448c4be0b8d89d1e9772c3ed7575f626

diff --git a/app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch 
b/app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch
new file mode 100644
index 000000000000..d443114613e5
--- /dev/null
+++ b/app-misc/ltunify/files/ltunify-0.3-compiler-warning.patch
@@ -0,0 +1,26 @@
+commit b68dc9af6db53de231d5ac71f9b6ba2ff3057a68
+Author: Peter Wu <pe...@lekensteyn.nl>
+Date:   Sun Jun 14 22:59:19 2020 +0200
+
+    ltunify: fix harmless compiler warning
+    
+    bInterfaceNumber is expected to return the `%02x` format according to
+    the current kernel sources. Even if that is not true, a user can always
+    manually specify the hidraw device if the wrong device is detected.
+
+diff --git a/ltunify.c b/ltunify.c
+index 1e685b4..9625776 100644
+--- a/ltunify.c
++++ b/ltunify.c
+@@ -1214,7 +1214,10 @@ int open_hidraw(void) {
+                               if (pid == PID_NANO_RECEIVER_2) {
+                                       int iface = -1;
+                                       if ((fp = 
fopen_format("/sys/class/hidraw/%s/device/../bInterfaceNumber", dev_name))) {
+-                                              fscanf(fp, "%02x", &iface);
++                                              int m = fscanf(fp, "%02x", 
&iface);
++                                              if (m != 1) {
++                                                      iface = -1;
++                                              }
+                                               fclose(fp);
+                                       }
+                                       if (iface == 0) {

diff --git a/app-misc/ltunify/files/ltunify-0.3-ldflags.patch 
b/app-misc/ltunify/files/ltunify-0.3-ldflags.patch
new file mode 100644
index 000000000000..10a18b3e485e
--- /dev/null
+++ b/app-misc/ltunify/files/ltunify-0.3-ldflags.patch
@@ -0,0 +1,19 @@
+diff --git a/Makefile b/Makefile
+index 8116950..e8b4df9 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,5 @@
+ CFLAGS ?= -g -O2 -Wall -Wextra -D_FORTIFY_SOURCE=2 -fstack-protector --param 
ssp-buffer-size=4
++LDFLAGS ?=
+ # for install-home
+ BINDIR ?= $(HOME)/bin
+ 
+@@ -24,7 +25,7 @@ all: ltunify read-dev-usbmon
+ read-dev-usbmon: read-dev-usbmon.c hidraw.c
+ 
+ ltunify: ltunify.c hidpp20.c
+-      $(CC) $(CFLAGS) -o $(OUTDIR)$@ $< -lrt $(LTUNIFY_DEFINES)
++      $(CC) $(CFLAGS) $(LDFLAGS) -o $(OUTDIR)$@ $< -lrt $(LTUNIFY_DEFINES)
+ 
+ .PHONY: all clean install-home install install-udevrule uninstall
+ clean:

diff --git a/app-misc/ltunify/ltunify-0.2-r2.ebuild 
b/app-misc/ltunify/ltunify-0.3.ebuild
similarity index 51%
rename from app-misc/ltunify/ltunify-0.2-r2.ebuild
rename to app-misc/ltunify/ltunify-0.3.ebuild
index 55d2dd4a7211..8c7a4d261f85 100644
--- a/app-misc/ltunify/ltunify-0.2-r2.ebuild
+++ b/app-misc/ltunify/ltunify-0.3.ebuild
@@ -1,8 +1,9 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
-inherit toolchain-funcs
+EAPI=8
+
+inherit udev toolchain-funcs
 
 DESCRIPTION="Tool for working with Logitech Unifying receivers and devices"
 HOMEPAGE="https://lekensteyn.nl/logitech-unifying.html 
https://git.lekensteyn.nl/ltunify/";
@@ -12,17 +13,35 @@ LICENSE="GPL-3+"
 SLOT="0"
 KEYWORDS="~amd64 ~x86"
 
-src_prepare() {
-       default
-       sed -i '/^override CFLAGS/d' Makefile || die
+DOCS=(
+       NEWS
+       README.txt
+)
+
+PATCHES=(
+       "${FILESDIR}/ltunify-0.3-compiler-warning.patch"
+       "${FILESDIR}/ltunify-0.3-ldflags.patch"
+)
+
+src_configure() {
        tc-export CC
 }
 
 src_compile() {
-       emake ${PN}
+       emake PACKAGE_VERSION=${PV} ${PN}
 }
 
 src_install() {
        dobin ${PN}
-       dodoc NEWS README.txt udev/42-logitech-unify-permissions.rules
+       dodoc "${DOCS[@]}"
+
+       udev_dorules udev/42-logitech-unify-permissions.rules
+}
+
+pkg_postinst() {
+       udev_reload
+}
+
+pkg_postrm() {
+       udev_reload
 }

Reply via email to