commit:     cbe66de5b84da655f31ca2c48a8e08c3c834c5af
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Mon Oct  6 20:16:49 2025 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Mon Oct  6 20:17:01 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cbe66de5

sys-apps/fakeroot: fix building on musl

Closes: https://bugs.gentoo.org/894510
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 sys-apps/fakeroot/fakeroot-1.32.2.ebuild           |  5 ++
 sys-apps/fakeroot/fakeroot-1.33.ebuild             |  5 ++
 .../files/fakeroot-1.32.2-configure-id_t.patch     | 35 +++++++++++
 sys-apps/fakeroot/files/fakeroot-1.32.2-musl.patch | 68 ++++++++++++++++++++++
 4 files changed, 113 insertions(+)

diff --git a/sys-apps/fakeroot/fakeroot-1.32.2.ebuild 
b/sys-apps/fakeroot/fakeroot-1.32.2.ebuild
index be16c401db92..50433f19d9ab 100644
--- a/sys-apps/fakeroot/fakeroot-1.32.2.ebuild
+++ b/sys-apps/fakeroot/fakeroot-1.32.2.ebuild
@@ -25,6 +25,11 @@ BDEPEND="nls? ( app-text/po4a )"
 
 DOCS=( AUTHORS BUGS DEBUG README doc/README.saving )
 
+PATCHES=(
+       "${FILESDIR}/${PN}-1.32.2-musl.patch"
+       "${FILESDIR}/${PN}-1.32.2-configure-id_t.patch"
+)
+
 src_prepare() {
        default
 

diff --git a/sys-apps/fakeroot/fakeroot-1.33.ebuild 
b/sys-apps/fakeroot/fakeroot-1.33.ebuild
index be16c401db92..2edd7bf26b41 100644
--- a/sys-apps/fakeroot/fakeroot-1.33.ebuild
+++ b/sys-apps/fakeroot/fakeroot-1.33.ebuild
@@ -25,6 +25,11 @@ BDEPEND="nls? ( app-text/po4a )"
 
 DOCS=( AUTHORS BUGS DEBUG README doc/README.saving )
 
+PATCHES=(
+       "${FILESDIR}/${PN}-1.32.2-musl.patch"
+       "${FILESDIR}/${PN}-1.32.2-configure-id_t.patch" # merged upstream 1.35.1
+)
+
 src_prepare() {
        default
 

diff --git a/sys-apps/fakeroot/files/fakeroot-1.32.2-configure-id_t.patch 
b/sys-apps/fakeroot/files/fakeroot-1.32.2-configure-id_t.patch
new file mode 100644
index 000000000000..d6fc07e2c8db
--- /dev/null
+++ b/sys-apps/fakeroot/files/fakeroot-1.32.2-configure-id_t.patch
@@ -0,0 +1,35 @@
+https://salsa.debian.org/clint/fakeroot/-/commit/819063eb4d2781ddea0647117ad6ab4d502dd39d
+From: Clint Adams <[email protected]>
+Date: Thu, 6 Jun 2024 09:16:52 -0400
+Subject: [PATCH] test for id_t with autoconf instead of blind typedef, fixes
+ FTBFS on FreeBSD
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -111,6 +111,7 @@ AC_C_CONST
+ AC_CHECK_TYPE(mode_t, int)
+ AC_CHECK_TYPE(off_t, long)
+ AC_CHECK_TYPE(size_t, unsigned)
++AC_CHECK_TYPE(id_t, int)
+
+ AH_TEMPLATE([FAKEROOT_ATTR], [for packed])
+ if test -n "$GCC";
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -139,13 +139,6 @@
+ #define INT_SEND_STAT(a,b) SEND_STAT(a,b,_STAT_VER)
+ #define INT_SEND_GET_XATTR(a,b) SEND_GET_XATTR(a,b,_STAT_VER)
+ #define INT_SEND_GET_STAT(a,b) SEND_GET_STAT(a,b)
+-
+-/* 10.10 uses id_t in getpriority/setpriority calls, so pretend
+-   id_t is used everywhere, just happens to be int on some OSes */
+-#ifndef _ID_T
+-#define _ID_T
+-typedef int id_t;
+-#endif
+ #endif
+
+ #include <sys/types.h>
+--
+GitLab
+

diff --git a/sys-apps/fakeroot/files/fakeroot-1.32.2-musl.patch 
b/sys-apps/fakeroot/files/fakeroot-1.32.2-musl.patch
new file mode 100644
index 000000000000..1f238d7fa50d
--- /dev/null
+++ b/sys-apps/fakeroot/files/fakeroot-1.32.2-musl.patch
@@ -0,0 +1,68 @@
+https://github.com/void-linux/void-packages/tree/master/srcpkgs/fakeroot/patches
+--- a/faked.c
++++ b/faked.c
+@@ -121,6 +121,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <signal.h>
++#include <inttypes.h>
+ #ifdef HAVE_STDINT_H
+ # include <stdint.h>
+ #endif
+@@ -514,11 +514,11 @@
+
+ #ifdef FAKEROOT_DB_PATH
+     if (find_path(i->buf.dev, i->buf.ino, roots, path))
+-      fprintf(f,"mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu %s\n",
++      
fprintf(f,"mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64"
 %s\n",
+               (uint64_t) i->buf.mode,(uint64_t) i->buf.uid,(uint64_t) 
i->buf.gid,
+               (uint64_t) i->buf.nlink,(uint64_t) i->buf.rdev,path);
+ #else
+-    
fprintf(f,"dev=%llx,ino=%llu,mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu\n",
++    
fprintf(f,"dev=%"PRIx64",ino=%"PRIu64",mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64"\n",
+             (uint64_t) i->buf.dev,(uint64_t) i->buf.ino,(uint64_t) 
i->buf.mode,
+             (uint64_t) i->buf.uid,(uint64_t) i->buf.gid,(uint64_t) 
i->buf.nlink,
+             (uint64_t) i->buf.rdev);
+@@ -544,7 +544,7 @@
+
+   while(1){
+ #ifdef FAKEROOT_DB_PATH
+-    r=scanf("mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu 
"DB_PATH_SCAN"\n",
++    
r=scanf("mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64"
 "DB_PATH_SCAN"\n",
+             &stmode, &stuid, &stgid, &stnlink, &strdev, &path);
+     if (r != 6)
+       break;
+@@ -559,7 +559,7 @@
+     stdev = path_st.st_dev;
+     stino = path_st.st_ino;
+ #else
+-    
r=scanf("dev=%llx,ino=%llu,mode=%llo,uid=%llu,gid=%llu,nlink=%llu,rdev=%llu\n",
++    
r=scanf("dev=%"PRIx64",ino=%"PRIu64",mode=%"PRIo64",uid=%"PRIu64",gid=%"PRIu64",nlink=%"PRIu64",rdev=%"PRIu64"\n",
+             &stdev, &stino, &stmode, &stuid, &stgid, &stnlink, &strdev);
+     if (r != 7)
+       break;
+@@ -687,7 +688,7 @@ int load_database(const uint32_t remote)
+ /*                               */
+ /*********************************/
+ void debug_stat(const struct fakestat *st){
+-  fprintf(stderr,"dev:ino=(%llx:%lli), mode=0%lo, own=(%li,%li), nlink=%li, 
rdev=%lli\n",
++  fprintf(stderr,"dev:ino=(%"PRIx64":%"PRIu64"), mode=0%lo, own=(%li,%li), 
nlink=%li, rdev=%"PRIu64"\n",
+         st->dev,
+         st->ino,
+         (long)st->mode,
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -81,12 +81,14 @@
+ #define SEND_STAT64(a,b,c) send_stat64(a,b,c)
+ #define SEND_GET_STAT(a,b) send_get_stat(a,b)
+ #define SEND_GET_STAT64(a,b) send_get_stat64(a,b)
++#define SEND_GET_XATTR(a,b,c) send_get_xattr(a,b,c)
+ #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b,c)
+ #else
+ #define SEND_STAT(a,b,c) send_stat(a,b)
+ #define SEND_STAT64(a,b,c) send_stat64(a,b)
+ #define SEND_GET_STAT(a,b) send_get_stat(a)
+ #define SEND_GET_STAT64(a,b) send_get_stat64(a)
++#define SEND_GET_XATTR(a,b,c) send_get_xattr(a,b)
+ #define SEND_GET_XATTR64(a,b,c) send_get_xattr64(a,b)
+ #endif

Reply via email to