0e981def57380e5bfe708a95072bb6a3ab039de8
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.21 / 902-darwin_scripts_include.patch
1 Index: linux-2.6.21.7/scripts/genksyms/parse.c_shipped
2 ===================================================================
3 --- linux-2.6.21.7.orig/scripts/genksyms/parse.c_shipped
4 +++ linux-2.6.21.7/scripts/genksyms/parse.c_shipped
5 @@ -144,7 +144,9 @@
6
7
8 #include <assert.h>
9 +#ifndef __APPLE__
10 #include <malloc.h>
11 +#endif
12 #include "genksyms.h"
13
14 static int is_typedef;
15 Index: linux-2.6.21.7/scripts/genksyms/parse.y
16 ===================================================================
17 --- linux-2.6.21.7.orig/scripts/genksyms/parse.y
18 +++ linux-2.6.21.7/scripts/genksyms/parse.y
19 @@ -24,7 +24,9 @@
20 %{
21
22 #include <assert.h>
23 +#ifndef __APPLE__
24 #include <malloc.h>
25 +#endif
26 #include "genksyms.h"
27
28 static int is_typedef;
29 Index: linux-2.6.21.7/scripts/kallsyms.c
30 ===================================================================
31 --- linux-2.6.21.7.orig/scripts/kallsyms.c
32 +++ linux-2.6.21.7/scripts/kallsyms.c
33 @@ -30,6 +30,35 @@
34 #include <stdlib.h>
35 #include <string.h>
36 #include <ctype.h>
37 +#ifdef __APPLE__
38 +/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */
39 +void *memmem (const void *haystack, size_t haystack_len,
40 + const void *needle, size_t needle_len)
41 +{
42 + const char *begin;
43 + const char *const last_possible
44 + = (const char *) haystack + haystack_len - needle_len;
45 +
46 + if (needle_len == 0)
47 + /* The first occurrence of the empty string is deemed to occur at
48 + the beginning of the string. */
49 + return (void *) haystack;
50 +
51 + /* Sanity check, otherwise the loop might search through the whole
52 + memory. */
53 + if (__builtin_expect (haystack_len < needle_len, 0))
54 + return NULL;
55 +
56 + for (begin = (const char *) haystack; begin <= last_possible; ++begin)
57 + if (begin[0] == ((const char *) needle)[0] &&
58 + !memcmp ((const void *) &begin[1],
59 + (const void *) ((const char *) needle + 1),
60 + needle_len - 1))
61 + return (void *) begin;
62 +
63 + return NULL;
64 +}
65 +#endif
66
67 #define KSYM_NAME_LEN 127
68
69 Index: linux-2.6.21.7/scripts/kconfig/Makefile
70 ===================================================================
71 --- linux-2.6.21.7.orig/scripts/kconfig/Makefile
72 +++ linux-2.6.21.7/scripts/kconfig/Makefile
73 @@ -87,6 +87,9 @@ check-lxdialog := $(srctree)/$(src)/lxd
74 # we really need to do so. (Do not call gcc as part of make mrproper)
75 HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
76 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
77 +ifeq ($(shell uname -s),Darwin)
78 +HOST_LOADLIBES += -lncurses
79 +endif
80
81 HOST_EXTRACFLAGS += -DLOCALE
82
83 Index: linux-2.6.21.7/scripts/mod/file2alias.c
84 ===================================================================
85 --- linux-2.6.21.7.orig/scripts/mod/file2alias.c
86 +++ linux-2.6.21.7/scripts/mod/file2alias.c
87 @@ -37,7 +37,21 @@ typedef unsigned char __u8;
88 * even potentially has different endianness and word sizes, since
89 * we handle those differences explicitly below */
90 #include "../../include/linux/mod_devicetable.h"
91 +#ifndef __APPLE__
92 #include "../../include/linux/input.h"
93 +#else
94 +#define EV_MAX 0x1f
95 +#define KEY_MUTE 113
96 +#define KEY_MIN_INTERESTING KEY_MUTE
97 +#define KEY_MAX 0x1ff
98 +#define REL_MAX 0x0f
99 +#define ABS_MAX 0x3f
100 +#define MSC_MAX 0x07
101 +#define LED_MAX 0x0f
102 +#define SND_MAX 0x07
103 +#define FF_MAX 0x7f
104 +#define SW_MAX 0x0f
105 +#endif
106
107 #define ADD(str, sep, cond, field) \
108 do { \
109 Index: linux-2.6.21.7/scripts/mod/mk_elfconfig.c
110 ===================================================================
111 --- linux-2.6.21.7.orig/scripts/mod/mk_elfconfig.c
112 +++ linux-2.6.21.7/scripts/mod/mk_elfconfig.c
113 @@ -1,7 +1,11 @@
114 #include <stdio.h>
115 #include <stdlib.h>
116 #include <string.h>
117 +#ifndef __APPLE__
118 #include <elf.h>
119 +#else
120 +#include "../../../../../tools/sstrip/include/elf.h"
121 +#endif
122
123 int
124 main(int argc, char **argv)
125 Index: linux-2.6.21.7/scripts/mod/modpost.h
126 ===================================================================
127 --- linux-2.6.21.7.orig/scripts/mod/modpost.h
128 +++ linux-2.6.21.7/scripts/mod/modpost.h
129 @@ -7,7 +7,11 @@
130 #include <sys/mman.h>
131 #include <fcntl.h>
132 #include <unistd.h>
133 +#ifndef __APPLE__
134 #include <elf.h>
135 +#else
136 +#include "../../../../../tools/sstrip/include/elf.h"
137 +#endif
138
139 #include "elfconfig.h"
140
141 Index: linux-2.6.21.7/scripts/mod/sumversion.c
142 ===================================================================
143 --- linux-2.6.21.7.orig/scripts/mod/sumversion.c
144 +++ linux-2.6.21.7/scripts/mod/sumversion.c
145 @@ -8,6 +8,9 @@
146 #include <errno.h>
147 #include <string.h>
148 #include "modpost.h"
149 +#ifdef __APPLE__
150 +#include <limits.h>
151 +#endif
152
153 /*
154 * Stolen form Cryptographic API.
This page took 0.062461 seconds and 3 git commands to generate.