forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / by-name / re / recoverdm / 0001-darwin-build-fixes.patch
blob9a06ffd4ab65dd3b8727f424ad2cb0a17e179129
1 From 9b46e151b9fdaf5684618482e69ef4a307c0d47c Mon Sep 17 00:00:00 2001
2 From: annalee <150648636+a-n-n-a-l-e-e@users.noreply.github.com>
3 Date: Sun, 18 Feb 2024 19:54:21 +0000
4 Subject: [PATCH] darwin build fixes
6 ---
7 compat.h | 14 ++++++++++++++
8 dev.c | 1 +
9 error.c | 1 +
10 io.c | 1 +
11 mergebad.c | 1 +
12 recoverdm.c | 1 +
13 utils.c | 1 +
14 utils.h | 1 +
15 8 files changed, 21 insertions(+)
16 create mode 100644 src/compat.h
18 diff --git a/compat.h b/compat.h
19 new file mode 100644
20 index 0000000..181c8ea
21 --- /dev/null
22 +++ b/compat.h
23 @@ -0,0 +1,14 @@
24 +#pragma once
25 +#ifdef __APPLE__
26 +#include <unistd.h>
27 +_Static_assert(sizeof(off_t) == 8, "off_t must be 8 bytes");
28 +typedef off_t off64_t;
29 +#define stat64 stat
30 +#define lseek64 lseek
31 +#define open64 open
32 +#define POSIX_FADV_SEQUENTIAL 1
33 +static inline int posix_fadvise(int fd, off_t offset, off_t len, int advice)
35 + return 0;
37 +#endif
38 diff --git a/dev.c b/dev.c
39 index c1ce748..ae3ce2c 100644
40 --- a/dev.c
41 +++ b/dev.c
42 @@ -18,6 +18,7 @@
43 #include <scsi/scsi_ioctl.h>
44 #include <linux/cdrom.h>
45 #endif
46 +#include "compat.h"
48 #include "dev.h"
50 diff --git a/error.c b/error.c
51 index d2f8acf..550e1af 100644
52 --- a/error.c
53 +++ b/error.c
54 @@ -4,6 +4,7 @@
55 #include <stdlib.h>
56 #include <sys/types.h>
57 #include <signal.h>
58 +#include "compat.h"
60 void error_exit(char *format, ...)
62 diff --git a/io.c b/io.c
63 index 9d66534..e784d75 100644
64 --- a/io.c
65 +++ b/io.c
66 @@ -7,6 +7,7 @@
67 #include <unistd.h>
68 #include <sys/types.h>
69 #include <sys/stat.h>
70 +#include "compat.h"
72 #include "io.h"
73 #include "error.h"
74 diff --git a/mergebad.c b/mergebad.c
75 index 34a6ef7..580c3bc 100644
76 --- a/mergebad.c
77 +++ b/mergebad.c
78 @@ -7,6 +7,7 @@
79 #include <stdio.h>
80 #include <stdlib.h>
81 #include <unistd.h>
82 +#include "compat.h"
84 #include "io.h"
85 #include "dev.h"
86 diff --git a/recoverdm.c b/recoverdm.c
87 index 8b71ae1..5dddeb3 100644
88 --- a/recoverdm.c
89 +++ b/recoverdm.c
90 @@ -7,6 +7,7 @@
91 #include <stdio.h>
92 #include <stdlib.h>
93 #include <unistd.h>
94 +#include "compat.h"
96 #include "io.h"
97 #include "dev.h"
98 diff --git a/utils.c b/utils.c
99 index 5791404..ee42a0a 100644
100 --- a/utils.c
101 +++ b/utils.c
102 @@ -7,6 +7,7 @@
103 #include <stdio.h>
104 #include <stdlib.h>
105 #include <unistd.h>
106 +#include "compat.h"
108 #include "io.h"
109 #include "dev.h"
110 diff --git a/utils.h b/utils.h
111 index c749c2e..acb0888 100644
112 --- a/utils.h
113 +++ b/utils.h
114 @@ -1,3 +1,4 @@
115 +#include "compat.h"
116 void * mymalloc(size_t size, char *what);
117 void * myrealloc(void *oldp, size_t newsize, char *what);
118 off64_t get_filesize(char *filename);
120 2.43.0