summaryrefslogtreecommitdiffstats
path: root/source/d/vala/disable-graphviz.patch
blob: 54631335a714d59db3dd4582f7e050609c300768 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
--- ./configure.ac.orig	2018-12-20 08:54:58.000000000 -0600
+++ ./configure.ac	2018-12-20 12:32:05.649552535 -0600
@@ -119,34 +119,38 @@
 AC_SUBST(GMODULE_CFLAGS)
 AC_SUBST(GMODULE_LIBS)
 
-PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
-AC_MSG_CHECKING([for CGRAPH])
-cgraph_tmp_LIBADD="$LIBADD"
-cgraph_tmp_CFLAGS="$CFLAGS"
-LIBADD="$LIBADD $LIBGVC_LIBS"
-CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
-AC_RUN_IFELSE(
-	[AC_LANG_SOURCE([
-		#include <gvc.h>
-
-		int main(void) {
-			#ifdef WITH_CGRAPH
-				return 0;
-			#else
-				return -1;
-			#endif
-		}
-	])], [
-		AC_MSG_RESULT([yes])
-		VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
-		have_cgraph=yes
-	], [
-		AC_MSG_RESULT([no])
-		have_cgraph=no
-	]
-)
-LIBADD="$cgraph_tmp_LIBADD"
-CFLAGS="$cgraph_tmp_CFLAGS"
+AC_ARG_ENABLE(graphviz, AS_HELP_STRING([--disable-graphviz], [Disable graphviz usage for valadoc]), enable_graphviz=$enableval, enable_graphviz=yes)
+if test x$enable_graphviz = xyes; then
+	PKG_CHECK_MODULES(LIBGVC, libgvc >= $LIBGVC_REQUIRED)
+	AC_MSG_CHECKING([for CGRAPH])
+	VALAFLAGS="$VALAFLAGS -D HAVE_GRAPHVIZ"
+	cgraph_tmp_LIBADD="$LIBADD"
+	cgraph_tmp_CFLAGS="$CFLAGS"
+	LIBADD="$LIBADD $LIBGVC_LIBS"
+	CFLAGS="$CFLAGS $LIBGVC_CFLAGS"
+	AC_RUN_IFELSE(
+		[AC_LANG_SOURCE([
+			#include <gvc.h>
+			int main(void) {
+				#ifdef WITH_CGRAPH
+					return 0;
+				#else
+					return -1;
+				#endif
+			}
+		])], [
+			AC_MSG_RESULT([yes])
+			VALAFLAGS="$VALAFLAGS -D WITH_CGRAPH"
+			have_cgraph=yes
+		], [
+			AC_MSG_RESULT([no])
+			have_cgraph=no
+		]
+	)
+	LIBADD="$cgraph_tmp_LIBADD"
+	CFLAGS="$cgraph_tmp_CFLAGS"
+fi
+AM_CONDITIONAL(ENABLE_GRAPHVIZ, test x$enable_graphviz = xyes)
 AM_CONDITIONAL(HAVE_CGRAPH, test "$have_cgraph" = "yes")
 
 AC_PATH_PROG([XSLTPROC], [xsltproc], :)
--- ./libvaladoc/Makefile.am.orig	2018-12-20 08:00:31.000000000 -0600
+++ ./libvaladoc/Makefile.am	2018-12-20 12:33:26.911553405 -0600
@@ -128,10 +128,6 @@
 	content/tablerow.vala \
 	content/taglet.vala \
 	content/text.vala \
-	charts/chart.vala \
-	charts/chartfactory.vala \
-	charts/hierarchychart.vala \
-	charts/simplechartfactory.vala \
 	parser/manyrule.vala \
 	parser/oneofrule.vala \
 	parser/optionalrule.vala \
@@ -158,13 +154,24 @@
 	highlighter/codetoken.vala \
 	highlighter/highlighter.vala \
 	html/basicdoclet.vala \
-	html/htmlchartfactory.vala \
 	html/linkhelper.vala \
 	html/cssclassresolver.vala \
 	html/htmlmarkupwriter.vala \
 	html/htmlrenderer.vala \
 	$(NULL)
 
+if ENABLE_GRAPHVIZ
+libvaladoc_la_VALASOURCES += \
+	charts/chart.vala \
+	charts/chartfactory.vala \
+	charts/hierarchychart.vala \
+	charts/simplechartfactory.vala \
+	html/htmlchartfactory.vala \
+	$(NULL)
+
+LIBGVC_PKG = --vapidir $(top_srcdir)/vapi --pkg libgvc
+endif
+
 libvaladoc@PACKAGE_SUFFIX@_la_SOURCES = \
 	libvaladoc.vala.stamp \
 	$(libvaladoc_la_VALASOURCES:.vala=.c) \
@@ -184,11 +191,11 @@
 		--library valadoc \
 		--vapi valadoc@PACKAGE_SUFFIX@.vapi \
 		--vapidir $(top_srcdir)/vapi --pkg gmodule-2.0 \
-		--vapidir $(top_srcdir)/vapi --pkg libgvc \
 		--vapidir $(top_srcdir)/gee --pkg gee \
 		--vapidir $(top_srcdir)/vala --pkg vala \
 		--vapidir $(top_srcdir)/ccode --pkg ccode \
 		--vapidir $(top_srcdir)/codegen --pkg codegen \
+		$(LIBGVC_PKG) \
 		--pkg config \
 		$(filter %.vala %.c,$^)
 	touch $@
@@ -217,6 +224,9 @@
 
 valadoc@PACKAGE_SUFFIX@.pc: valadoc.pc
 	cp $< $@
+if !ENABLE_GRAPHVIZ
+	sed -i "s/libgvc //g" $@
+endif
 
 vapidir = $(datadir)/vala/vapi
 dist_vapi_DATA = valadoc@PACKAGE_SUFFIX@.vapi
@@ -224,6 +234,9 @@
 
 valadoc@PACKAGE_SUFFIX@.deps: valadoc.deps
 	cp $< $@
+if !ENABLE_GRAPHVIZ
+	sed -i "s/libgvc//g" $@
+endif
 
 EXTRA_DIST = \
 	$(libvaladoc_la_VALASOURCES) \
--- ./libvaladoc/html/basicdoclet.vala.orig	2018-12-20 08:00:31.000000000 -0600
+++ ./libvaladoc/html/basicdoclet.vala	2018-12-20 12:32:05.661552535 -0600
@@ -46,7 +46,11 @@
 	protected HtmlRenderer _renderer;
 	protected Html.MarkupWriter writer;
 	protected Html.CssClassResolver cssresolver;
+#if HAVE_GRAPHVIZ
 	protected Charts.Factory image_factory;
+#else
+	protected void* image_factory;
+#endif
 	protected ErrorReporter reporter;
 	protected string package_list_link = "../index.html";
 
@@ -120,7 +124,9 @@
 		this.linker = new LinkHelper ();
 
 		_renderer = new HtmlRenderer (settings, this.linker, this.cssresolver);
+#if HAVE_GRAPHVIZ
 		this.image_factory = new SimpleChartFactory (settings, linker);
+#endif
 	}
 
 
@@ -1026,6 +1032,7 @@
 	}
 
 	protected void write_image_block (Api.Node element) {
+#if HAVE_GRAPHVIZ
 		if (element is Class || element is Interface || element is Struct) {
 			unowned string format = (settings.use_svg_images ? "svg" : "png");
 			var chart = new Charts.Hierarchy (image_factory, element);
@@ -1045,6 +1052,7 @@
 									   this.get_img_path_html (element, format)});
 			writer.add_usemap (chart);
 		}
+#endif
 	}
 
 	public void write_namespace_content (Namespace node, Api.Node? parent) {
--- ./libvaladoc/html/htmlmarkupwriter.vala.orig	2018-12-20 08:54:58.000000000 -0600
+++ ./libvaladoc/html/htmlmarkupwriter.vala	2018-12-20 12:32:05.662552535 -0600
@@ -51,12 +51,16 @@
 		}
 	}
 
+#if HAVE_GRAPHVIZ
 	public unowned MarkupWriter add_usemap (Charts.Chart chart) {
 		string? buf = (string?) chart.write_buffer ("cmapx");
 		if (buf != null) {
 			raw_text ("\n");
 			raw_text ((!) buf);
 		}
+#else
+	public unowned MarkupWriter add_usemap (void* chart) {
+#endif
 
 		return this;
 	}