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