File wine-pure.spec of Package wine-pure

# wine-pure.spec for openSUSE Build Service

# Define version and release
%define wine_version 10.13
%define wine_release 1

# Package information
Name:           wine-pure
Version:        %{wine_version}
Release:        %{wine_release}
Summary:        Bleeding-edge Wine build (Staging, WoW64, NTSync, Wayland)
License:        LGPL-2.1-or-later
Group:          Emulators/PC
URL:            https://github.com/ventureoo/PKGBUILDs
Source0:        wine-%{version}.tar.xz
Source1:        wine-staging-%{version}.tar.xz
Source2:        30-win32-aliases.conf
Source3:        wine-binfmt.conf

# Patches
Patch0:         patches/ntsync-10.13-staging.patch
Patch1:         patches/0001-HACK-wine.inf-Add-native-builtin-overrides-for-msvcr.patch
Patch2:         patches/0001-HACK-ws2_32-Block-first-internet-connection-for-some.patch
Patch3:         patches/0002-wine.inf-Set-a-valid-Win10-ProductId.patch
Patch4:         patches/0003-wineboot-On-prefix-upgrade-update-win10-build-number.patch
Patch5:         patches/0004-wineboot-Generate-better-DigitalProductId.patch
Patch6:         patches/0005-wineboot-Load-root-certificates-on-prefix-update.patch
Patch7:         patches/kernelbase-Fix-uninitialized-structs-in-OpenThread.patch
Patch8:         patches/winecfg-Add-tweaks-tab-page.patch
Patch9:         patches/ntdll-loader-add-support-for-overriding-IMAGE_FILE_L.patch
Patch10:        patches/Add-workarounds-for-game-launchers.patch
Patch11:        patches/Do-not-handle-IMAGE_FILE_LARGE_ADDRESS_AWARE-on-WoW64.patch
Patch12:        patches/winex11.drv-Recognize-the-keyboard-in-a-locale-indep.patch

BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  alsa-devel
BuildRequires:  gnutls-devel
BuildRequires:  gstreamer-plugins-base-devel
BuildRequires:  libpulse-devel
BuildRequires:  libXcomposite-devel
BuildRequires:  Mesa-devel
BuildRequires:  opencl-headers
BuildRequires:  ocl-icd-devel
BuildRequires:  SDL2-devel
BuildRequires:  vulkan-devel
BuildRequires:  mingw32-gcc
BuildRequires:  mingw64-gcc
BuildRequires:  kernel-devel
BuildRequires:  pkgconf-pkg-config
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool

Requires:       desktop-file-utils
Requires:       fontconfig
Requires:       freetype2
Requires:       gcc-libs
Requires:       gettext
Requires:       libXcursor1
Requires:       libxkbcommon
Requires:       libXi6
Requires:       libXrandr2
Requires:       wayland
Requires:       ffmpeg
Requires:       unixODBC

Recommends:     alsa
Recommends:     alsa-plugins
Recommends:     gnutls
Recommends:     gstreamer-plugins-bad
Recommends:     gstreamer-plugins-base
Recommends:     gstreamer-plugins-good
Recommends:     gstreamer-plugins-ugly
Recommends:     libpulse0
Recommends:     libXcomposite1
Recommends:     ocl-icd
Recommends:     SDL2
Recommends:     wine-gecko
Recommends:     wine-mono

Provides:       wine-staging = %{version}-%{release}
Provides:       wine = %{version}-%{release}
Provides:       wine-wow64 = %{version}-%{release}

Conflicts:      wine

%description
Bleeding-edge Wine build (Staging, WoW64, NTSync, Wayland)

%prep
%setup -q -n wine-%{version} -a 1

# 手动应用所有补丁,使用正确的语法和路径
%patch -P 0 -p1
%patch -P 1 -p1
%patch -P 2 -p1
%patch -P 3 -p1
%patch -P 4 -p1
%patch -P 5 -p1
%patch -P 6 -p1
%patch -P 7 -p1
%patch -P 8 -p1
%patch -P 9 -p1
%patch -P 10 -p1
%patch -P 11 -p1
%patch -P 12 -p1

# Apply wine-staging patches
cd ../wine-staging-%{version}
../wine-%{version}/patches/patchinstall.py --backend=git-apply --all -W server-Signal_Thread
cd ../wine-%{version}

# Generate necessary files
./dlls/winevulkan/make_vulkan
./tools/make_requests
./tools/make_specfiles
autoreconf -f

%build
# Set build flags for cross-compilation (from Proton)
export CFLAGS="-O2 -march=x86-64-v3 -mtune=haswell -mfpmath=sse -fwrapv -pipe"
export CROSSCFLAGS="$CFLAGS"
export CROSSCXXFLAGS="$CROSSCFLAGS"
export CROSSLDFLAGS="-Wl,-O1"
export LDFLAGS="-Wl,-O1,--sort-common,--as-needed"

%configure \
  --disable-tests \
  --disable-win16 \
  --prefix=%{_prefix} \
  --libdir=%{_libdir} \
  --with-x \
  --with-wayland \
  --with-gstreamer \
  --with-ffmpeg \
  --without-oss \
  --without-sane \
  --without-v4l2 \
  --without-cups \
  --without-gphoto \
  --without-xinerama \
  --without-pcsclite \
  --without-xxf86vm \
  --without-pcap \
  --enable-archs=x86_64,i386

make %{?_smp_mflags}

%install
%make_install prefix=%{buildroot}%{_prefix} libdir=%{buildroot}%{_libdir} dlldir=%{buildroot}%{_libdir}/wine

# Create symlink for compatibility
ln -sf %{_bindir}/wine %{buildroot}%{_bindir}/wine64

# Strip Windows binaries
i686-w64-mingw32-strip --strip-debug %{buildroot}%{_libdir}/wine/i386-windows/*.dll
x86_64-w64-mingw32-strip --strip-debug %{buildroot}%{_libdir}/wine/x86_64-windows/*.dll

# Install font aliasing settings
install -d %{buildroot}%{_datadir}/fontconfig/conf.{avail,default}
install -m644 %{SOURCE2} %{buildroot}%{_datadir}/fontconfig/conf.avail/
ln -s ../conf.avail/30-win32-aliases.conf %{buildroot}%{_datadir}/fontconfig/conf.default/30-win32-aliases.conf

# Install binfmt configuration
install -Dm 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/binfmt.d/wine.conf

# NTSync additions
echo "ntsync" | install -Dm644 /dev/stdin %{buildroot}%{_sysconfdir}/modules-load.d/wine-pure.conf

%files
%doc README
%{_bindir}/wine*
%{_libdir}/wine/
%{_datadir}/fontconfig/conf.avail/30-win32-aliases.conf
%{_datadir}/fontconfig/conf.default/30-win32-aliases.conf
%{_sysconfdir}/binfmt.d/wine.conf
%{_sysconfdir}/modules-load.d/wine-pure.conf

%changelog
* Sun Aug 24 2025 - light233 <light233@example.com>
- Initial package for openSUSE Build Service
openSUSE Build Service is sponsored by