diff --git a/SOURCES/graphviz-2.30.1-ghostscript-build-fix.patch b/SOURCES/graphviz-2.30.1-ghostscript-build-fix.patch
new file mode 100644
index 0000000..89b7f8f
--- /dev/null
+++ b/SOURCES/graphviz-2.30.1-ghostscript-build-fix.patch
@@ -0,0 +1,19 @@
+diff --git a/plugin/gs/gvloadimage_gs.c b/plugin/gs/gvloadimage_gs.c
+index 4ed9b71..53be600 100644
+--- a/plugin/gs/gvloadimage_gs.c
++++ b/plugin/gs/gvloadimage_gs.c
+@@ -72,11 +72,11 @@ static void gs_error(GVJ_t * job, const char *name, const char *funstr, int err)
+ 
+     assert (err < 0);
+ 
+-    if (err >= e_VMerror) 
++    if (err >= gs_error_VMerror)
+ 	errsrc = "PostScript Level 1"; 
+-    else if (err >= e_unregistered)
++    else if (err >= gs_error_unregistered)
+ 	errsrc = "PostScript Level 2";
+-    else if (err >= e_invalidid)
++    else if (err >= gs_error_invalidid)
+ 	errsrc = "DPS error";
+     else
+ 	errsrc = "Ghostscript internal error";
diff --git a/SOURCES/graphviz-2.30.1-hard-syntax-errors.patch b/SOURCES/graphviz-2.30.1-hard-syntax-errors.patch
new file mode 100644
index 0000000..9ca8057
--- /dev/null
+++ b/SOURCES/graphviz-2.30.1-hard-syntax-errors.patch
@@ -0,0 +1,13 @@
+diff --git a/lib/cgraph/scan.l b/lib/cgraph/scan.l
+index 94e4c17..efed606 100644
+--- a/lib/cgraph/scan.l
++++ b/lib/cgraph/scan.l
+@@ -224,7 +224,7 @@ void yyerror(char *str)
+ 	agxbput (&xb, buf);
+ 	agxbput (&xb, yytext);
+ 	agxbput (&xb,"'\n");
+-	agerr(AGWARN,agxbuse(&xb));
++	agerr(AGERR,agxbuse(&xb));
+ 	agxbfree(&xb);
+ }
+ /* must be here to see flex's macro defns */
diff --git a/SPECS/graphviz.spec b/SPECS/graphviz.spec
index e211d4a..b7bd61d 100644
--- a/SPECS/graphviz.spec
+++ b/SPECS/graphviz.spec
@@ -48,7 +48,7 @@
 Name:			graphviz
 Summary:		Graph Visualization Tools
 Version:		2.30.1
-Release:		21%{?dist}
+Release:		22%{?dist}
 Group:			Applications/Multimedia
 License:		EPL
 URL:			http://www.graphviz.org/
@@ -83,10 +83,14 @@ Patch15:		graphviz-2.30.1-CVE-2014-1236.patch
 # Fix for ppc64le
 Patch16:		graphviz-2.30.1-ppc64le-fix.patch
 # Fix for OCaml 4.05
-Patch17:                graphviz-2.30.1-ocaml-int64-fix.patch
+Patch17:		graphviz-2.30.1-ocaml-int64-fix.patch
+# Backported from the upstream
+Patch18:		graphviz-2.30.1-hard-syntax-errors.patch
+# FTBFS fix due to ghostscript rebase which changed API
+Patch19:		graphviz-2.30.1-ghostscript-build-fix.patch
 BuildRoot:		%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:		zlib-devel, libpng-devel, libjpeg-devel, expat-devel, freetype-devel >= 2
-BuildRequires:		ksh, bison, m4, flex, tk-devel, tcl-devel >= 8.3, swig
+BuildRequires:		ksh, bison, m4, flex, tk-devel, tcl-devel >= 8.3, swig, ghostscript
 BuildRequires:		fontconfig-devel, libtool-ltdl-devel, ruby-devel, ruby, guile-devel, python-devel
 BuildRequires:		libXaw-devel, libSM-devel, libXext-devel, java-devel, php-devel
 BuildRequires:		cairo-devel >= 1.1.10, pango-devel, gmp-devel, lua-devel, gtk2-devel, libgnomeui-devel
@@ -297,6 +301,8 @@ Various tcl packages (extensions) for the graphviz tools.
 %patch15 -p1 -b .CVE-2014-1236
 %patch16 -p1 -b .ppc64le-fix
 %patch17 -p1 -b .ocaml-int64-fix
+%patch18 -p1 -b .hard-syntax-errors
+%patch19 -p1 -b .ghostscript-build-fix
 
 # Attempt to fix rpmlint warnings about executable sources
 find -type f -regex '.*\.\(c\|h\)$' -exec chmod a-x {} ';'
@@ -585,6 +591,11 @@ rm -rf %{buildroot}
 
 
 %changelog
+* Tue Mar  3 2020 Jaroslav Škarvada <jskarvad@redhat.com> - 2.30.1-22
+- Made syntax errors hard
+  Resolves: rhbz#1679097
+- Fixed FTBFS due to ghostscript rebase
+
 * Sat Sep 16 2017 Richard W.M. Jones <rjones@redhat.com> - 2.30.1-21
 - Rebuild for OCaml 4.05.0
   resolves: rhbz#1447982