From ae5851d0e8d483190e7e6238ab3b95eec8175a3c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Wed, 28 Aug 2024 20:26:33 +0200
Subject: [PATCH] community/usb-moded: fix build with gcc-14

---
 community/usb-moded/APKBUILD       |  2 ++
 community/usb-moded/basename.patch | 12 ++++++++++++
 2 files changed, 14 insertions(+)
 create mode 100644 community/usb-moded/basename.patch

diff --git a/community/usb-moded/APKBUILD b/community/usb-moded/APKBUILD
index 4f198e466840..d7429ced60a2 100644
--- a/community/usb-moded/APKBUILD
+++ b/community/usb-moded/APKBUILD
@@ -30,6 +30,7 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/sailfishos/usb-moded/archive
 	https://github.com/sailfishos-mirror/dbus-glib/archive/$_commit_dbus_glib/dbus-glib-$_commit_dbus_glib.tar.gz
 	usb-moded.confd
 	usb-moded.initd
+	basename.patch
 	"
 options="!check" # No test suite available
 builddir="$srcdir/$pkgname-mer-${_pkgver/+/-}"
@@ -76,4 +77,5 @@ e01072b119e672d5df9ae2ac59c47e9027bfedf1281427efd98774f2db955382bce6026f927a2d37
 665cd6395ee0ea14086ba30188c62a72697b3f63484681e18fc7f54109c9aca162f2e33aa2fa4d45287c6c0b590e81ca310c143dac0232cd5887692cdaf51256  dbus-glib-d42176ae4763e5288ef37ea314fe58387faf2005.tar.gz
 b841282b96110ec59a7aa539db0737327b09549d55c78dc4b2c3b28b4a6ad1facf015b3175cb6d3a38f13e47aa6314ef3dc1514a4e60dd653a97409ec54ba706  usb-moded.confd
 28c2d1e594d0be7d480885c1d3d38a2e33d310363a51093f19daf69221d173df5a03d04f1b7dfba3bcdb00697715123313441216a016efc8d11151daaa0ae4ea  usb-moded.initd
+8e15fcdcb5199c7c9deffc417035e2260aa7d4a437056f2ab9141c33220618da59324b87cbcebe9857d0269b170f98e2ea703c69b6543cbae237555cc6e297a4  basename.patch
 "
diff --git a/community/usb-moded/basename.patch b/community/usb-moded/basename.patch
new file mode 100644
index 000000000000..c5c76b272201
--- /dev/null
+++ b/community/usb-moded/basename.patch
@@ -0,0 +1,12 @@
+diff -upr usb-moded-mer-0.86.0-mer66.orig/src/usb_moded.c usb-moded-mer-0.86.0-mer66/src/usb_moded.c
+--- usb-moded-mer-0.86.0-mer66.orig/src/usb_moded.c	2024-08-28 20:24:01.495130829 +0200
++++ usb-moded-mer-0.86.0-mer66/src/usb_moded.c	2024-08-28 20:25:30.838474437 +0200
+@@ -175,6 +175,8 @@ static pthread_mutex_t  usbmoded_mutex =
+     }\
+ }while(0)
+ 
++#define basename(name) (strrchr((name),'/') ? strrchr((name),'/')+1 : (name))
++
+ /* ========================================================================= *
+  * Functions
+  * ========================================================================= */
-- 
GitLab