====== Information ======
* Wine 2.0 ((https://github.com/wine-mirror/wine/releases/tag/wine-2.0))
* Wine Staging 2.0 ((https://github.com/wine-staging/wine-staging/releases/tag/v2.0))
* laino/wine-patches ((https://github.com/laino/wine-patches)) ((https://github.com/laino/wine-patches/tree/cbadc28b353d235a29945e2502b0622b8116e2c5))
* https://copr.fedorainfracloud.org/coprs/espionage724/wine-patches-laino
====== Dependencies ======
****
sudo dnf install 'rpm-build'
====== Prepare Build Environment ======
===== Acquire SRPM =====
==== 2.0 F25 ====
* F25 is the latest version of Fedora this SRPM is available for; works fine on F27
wget -O ~/'Downloads/wine-2.0-1.fc25.src.rpm' 'https://kojipkgs.fedoraproject.org//packages/wine/2.0/1.fc25/src/wine-2.0-1.fc25.src.rpm'
===== Extract SRPM =====
****
rm -Rf ~/'rpmbuild' && rpm -ivh ~/'Downloads/wine'*'.src.rpm' && rm -fv ~/'Downloads/wine'*'.src.rpm' && sync
====== Download Patches ======
===== laino/wine-patches =====
* https://github.com/laino/wine-patches/tree/cbadc28b353d235a29945e2502b0622b8116e2c5
* Last commit at time of writing in laino/wine-patches is [[https://github.com/laino/wine-patches/commit/3ffdac0356ca3d64924e75851acc545efd259a05|3ffdac0]]
* Between that last commit and [[https://github.com/laino/wine-patches/commit/cbadc28b353d235a29945e2502b0622b8116e2c5|cbadc2]], the only patch file that changes is ''0007''
* Thus, anything beyond commit [[https://github.com/laino/wine-patches/commit/cbadc28b353d235a29945e2502b0622b8116e2c5|cbadc2]] is incompatible with Wine Staging 2.0
wget -O '/tmp/wine-patches-laino-cbadc2.zip' 'https://github.com/laino/wine-patches/archive/cbadc28b353d235a29945e2502b0622b8116e2c5.zip' && unzip '/tmp/wine-patches-laino-cbadc2' -d '/tmp' && mv '/tmp/wine-patches-cbadc28b353d235a29945e2502b0622b8116e2c5/'*'.patch' ~/'rpmbuild/SOURCES' && cd ~/'rpmbuild/SOURCES' && ls '00'*'.patch' && cd ~ && rm -Rfv '/tmp/wine-patches-laino-cbadc2.zip' '/tmp/wine-patches-cbadc28b353d235a29945e2502b0622b8116e2c5' && sync
====== Spec Config ======
****
gio open ~/'rpmbuild/SPECS/wine.spec'
===== wine-mono =====
* F27 has ''wine-mono'' 4.7.1
* Change ''4.6.4'' to ''4.7.1''
%global winemono 4.7.1
===== Release =====
* Default release format is ''1%{?dist}''
* Increase ''1'' for future package builds
* Add ''.laino'' to the end to make ''1%{?dist}.laino''
* If ''Version'' changes, start back at release ''1''
* Check https://copr.fedorainfracloud.org/coprs/espionage724/wine-patches-laino/packages/
Release: 1%{?dist}.laino
===== Add Patches =====
* Add under ''Patch511: wine-cjk.patch''
Patch600: 0001-ntdll-improve-heap-allocation-performance.patch
Patch601: 0002-ntdll-heap.c-align-everything-to-64-byte-to-reduce-f.patch
Patch602: 0003-wine-list.h-linked-list-cache-line-prefetching.patch
Patch603: 0004-ntdll-heap.c-freelist_balance-prefetch-next-entry-ca.patch
Patch604: 0005-oleaut32-typelib.c-fix-cursor2-having-the-wrong-type.patch
Patch605: 0006-Ensure-16-byte-alignment-of-data.patch
Patch606: 0007-wined3d-use-SwitchToThread-and-calls-to-select-in-bu.patch
===== Apply Patches =====
* Add in-between the ''make -C patches DESTDIR'' and ''# fix parallelized build'' lines
* The undo patch is for laino's patch ''0001-ntdll-improve-heap-allocation-performance'' ((they conflict))
# undo ntdll-Heap_FreeLists
patch -p1 -R < patches/ntdll-Heap_FreeLists/0001-ntdll-Improve-heap-allocation-performance-by-using-m.patch
# apply laino wine-patches
%patch600 -p1
%patch601 -p1
%patch602 -p1
%patch603 -p1
%patch604 -p1
%patch605 -p1
%patch606 -p1
===== GCC Flags =====
==== Ofast ====
* Find the following line under ''%build''
* Change ''O1'' to ''Ofast''
export TEMP_CFLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/-O2/-O1/'`"
export TEMP_CFLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/-O2/-Ofast/'`"
====== Build SRPM ======
* https://copr.fedorainfracloud.org/coprs/espionage724/wine-patches-laino/add_build_upload
rpmbuild -bs ~/'rpmbuild/SPECS/wine.spec' && sync
~/rpmbuild/SRPMS
====== Compile Locally ======
sudo dnf builddep ~/'Downloads/wine'*'.src.rpm' && sync
rpmbuild -ba ~/'rpmbuild/SPECS/wine.spec' && sync
====== Cleanup ======
sudo dnf remove 'rpm-build'
rm -Rf ~/'rpmbuild' ~/'Downloads/wine'*'.src.rpm'