python3Packages.pywikibot: init at 9.5.0 (#333068)
[NixPkgs.git] / pkgs / by-name / my / myrescue / 0001-darwin-build-fixes.patch
blob6dee89ab8f803b9a063ef76ed319f88cadc43be2
1 From c8f75fec1e558d1f6d5bbcdd89ac14b10fa370de 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 09:08:12 +0000
4 Subject: [PATCH] darwin build fixes
6 ---
7 compat.h | 9 +++++++++
8 myrescue-bitmap2ppm.c | 1 +
9 myrescue-stat.c | 1 +
10 myrescue.c | 5 +++++
11 4 files changed, 16 insertions(+)
12 create mode 100644 src/compat.h
14 diff --git a/compat.h b/compat.h
15 new file mode 100644
16 index 0000000..99b7239
17 --- /dev/null
18 +++ b/compat.h
19 @@ -0,0 +1,9 @@
20 +#pragma once
22 +#ifdef __APPLE__
23 +#include <unistd.h>
24 +#include <fcntl.h>
25 +_Static_assert(sizeof(off_t) == 8, "off_t must be 8 bytes");
26 +#define lseek64 lseek
27 +#define open64 open
28 +#endif
29 diff --git a/myrescue-bitmap2ppm.c b/myrescue-bitmap2ppm.c
30 index 68ecc29..eb2dd9e 100644
31 --- a/myrescue-bitmap2ppm.c
32 +++ b/myrescue-bitmap2ppm.c
33 @@ -25,6 +25,7 @@
34 #include <stdlib.h>
35 #include <unistd.h>
36 #include <fcntl.h>
37 +#include "compat.h"
39 int main(int argc, char** argv)
41 diff --git a/myrescue-stat.c b/myrescue-stat.c
42 index c7a115f..264bd55 100644
43 --- a/myrescue-stat.c
44 +++ b/myrescue-stat.c
45 @@ -25,6 +25,7 @@
46 #include <stdlib.h>
47 #include <unistd.h>
48 #include <fcntl.h>
49 +#include "compat.h"
51 #define BUFFER_SIZE 4096
53 diff --git a/myrescue.c b/myrescue.c
54 index 0b119c5..f9b052c 100644
55 --- a/myrescue.c
56 +++ b/myrescue.c
57 @@ -21,7 +21,11 @@
58 #define __USE_LARGEFILE64 1
59 #define _LARGEFILE_SOURCE 1
60 #define _LARGEFILE64_SOURCE 1
61 +#ifdef __linux__
62 #define HAVE_USBRESET 1
63 +#else
64 +#define HAVE_USBRESET 0
65 +#endif
67 #include <stdio.h>
68 #include <stdlib.h>
69 @@ -37,6 +41,7 @@
70 #include <signal.h>
72 #include "permute.h"
73 +#include "compat.h"
75 #define LONG_TIME 3
76 #define SLEEP_AFTER_USBRESET 5
77 --
78 2.43.0