fix breakage introduced with [17394]
[openwrt.git] / target / linux / generic-2.6 / patches-2.6.27 / 902-darwin_scripts_include.patch
1 --- a/scripts/genksyms/parse.c_shipped
2 +++ b/scripts/genksyms/parse.c_shipped
3 @@ -160,7 +160,9 @@
4
5
6 #include <assert.h>
7 +#ifndef __APPLE__
8 #include <malloc.h>
9 +#endif
10 #include "genksyms.h"
11
12 static int is_typedef;
13 --- a/scripts/genksyms/parse.y
14 +++ b/scripts/genksyms/parse.y
15 @@ -24,7 +24,9 @@
16 %{
17
18 #include <assert.h>
19 +#ifndef __APPLE__
20 #include <malloc.h>
21 +#endif
22 #include "genksyms.h"
23
24 static int is_typedef;
25 --- a/scripts/kallsyms.c
26 +++ b/scripts/kallsyms.c
27 @@ -22,6 +22,35 @@
28 #include <stdlib.h>
29 #include <string.h>
30 #include <ctype.h>
31 +#ifdef __APPLE__
32 +/* Darwin has no memmem implementation, this one is ripped of the uClibc-0.9.28 source */
33 +void *memmem (const void *haystack, size_t haystack_len,
34 + const void *needle, size_t needle_len)
35 +{
36 + const char *begin;
37 + const char *const last_possible
38 + = (const char *) haystack + haystack_len - needle_len;
39 +
40 + if (needle_len == 0)
41 + /* The first occurrence of the empty string is deemed to occur at
42 + the beginning of the string. */
43 + return (void *) haystack;
44 +
45 + /* Sanity check, otherwise the loop might search through the whole
46 + memory. */
47 + if (__builtin_expect (haystack_len < needle_len, 0))
48 + return NULL;
49 +
50 + for (begin = (const char *) haystack; begin <= last_possible; ++begin)
51 + if (begin[0] == ((const char *) needle)[0] &&
52 + !memcmp ((const void *) &begin[1],
53 + (const void *) ((const char *) needle + 1),
54 + needle_len - 1))
55 + return (void *) begin;
56 +
57 + return NULL;
58 +}
59 +#endif
60
61 #define KSYM_NAME_LEN 128
62
63 --- a/scripts/kconfig/Makefile
64 +++ b/scripts/kconfig/Makefile
65 @@ -93,6 +93,9 @@ check-lxdialog := $(srctree)/$(src)/lxd
66 # we really need to do so. (Do not call gcc as part of make mrproper)
67 HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags)
68 HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
69 +ifeq ($(shell uname -s),Darwin)
70 +HOST_LOADLIBES += -lncurses
71 +endif
72
73 HOST_EXTRACFLAGS += -DLOCALE
74
75 --- a/scripts/mod/mk_elfconfig.c
76 +++ b/scripts/mod/mk_elfconfig.c
77 @@ -1,7 +1,11 @@
78 #include <stdio.h>
79 #include <stdlib.h>
80 #include <string.h>
81 +#ifndef __APPLE__
82 #include <elf.h>
83 +#else
84 +#include "../../../../../tools/sstrip/include/elf.h"
85 +#endif
86
87 int
88 main(int argc, char **argv)
89 --- a/scripts/mod/modpost.h
90 +++ b/scripts/mod/modpost.h
91 @@ -7,7 +7,11 @@
92 #include <sys/mman.h>
93 #include <fcntl.h>
94 #include <unistd.h>
95 +#ifndef __APPLE__
96 #include <elf.h>
97 +#else
98 +#include "../../../../../tools/sstrip/include/elf.h"
99 +#endif
100
101 #include "elfconfig.h"
102
This page took 0.047059 seconds and 5 git commands to generate.