diff --git a/_multibuild b/_multibuild
new file mode 100644
index 0000000..900c0e7
--- /dev/null
+++ b/_multibuild
@@ -0,0 +1,5 @@
+
+ nine
+ staging
+ staging-nine
+
diff --git a/_service b/_service
new file mode 100644
index 0000000..7ae6513
--- /dev/null
+++ b/_service
@@ -0,0 +1,21 @@
+
+
+ @PARENT_TAG@
+ v(.*)
+ https://github.com/wine-compholio/wine-staging.git
+ refs/tags/v2.20
+ v*.*
+ git
+
+
+ @PARENT_TAG@
+ wined3d9(.*)
+ https://github.com/sarnex/wine-d3d9-patches.git
+ refs/tags/wine-d3d9-2.20
+ git
+
+
+ *.tar
+ xz
+
+
diff --git a/wine-d3d9-patches-2.20.tar.xz b/wine-d3d9-patches-2.20.tar.xz
new file mode 100644
index 0000000..4794ab0
--- /dev/null
+++ b/wine-d3d9-patches-2.20.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:33e42128cce101d409b16c893d7e52a80f6797d860a29d90a259199e3ba6a6b0
+size 40848
diff --git a/wine-staging-2.20.tar.xz b/wine-staging-2.20.tar.xz
new file mode 100644
index 0000000..2a3c970
--- /dev/null
+++ b/wine-staging-2.20.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a20300e18be553de96a0f400ac1406420e04d190dc329437d130db9df9d5a70c
+size 7709416
diff --git a/wine.spec b/wine.spec
index a5c4ef8..933eb59 100644
--- a/wine.spec
+++ b/wine.spec
@@ -16,7 +16,25 @@
#
+%define projectname wine
+%global flavor @BUILD_FLAVOR@%nil
+%define staging 0
+%define nine 0
+
+%if "%flavor" == "staging" || "%flavor" == "staging-nine"
+%define staging 1
+%endif
+%if "%flavor" == "nine" || "%flavor" == "staging-nine"
+%define nine 1
+%endif
+
+%if "%{flavor}" == ""
Name: wine
+%else
+Name: wine-%{flavor}
+Provides: wine = %{version}
+%endif
+Conflicts: otherproviders(wine)
BuildRequires: Mesa-devel
BuildRequires: alsa-devel
BuildRequires: autoconf
@@ -68,9 +86,9 @@ Summary: An MS Windows Emulator
License: LGPL-2.1+
Group: System/Emulators/PC
Url: http://www.winehq.org/
-Source0: http://downloads.sourceforge.net/wine/wine-%{realver}.tar.xz
+Source0: http://downloads.sourceforge.net/wine/%{projectname}-%{realver}.tar.xz
Source41: wine.keyring
-Source42: http://downloads.sourceforge.net/wine/%{name}-%{realver}.tar.xz.sign
+Source42: http://downloads.sourceforge.net/wine/%{projectname}-%{realver}.tar.xz.sign
Source1: https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks
Source11: https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks.1
Source2: http://kegel.com/wine/wisotool
@@ -98,6 +116,22 @@ Recommends: cabextract
Recommends: unzip
BuildRoot: %{_tmppath}/%{name}-%{version}-build
ExclusiveArch: %{ix86} x86_64 ppc %arm
+%if %{staging}
+# upstream patch target version
+%define staging_version 2.20
+Source100: wine-staging-%{staging_version}.tar.xz
+BuildRequires: gtk3-devel
+BuildRequires: libOSMesa-devel
+BuildRequires: libva-devel
+%endif
+%if %{nine}
+# upstream patch target version
+%define nine_version 2.20
+BuildRequires: Mesa-libd3d-devel
+BuildRequires: dri2proto-devel
+BuildRequires: libOSMesa-devel
+Source110: wine-d3d9-patches-%{nine_version}.tar.xz
+%endif
%description
Wine is a compatibility layer capable of running Windows
@@ -122,6 +156,10 @@ running 'winecfg'.
%package devel
Summary: Files for Wine development
Group: Development/Libraries/C and C++
+%if "%{flavor}" != ""
+Provides: wine-devel = %{version}
+%endif
+Conflicts: otherproviders(wine-devel)
%description devel
This RPM contains the header files and development tools for the WINE
@@ -133,6 +171,21 @@ libraries.
#
cp %{S:3} .
#
+%if %{staging}
+# apply wine staging patch set on top of the wine release.
+tar xf %{SOURCE100}
+bash ./wine-staging-%staging_version/patches/patchinstall.sh --all
+%endif
+
+%if %{nine}
+tar xf %{SOURCE110}
+%if %{staging}
+patch --no-backup-if-mismatch -p1 -i ./wine-d3d9-patches-%nine_version/staging-helper.patch
+%else
+patch --no-backup-if-mismatch -p1 -i ./wine-d3d9-patches-%nine_version/d3d9-helper.patch
+%endif
+patch --no-backup-if-mismatch -p1 -i ./wine-d3d9-patches-%nine_version/wine-d3d9.patch
+%endif
%build
cat VERSION
@@ -142,6 +195,9 @@ export WIDL_TIME_OVERRIDE="0" # for reproducible builds.
export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fomit-frame-pointer//'`
%endif
+%if %{staging} || %{nine}
+autoreconf -i -f
+%endif
# keep just for susepatches with configure changes
#autoconf
#autoheader -I include
@@ -150,6 +206,9 @@ CFLAGS="$RPM_OPT_FLAGS" \
--with-x \
%ifarch x86_64
--enable-win64 \
+%endif
+%if %{nine}
+ --with-d3d9-nine \
%endif
--verbose
@@ -174,8 +233,16 @@ echo " recommends \"wine-mp3-32bit\"" >> %SOURCE7
%if 0%{?suse_version} >= 1310
echo " requires \"p11-kit-32bit\"" >> %SOURCE7
%endif
+%if "%{flavor}" != ""
+echo " provides \"wine- = \"" >> %SOURCE7
+%endif
+echo " conflicts \"otherproviders(wine-)\"" >> %SOURCE7
echo "%name-devel" >> %SOURCE7
echo " +^/usr/lib/wine/.*def" >> %SOURCE7
+%if "%{flavor}" != ""
+echo " provides \"wine-devel- = \"" >> %SOURCE7
+%endif
+echo " conflicts \"otherproviders(wine-devel-)\"" >> %SOURCE7
cat %SOURCE7
%endif
make %{?_smp_mflags} all
@@ -230,7 +297,7 @@ cd ubuntuwine
cd ..
# find the implicit dependencies
-%define winedir %_builddir/%name-%realver/
+%define winedir %_builddir/%projectname-%realver
cat >%winedir/my-find-requires.sh <