Fix build with clang.

This commit is contained in:
bentley 2017-04-21 20:34:19 +00:00
parent 74db53c5d7
commit 404ea13a5a
5 changed files with 83 additions and 1 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.3 2016/11/30 07:35:00 bentley Exp $
# $OpenBSD: Makefile,v 1.4 2017/04/21 20:34:19 bentley Exp $
COMMENT = SVG Tiny implementation
NETSURF_PROJECT = libsvgtiny
NETSURF_VERSION = 0.1.5
REVISION = 0
CATEGORIES = graphics
SHARED_LIBS = svgtiny 0.0 #0.1.4

View File

@ -0,0 +1,28 @@
$OpenBSD: patch-src_Makefile,v 1.1 2017/04/21 20:34:19 bentley Exp $
Fix build with multiple versions of gperf.
From upstream 4390f1c84e8fee51fc22468821e6fc158e783053.
--- src/Makefile.orig Thu Apr 20 09:06:18 2017
+++ src/Makefile Thu Apr 20 09:07:08 2017
@@ -1,13 +1,17 @@
# Sources
DIR_SOURCES := svgtiny.c svgtiny_gradient.c svgtiny_list.c
-SOURCES := $(SOURCES) $(BUILDDIR)/src_colors.c
+SOURCES := $(SOURCES)
-$(BUILDDIR)/src_colors.c: src/colors.gperf
+$(DIR)autogenerated_colors.c: src/colors.gperf
$(VQ)$(ECHO) " GPERF: $<"
$(Q)gperf --output-file=$@.tmp $<
-# Hack for GCC 4.2 compatibility (gperf 3.0.4 solves this properly)
- $(Q)$(SED) -e 's/#ifdef __GNUC_STDC_INLINE__/#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__/' $@.tmp >$@
+# Squash "error: no previous declaration for 'svgtiny_color_lookup'"
+ $(Q)$(SED) -e 's/^\(const struct svgtiny_named_color\)/static \1/' $@.tmp >$@
$(Q)$(RM) $@.tmp
+
+PRE_TARGETS := $(DIR)autogenerated_colors.c
+
+CLEAN_ITEMS := $(DIR)autogenerated_colors.c
include $(NSBUILD)/Makefile.subdir

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-src_colors_gperf,v 1.1 2017/04/21 20:34:19 bentley Exp $
Fix build with multiple versions of gperf.
From upstream 4390f1c84e8fee51fc22468821e6fc158e783053.
--- src/colors.gperf.orig Thu Apr 20 09:10:27 2017
+++ src/colors.gperf Thu Apr 20 09:10:45 2017
@@ -17,14 +17,6 @@
#include "svgtiny.h"
#include "svgtiny_internal.h"
-/* This unusual define shennanigan is to try and prevent the gperf
- * generated function from being inlined. This is pointless given
- * it (a) is in a separate .c file and (b) has external linkage.
- */
-#ifdef __inline
-#undef __inline
-#define __inline
-#endif
%}
struct svgtiny_named_color;

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_svgtiny_c,v 1.1 2017/04/21 20:34:19 bentley Exp $
Fix build with multiple versions of gperf.
From upstream 4390f1c84e8fee51fc22468821e6fc158e783053.
--- src/svgtiny.c.orig Thu Apr 20 09:06:24 2017
+++ src/svgtiny.c Thu Apr 20 09:07:19 2017
@@ -20,6 +20,9 @@
#include "svgtiny.h"
#include "svgtiny_internal.h"
+/* Source file generated by `gperf`. */
+#include "autogenerated_colors.c"
+
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-src_svgtiny_internal_h,v 1.1 2017/04/21 20:34:19 bentley Exp $
Fix build with multiple versions of gperf.
From upstream 4390f1c84e8fee51fc22468821e6fc158e783053.
--- src/svgtiny_internal.h.orig Thu Apr 20 09:09:27 2017
+++ src/svgtiny_internal.h Thu Apr 20 09:09:56 2017
@@ -102,9 +102,4 @@ void *svgtiny_list_get(struct svgtiny_list *list,
void *svgtiny_list_push(struct svgtiny_list *list);
void svgtiny_list_free(struct svgtiny_list *list);
-/* colors.gperf */
-const struct svgtiny_named_color *
- svgtiny_color_lookup(register const char *str,
- register unsigned int len);
-
#endif