File wine12.spec of Package wine12

#
# spec file for package wine
#
# Copyright (c) 2012 SUSE LINUX Products 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 http://bugs.opensuse.org/
#


Name:           wine12
BuildRequires:  Mesa-devel
BuildRequires:  alsa-devel
BuildRequires:  audiofile
BuildRequires:  bison
BuildRequires:  capi4linux
BuildRequires:  cups-devel
BuildRequires:  desktop-file-utils
BuildRequires:  flex
BuildRequires:  fontconfig-devel
BuildRequires:  freeglut-devel
BuildRequires:  freetype2-devel
BuildRequires:  giflib-devel
BuildRequires:  gnutls-devel
BuildRequires:  jack-devel
BuildRequires:  libgphoto2
BuildRequires:  libjpeg-devel
BuildRequires:  liblcms-devel
BuildRequires:  libpng-devel
BuildRequires:  libtiff-devel
BuildRequires:  libxml2-devel
BuildRequires:  libxslt-devel
BuildRequires:  ncurses-devel
BuildRequires:  openldap2-devel
BuildRequires:  openssl-devel
BuildRequires:  pkgconfig
BuildRequires:  prelink
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel

%if 0%{?suse_version} < 1210
BuildRequires:  hal-devel
%endif
%if 0%{?suse_version} >= 1100
BuildRequires:  libgphoto2-devel
BuildRequires:  libgsm-devel
BuildRequires:  valgrind-devel
%endif
%if 0%{?suse_version} >= 1110 && 0%{?sles_version} == 0
BuildRequires:  fdupes
BuildRequires:  libv4l-devel
%endif
%if 0%{?suse_version} >= 1120
BuildRequires:  openal-soft-devel
%endif

Version:        1.2.3
Release:        0
Summary:        An MS Windows emulator
License:        LGPL-2.1+
Group:          System/Emulators/PC
Url:            http://www.winehq.org/
Source0:        wine-%version.tar.bz2
Patch0:         susepatches.patch
Source1:        http://kegel.com/wine/winetricks
Source2:        http://kegel.com/wine/wisotool
Source3:        README.SuSE
Source4:        wine.desktop
Source5:        ubuntuwine.tar.bz2

%if 0%{?suse_version} > 1120
Requires:       wine12-32bit = %version
%endif

%ifarch %ix86
Requires:       wine-gecko
%endif
Recommends:     wine-mp3

BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
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:          Development/Libraries/C and C++

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

%ifarch %ix86
%if 0%{?suse_version} > 1120
%package 32bit
Summary:        the 32bit runtime part of Wine
Group:          System/Emulators/PC

%description 32bit
This RPM contains the 32bit runtime part of Wine. These are all DLLs, EXEs,
libwine and the main Wine executable.

This package is meant to be used with either the 32 bit "wine" main package
or the 64 bit "wine" package.
%endif
%endif

%prep
%setup -q -n wine-%version
%patch0 -p1
#
cp %{S:3} .
#

%build
cat VERSION
CFLAGS="-DLDAP_DEPRECATED=1 ${RPM_OPT_FLAGS}" \
./configure \
	--prefix=%{_prefix} \
	--libdir=%{_libdir} \
	--with-x --verbose \
%ifarch x86_64
	--enable-win64 \
%endif
	--mandir=%{_mandir}

grep "have_x=yes" config.log || exit 1
make %{?jobs:-j%jobs} depend
make %{?jobs:-j%jobs} all

%install
make install DESTDIR=$RPM_BUILD_ROOT
# install desktop file
install -d $RPM_BUILD_ROOT/usr/share/applications/
install -m 0644 %SOURCE4 $RPM_BUILD_ROOT/usr/share/applications/
install -m 0755 %SOURCE1 $RPM_BUILD_ROOT/usr/bin/
install -m 0755 %SOURCE2 $RPM_BUILD_ROOT/usr/bin/
mv $RPM_BUILD_ROOT/%{_mandir}/de.UTF-8 $RPM_BUILD_ROOT/%{_mandir}/de
mv $RPM_BUILD_ROOT/%{_mandir}/fr.UTF-8 $RPM_BUILD_ROOT/%{_mandir}/fr

tar xjf %{SOURCE5}
# Copied from Ubuntu Wine out of debian.diff
# https://launchpad.net/~ubuntu-wine/+archive/ppa/+packages
# taken on 1.2rc2 time.
cd ubuntuwine
        install -d $RPM_BUILD_ROOT/etc/xdg/menus/applications-merged
        install -c -m 644 wine.menu $RPM_BUILD_ROOT/etc/xdg/menus/applications-merged

        # Install application-specific desktop files
        install -d $RPM_BUILD_ROOT/usr/share/applications
        install -c -m 644 *.desktop $RPM_BUILD_ROOT/usr/share/applications/

        install -d $RPM_BUILD_ROOT/usr/share/desktop-directories/
        install -c -m 644 *.directory $RPM_BUILD_ROOT/usr/share/desktop-directories/

        # Install icons
        install -d $RPM_BUILD_ROOT/usr/share/pixmaps
        install -c -m 644 *.svg $RPM_BUILD_ROOT/usr/share/pixmaps
cd ..

%if 0%{?suse_version} > 1100
%if 0%{?sles_version} == 0
%fdupes $RPM_BUILD_ROOT
%endif
%endif

# find the implicit dependencies
%define winedir %_builddir/wine-%version/
cat >%winedir/my-find-requires.sh <<EOF
#!/bin/bash
%{__find_requires}
%ifarch x86_64
grep SONAME_ %winedir/config.log|grep -v 'so"'|sed -e 's/^.*"\(.*\)".*$/\1()(64bit)/;'|sort -u
%else
grep SONAME_ %winedir/config.log|grep -v 'so"'|sed -e 's/^.*"\(.*\)".*$/\1/;'|sort -u
%endif
EOF
chmod 755 %winedir/my-find-requires.sh
%define _use_internal_dependency_generator 0
%define __find_requires %winedir/my-find-requires.sh

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc ANNOUNCE AUTHORS LICENSE LICENSE.OLD README* 
/usr/bin/function_grep.pl
/usr/bin/msiexec
/usr/bin/notepad
/usr/bin/regedit
/usr/bin/regsvr32
/usr/bin/widl
/usr/bin/wineboot
/usr/bin/winebuild
/usr/bin/winecfg
/usr/bin/wineconsole
/usr/bin/winecpp
/usr/bin/winedbg
/usr/bin/winedump
/usr/bin/winefile
/usr/bin/wineg++
/usr/bin/winegcc
/usr/bin/winemaker
/usr/bin/winemine
/usr/bin/winepath
/usr/bin/wineserver
/usr/bin/winetricks
/usr/bin/wisotool
/usr/bin/wmc
/usr/bin/wrc
/usr/share/wine
/usr/share/applications/wine.desktop
%doc %{_mandir}/*/*
%dir /etc/xdg/menus/
%dir /etc/xdg/menus/applications-merged
%config /etc/xdg/menus/applications-merged/*.menu
/usr/share/applications/*.desktop
%dir /usr/share/desktop-directories/
/usr/share/desktop-directories/*.directory 
/usr/share/pixmaps/*.svg 

%if 0%{?suse_version} > 1120
%ifarch %ix86
%files 32bit
%defattr(-,root,root)
%endif
%endif
%ifarch %ix86
/usr/bin/wine
/usr/bin/wine-preloader
%endif
%ifarch x86_64
/usr/bin/wine64
%endif
%{_libdir}/lib*
%dir %{_libdir}/wine
%{_libdir}/wine/*.so
%dir %{_libdir}/wine/fakedlls
%{_libdir}/wine/fakedlls/*

%files devel
%defattr(-,root,root)
%{_includedir}/wine
%{_libdir}/wine/*.def
%{_libdir}/wine/*.a
# /usr/share/aclocal/wine.m4

%changelog
openSUSE Build Service is sponsored by