902-darwin_scripts_include.patch 3.7 KB

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