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