--- a/wine.spec	2017-07-12 11:54:59.000000000 -0500
+++ b/wine.spec	2017-07-27 11:59:51.621620483 -0500
@@ -10,6 +10,7 @@
 # uncomment to enable; comment-out to disable.
 %if 0%{?fedora}
 %global compholio 1
+%global nine 1
 %endif # 0%{?fedora}
 
 # binfmt macros for RHEL
@@ -22,7 +23,7 @@
 
 Name:           wine
 Version:        2.12
-Release:        1%{?dist}
+Release:        2%{?nine:.with_nine}%{?dist}
 Summary:        A compatibility layer for windows applications
 
 Group:          Applications/Emulators
@@ -71,7 +72,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
@@ -148,6 +152,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
@@ -192,7 +200,7 @@
 Requires:       wine-pulseaudio(x86-64) = %{version}-%{release}
 %if 0%{?fedora} >= 10 || 0%{?rhel} >= 6
 Requires:       wine-openal(x86-64) = %{version}-%{release}
-%endif 
+%endif
 %if 0%{?fedora}
 Requires:       wine-opencl(x86-64) = %{version}-%{release}
 %endif
@@ -274,6 +282,9 @@
 %if 0%{?compholio}
 Requires:       libva(x86-32)
 %endif
+%if 0%{?nine}
+Requires:       mesa-libd3d(x86-32)
+%endif
 %endif
 
 %ifarch x86_64
@@ -296,6 +307,9 @@
 %if 0%{?compholio}
 Requires:       libva(x86-64)
 %endif
+%if 0%{?nine}
+Requires:       mesa-libd3d(x86-64)
+%endif
 %endif
 
 %ifarch %{arm} aarch64
@@ -678,6 +692,18 @@
 
 %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
+%endif # 0%{?nine}
+
+sed 's|OpenAL/al.h|AL/al.h|g' -i configure*
+sed 's|OpenCL/opencl.h|CL/opencl.h|g' -i configure*
+
 %build
 
 # disable fortify as it breaks wine
@@ -700,6 +726,7 @@
  --enable-win64 \
 %endif
 %{?compholio: --with-xattr} \
+%{?nine: --with-d3dadapter} \
  --disable-tests
 
 make %{?_smp_mflags} TARGETFLAGS=""
@@ -1382,6 +1409,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
@@ -2146,51 +2176,93 @@
 %endif
 
 %changelog
+* Thu Jul 27 2017 Dylan Smith <dyskette@gmail.com> - 2.12-2.with_nine
+- Apply patches
+
 * Wed Jul 12 2017 Michael Cronenworth <mike@cchtml.com> 2.12-1
 - version update
 
+* Fri Jul 07 2017 Dylan Smith <dyskette@gmail.com> - 2.11-2.with_nine
+- Apply patches
+
 * Tue Jun 27 2017 Michael Cronenworth <mike@cchtml.com> 2.11-1
 - version update
 
+* Mon Jun 26 2017 Dylan Smith <dyskette@gmail.com> - 2.10-2.with_nine
+- Apply patches
+
 * Tue Jun 13 2017 Michael Cronenworth <mike@cchtml.com> 2.10-1
 - version update
 
+* Fri Jun 09 2017 Dylan Smith <dyskette@gmail.com> - 2.9-2.with_nine
+- Apply patches
+
 * Mon May 29 2017 Michael Cronenworth <mike@cchtml.com> 2.9-1
 - version update
 
+* Fri May 26 2017 Dylan Smith <dyskette@gmail.com> - 2.8-2.with_nine
+- Apply patches
+
 * Tue May 16 2017 Michael Cronenworth <mike@cchtml.com> 2.8-1
 - version update
 
+* Wed May 03 2017 Dylan Smith <dyskette@gmail.com> - 2.7-2.with_nine
+- Apply patches
+
 * Tue May 02 2017 Michael Cronenworth <mike@cchtml.com> 2.7-1
 - version update
 
+* Mon Apr 24 2017 Dylan Smith <dyskette@gmail.com> - 2.6-2.with_nine
+- Apply patches
+
 * Wed Apr 19 2017 Michael Cronenworth <mike@cchtml.com> 2.6-1
 - version update
 
+* Thu Apr 13 2017 Dylan Smith <dyskette@gmail.com> - 2.5-2.with_nine
+- Apply patches
+
 * Mon Apr 10 2017 Michael Cronenworth <mike@cchtml.com> 2.5-1
 - version update
 
+* Fri Mar 24 2017 Dylan Smith <dyskette@gmail.com> - 2.4-3.with_nine
+- Apply patches
+
 * Thu Mar 23 2017 Michael Cronenworth <mike@cchtml.com> 2.4-2
 - update wine-mono requirement
 
 * Thu Mar 23 2017 Michael Cronenworth <mike@cchtml.com> 2.4-1
 - version update
 
+* Sat Mar 11 2017 Dylan Smith <dyskette@gmail.com> - 2.3-2.with_nine
+- Apply patches
+
 * Mon Mar 06 2017 Michael Cronenworth <mike@cchtml.com> 2.3-1
 - version update
 
+* Tue Feb 28 2017 Dylan Smith <dyskette@gmail.com> - 2.2-2.with_nine
+- Apply patches
+
 * Mon Feb 20 2017 Michael Cronenworth <mike@cchtml.com> 2.2-1
 - version update
 
+* Fri Feb 17 2017 Dylan Smith <dyskette@gmail.com> - 2.1-2.with_nine
+- Apply patches
+
 * Thu Feb 09 2017 Michael Cronenworth <mike@cchtml.com> 2.1-1
 - version update
 
+* Sat Feb 04 2017 Dylan Smith <dyskette@gmail.com> - 2.0-2.with_nine
+- Apply patches
+
 * Wed Jan 25 2017 Michael Cronenworth <mike@cchtml.com> 2.0-1
 - version update
 
 * Mon Jan 23 2017 Michael Cronenworth <mike@cchtml.com> 2.0-0.1.rc6
 - version update
 
+* Mon Jan 23 2017 Dylan Smith <dyskette@gmail.com> - 2.0-0.2.rc5.with_nine
+- Apply patches
+
 * Mon Jan 16 2017 Michael Cronenworth <mike@cchtml.com> 2.0-0.1.rc5
 - version update
 
@@ -2203,9 +2275,15 @@
 * Wed Dec 21 2016 Michael Cronenworth <mike@cchtml.com> 2.0-0.1.rc2
 - version update
 
+* Sat Dec 17 2016 Dylan Smith <dyskette@gmail.com> - 2.0-0.2.rc1.with_nine
+- Apply patches to 2.0-rc1
+
 * Thu Dec 15 2016 Michael Cronenworth <mike@cchtml.com> 2.0-0.1.rc1
 - version update
 
+* Wed Nov 23 2016 Dylan Smith <dyskette@gmail.com> - 1.9.23-3.with_nine
+- Apply patches to 1.9.23
+
 * Wed Nov 23 2016 Michael Cronenworth <mike@cchtml.com> 1.9.23-2
 - drop sysvinit on Fedora, again
 
@@ -2215,33 +2293,58 @@
 - add hard cups-libs dependency (rhbz#1367537)
 - include mp3 support (rhbz#1395711)
 
+* Thu Nov 03 2016 Dylan Smith <dyskette@gmail.com>
+- Apply patches to 1.9.22
+
 * Thu Nov 03 2016 Michael Cronenworth <mike@cchtml.com> 1.9.22-1
 - version update
 
+* Mon Oct 17 2016 Dylan Smith <dyskette@gmail.com> - 1.9.21-2.with_nine
+- Apply patches to 1.9.21
+
 * Mon Oct 17 2016 Michael Cronenworth <mike@cchtml.com> 1.9.21-1
 - version update
 
+* 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
 
@@ -2251,30 +2354,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
 
@@ -2290,6 +2414,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
@@ -2310,15 +2437,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
 
