--- a/wine.spec	2016-10-03 09:36:22.000000000 -0500
+++ b/wine.spec	2016-10-03 11:26:20.824293406 -0500
@@ -14,6 +14,7 @@
 # uncomment to enable; comment-out to disable.
 %if 0%{?fedora}
 %global compholio 1
+%global nine 1
 %endif # 0%{?fedora}
 
 # binfmt macros for RHEL
@@ -26,7 +27,7 @@
 
 Name:           wine
 Version:        1.9.20
-Release:        1%{?dist}
+Release:        2%{?nine:.with_nine}%{?dist}
 Summary:        A compatibility layer for windows applications
 
 Group:          Applications/Emulators
@@ -75,7 +76,10 @@
 
 # wine compholio patches for wine-staging
 # pulseaudio-patch is covered by that patch-set, too.
-Source900: https://github.com/compholio/wine-compholio/archive/v%{version}.tar.gz#/wine-staging-%{version}.tar.gz
+Source900:      https://github.com/compholio/wine-compholio/archive/v%{version}.tar.gz#/wine-staging-%{version}.tar.gz
+
+# gallium nine patch
+Source999:      https://github.com/sarnex/%{name}-d3d9-patches/archive/%{name}-d3d9-%{version}.tar.gz
 
 %if !%{?no64bit}
 ExclusiveArch:  %{ix86} x86_64 %{arm} aarch64
@@ -151,6 +155,10 @@
 BuildRequires:  libva-devel
 %endif # 0%{?compholio}
 
+%if 0%{?nine}
+BuildRequires:  mesa-libd3d-devel
+%endif
+
 %if 0%{?fedora} >= 10 || 0%{?rhel} >= 6
 BuildRequires:  openal-soft-devel
 BuildRequires:  icoutils
@@ -275,6 +283,9 @@
 %if 0%{?compholio}
 Requires:       libva(x86-32)
 %endif
+%if 0%{?nine}
+Requires:       mesa-libd3d(x86-32)
+%endif
 %endif
 
 %ifarch x86_64
@@ -295,6 +306,9 @@
 %if 0%{?compholio}
 Requires:       libva(x86-64)
 %endif
+%if 0%{?nine}
+Requires:       mesa-libd3d(x86-64)
+%endif
 %endif
 
 %ifarch %{arm} aarch64
@@ -694,6 +708,17 @@
 
 %endif # 0%{?compholio}
 
+%if 0%{?nine}
+gzip -dc %{SOURCE999} | tar -xf - --strip-components=1
+
+patch -p1 < staging-helper.patch
+patch -p1 < wine-d3d9.patch
+
+autoreconf -f
+
+sed 's|OpenCL/opencl.h|CL/opencl.h|g' -i configure*
+%endif # 0%{?nine}
+
 %build
 
 # disable fortify as it breaks wine
@@ -710,6 +735,7 @@
  --enable-win64 \
 %endif
 %{?compholio: --with-xattr} \
+%{?nine: --with-d3dadapter} \
  --disable-tests
 
 make %{?_smp_mflags} TARGETFLAGS=""
@@ -1381,6 +1407,9 @@
 %{_libdir}/wine/ctapi32.dll.so
 %{_libdir}/wine/ctl3d32.dll.so
 %{_libdir}/wine/d2d1.dll.so
+%if 0%{?nine}
+%{_libdir}/wine/d3d9-nine.dll.so
+%endif
 %{_libdir}/wine/d3d10.dll.so
 %{_libdir}/wine/d3d10_1.dll.so
 %{_libdir}/wine/d3d10core.dll.so
@@ -2106,27 +2135,46 @@
 %endif
 
 %changelog
+* Mon Oct 03 2016 Dylan Smith <dyskette@gmail.com> - 1.9.20-2.with_nine
+- Apply patches to 1.9.20
+
 * Sun Oct 02 2016 Michael Cronenworth <mike@cchtml.com> 1.9.20-1
 - version update
 
+* Sun Oct 02 2016 Dylan Smith <dyskette@gmail.com> - 1.9.19-2.with_nine
+- Apply patches to 1.9.19
+
 * Mon Sep 19 2016 Michael Cronenworth <mike@cchtml.com> 1.9.19-1
 - version update
 
 * Thu Sep 15 2016 Peter Robinson <pbrobinson@fedoraproject.org> 1.9.18-2
 - fix aarch64 definition
 
+* Tue Sep 13 2016 Dylan Smith <dyskette@gmail.com> - 1.9.18-2.with_nine
+- rebuilt
+
 * Wed Sep 07 2016 Michael Cronenworth <mike@cchtml.com> 1.9.18-1
 - version update
 
+* Mon Aug 29 2016 Dylan Smith <dyskette@gmail.com> - 1.9.17-2.with_nine
+- Apply patches to 1.9.17
+
 * Sun Aug 28 2016 Michael Cronenworth <mike@cchtml.com> 1.9.17-1
 - version update
 
 * Sat Aug 20 2016 Peter Robinson <pbrobinson@fedoraproject.org> 1.9.16-2
 - build on aarch64
 
+* Mon Aug 15 2016 Dylan Smith <dyskette@gmail.com> - 1.9.16-2.with_nine
+- Apply patches to 1.9.16
+
 * Tue Aug 09 2016 Michael Cronenworth <mike@cchtml.com> 1.9.16-1
 - version update
 
+* Thu Aug 04 2016 Dylan Smith <dyskette@gmail.com> - 1.9.15-2.with_nine
+- Apply patches to 1.9.15
+- Use https://github.com/sarnex/wine-d3d9-patches
+
 * Fri Jul 29 2016 Michael Cronenworth <mike@cchtml.com> 1.9.15-1
 - version update
 
@@ -2136,30 +2184,51 @@
 * Fri Jul 01 2016 Michael Cronenworth <mike@cchtml.com> 1.9.13-1
 - version update
 
+* Thu Jun 23 2016 Dylan Smith <dyskette@gmail.com> - 1.9.12-2.with_nine
+- Apply patches to 1.9.12
+
 * Wed Jun 15 2016 Michael Cronenworth <mike@cchtml.com> 1.9.12-1
 - version update
 
 * Tue Jun 07 2016 Michael Cronenworth <mike@cchtml.com> 1.9.11-1
 - version update
 
+* Fri May 27 2016 Dylan Smith <dyskette@gmail.com> - 1.9.10-4.with_nine
+- Apply patches to 1.9.10
+
 * Tue May 24 2016 Michael Cronenworth <mike@cchtml.com> 1.9.10-2
 - gecko update
 
 * Tue May 17 2016 Michael Cronenworth <mike@cchtml.com> 1.9.10-1
 - version upgrade
 
+* Tue May 03 2016 Dylan Smith <dyskette@gmail.com> - 1.9.9-2.with_nine
+- Apply patches to 1.9.9
+
 * Sun May 01 2016 Michael Cronenworth <mike@cchtml.com> 1.9.9-1
 - version upgrade
 
+* Tue Apr 19 2016 Dylan Smith <dyskette@gmail.com> - 1.9.8-2.with_nine
+- Apply patches to 1.9.8
+
 * Sun Apr 17 2016 Michael Cronenworth <mike@cchtml.com> 1.9.8-1
 - version upgrade
 
+* Sun Apr 17 2016 Dylan Smith <dyskette@gmail.com> - 1.9.7-2.with_nine
+- Apply patches to 1.9.7
+
 * Sun Apr 03 2016 Michael Cronenworth <mike@cchtml.com> 1.9.7-1
 - version upgrade
 
+* Sat Mar 26 2016 Dylan Smith <dyskette@gmail.com> - 1.9.6-2.with_nine
+- Apply patches to 1.9.6
+
 * Mon Mar 21 2016 Michael Cronenworth <mike@cchtml.com> 1.9.6-1
 - version upgrade
 
+* Wed Mar 16 2016 Dylan Smith <dyskette@gmail.com> - 1.9.5-3.with_nine
+- Apply patches to 1.9.5
+
 * Tue Mar 08 2016 Michael Cronenworth <mike@cchtml.com> 1.9.5-2
 - update mono requirement
 
@@ -2175,6 +2244,9 @@
 * Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.2-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
 
+* Sun Jan 31 2016 Dylan Smith <dyskette@gmail.com> - 1.9.2-2.with_nine
+- Use patches from AUR : wine-gaming-nine
+
 * Sun Jan 24 2016 Michael Cronenworth <mike@cchtml.com> 1.9.2-1
 - version upgrade
 - enable gstreamer support
@@ -2195,15 +2267,30 @@
 * Sun Dec 06 2015 Michael Cronenworth <mike@cchtml.com> 1.8-0.1
 - version upgrade, 1.8-rc3
 
+* Wed Nov 18 2015 Dylan Smith - 1.7.55-2.with_nine
+- Upgrade gallium nine patch
+
 * Sun Nov 15 2015 Michael Cronenworth <mike@cchtml.com> 1.7.55-1
 - version upgrade
 
 * Wed Nov 04 2015 Michael Cronenworth <mike@cchtml.com> 1.7.54-1
 - version upgrade
 
+* Tue Oct 27 2015 Dylan Smith - 1.7.53-2.with_nine
+- Upgrade gallium nine patch
+
 * Wed Oct 21 2015 Michael Cronenworth <mike@cchtml.com> 1.7.53-1
 - version upgrade
 
+* Wed Oct 14 2015 Dylan Smith - 1.7.52-4.with_nine
+- Fix dependency on mesa-libd3d
+
+* Wed Oct 14 2015 Dylan Smith - 1.7.52-3.with_nine
+- Add autoreconf
+
+* Mon Oct 12 2015 Dylan Smith <dyskette@gmail.com> - 1.7.52-2.with_nine
+- Add gallium nine patch
+
 * Sat Oct 03 2015 Michael Cronenworth <mike@cchtml.com> 1.7.52-1
 - version upgrade
 
