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