File wine.spec of Package wine

# spec file for package wine
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

# The 32bit package (wine-32bit) can be obtained using the following command:
#   osc build --baselibs --disable-debuginfo <openSUSE version> i586 wine.spec
# If the package is to be installed with a different prefix, change it here
# using %%define _prefix /usr/lib/wine-<suffix>
%define changedprefix %(test %_prefix != /usr && echo "1" || echo "0")

%if 0%{?changedprefix}
%define _bindir %_prefix/bin
%ifarch  x86_64
%define _libdir %_prefix/lib64
%define _libdir %_prefix/lib
%define _mandir %_prefix/man
%define _includedir %_prefix/include
%define _defaultdocdir %_prefix/share/doc

%if 0%{?suse_version} == 1320
%define vulkan 0
%define vulkan 1

# The variable prjname points to the wine project name, and should therefor
# probably stay the same forever.
# The package name, that is defined by the rpm tag Name, may be changed
# which will result in a different package name.  In combination with a
# different file path location (_prefix), it could be installed along side
# the wine package that is provided by openSUSE (the distribution).
%define prjname wine

Name:           wine

# Is this a native (openSUSE distribution) package?
# modpkgname: Modified Package Name
%define modpkgname %(test %name != "wine" && echo "1" || echo "0")

BuildRequires:  Mesa-devel
BuildRequires:  alsa-devel
BuildRequires:  autoconf
BuildRequires:  bison
BuildRequires:  libva-devel
BuildRequires:  libpulse-devel
BuildRequires:  libattr-devel
BuildRequires:  libpcap-devel
BuildRequires:  Mesa-libd3d-devel
BuildRequires:  libtxc_dxtn-devel
BuildRequires:  libtxc_dxtn
BuildRequires:  capi4linux-devel
BuildRequires:  cups-devel
BuildRequires:  dbus-1-devel
BuildRequires:  desktop-file-utils
BuildRequires:  flex
BuildRequires:  fontconfig-devel
BuildRequires:  freeglut-devel
BuildRequires:  freetype2-devel
BuildRequires:  giflib-devel
%if 0%{?suse_version} >= 1310
#BuildRequires:  libOSMesa-devel
BuildRequires:  pkgconfig(egl) ocl-icd-devel opencl-headers
%if 0%{?suse_version} >= 1110
BuildRequires:  libgnutls-devel
BuildRequires:  libgphoto2-devel

%if 0%{?suse_version} >= 1210
BuildRequires:  libgsm-devel

BuildRequires:  libjpeg-devel
%if 0%{?suse_version} >= 1230
BuildRequires:  liblcms2-devel
BuildRequires:  libpcap-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  libunwind-devel
BuildRequires:  libudev-devel 
BuildRequires:  ncurses-devel
BuildRequires:  libunwind-devel
BuildRequires:  openldap2-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  openal-soft-devel
BuildRequires:  libattr-devel
BuildRequires:  gtk3-devel
BuildRequires:  dri2proto-devel
BuildRequires:  update-desktop-files
BuildRequires:  valgrind-devel
BuildRequires:  xorg-x11-devel
BuildRequires:  gstreamer-plugins-base-devel
%if %vulkan
BuildRequires:  vulkan-devel
#%if 0%{?suse_version} <= 1320
#BuildRequires:  gcc48

%define realver 3.3
Version:   3.3_gallium_nine+staging
Release:        0
Summary:        An MS Windows Emulator
License:        LGPL-2.1+
Group:          System/Emulators/PC
Source0:        wine.tar.bz2
Source41:       wine.keyring
Patch0:         susepatches.patch
Source1:        winetricks
Source11:       winetricks.1
Source3:        README.SUSE
Source4:        wine.desktop
Source5:        ubuntuwine.tar.bz2
Source6:        wine-msi.desktop

Source7:        baselibs.conf

%if %{modpkgname}
  %if %{changedprefix}
    %define pkgconflict 0
    %define pkgconflict 1
Conflicts:      wine
  %define pkgconflict 0

%if 0%{?suse_version} > 1120
%ifarch x86_64
Requires:       %{name}-32bit = %{version}
%ifarch %ix86 x86_64
Requires:       wine-gecko >= 2.24
# for ntlm_auth helper
Requires:       samba-winbind
# wine-mp3 is built at Packman, not in OBS
Recommends:     wine-mp3
# We built it here, but it is kind of large
Recommends:     wine-mono
# for DOS support
Recommends:     dosbox 
Recommends:     gtk3
# To have correct Pulseaudio support.
Recommends:     alsa-plugins
Recommends:     alsa-plugins-pulse
# for winetricks:
Requires:       cabextract
Requires:       unzip
Provides:       wine-staging
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

An MS Windows emulator, consisting of both runtime and also source
compatibility functions. You can run your MS executables with it, and
you can write your Windows programs under Linux and link against the
WINE libraries.

It is not necessary to have a Windows installation to run WINE.

Please have a look at /usr/share/doc/packages/wine/README.SUSE. There
is more documentation available in that directory. Read 'man wine' for
further information.

You can invoke wine by entering: 'wine program.exe' wine can be
configured by running 'winecfg'.

%package devel
Summary:        files for wine development
Group:          System/Emulators/PC
Requires:       %{name} = %{version}
%ifarch x86_64
Requires:       %{name}-32bit = %{version}
#%if 0%{?suse_version} <= 1320
#Requires:  gcc48

%description devel
This RPM contains the header files and development tools for the WINE

%setup -q -n wine-%{realver}
%patch0 -p1
#sed -i 's/lib32/%{_lib}/g' ./dlls/winex11.drv/d3dadapter.c
cp %{SOURCE3} .
# prevent wine from shitting on file association
sed -i -e '/winemenubuilder.exe/s:-a -r:-r:g' loader/

%ifarch %ix86
# e.g. Steam and other copy protections hate removed %ebp.
export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fomit-frame-pointer//'`
export RPM_OPT_FLAGS=`echo $RPM_OPT_FLAGS|sed -e 's/-fomit-frame-pointer//'`
# Until gcc 5 is fixed
#%if 0%{?suse_version} <= 1320
#export CC="gcc-4.8"

# keep just for susepatches with configure changes
autoreconf -fi
%ifarch x86_64
sed 's|OpenCL/opencl.h|CL/opencl.h|g' -i configure*
#autoheader -I include
CFLAGS="$RPM_OPT_FLAGS  -fno-omit-frame-pointer" \
%configure \
	--with-x --with-va --with-xattr --with-d3dadapter --with-d3dadapter-dri2-fallback --without-opencl --disable-tests \
%ifarch x86_64
	--enable-win64  --with-opencl

grep "have_x=yes" config.log || exit 1
# generate baselibs.conf
%ifarch %ix86
echo "# autogenerated in .spec file" >%SOURCE7
echo "%name" >> %SOURCE7
echo "  +^/usr/bin/wine\$" >> %SOURCE7
echo "  +^/usr/bin/wine-preloader\$" >> %SOURCE7
echo "  +^/usr/lib/wine/fakedlls" >> %SOURCE7
grep SONAME_ config.log
grep SONAME_ config.log|grep -v 'so"'|sed -e 's/^.*\(".*"\).*$/ requires \1/;'|sort -u >>%SOURCE7
echo " recommends \"alsa-plugins-pulse-32bit\""	>> %SOURCE7
echo " recommends \"alsa-plugins-32bit\""	>> %SOURCE7
%if 0%{?suse_version} >= 1310
echo " requires \"p11-kit-32bit\""		>> %SOURCE7
echo "%name-devel" >> %SOURCE7
echo "  +^/usr/lib/wine/.*def" >> %SOURCE7
cat %SOURCE7
make %{?_smp_mflags} all

make install DESTDIR=%{buildroot}
# install desktop file
install -d %{buildroot}%{_datadir}/applications/
%suse_update_desktop_file %{SOURCE4} Emulator

install -m 0644 %SOURCE4 %{buildroot}%{_datadir}/applications/
install -m 0644 %SOURCE6 %{buildroot}%{_datadir}/applications/
install -m 0755 %SOURCE1 %{buildroot}%{_bindir}/
install -m 0755 %SOURCE2 %{buildroot}%{_bindir}/
#mv %{buildroot}/%{_mandir}/de.UTF-8 %{buildroot}/%{_mandir}/de
#mv %{buildroot}/%{_mandir}/fr.UTF-8 %{buildroot}/%{_mandir}/fr
#mv %{buildroot}/%{_mandir}/pl.UTF-8 %{buildroot}/%{_mandir}/pl
#install -c %{SOURCE11} %{buildroot}/%{_mandir}/man1/
rm -fr %{buildroot}/%{_mandir}
tar xjf %{SOURCE5}
# Copied from Ubuntu Wine out of debian.diff
# taken on 1.2rc2 time.
cd ubuntuwine
        install -d %{buildroot}%{_sysconfdir}/xdg/menus/applications-merged
        install -c -m 644 %{buildroot}%{_sysconfdir}/xdg/menus/applications-merged

        # Install application-specific desktop files
        install -d %{buildroot}%{_datadir}/applications
        install -c -m 644 *.desktop %{buildroot}%{_datadir}/applications/

        install -d %{buildroot}%{_datadir}/desktop-directories/
        install -c -m 644 *.directory %{buildroot}%{_datadir}/desktop-directories/

        # Install icons
        install -d %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
        install -c -m 644 *.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
cd ..

# find the implicit dependencies
%define winedir %_builddir/%name-%realver/
cat >%winedir/ <<EOF
%ifarch x86_64
grep SONAME_ %winedir/config.log|grep -v 'so"'|sed -e 's/^.*"\(.*\)".*$/\1()(64bit)/;'|sort -u
grep SONAME_ %winedir/config.log|grep -v 'so"'|sed -e 's/^.*"\(.*\)".*$/\1/;'|sort -u
chmod 755 %winedir/
%define _use_internal_dependency_generator 0
%define __find_requires %winedir/

# breaks btrfs installation, see bnc#723402
# %fdupes -s %{buildroot}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

#%doc %{_mandir}/man1/wine.1*
#%doc %{_mandir}/man1/winedbg.1*
#%doc %{_mandir}/man1/wineserver.1*
#%doc %dir %doc %{_mandir}/pl
#%doc %dir %doc %{_mandir}/pl/man1
#%doc %{_mandir}/*/man1/wine.1*
#%doc %{_mandir}/*/man1/wineserver.1*
#%doc %{_mandir}/man1/msiexec.1.*
#%doc %{_mandir}/man1/notepad.1.*
#%doc %{_mandir}/man1/regedit.1.*
#%doc %{_mandir}/man1/regsvr32.1.*
#%doc %{_mandir}/man1/wineboot.1.*
#%doc %{_mandir}/man1/winebuild.1.*
#%doc %{_mandir}/man1/winecfg.1.*
#%doc %{_mandir}/man1/wineconsole.1.*
#%doc %{_mandir}/man1/winecpp.1.*
#%doc %{_mandir}/man1/winefile.1.*
#%doc %{_mandir}/man1/winemine.1.*
#%doc %{_mandir}/man1/winetricks.1.*
#%doc %{_mandir}/man1/winepath.1.*
%dir %{_sysconfdir}/xdg/menus/
%dir %{_sysconfdir}/xdg/menus/applications-merged
%config %{_sysconfdir}/xdg/menus/applications-merged/*.menu
%dir %{_datadir}/desktop-directories/
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/scalable
%dir %{_datadir}/icons/hicolor/scalable/apps
%ifarch %ix86
%ifarch ppc %arm
%ifarch x86_64
%dir %{_libdir}/wine
%dir %{_libdir}/wine/fakedlls

%files devel
#%doc %{_mandir}/man1/winemaker.1*
#%doc %{_mandir}/*/man1/winemaker.1*
#%doc %{_mandir}/man1/widl.1*
#%doc %{_mandir}/man1/winedump.1*
#%doc %{_mandir}/man1/wineg++.1*
#%doc %{_mandir}/man1/winegcc.1*
#%doc %{_mandir}/man1/wmc.1*
#%doc %{_mandir}/man1/wrc.1*

# %{_datadir}/aclocal/wine.m4

openSUSE Build Service is sponsored by