0004-Build-Include-gperf-generated-code-directly.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From 4390f1c84e8fee51fc22468821e6fc158e783053 Mon Sep 17 00:00:00 2001
  2. From: Michael Drake <michael.drake@codethink.co.uk>
  3. Date: Thu, 20 Apr 2017 10:51:07 +0100
  4. Subject: Build: Include gperf-generated code directly.
  5. Previously we built the generated code separatly and then linked to
  6. it. However, this caused problems with certain compilers and gperf
  7. versions. This change includes the generated code directly in
  8. svgtiny.c instead, which is the only place its used.
  9. [Retrieved from:
  10. https://source.netsurf-browser.org/libsvgtiny.git/commit/src?id=4390f1c84e8fee51fc22468821e6fc158e783053]
  11. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  12. ---
  13. src/Makefile | 13 +++++++------
  14. src/colors.gperf | 8 --------
  15. src/svgtiny.c | 3 +++
  16. src/svgtiny_internal.h | 5 -----
  17. 4 files changed, 10 insertions(+), 19 deletions(-)
  18. (limited to 'src')
  19. diff --git a/src/Makefile b/src/Makefile
  20. index a979720..fb8a72f 100644
  21. --- a/src/Makefile
  22. +++ b/src/Makefile
  23. @@ -1,13 +1,14 @@
  24. # Sources
  25. DIR_SOURCES := svgtiny.c svgtiny_gradient.c svgtiny_list.c
  26. -SOURCES := $(SOURCES) $(BUILDDIR)/src_colors.c
  27. +SOURCES := $(SOURCES)
  28. -$(BUILDDIR)/src_colors.c: src/colors.gperf
  29. +$(DIR)autogenerated_colors.c: src/colors.gperf
  30. $(VQ)$(ECHO) " GPERF: $<"
  31. - $(Q)gperf --output-file=$@.tmp $<
  32. -# Hack for GCC 4.2 compatibility (gperf 3.0.4 solves this properly)
  33. - $(Q)$(SED) -e 's/#ifdef __GNUC_STDC_INLINE__/#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__/' $@.tmp >$@
  34. - $(Q)$(RM) $@.tmp
  35. + $(Q)gperf --output-file=$@ $<
  36. +
  37. +PRE_TARGETS := $(DIR)autogenerated_colors.c
  38. +
  39. +CLEAN_ITEMS := $(DIR)autogenerated_colors.c
  40. include $(NSBUILD)/Makefile.subdir
  41. diff --git a/src/colors.gperf b/src/colors.gperf
  42. index 96d5b9e..a836787 100644
  43. --- a/src/colors.gperf
  44. +++ b/src/colors.gperf
  45. @@ -17,14 +17,6 @@
  46. #include "svgtiny.h"
  47. #include "svgtiny_internal.h"
  48. -/* This unusual define shennanigan is to try and prevent the gperf
  49. - * generated function from being inlined. This is pointless given
  50. - * it (a) is in a separate .c file and (b) has external linkage.
  51. - */
  52. -#ifdef __inline
  53. -#undef __inline
  54. -#define __inline
  55. -#endif
  56. %}
  57. struct svgtiny_named_color;
  58. diff --git a/src/svgtiny.c b/src/svgtiny.c
  59. index 4661a58..bbefb88 100644
  60. --- a/src/svgtiny.c
  61. +++ b/src/svgtiny.c
  62. @@ -20,6 +20,9 @@
  63. #include "svgtiny.h"
  64. #include "svgtiny_internal.h"
  65. +/* Source file generated by `gperf`. */
  66. +#include "autogenerated_colors.c"
  67. +
  68. #ifndef M_PI
  69. #define M_PI 3.14159265358979323846
  70. #endif
  71. diff --git a/src/svgtiny_internal.h b/src/svgtiny_internal.h
  72. index 158d230..6bf5d64 100644
  73. --- a/src/svgtiny_internal.h
  74. +++ b/src/svgtiny_internal.h
  75. @@ -102,9 +102,4 @@ void *svgtiny_list_get(struct svgtiny_list *list,
  76. void *svgtiny_list_push(struct svgtiny_list *list);
  77. void svgtiny_list_free(struct svgtiny_list *list);
  78. -/* colors.gperf */
  79. -const struct svgtiny_named_color *
  80. - svgtiny_color_lookup(register const char *str,
  81. - register unsigned int len);
  82. -
  83. #endif
  84. --
  85. cgit v1.2.1