tools/fakeroot: fix build on MacOS arm64
[openwrt/openwrt.git] / tools / fakeroot / patches / 500-macos_arm64_compile_fix.patch
1 diff --git a/communicate.c b/communicate.c
2 index e2699a2..21e5366 100644
3 --- a/communicate.c
4 +++ b/communicate.c
5 @@ -24,7 +24,12 @@
6 In this file, we want 'struct stat' to have a 32-bit 'ino_t'.
7 We use 'struct stat64' when we need a 64-bit 'ino_t'.
8 */
9 -#define _DARWIN_NO_64_BIT_INODE
10 +# include <sys/types.h>
11 +# if __DARWIN_ONLY_64_BIT_INO_T
12 +# define _DARWIN_USE_64_BIT_INODE
13 +# else
14 +# define _DARWIN_NO_64_BIT_INODE
15 +# endif
16 #endif
17
18 #include "communicate.h"
19 diff --git a/communicate.h b/communicate.h
20 index 3f9ca39..a586108 100644
21 --- a/communicate.h
22 +++ b/communicate.h
23 @@ -91,6 +91,10 @@
24 # include <inttypes.h>
25 #endif
26
27 +#if __DARWIN_ONLY_64_BIT_INO_T
28 +struct stat64 __DARWIN_STRUCT_STAT64;
29 +#endif
30 +
31 #ifndef FAKEROOT_FAKENET
32 # define FAKEROOTKEY_ENV "FAKEROOTKEY"
33 #endif /* ! FAKEROOT_FAKENET */
34 diff --git a/faked.c b/faked.c
35 index a970184..ea51a23 100644
36 --- a/faked.c
37 +++ b/faked.c
38 @@ -84,7 +84,12 @@
39 In this file, we want 'struct stat' to have a 32-bit 'ino_t'.
40 We use 'struct stat64' when we need a 64-bit 'ino_t'.
41 */
42 -#define _DARWIN_NO_64_BIT_INODE
43 +# include <sys/types.h>
44 +# if __DARWIN_ONLY_64_BIT_INO_T
45 +# define _DARWIN_USE_64_BIT_INODE
46 +# else
47 +# define _DARWIN_NO_64_BIT_INODE
48 +# endif
49 #endif
50
51 #include "config.h"
52 diff --git a/libfakeroot.c b/libfakeroot.c
53 index c967d5d..836337d 100644
54 --- a/libfakeroot.c
55 +++ b/libfakeroot.c
56 @@ -38,7 +38,12 @@
57 In this file, we want 'struct stat' to have a 32-bit 'ino_t'.
58 We use 'struct stat64' when we need a 64-bit 'ino_t'.
59 */
60 -#define _DARWIN_NO_64_BIT_INODE
61 +# include <sys/types.h>
62 +# if __DARWIN_ONLY_64_BIT_INO_T
63 +# define _DARWIN_USE_64_BIT_INODE
64 +# else
65 +# define _DARWIN_NO_64_BIT_INODE
66 +# endif
67
68 /* The helper _unix2003 version of this file calls a few functions in this file
69 that are marked with static_nonapple so that needs to become private instead
70 diff --git a/libfakeroot_unix2003.c b/libfakeroot_unix2003.c
71 index e1e19b6..f32bfec 100644
72 --- a/libfakeroot_unix2003.c
73 +++ b/libfakeroot_unix2003.c
74 @@ -18,7 +18,11 @@
75 In this file, we want 'struct stat' to have a 32-bit 'ino_t'.
76 We use 'struct stat64' when we need a 64-bit 'ino_t'.
77 */
78 -#define _DARWIN_NO_64_BIT_INODE
79 +# if __DARWIN_ONLY_64_BIT_INO_T
80 +# define _DARWIN_USE_64_BIT_INODE
81 +# else
82 +# define _DARWIN_NO_64_BIT_INODE
83 +# endif
84
85 /*
86 This file is for 32-bit symbols which have the "$UNIX2003" version, i.e.