fix apex compile on osx, suppress some build warnings
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.24 / 902-darwin_scripts_include.patch
1 Index: linux-2.6.23-rc6/scripts/genksyms/parse.c_shipped
2 ===================================================================
3 --- linux-2.6.23-rc6.orig/scripts/genksyms/parse.c_shipped 2007-09-21 16:23:51.000000000 +0800
4 +++ linux-2.6.23-rc6/scripts/genksyms/parse.c_shipped 2007-09-21 16:24:10.000000000 +0800
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.23-rc6/scripts/genksyms/parse.y
16 ===================================================================
17 --- linux-2.6.23-rc6.orig/scripts/genksyms/parse.y 2007-09-21 16:23:51.000000000 +0800
18 +++ linux-2.6.23-rc6/scripts/genksyms/parse.y 2007-09-21 16:24:10.000000000 +0800
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.23-rc6/scripts/kallsyms.c
30 ===================================================================
31 --- linux-2.6.23-rc6.orig/scripts/kallsyms.c 2007-09-21 16:23:51.000000000 +0800
32 +++ linux-2.6.23-rc6/scripts/kallsyms.c 2007-09-21 16:24:10.000000000 +0800
33 @@ -28,6 +28,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 128
68
69 Index: linux-2.6.23-rc6/scripts/kconfig/Makefile
70 ===================================================================
71 --- linux-2.6.23-rc6.orig/scripts/kconfig/Makefile 2007-09-21 16:23:51.000000000 +0800
72 +++ linux-2.6.23-rc6/scripts/kconfig/Makefile 2007-09-21 16:24:10.000000000 +0800
73 @@ -88,6 +88,9 @@
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.23-rc6/scripts/mod/mk_elfconfig.c
84 ===================================================================
85 --- linux-2.6.23-rc6.orig/scripts/mod/mk_elfconfig.c 2007-09-21 16:23:51.000000000 +0800
86 +++ linux-2.6.23-rc6/scripts/mod/mk_elfconfig.c 2007-09-21 16:24:10.000000000 +0800
87 @@ -1,7 +1,11 @@
88 #include <stdio.h>
89 #include <stdlib.h>
90 #include <string.h>
91 +#ifndef __APPLE__
92 #include <elf.h>
93 +#else
94 +#include "../../../../../tools/sstrip/include/elf.h"
95 +#endif
96
97 int
98 main(int argc, char **argv)
99 Index: linux-2.6.23-rc6/scripts/mod/modpost.h
100 ===================================================================
101 --- linux-2.6.23-rc6.orig/scripts/mod/modpost.h 2007-09-21 16:23:51.000000000 +0800
102 +++ linux-2.6.23-rc6/scripts/mod/modpost.h 2007-09-21 16:24:10.000000000 +0800
103 @@ -7,7 +7,11 @@
104 #include <sys/mman.h>
105 #include <fcntl.h>
106 #include <unistd.h>
107 +#ifndef __APPLE__
108 #include <elf.h>
109 +#else
110 +#include "../../../../../tools/sstrip/include/elf.h"
111 +#endif
112
113 #include "elfconfig.h"
114
This page took 0.045064 seconds and 5 git commands to generate.