diff --git a/jlatexmath-1.0.3-nosource.patch b/jlatexmath-1.0.3-nosource.patch
new file mode 100644
index 0000000..dbbd64f
--- /dev/null
+++ b/jlatexmath-1.0.3-nosource.patch
@@ -0,0 +1,19 @@
+--- jlatexmath-1.0.3/plugin/fop/build.xml 2014-02-09 18:30:10.000000000 +0100
++++ jlatexmath-1.0.3/plugin/fop/build.xml 2017-09-19 10:27:38.975496694 +0200
+@@ -62,14 +62,14 @@
+
+
+
+-
++
+
+
+
+
+
+
+-
++
+
+
+
diff --git a/jlatexmath.changes b/jlatexmath.changes
index 4dfe8a8..373b6b2 100644
--- a/jlatexmath.changes
+++ b/jlatexmath.changes
@@ -1,3 +1,12 @@
+-------------------------------------------------------------------
+Tue Sep 19 08:31:24 UTC 2017 - fstrba@suse.com
+
+- Fix build with jdk9: specify java source and target level 1.6
+- Added patch:
+ * jlatexmath-1.0.3-nosource.patch
+ + Don't hardcode java source and target level; we specify them
+ on command-line
+
-------------------------------------------------------------------
Fri Jun 27 14:26:28 UTC 2014 - tchvatal@suse.com
diff --git a/jlatexmath.spec b/jlatexmath.spec
index 5f581b9..2228915 100644
--- a/jlatexmath.spec
+++ b/jlatexmath.spec
@@ -1,7 +1,7 @@
#
# spec file for package jlatexmath
#
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -20,19 +20,21 @@ Name: jlatexmath
Version: 1.0.3
Release: 0
Summary: Java API to display mathematical formulas written in LaTeX
+# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
License: GPL-2.0+
Group: Development/Libraries
Url: http://forge.scilab.org/index.php/p/jlatexmath/
Source0: http://forge.scilab.org/index.php/p/jlatexmath/downloads/get/%{name}-src-all-%{version}.zip
Source1: patched_fop.properties
+Patch0: jlatexmath-1.0.3-nosource.patch
BuildRequires: ant
+BuildRequires: fdupes
BuildRequires: java-devel
BuildRequires: javapackages-tools
BuildRequires: unzip
BuildRequires: xmlgraphics-fop
Requires: java
Requires: javapackages-tools
-BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
@@ -43,6 +45,7 @@ JLaTeXMath is a fork of the excellent project JMathTeX.
%package fop
Summary: FOP plug-in for %{name}
+# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: javapackages-tools
@@ -53,6 +56,7 @@ This package contains the FOP plug-in for %{name}.
%package javadoc
Summary: API Documentation for %{name}
+# FIXME: use correct group, see "https://en.opensuse.org/openSUSE:Package_group_guidelines"
Group: Documentation
Requires: %{name} = %{version}-%{release}
@@ -61,6 +65,7 @@ This package contains the API documentation for %{name}.
%prep
%setup -q
+%patch0 -p1
rm fop.properties
cp -a %{SOURCE1} fop.properties
@@ -72,9 +77,7 @@ find -name '*.jar' -exec rm -f '{}' \;
sed -i '/class-path/I d' plugin/fop/MANIFEST.MF
%build
-ant buildJar
-ant fop
-ant doc
+ant -Djava_version=1.6 buildJar fop doc
%install
@@ -84,22 +87,20 @@ cp -p dist/%{name}-fop-%{version}.jar %{buildroot}%{_javadir}/%{name}-fop.jar
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -rp doc/ %{buildroot}%{_javadocdir}/%{name}
+%fdupes -s %{buildroot}%{_javadocdir}/%{name}
%files
-%defattr(-,root,root)
%{_javadir}/%{name}.jar
%doc README
%doc COPYING
%doc LICENSE
%files fop
-%defattr(-,root,root)
%{_javadir}/%{name}-fop.jar
%doc plugin/fop/COPYING
%doc plugin/fop/LICENSE
%files javadoc
-%defattr(-,root,root)
%{_javadocdir}/%{name}
%changelog