902-darwin_scripts_include.patch 5.2 KB

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