summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoakim Hernberg2015-06-13 17:44:12 +0200
committerJoakim Hernberg2015-06-13 17:44:12 +0200
commitecdde2b5e91b0178a18e7e2170e14b99e2d42009 (patch)
tree5a03e09ecd9b2acebe38d393bfe0f3841c754fff
downloadaur-ecdde2b5e91b0178a18e7e2170e14b99e2d42009.tar.gz
initial commit of wine-rt (1.7.45-1)
-rw-r--r--.SRCINFO166
-rw-r--r--30-win32-aliases.conf20
-rw-r--r--PKGBUILD208
-rw-r--r--wine-rt-101107.patch264
-rw-r--r--wine-rt.install18
5 files changed, 676 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..0b464c44ae98
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,166 @@
+# Generated by makepkg 4.2.1
+# Sat Jun 13 15:10:29 UTC 2015
+pkgbase = wine-rt
+ pkgdesc = Realtime Wine - maps windows priority levels to linux scheduling policies
+ pkgver = 1.7.45
+ pkgrel = 1
+ url = http://www.winehq.com
+ install = wine-rt.install
+ arch = i686
+ arch = x86_64
+ license = LGPL
+ makedepends = autoconf
+ makedepends = ncurses
+ makedepends = bison
+ makedepends = perl
+ makedepends = fontforge
+ makedepends = flex
+ makedepends = prelink
+ makedepends = gcc>=4.5.0-2
+ makedepends = gcc-multilib>=4.5.0-2
+ makedepends = giflib
+ makedepends = lib32-giflib
+ makedepends = libpng
+ makedepends = lib32-libpng
+ makedepends = gnutls
+ makedepends = lib32-gnutls
+ makedepends = libxinerama
+ makedepends = lib32-libxinerama
+ makedepends = libxcomposite
+ makedepends = lib32-libxcomposite
+ makedepends = libxmu
+ makedepends = lib32-libxmu
+ makedepends = libxxf86vm
+ makedepends = lib32-libxxf86vm
+ makedepends = libxml2
+ makedepends = lib32-libxml2
+ makedepends = libldap
+ makedepends = lib32-libldap
+ makedepends = lcms2
+ makedepends = lib32-lcms2
+ makedepends = mpg123
+ makedepends = lib32-mpg123
+ makedepends = openal
+ makedepends = lib32-openal
+ makedepends = v4l-utils
+ makedepends = lib32-v4l-utils
+ makedepends = alsa-lib
+ makedepends = lib32-alsa-lib
+ makedepends = libxcomposite
+ makedepends = lib32-libxcomposite
+ makedepends = mesa
+ makedepends = lib32-mesa
+ makedepends = mesa-libgl
+ makedepends = lib32-mesa-libgl
+ makedepends = libcl
+ makedepends = lib32-libcl
+ makedepends = libxslt
+ makedepends = lib32-libxslt
+ makedepends = samba
+ makedepends = opencl-headers
+ makedepends = fontconfig
+ makedepends = lib32-fontconfig
+ makedepends = libxcursor
+ makedepends = lib32-libxcursor
+ makedepends = libxrandr
+ makedepends = lib32-libxrandr
+ makedepends = libxdamage
+ makedepends = lib32-libxdamage
+ makedepends = libxi
+ makedepends = lib32-libxi
+ makedepends = gettext
+ makedepends = lib32-gettext
+ makedepends = freetype2
+ makedepends = lib32-freetype2
+ makedepends = glu
+ makedepends = lib32-glu
+ makedepends = libsm
+ makedepends = lib32-libsm
+ makedepends = gcc-libs
+ makedepends = lib32-gcc-libs
+ makedepends = libpcap
+ makedepends = lib32-libpcap
+ makedepends = desktop-file-utils
+ optdepends = giflib
+ optdepends = lib32-giflib
+ optdepends = libpng
+ optdepends = lib32-libpng
+ optdepends = libldap
+ optdepends = lib32-libldap
+ optdepends = gnutls
+ optdepends = lib32-gnutls
+ optdepends = lcms2
+ optdepends = lib32-lcms2
+ optdepends = libxml2
+ optdepends = lib32-libxml2
+ optdepends = mpg123
+ optdepends = lib32-mpg123
+ optdepends = openal
+ optdepends = lib32-openal
+ optdepends = v4l-utils
+ optdepends = lib32-v4l-utils
+ optdepends = libpulse
+ optdepends = lib32-libpulse
+ optdepends = alsa-plugins
+ optdepends = lib32-alsa-plugins
+ optdepends = alsa-lib
+ optdepends = lib32-alsa-lib
+ optdepends = libjpeg-turbo
+ optdepends = lib32-libjpeg-turbo
+ optdepends = libxcomposite
+ optdepends = lib32-libxcomposite
+ optdepends = libxinerama
+ optdepends = lib32-libxinerama
+ optdepends = ncurses
+ optdepends = lib32-ncurses
+ optdepends = libcl
+ optdepends = lib32-libcl
+ optdepends = libxslt
+ optdepends = lib32-libxslt
+ optdepends = cups
+ optdepends = samba
+ optdepends = dosbox
+ provides = wine=1.7.45
+ provides = bin32-wine=1.7.45
+ provides = wine-wow64=1.7.45
+ conflicts = wine
+ conflicts = bin32-wine
+ conflicts = wine-wow64
+ replaces = wine
+ replaces = bin32-wine
+ options = staticlibs
+ options = !buildflags
+ source = http://prdownloads.sourceforge.net/wine/wine-1.7.45.tar.bz2
+ source = http://prdownloads.sourceforge.net/wine/wine-1.7.45.tar.bz2.sign
+ source = 30-win32-aliases.conf
+ source = wine-rt-101107.patch
+ sha256sums = a30cef1ee4ceaee4b6c9c2ad96df3b8a8847278246e7727624db314c68adaa23
+ sha256sums = SKIP
+ sha256sums = 9901a5ee619f24662b241672a7358364617227937d5f6d3126f70528ee5111e7
+ sha256sums = cd8c48c9e5111b6acb47120da0272bc7afe3acc1f021443c81bb75d5d40ba4cc
+
+pkgname = wine-rt
+ depends = fontconfig
+ depends = lib32-fontconfig
+ depends = libxcursor
+ depends = lib32-libxcursor
+ depends = libxrandr
+ depends = lib32-libxrandr
+ depends = libxdamage
+ depends = lib32-libxdamage
+ depends = libxi
+ depends = lib32-libxi
+ depends = gettext
+ depends = lib32-gettext
+ depends = freetype2
+ depends = lib32-freetype2
+ depends = glu
+ depends = lib32-glu
+ depends = libsm
+ depends = lib32-libsm
+ depends = gcc-libs
+ depends = lib32-gcc-libs
+ depends = libpcap
+ depends = lib32-libpcap
+ depends = desktop-file-utils
+
diff --git a/30-win32-aliases.conf b/30-win32-aliases.conf
new file mode 100644
index 000000000000..99ae1f7b83a5
--- /dev/null
+++ b/30-win32-aliases.conf
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+ <alias binding="same">
+ <family>MS Shell Dlg</family>
+ <accept><family>Microsoft Sans Serif</family></accept>
+ <default><family>sans-serif</family></default>
+ </alias>
+ <alias binding="same">
+ <family>MS Shell Dlg 2</family>
+ <accept><family>Tahoma</family></accept>
+ <default><family>sans-serif</family></default>
+ </alias>
+
+ <alias binding="same">
+ <family>MS Sans Serif</family>
+ <prefer><family>Microsoft Sans Serif</family></prefer>
+ <default><family>sans-serif</family></default>
+ </alias>
+</fontconfig>
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..bfcfc7be23c1
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,208 @@
+# Maintainer: Joakim Hernberg <jhernberg@alchemy.lu>
+# Contributor: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Contributor: Jan "heftig" Steffens <jan.steffens@gmail.com>
+# Contributor: Eduardo Romero <eduardo@archlinux.org>
+# Contributor: Giovanni Scafora <giovanni@archlinux.org>
+
+pkgname=wine-rt
+pkgver=1.7.45
+pkgrel=1
+
+_pkgbasever=${pkgver/rc/-rc}
+
+source=(http://prdownloads.sourceforge.net/wine/wine-$_pkgbasever.tar.bz2{,.sign}
+ 30-win32-aliases.conf
+ wine-rt-101107.patch)
+
+sha256sums=('a30cef1ee4ceaee4b6c9c2ad96df3b8a8847278246e7727624db314c68adaa23'
+ 'SKIP'
+ '9901a5ee619f24662b241672a7358364617227937d5f6d3126f70528ee5111e7'
+ 'cd8c48c9e5111b6acb47120da0272bc7afe3acc1f021443c81bb75d5d40ba4cc')
+
+validpgpkeys=('5AC1A08B03BD7A313E0A955AF5E6E9EEB9461DD7')
+
+pkgdesc="Realtime Wine - maps windows priority levels to linux scheduling policies"
+url="http://www.winehq.com"
+arch=(i686 x86_64)
+options=(staticlibs)
+options=(staticlibs !buildflags) # remove !buildflags once https://bugs.winehq.org/show_bug.cgi?id=38653 is resolved
+license=(LGPL)
+install=wine-rt.install
+
+_depends=(
+ fontconfig lib32-fontconfig
+ libxcursor lib32-libxcursor
+ libxrandr lib32-libxrandr
+ libxdamage lib32-libxdamage
+ libxi lib32-libxi
+ gettext lib32-gettext
+ freetype2 lib32-freetype2
+ glu lib32-glu
+ libsm lib32-libsm
+ gcc-libs lib32-gcc-libs
+ libpcap lib32-libpcap
+ desktop-file-utils
+)
+
+makedepends=(autoconf ncurses bison perl fontforge flex prelink
+ 'gcc>=4.5.0-2' 'gcc-multilib>=4.5.0-2'
+ giflib lib32-giflib
+ libpng lib32-libpng
+ gnutls lib32-gnutls
+ libxinerama lib32-libxinerama
+ libxcomposite lib32-libxcomposite
+ libxmu lib32-libxmu
+ libxxf86vm lib32-libxxf86vm
+ libxml2 lib32-libxml2
+ libldap lib32-libldap
+ lcms2 lib32-lcms2
+ mpg123 lib32-mpg123
+ openal lib32-openal
+ v4l-utils lib32-v4l-utils
+ alsa-lib lib32-alsa-lib
+ libxcomposite lib32-libxcomposite
+ mesa lib32-mesa
+ mesa-libgl lib32-mesa-libgl
+ libcl lib32-libcl
+ libxslt lib32-libxslt
+ samba
+ opencl-headers
+)
+
+optdepends=(
+ giflib lib32-giflib
+ libpng lib32-libpng
+ libldap lib32-libldap
+ gnutls lib32-gnutls
+ lcms2 lib32-lcms2
+ libxml2 lib32-libxml2
+ mpg123 lib32-mpg123
+ openal lib32-openal
+ v4l-utils lib32-v4l-utils
+ libpulse lib32-libpulse
+ alsa-plugins lib32-alsa-plugins
+ alsa-lib lib32-alsa-lib
+ libjpeg-turbo lib32-libjpeg-turbo
+ libxcomposite lib32-libxcomposite
+ libxinerama lib32-libxinerama
+ ncurses lib32-ncurses
+ libcl lib32-libcl
+ libxslt lib32-libxslt
+ cups
+ samba dosbox
+)
+
+if [[ $CARCH == i686 ]]; then
+ provides=("wine=$pkgver")
+ # Strip lib32 etc. on i686
+ _depends=(${_depends[@]/*32-*/})
+ makedepends=(${makedepends[@]/*32-*/} ${_depends[@]})
+ makedepends=(${makedepends[@]/*-multilib*/})
+ optdepends=(${optdepends[@]/*32-*/})
+else
+ makedepends=(${makedepends[@]} ${_depends[@]})
+ provides=("wine=$pkgver" "bin32-wine=$pkgver" "wine-wow64=$pkgver")
+ conflicts=('wine' 'bin32-wine' 'wine-wow64')
+ replaces=('wine' 'bin32-wine')
+fi
+
+prepare() {
+ if [ -f "$srcdir//wine-$pkgver/README.WINE-RT" ]
+ then
+ rm "$srcdir//wine-$pkgver/README.WINE-RT"
+ fi
+
+ cd "$srcdir/wine-$_pkgbasever"
+
+ sed 's|OpenCL/opencl.h|CL/opencl.h|g' -i configure*
+
+ msg2 "Apply wine-rt-101107.patch"
+ patch -s -Np1 -i $srcdir/wine-rt-101107.patch
+
+ msg2 "Patches applied cleanly, continue building wine"
+}
+
+build() {
+ cd "$srcdir"
+
+ # Allow ccache to work
+ mv wine-$_pkgbasever wine
+
+ # Get rid of old build dirs
+ rm -rf wine-{32,64}-build
+ mkdir wine-32-build
+
+ # These additional CPPFLAGS solve FS#27662 and FS#34195
+ export CPPFLAGS="${CPPFLAGS/-D_FORTIFY_SOURCE=2/} -D_FORTIFY_SOURCE=0"
+
+ # Fix build with GCC5
+ export CFLAGS="${CFLAGS/-O2/} -O0"
+ export CXXFLAGS="${CXXFLAGS/-O2/} -O0"
+
+ if [[ $CARCH == x86_64 ]]; then
+ msg2 "Building Wine-64..."
+
+ mkdir wine-64-build
+ cd "$srcdir/wine-64-build"
+ ../wine/configure \
+ --prefix=/usr \
+ --libdir=/usr/lib \
+ --with-x \
+ --disable-tests \
+ --without-gstreamer \
+ --enable-win64
+ # Gstreamer was disabled for FS#33655
+
+ make
+
+ _wine32opts=(
+ --libdir=/usr/lib32
+ --with-wine64="$srcdir/wine-64-build"
+ )
+
+ export PKG_CONFIG_PATH="/usr/lib32/pkgconfig"
+ fi
+
+ msg2 "Building Wine-32..."
+ cd "$srcdir/wine-32-build"
+ ../wine/configure \
+ --prefix=/usr \
+ --with-x \
+ --disable-tests \
+ --without-gstreamer \
+ "${_wine32opts[@]}"
+
+ # Not needed...
+
+ # These additional flags solve FS#23277
+ make CFLAGS+="-mstackrealign -mincoming-stack-boundary=2" CXXFLAGS+="-mstackrealign -mincoming-stack-boundary=2"
+}
+
+package() {
+ depends=(${_depends[@]})
+
+ msg2 "Packaging Wine-32..."
+ cd "$srcdir/wine-32-build"
+
+ if [[ $CARCH == i686 ]]; then
+ make prefix="$pkgdir/usr" install
+ else
+ make prefix="$pkgdir/usr" \
+ libdir="$pkgdir/usr/lib32" \
+ dlldir="$pkgdir/usr/lib32/wine" install
+
+ msg2 "Packaging Wine-64..."
+ cd "$srcdir/wine-64-build"
+ make prefix="$pkgdir/usr" \
+ libdir="$pkgdir/usr/lib" \
+ dlldir="$pkgdir/usr/lib/wine" install
+ fi
+
+ # Font aliasing settings for Win32 applications
+ install -d "$pkgdir"/etc/fonts/conf.{avail,d}
+ install -m644 "$srcdir/30-win32-aliases.conf" "$pkgdir/etc/fonts/conf.avail"
+ ln -s ../conf.avail/30-win32-aliases.conf "$pkgdir/etc/fonts/conf.d/30-win32-aliases.conf"
+
+ mkdir -p "$pkgdir/usr/share/doc/wine-rt"
+ cp "$srcdir/wine/README.WINE-RT" "$pkgdir/usr/share/doc/wine-rt"
+}
diff --git a/wine-rt-101107.patch b/wine-rt-101107.patch
new file mode 100644
index 000000000000..556d203205eb
--- /dev/null
+++ b/wine-rt-101107.patch
@@ -0,0 +1,264 @@
+From 1dceb627db51a239a63ed5276f7e8911be6751bc Mon Sep 17 00:00:00 2001
+From: Joakim B Hernberg <jhernberg@alchemy.lu>
+Date: Sun, 7 Nov 2010 19:10:49 +0100
+Subject: [PATCH] 3:rd wine-rt patch 101107
+
+---
+ README.WINE-RT | 27 +++++++++++++++++
+ server/main.c | 60 ++++++++++++++++++++++++++++++++++++++
+ server/thread.c | 87 ++++++++++++++++++++++++++++++++++++++++++------------
+ 3 files changed, 154 insertions(+), 20 deletions(-)
+ create mode 100644 README.WINE-RT
+
+diff --git a/README.WINE-RT b/README.WINE-RT
+new file mode 100644
+index 0000000..3f3f2c1
+--- /dev/null
++++ b/README.WINE-RT
+@@ -0,0 +1,27 @@
++What is it?
++The Wine-RT patch allows programs that use windows' concept of thread priority to gain similar functionality under linux. It maps windows priority levels to linux scheduling policies. THREAD_PRIORITY_ABOVE_NORMAL, THREAD_PRIORITY_HIGHEST and THREAD_PRIORITY_TIME_CRITICAL levels which are made to run as linux SCHED_FIFO threads at priority levels that are defined by the WINERT variable. THREAD_PRIORITY_NORMAL threads are run as normal linux threads (as all threads are without the patch), and the priorities below normal (THREAD_PRIORITY_BELOW_NORMAL, THREAD_PRIORITY_LOWEST) are run as SCHED_BATCH. THREAD_PRIORITY_IDLE threads are run as SCHED_IDLE.
++Windows' concept of priority classes is not implemented at all.
++
++Please note that threads running SCHED_FIFO might hang your entire system, so please exercise caution!
++
++How does it work?
++When a windows program asks for a thread to be run at a higher priority, Wine will ask the linux system to schedule it as a SCHED_FIFO thread, which means that the tread will keep on executing until it has either finished, voluntarily yields execution or gets preempted by a higher priority SCHED_FIFO thread. This is already done by many linux audio applications, to ensure less xruns on lower buffer sizes. With Wine-RT, the same thing can be done for Wine applications.
++
++How to use it?
++The Wine-RT functionality is not enabled by default. Instead it is controlled by 2 environment variables "WINE_RT" and "WINE_SRV_RT".
++
++The "WINE_RT" variable has 2 purposes, it has to be set in order to activate the patch, and it determines the priority of the SCHED_FIFO threads, Its value can be set from 1 to your system's rtprio max value minus 10, as set in limits.conf or limits.d/audio.conf. (In Debian, Ubuntu and KXStudio this value is 99). THREAD_PRIORITY_ABOVE_NORMAL threads will run at this priority level, THREAD_PRIORITY_HIGHEST threads at this level + 5, and THREAD_PRIORITY_TIME_CRITICAL threads at this level + 10.
++
++WINE_SRV_RT makes the wineserver main thread run SCHED_FIFO. Valid values range from 1 to your system's rtprio max value.
++
++We can set these variables in 2 simple ways.
++First one is using a terminal with "exports", like this:
++export WINE_RT=#
++export WINE_SRV_RT=#
++wine <app>
++
++or just prefix your application with 'env VARIABLE=value', like this:
++env WINE_RT=# WINE_SRV_RT=# wine <app>
++
++A recommended starting point might be "env WINE_RT=15 WINE_SRV_RT=10 wine appname.exe".
++
+diff --git a/server/main.c b/server/main.c
+index 2d841e8..a89d1e0 100644
+--- a/server/main.c
++++ b/server/main.c
+@@ -27,10 +27,18 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <sys/time.h>
++#include <sys/resource.h>
++#include <sys/mman.h>
+ #include <unistd.h>
+ #ifdef HAVE_GETOPT_H
+ # include <getopt.h>
+ #endif
++#ifdef HAVE_SCHED_H
++#include <sched.h>
++#ifndef SCHED_NORMAL
++#define SCHED_NORMAL SCHED_OTHER
++#endif
++#endif
+
+ #include "object.h"
+ #include "file.h"
+@@ -44,6 +52,9 @@ int foreground = 0;
+ timeout_t master_socket_timeout = 3 * -TICKS_PER_SEC; /* master socket timeout, default is 3 seconds */
+ const char *server_argv0;
+
++/* global variable used here and in thread.c to determine whether wine runs with rt threads and at what base value */
++int base_rt_priority = -1;
++
+ /* parse-line args */
+
+ static void usage(void)
+@@ -125,6 +136,51 @@ static void sigterm_handler( int signum )
+ exit(1); /* make sure atexit functions get called */
+ }
+
++#ifdef HAVE_SCHED_H
++void init_rt_scheduling( void )
++{
++ struct sched_param param;
++ struct rlimit limit;
++ int priority_max, policy, wine_server_rt_priority;
++ char *enviroment, *endptr;
++
++ getrlimit( RLIMIT_RTPRIO, &limit );
++ priority_max = limit.rlim_max;
++
++ /* check for realtime mode and set the base priority level */
++
++ if (!(enviroment = getenv( "WINE_RT" )))
++ return;
++ base_rt_priority = (int) strtol( enviroment, &endptr, 10 );
++ if (enviroment == endptr || base_rt_priority == 0 || base_rt_priority > priority_max - 10)
++ {
++ fprintf( stderr, "Unable to run WINE in rt mode, WINE_RT values supported on this system range from 1 to %i\n", priority_max - 10 );
++ base_rt_priority = -1;
++ return;
++ }
++ fprintf( stderr, "WINE realtime scheduling hack enabled, realtime base priority has been set to %i\n", base_rt_priority );
++
++ /* determine scheduling policy for the main wineserver thread */
++
++ if (!(enviroment = getenv( "WINE_SRV_RT" )))
++ {
++ fprintf( stderr, "wineserver running SCHED_NORMAL\n" );
++ return;
++ }
++ wine_server_rt_priority = (int) strtol( enviroment, &endptr, 10 );
++ if (enviroment == endptr || wine_server_rt_priority == 0 || wine_server_rt_priority > priority_max)
++ {
++ fprintf( stderr, "Unable to run the wineserver SCHED_FIFO, valid WINE_SRV_RT values range from 1 to %i\n", priority_max );
++ return;
++ }
++ fprintf( stderr, "wineserver running SCHED_FIFO at priority %i\n", wine_server_rt_priority );
++ policy = SCHED_FIFO;
++ param.sched_priority = wine_server_rt_priority;
++ if (sched_setscheduler ( 0, policy, &param) != 0)
++ fprintf (stderr, "Error scheduling wineserver as SCHED_FIFO\n");
++}
++#endif
++
+ int main( int argc, char *argv[] )
+ {
+ setvbuf( stderr, NULL, _IOLBF, 0 );
+@@ -138,6 +194,10 @@ int main( int argc, char *argv[] )
+ signal( SIGTERM, sigterm_handler );
+ signal( SIGABRT, sigterm_handler );
+
++#ifdef HAVE_SCHED_H
++ init_rt_scheduling();
++#endif
++ mlockall(MCL_FUTURE);
+ sock_init();
+ open_master_socket();
+
+diff --git a/server/thread.c b/server/thread.c
+index 05e4121..2d103b4 100644
+--- a/server/thread.c
++++ b/server/thread.c
+@@ -32,11 +32,18 @@
+ #include <sys/types.h>
+ #include <unistd.h>
+ #include <time.h>
+-#ifdef HAVE_POLL_H
+-#include <poll.h>
+-#endif
+ #ifdef HAVE_SCHED_H
+ #include <sched.h>
++#ifndef SCHED_NORMAL
++#define SCHED_NORMAL SCHED_OTHER
++#endif
++#ifndef SCHED_IDLE
++#define SCHED_IDLE 5 /* missing from my glibc, taken from linux/sched.h */
++#endif
++#endif
++
++#ifdef HAVE_POLL_H
++#include <poll.h>
+ #endif
+
+ #include "ntstatus.h"
+@@ -164,6 +171,8 @@ static const struct fd_ops thread_fd_ops =
+
+ static struct list thread_list = LIST_INIT(thread_list);
+
++extern int base_rt_priority;
++
+ /* initialize the structure for a newly allocated thread */
+ static inline void init_thread_structure( struct thread *thread )
+ {
+@@ -432,29 +441,67 @@ int set_thread_affinity( struct thread *thread, affinity_t affinity )
+ return ret;
+ }
+
+-#define THREAD_PRIORITY_REALTIME_HIGHEST 6
+-#define THREAD_PRIORITY_REALTIME_LOWEST -7
++void set_thread_priority( struct thread *thread, int priority )
++{
++#ifdef HAVE_SCHED_H
++ struct sched_param param;
++ int policy;
++
++ if (base_rt_priority == -1 || (thread->unix_tid == -1)) return;
++
++ switch (priority)
++ {
++ case THREAD_PRIORITY_TIME_CRITICAL:
++ param.sched_priority = base_rt_priority + 10;
++ policy = SCHED_FIFO;
++ fprintf( stderr, "Thread %i at THREAD_PRIORITY_TIME_CRITICAL set to SCHED_FIFO - priority %i\n", thread->unix_tid, param.sched_priority );
++ break;
++ case THREAD_PRIORITY_HIGHEST:
++ param.sched_priority = base_rt_priority + 5;
++ policy = SCHED_FIFO;
++ fprintf( stderr, "Thread %i at THREAD_PRIORITY_HIGHEST set to SCHED_FIFO - priority %i\n", thread->unix_tid, param.sched_priority );
++ break;
++ case THREAD_PRIORITY_ABOVE_NORMAL:
++ param.sched_priority = base_rt_priority;
++ policy = SCHED_FIFO;
++ fprintf( stderr, "Thread %i at THREAD_PRIORITY_ABOVE_NORMAL set to SCHED_FIFO - priority %i\n", thread->unix_tid, param.sched_priority );
++ break;
++ case THREAD_PRIORITY_NORMAL:
++ param.sched_priority = 0;
++ policy = SCHED_NORMAL;
++ fprintf( stderr, "Setting thread %i at level THREAD_PRIORITY_NORMAL to SCHED_NORMAL\n", thread->unix_tid );
++ break;
++ case THREAD_PRIORITY_BELOW_NORMAL:
++ param.sched_priority = 0;
++ policy = SCHED_BATCH;
++ fprintf( stderr, "Setting thread %i at level THREAD_PRIORITY_BELOW_NORMAL to SCHED_BATCH\n", thread->unix_tid );
++ break;
++ case THREAD_PRIORITY_LOWEST:
++ param.sched_priority = 0;
++ policy = SCHED_BATCH;
++ fprintf( stderr, "Setting thread %i at THREAD_PRIORITY_LOWEST level to SCHED_BATCH\n", thread->unix_tid );
++ break;
++ case THREAD_PRIORITY_IDLE:
++ param.sched_priority = 0;
++ policy = SCHED_IDLE;
++ fprintf( stderr, "Setting thread %i with level THREAD_PRIORITY_IDLE to SCHED_IDLE\n", thread->unix_tid );
++ break;
++ default:
++ fprintf( stderr, "Error setting scheduling priority level, unknown should never come here\n" );
++ return;
++ }
++ if (sched_setscheduler (thread->unix_tid, policy, &param) != 0) fprintf (stderr, "Error setting priorities\n");
++ thread->priority = priority;
++ return;
++#endif
++}
+
+ /* set all information about a thread */
+ static void set_thread_info( struct thread *thread,
+ const struct set_thread_info_request *req )
+ {
+ if (req->mask & SET_THREAD_INFO_PRIORITY)
+- {
+- int max = THREAD_PRIORITY_HIGHEST;
+- int min = THREAD_PRIORITY_LOWEST;
+- if (thread->process->priority == PROCESS_PRIOCLASS_REALTIME)
+- {
+- max = THREAD_PRIORITY_REALTIME_HIGHEST;
+- min = THREAD_PRIORITY_REALTIME_LOWEST;
+- }
+- if ((req->priority >= min && req->priority <= max) ||
+- req->priority == THREAD_PRIORITY_IDLE ||
+- req->priority == THREAD_PRIORITY_TIME_CRITICAL)
+- thread->priority = req->priority;
+- else
+- set_error( STATUS_INVALID_PARAMETER );
+- }
++ set_thread_priority( thread, req->priority );
+ if (req->mask & SET_THREAD_INFO_AFFINITY)
+ {
+ if ((req->affinity & thread->process->affinity) != req->affinity)
+--
+1.7.3.2
+
diff --git a/wine-rt.install b/wine-rt.install
new file mode 100644
index 000000000000..8cfd0a2fc5ad
--- /dev/null
+++ b/wine-rt.install
@@ -0,0 +1,18 @@
+post_install() {
+ update-desktop-database -q
+ #echo "This wine package is wow64 enabled. This means it can run 32bit/64bit Windows apps on x86_64."
+ #echo "If you are on x86_64, the default WINEARCH will be win64."
+ #echo "This will cause a lot of Windows applications to malfunction even if they usually work in wine."
+ #echo "Please create your ~/.wine with 'WINEARCH=win32 winecfg' if you are unsure and on x86_64."
+ #echo "See the Arch wiki on wine for more information."
+ echo "Please see /usr/share/doc/wine-rt/README.WINE-RT for instructions on how to enable the realtime patch"
+}
+
+post_upgrade() {
+ echo
+ echo "Please see /usr/share/doc/wine-rt/README.WINE-RT for instructions on how to enable the realtime patch"
+}
+
+post_remove() {
+ update-desktop-database -q
+}