game patches

Serge Ryabchun sr at energy.uch.net
Mon Jul 29 06:40:31 CDT 2002


comments in spec

-- 
Serge Ryabchun sr at energy.uch.net

-------------- next part --------------
--- wine-cvs/dlls/ddraw/ddraw/main.c	Tue Apr 23 13:12:19 2002
+++ wine/dlls/ddraw/ddraw/main.c	Wed Jul 24 14:17:04 2002
@@ -1221,16 +1221,47 @@
     return DD_OK;
 }
 
+/*
+ * System Shock 2 expects like as right value of freeVidMem.
+ * it calls GetAvailableVidMem before and after CreateTexture,
+ * compares first and second values and exit with error message 
+ * about bad DirectX provider ;-) 
+ * 
+ * So let it be happy
+ */
+#define VidMemAlign     4
+/* How it aligned? maybe by bus width but it's just workaround ;-) */
+#define VidMemMask      (~(VidMemAlign-1))
+#define SIZE_ALIGN( X)  ((X+VidMemAlign-1)&VidMemMask)
+
+/*
+ * I have no idea how get correct totalVidMem & freeVidMem from Xserver.
+ * SDL do that by parsing /proc/self/maps if DGA available ;-)
+ * maybe read it from config?
+ */
+static int totalVidMem = 32*1024*1024;
+static int freeVidMem  = 24*1024*1024;
+
+void DirectDraw_Dec_VidMem( int size) {
+
+    freeVidMem -= SIZE_ALIGN( size);
+}
+
+void DirectDraw_Inc_Vidmem( int size) {
+
+    freeVidMem += SIZE_ALIGN( size);
+}
+
 HRESULT WINAPI
 Main_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
 				   LPDWORD total, LPDWORD free)
 {
     ICOM_THIS(IDirectDrawImpl,iface);
-    TRACE("(%p)->(%p,%p,%p)\n", This,ddscaps,total,free);
+    TRACE("(%p)->(%p,%p->%d,%p->%d)\n", This,ddscaps,total,totalVidMem,free,freeVidMem);
 
-    /* We have 16 MB videomemory */
-    if (total)	*total= 16*1024*1024;
-    if (free)	*free = 16*1024*1024;
+    if (total)	*total= totalVidMem;
+    if (free)	*free = freeVidMem;
+    
     return DD_OK;
 }
 
--- wine-cvs/dlls/ddraw/dsurface/dib.c	Tue Mar 26 12:57:11 2002
+++ wine/dlls/ddraw/dsurface/dib.c	Wed Jul 24 13:09:40 2002
@@ -140,6 +140,9 @@
     return S_OK;
 }
 
+extern void DirectDraw_Inc_VidMem( int size);
+extern void DirectDraw_Dec_VidMem( int size);
+
 void DIB_DirectDrawSurface_final_release(IDirectDrawSurfaceImpl* This)
 {
     DIB_DirectDrawSurfaceImpl* priv = This->private;
@@ -147,8 +150,10 @@
    if (priv->dib.DIBsection)
        DeleteObject(priv->dib.DIBsection);
 
-    if (!priv->dib.client_memory)
+    if (!priv->dib.client_memory) {
+	DirectDraw_Inc_VidMem( This->surface_desc.u1.lPitch * This->surface_desc.dwHeight);
 	VirtualFree(This->surface_desc.lpSurface, 0, MEM_RELEASE);
+    }
 
     Main_DirectDrawSurface_final_release(This);
 }
@@ -250,7 +255,7 @@
 	    Main_DirectDrawSurface_final_release(This);
 	    return HRESULT_FROM_WIN32(GetLastError());
 	}
-
+	DirectDraw_Dec_VidMem( This->surface_desc.u1.lPitch * This->surface_desc.dwHeight);
 	priv->dib.client_memory = FALSE;
     }
 
--- wine-cvs/dlls/d3dgl/texture.c	Tue May  7 17:20:51 2002
+++ wine/dlls/d3dgl/texture.c	Wed Jul 24 14:15:35 2002
@@ -900,8 +900,11 @@
 	if (d3dp->texstagestate[dwStage][D3DTSS_ALPHAOP] != D3DTOP_DISABLE)
 	    return D3DERR_UNSUPPORTEDALPHAOPERATION;
         FIXME("trying to validate disabled alpha operation\n");   
+	return D3D_OK;
 	/* FIXME: maybe some apps might expect this to succeed anyway? */
-	return D3DERR_UNSUPPORTEDALPHAOPERATION;
+	/*  - Yes, System Shock 2 expects success here */
+	/* FIXME: It can wark after that but same textures (glass, sky, fog) are corrupted :-/ */
+	/* return D3DERR_UNSUPPORTEDALPHAOPERATION; */
     }
 
     GL_get_color_src0(d3dp, dwStage, cop, &csrc0, &copn0);
-------------- next part --------------
--- wine-cvs/graphics/x11drv/opengl.c	Wed Aug 29 22:37:08 2001
+++ wine/graphics/x11drv/opengl.c	Sat Jul 20 10:07:05 2002
@@ -200,7 +200,7 @@
   ppfd->nVersion = 1;
   
   /* These flags are always the same... */
-  ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_GENERIC_ACCELERATED;
+  ppfd->dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_SWAP_COPY;
   /* Now the flags extraced from the Visual */
   ENTER_GL();
   glXGetConfig(gdi_display, vis, GLX_DOUBLEBUFFER, &value); if (value) ppfd->dwFlags |= PFD_DOUBLEBUFFER;
-------------- next part --------------
--- wine-cvs/server/Makefile.in	Fri Sep 14 08:28:30 2001
+++ wine/server/Makefile.in	Sat Jul 20 10:07:05 2002
@@ -1,4 +1,5 @@
-DEFS      = -D__WINE__
+sysconfdir = @sysconfdir@
+DEFS      = -D__WINE__ -DETCDIR="\"$(sysconfdir)\""
 TOPSRCDIR = @top_srcdir@
 TOPOBJDIR = ..
 SRCDIR    = @srcdir@
--- wine-cvs/server/registry.c	Wed Jan  2 10:39:40 2002
+++ wine/server/registry.c	Sat Jul 20 10:07:05 2002
@@ -1355,6 +1355,26 @@
     if (!(filename = malloc( strlen(config) + 8 ))) fatal_error( "out of memory\n" );
     strcpy( filename, config );
     strcat( filename, "/config" );
+
+    {
+        /*
+         *  If the registry doesn't exist, copy the global one
+         */
+        if( access( filename, R_OK ) && !access( ETCDIR"/config", R_OK )) {
+            FILE *in, *out;
+	    char buf[1024];
+            if( !(in = fopen( ETCDIR"/config", "r" )))
+                return;
+            if( !(out = fopen( filename, "w" ))) {
+                fclose( in);
+                return;
+	    }
+	    while( fgets( buf, 1024, in)) fputs(buf, out);
+            fclose( in);
+	    fclose( out);
+        }
+    }
+
     if ((f = fopen( filename, "r" )))
     {
         struct key *key;
-------------- next part --------------
--- wine-cvs/include/wingdi.h	Mon Apr 22 10:01:17 2002
+++ wine/include/wingdi.h	Sat Jul 20 13:22:05 2002
@@ -3345,6 +3345,39 @@
 BOOL      WINAPI PolyTextOutW(HDC,PPOLYTEXTW,INT);
 #define   PolyTextOut WINELIB_NAME_AW(PolyTextOut)
 
+/* These defines are used by wglSwapLayerBuffers */
+#define WGL_SWAP_MAIN_PLANE (1 <<  0)
+#define WGL_SWAP_OVERLAY1   (1 <<  1)
+#define WGL_SWAP_OVERLAY2   (1 <<  2)
+#define WGL_SWAP_OVERLAY3   (1 <<  3)
+#define WGL_SWAP_OVERLAY4   (1 <<  4)
+#define WGL_SWAP_OVERLAY5   (1 <<  5)
+#define WGL_SWAP_OVERLAY6   (1 <<  6)
+#define WGL_SWAP_OVERLAY7   (1 <<  7)
+#define WGL_SWAP_OVERLAY8   (1 <<  8)
+#define WGL_SWAP_OVERLAY9   (1 <<  9)
+#define WGL_SWAP_OVERLAY10  (1 << 10)
+#define WGL_SWAP_OVERLAY11  (1 << 11)
+#define WGL_SWAP_OVERLAY12  (1 << 12)
+#define WGL_SWAP_OVERLAY13  (1 << 13)
+#define WGL_SWAP_OVERLAY14  (1 << 14)
+#define WGL_SWAP_OVERLAY15  (1 << 15)
+#define WGL_SWAP_UNDERLAY1  (1 << 16)
+#define WGL_SWAP_UNDERLAY2  (1 << 17)
+#define WGL_SWAP_UNDERLAY3  (1 << 18)
+#define WGL_SWAP_UNDERLAY4  (1 << 19)
+#define WGL_SWAP_UNDERLAY5  (1 << 20)
+#define WGL_SWAP_UNDERLAY6  (1 << 21)
+#define WGL_SWAP_UNDERLAY7  (1 << 22)
+#define WGL_SWAP_UNDERLAY8  (1 << 23)
+#define WGL_SWAP_UNDERLAY9  (1 << 24)
+#define WGL_SWAP_UNDERLAY10 (1 << 25)
+#define WGL_SWAP_UNDERLAY11 (1 << 26)
+#define WGL_SWAP_UNDERLAY12 (1 << 27)
+#define WGL_SWAP_UNDERLAY13 (1 << 28)
+#define WGL_SWAP_UNDERLAY14 (1 << 29)
+#define WGL_SWAP_UNDERLAY15 (1 << 30)
+
 #ifdef __cplusplus
 }
 #endif
--- wine-cvs/dlls/opengl32/wgl.c	Tue May 14 10:04:06 2002
+++ wine/dlls/opengl32/wgl.c	Sat Jul 20 13:22:49 2002
@@ -424,9 +424,18 @@
  */
 BOOL WINAPI wglSwapLayerBuffers(HDC hdc,
 				UINT fuPlanes) {
-  FIXME("(): stub !\n");
+  TRACE("(%08x, %08x)\n", hdc, fuPlanes);
 
-  return FALSE;
+  if (fuPlanes & WGL_SWAP_MAIN_PLANE) {
+    if (!SwapBuffers(hdc)) return FALSE;
+    fuPlanes &= ~WGL_SWAP_MAIN_PLANE;
+  }
+
+  if (fuPlanes) {
+    WARN("Following layers unhandled : %08x\n", fuPlanes);
+  }
+  
+  return TRUE;
 }
 
 /***********************************************************************
-------------- next part --------------
--- wine-cvs/dlls/opengl32/opengl_norm.c	Wed Aug 29 22:37:07 2001
+++ wine/dlls/opengl32/opengl_norm.c	Sat Jul 20 12:55:16 2002
@@ -7,7 +7,12 @@
 
 typedef const GLubyte * GLstring;
 
-DEFAULT_DEBUG_CHANNEL(opengl);
+#undef  TRACE
+#define TRACE(...)     do{}while(0)
+#undef  ENTER_GL
+#define ENTER_GL(...)  do{}while(0)
+#undef  LEAVE_GL
+#define LEAVE_GL(...)  do{}while(0)
 
 /***********************************************************************
  *              glAccum (OPENGL32.@)
--- wine-cvs/dlls/opengl32/opengl_ext.c	Mon Apr 22 09:57:53 2002
+++ wine/dlls/opengl32/opengl_ext.c	Sat Jul 20 12:54:53 2002
@@ -9,7 +9,12 @@
 
 #include "opengl_ext.h"
 
-DEFAULT_DEBUG_CHANNEL(opengl);
+#undef  TRACE
+#define TRACE(...)     do{}while(0)
+#undef  ENTER_GL
+#define ENTER_GL(...)  do{}while(0)
+#undef  LEAVE_GL
+#define LEAVE_GL(...)  do{}while(0)
 
 void (*func_glActiveTexture)( GLenum ) = (void *) 0xdeadbeef;
 void (*func_glAlphaFragmentOp1ATI)( GLenum, GLuint, GLuint, GLuint, GLuint, GLuint ) = (void *) 0xdeadbeef;
-------------- next part --------------
--- wine-cvs/dlls/opengl32/make_opengl	Mon Apr 22 09:57:46 2002
+++ wine/dlls/opengl32/make_opengl	Sat Jul 20 10:07:05 2002
@@ -43,11 +43,11 @@
 $ext_file  = "opengl_ext.c";
 
 # Set to 0 for removing the ENTER / LEAVE GL calls
-$gen_thread_safe = 1;
+$gen_thread_safe = 0;
 # Prefix used for the local variables
-$ext_prefix = "func_";
+$ext_prefix = "";
 # If set to 1, generate TRACEs for each OpenGL function
-$gen_traces = 1;
+$gen_traces = 0;
 
 #
 # List of categories to put in the 'opengl_norm.c' file
-------------- next part --------------
--- winex-cvs/dlls/Makefile.in	Tue May 14 10:04:03 2002
+++ wine/dlls/Makefile.in	Wed May 15 17:30:26 2002
@@ -12,7 +12,7 @@
 OPENGLFILES = d3dgl opengl32
 SDLDRVFILES = sdldrv
 XFILES = x11drv
-EXTRADIRS = @GLU32FILES@ @OPENGLFILES@ @SDLDRVFILES@ @XFILES@
+EXTRADIRS = @XFILES@ @GLU32FILES@ @OPENGLFILES@ @SDLDRVFILES@ 
 
 # Subdir list
 
-------------- next part --------------
--- winex-cvs/files/dos_fs.c	Mon Apr 22 10:00:02 2002
+++ wine/files/dos_fs.c	Fri May 17 13:47:49 2002
@@ -1326,9 +1326,6 @@
 	}
     if (full_name.short_name[namelen-1]=='.')
 	full_name.short_name[(namelen--)-1] =0;
-    if (!driveletter)
-      if (full_name.short_name[namelen-1]=='\\')
-	full_name.short_name[(namelen--)-1] =0;
     TRACE("got %s\n",full_name.short_name);
 
     /* If the lpBuffer buffer is too small, the return value is the 
-------------- next part --------------
--- wine-cvs/windows/x11drv/event.c	Thu Jul  4 12:39:23 2002
+++ wine/windows/x11drv/event.c	Sat Jul 20 10:01:59 2002
@@ -107,8 +107,8 @@
 static int DGAKeyPressEventType;
 static int DGAKeyReleaseEventType;
 
-static BOOL DGAUsed = FALSE;
-static HWND DGAhwnd = 0;
+BOOL DGAUsed = FALSE;
+HWND DGAhwnd = 0;
 
 extern void X11DRV_DGAMotionEvent( HWND hwnd, XDGAMotionEvent *event );
 extern void X11DRV_DGAButtonPressEvent( HWND hwnd, XDGAButtonEvent *event );
@@ -126,16 +126,21 @@
 static int process_events( struct x11drv_thread_data *data )
 {
     XEvent event;
-    int count = 0;
+    int count = 0, events;
+    
+    Display *display = DGAUsed ? gdi_display : data->display;
 
     wine_tsx11_lock();
-    while ( XPending( data->display ) )
+    while ( (events = XPending( display )) )
     {
-        XNextEvent( data->display, &event );
-        wine_tsx11_unlock();
-        EVENT_ProcessEvent( &event );
-        count++;
-        wine_tsx11_lock();
+	do {
+    	    XNextEvent( display, &event );
+    	    wine_tsx11_unlock();
+    	    EVENT_ProcessEvent( &event );
+    	    count++;
+    	    wine_tsx11_lock();
+	}
+	while ( --events != 0);
     }
     wine_tsx11_unlock();
     return count;
--- wine-cvs/dlls/x11drv/mouse.c	Wed Jun 19 09:59:39 2002
+++ wine/dlls/x11drv/mouse.c	Sat Jul 20 10:01:24 2002
@@ -23,6 +23,8 @@
 
 int X11DRV_NoCursor;
 
+extern BOOL DGAUsed;
+
 /**********************************************************************/
 
 #define NB_BUTTONS   7     /* Windows can handle 3 buttons and the wheel too */
@@ -398,7 +400,7 @@
 static BOOL CALLBACK set_win_cursor( HWND hwnd, LPARAM cursor )
 {
     Window win = X11DRV_get_whole_window( hwnd );
-    if (win) TSXDefineCursor( thread_display(), win, (Cursor)cursor );
+    if (win) TSXDefineCursor( DGAUsed ? gdi_display : thread_display(), win, (Cursor)cursor );
     return TRUE;
 }
 
@@ -426,7 +428,7 @@
     }
     else /* set the same cursor for all top-level windows of the current thread */
     {
-        Display *display = thread_display();
+        Display *display = DGAUsed ? gdi_display : thread_display();
 
         wine_tsx11_lock();
         cursor = X11DRV_GetCursor( display, lpCursor );
@@ -446,7 +448,7 @@
  */
 void X11DRV_SetCursorPos( INT x, INT y )
 {
-    Display *display = thread_display();
+    Display *display = DGAUsed ? gdi_display : thread_display();
 
     TRACE( "warping to (%d,%d)\n", x, y );
 
@@ -461,7 +463,7 @@
  */
 void X11DRV_GetCursorPos(LPPOINT pos)
 {
-  Display *display = thread_display();
+  Display *display = DGAUsed ? gdi_display : thread_display();
   Window root, child;
   int rootX, rootY, winX, winY;
   unsigned int xstate;
@@ -487,7 +489,7 @@
     pKeyStateTable = key_state_table;
     /* Get the current mouse position and simulate an absolute mouse
        movement to initialize the mouse global variables */
-    TSXQueryPointer( thread_display(), root_window, &root, &child,
+    TSXQueryPointer( DGAUsed ? gdi_display : thread_display(), root_window, &root, &child,
                      &root_x, &root_y, &child_x, &child_y, &KeyState);
     update_key_state( KeyState );
     send_mouse_event( 0, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
-------------- next part --------------
--- winex-cvs/include/wine/debug.h	Fri Apr 19 18:52:22 2002
+++ wine/include/wine/debug.h	Wed May 15 16:14:14 2002
@@ -127,17 +127,33 @@
 inline static const char *debugres_a( const char *s )  { return wine_dbgstr_an( s, 80 ); }
 inline static const char *debugres_w( const WCHAR *s ) { return wine_dbgstr_wn( s, 80 ); }
 
-#define TRACE                      WINE_TRACE
-#define TRACE_(ch)                 WINE_TRACE_(ch)
-#define TRACE_ON(ch)               WINE_TRACE_ON(ch)
+#ifndef NO_TRACE_MSGS
+#   define TRACE                      WINE_TRACE
+#   define TRACE_(ch)                 WINE_TRACE_(ch)
+#   define TRACE_ON(ch)               WINE_TRACE_ON(ch)
+#else
+#   define TRACE(...)                 do{}while(0)
+#   define TRACE_(ch)                 TRACE
+#   define TRACE_ON(ch)               (0)
+#endif
 
-#define WARN                       WINE_WARN
-#define WARN_(ch)                  WINE_WARN_(ch)
-#define WARN_ON(ch)                WINE_WARN_ON(ch)
+#ifndef NO_DEBUG_MSGS
+#   define WARN                       WINE_WARN
+#   define WARN_(ch)                  WINE_WARN_(ch)
+#   define WARN_ON(ch)                WINE_WARN_ON(ch)
 
-#define FIXME                      WINE_FIXME
-#define FIXME_(ch)                 WINE_FIXME_(ch)
-#define FIXME_ON(ch)               WINE_FIXME_ON(ch)
+#   define FIXME                      WINE_FIXME
+#   define FIXME_(ch)                 WINE_FIXME_(ch)
+#   define FIXME_ON(ch)               WINE_FIXME_ON(ch)
+#else
+#   define WARN(...)                  do{}while(0)
+#   define WARN_(ch)                  WARN
+#   define WARN_ON(ch)                (0)
+
+#   define FIXME(...)                 do{}while(0)
+#   define FIXME_(ch)                 FIXME
+#   define FIXME_ON(ch)               (0)
+#endif
 
 #undef ERR  /* Solaris got an 'ERR' define in <sys/reg.h> */
 #define ERR                        WINE_ERR
-------------- next part --------------
%define DATE 20020507
Summary: A Windows 16/32 bit emulator.
Name: winex%{DATE}
Version: 2.0.x
Release: 16
Group: Applications/Emulators
License: Aladdin Free Public License
URL: http://www.transgaming.com/

Source: winex-%{DATE}-cvs.tar.bz2
Source2: winex.config
#Source2: winex.userreg
#Source3: winex.systemreg
#Source2: winex.config

#
#(cd dlls/opengl32; ./make_opengl specs2 1.2)
#
# after winex20020507 no pasaran, mlya! And I don't know why :-/
# So we'll go by other way ;-) - look at winex.patch-opengl-speedup
# new gl.spec and gl.tm from SGI not needed now.
#
# On my home Duron1200 GF4MX440 - Blue shift (HL'clone), Hazard Cource, at the begining
# before this patch timerefresh show 180FPS under wine and 340FPS in native windoze
# after patch and without -fPIC 330FPS and 337FPS with native glu32.dll under wine ;-)
# Any comments?
#
Patch:  winex.patch-opengl-speedup

#
# after --disable-debug & --disable-trace TRACE & WARN do stupid if()
# remove it
#
Patch2: winex.patch-debug

#
# enable mouse & keyboad with DGA, not finished yet
# Don't use DGA!!!
#
Patch3: winex.patch-dga

#
# Heroes III wants G:\\HMM3\\DATA\\filename.ext but has G:\\HMM3\\DATAfilename.ext :-)
#
Patch4: winex.patch-hmm3

Patch5: winex.patch-make
Patch6: winex.patch-registry
#Patch7: winex.patch-registry-hostname

#
# SeriousSam & SeriousSam-SE check opengl by if( exists( "$WINDOWSSYSTEMDIR/opengl32.dll"))
# so touch it. Maybe it looks at registry and add record to winedefault.reg?
# wglDescribePixelFormat return PFD_GENERIC_ACCELERATED but SSam expects PFD_SWAP_COPY or more.
# kgm, I'm not sure about PFD_SWAP_COPY, but NV windriver return that on GF2MX, so ... 
#
Patch8: winex.patch-SeriousSam

#
# Need for WarCraft III -opengl, already in winehq
#
Patch9: winex.patch-opengl-swap-buffers

#
# System Shock 2
#
Patch10: winex.patch-sshock

#
# not needed now, used winex.patch-opengl-speedup
#
Patch11: winex.patch-make_opengl



Buildroot: %{_tmppath}/%{name}-root
ExclusiveArch: %{ix86}

Prefix: /usr/local/winex%{DATE}
Prereq: shadow-utils
BuildRequires: docbook-utils autoconf253 flex bison 
#ipxutils

%description
While Wine is usually thought of as a Windows(TM) emulator, the Wine
developers would prefer that users thought of Wine as a Windows
compatibility layer for UNIX. This package includes a program loader,
which allows unmodified Windows 3.1/95/NT binaries to run under Intel
Unixes. Wine does not require MS Windows, but it can use native system
.dll files if they are available.

Accelerated opengl build

%package devel
Summary: Wine development environment.
Group: System Environment/Libraries
Requires: winex%{DATE} = %{version}

%description devel
Header and include files for developing applications with the Wine
Windows(TM) emulation libraries.

%package doc
Summary: Wine documentation.
Group: System Environment/Libraries
Requires: winex%{DATE} = %{version}

%description doc
Documantations for Wine.

%prep
%setup -q -n wine
find . -type d -name CVS |xargs rm -rf
%patch -p1
%patch2 -p1
#%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
#%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
#%patch11 -p1

%build

# kgm, conflict nvidia/GL/*.h and GL/glu.h
#export EXTRAINCL="-I/usr/share/doc/NVIDIA_GLX-1.0/usr/include"

#
# -fPIC eats 10-15% FPS in Half-Life on Celeron566
# 
mv configure.ac configure.ac.original
sed s/-fPIC// configure.ac.original > configure.ac

export CC="gcc31"
export CFLAGS="$RPM_OPT_FLAGS -mcpu=i686 -march=i686 -O2 -DNDEBUG -fomit-frame-pointer"
autoconf-2.53

%configure \
	--prefix=%{prefix} \
	--bindir=%{prefix}/bin \
	--libdir=%{prefix}/lib \
	--includedir=%{prefix}/include \
        --sysconfdir=%{prefix}/etc \
	--with-x \
	--enable-dll \
	--disable-debug \
        --disable-trace \
        --enable-opengl
#
# 
#	--enable-sdldrv

make depend
make
(cd programs/regapi; make) 
make -C documentation wine-doc/index.html

%install
rm -rf $RPM_BUILD_ROOT

%makeinstall \
	bindir=${RPM_BUILD_ROOT}%{prefix}/bin \
	libdir=${RPM_BUILD_ROOT}%{prefix}/lib \
	sysconfdir=${RPM_BUILD_ROOT}%{prefix}/etc \
	includedir=$RPM_BUILD_ROOT/usr/include/wine

(cd ${RPM_BUILD_ROOT}%{prefix}/bin; ln -s wine regapi)
cp programs/regapi/regapi.so ${RPM_BUILD_ROOT}%{prefix}/bin

# Take care of wine and windows configuration files...
mkdir -p ${RPM_BUILD_ROOT}%{prefix}/etc
mkdir -p $RPM_BUILD_ROOT/usr/bin
#install -c -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{prefix}/etc/wine.userreg
#install -c -m 0644 %{SOURCE3} $RPM_BUILD_ROOT%{prefix}/etc/wine.systemreg
#install -c documentation/samples/config $RPM_BUILD_ROOT%{prefix}/etc/config
install -c -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{prefix}/etc/config
install -c -m 0644 winedefault.reg $RPM_BUILD_ROOT%{prefix}/etc/winedefault.reg

cat >$RPM_BUILD_ROOT%{prefix}/bin/create-windows-dir <<EEOF
#!/bin/bash

[ x"\$1" = "x" ] && rootdir="/var/wine" || rootdir="\$1"

umask 002

for i in system Desktop Favorites Fonts NetHood "Start Menu/Programs/Startup" \\
         Recent SendTo ShellNew system32 Profiles/Administrator; do
	mkdir -p "\${rootdir}/disk/c/windows/\$i"
done
mkdir -p "\${rootdir}/disk/c/Program Files/Common Files"
mkdir -p "\${rootdir}/disk/c/My Documents"
mkdir -p "\${rootdir}/disk/g"

for i in shell.dll shell32.dll winsock.dll wnsock32.dll opengl32.dll; do
	touch \${rootdir}/disk/c/windows/system/\$i
done
touch \${rootdir}/disk/c/autoexec.bat
touch \${rootdir}/disk/c/config.sys
touch \${rootdir}/disk/c/io.sys
touch \${rootdir}/disk/c/windows/win.ini

cat >\${rootdir}/disk/c/windows/system.ini <<EOF
[mci]
cdaudio=mcicda.drv
sequencer=mciseq.drv
waveaudio=mciwave.drv
avivideo=mciavi.drv
videodisc=mcipionr.drv
vcr=mciviscd.drv
MPEGVideo=mciqtz.drv
EOF

chown -R root.gamer \${rootdir}
exit 0
EEOF
chmod 0755 $RPM_BUILD_ROOT%{prefix}/bin/create-windows-dir

#
#
#
echo "#!/bin/bash" > $RPM_BUILD_ROOT/usr/bin/winex%{DATE}
echo >> $RPM_BUILD_ROOT/usr/bin/winex%{DATE}
echo "WINEINSTDIR=/usr/local/winex"%{DATE} >> $RPM_BUILD_ROOT/usr/bin/winex%{DATE} 

cat >>$RPM_BUILD_ROOT/usr/bin/winex%{DATE} <<EOF
DISPHOST=\${DISPLAY/:*/}
DISPNUM=\${DISPLAY/\${DISPHOST}:}
DISPSCR=\${DISPNUM/.*/}; [ x"\$DISPSCR" = "x" ] && DISPSCR=0 
DISPNUM=\${DISPNUM/*./}

#echo \${WINEINSTDIR}/etc/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR}

export PATH=\${WINEINSTDIR}/bin:\$PATH
export LD_LIBRARY_PATH=\${WINEINSTDIR}/lib:\$LD_LIBRARY_PATH

#
# check for right *.reg
#
if [ ! -f \${WINEINSTDIR}/etc/wine.systemreg ]; then
    echo
    echo "Installing default Wine registry entries..."
    echo
    WINEPREFIXSAVE=\${WINEPREFIX}
    export WINEPREFIX=\${WINEINSTDIR}/etc
    WINEINI=\${WINEINSTDIR}/etc/config
    mv \${WINEINI} \${WINEINI}.original   
    # edit config files so we don't have to run regapi under X
    sed "s/\"GraphicsDriver\" = \"x11drv\"/\"GraphicsDriver\" = \"ttydrv\"/" \$WINEINI.original > \${WINEINI} 
    
    if ! regapi setValue < \${WINEINSTDIR}/etc/winedefault.reg > /dev/null ; then
	rm -rf \${WINEINSTDIR}/etc/wineserver-\`hostname -f\`
	rm -f \${WINEINI}
        mv \${WINEINI}.original \${WINEINI}
	echo "Registry install failed."
	exit 1
    fi
    sync
    rm -rf \${WINEINSTDIR}/etc/wineserver-\`hostname -f\`
    rm -f \${WINEINI}
    mv \${WINEINI}.original \${WINEINI}
    mv \${WINEINSTDIR}/etc/system.reg \${WINEINSTDIR}/etc/wine.systemreg
    mv \${WINEINSTDIR}/etc/userdef.reg \${WINEINSTDIR}/etc/wine.userreg
    rm -f \${WINEINSTDIR}/etc/user.reg
    WINEPREFIX=\${WINEPREFIXSAVE}
    [ x"\${*}" = "x" ] && exit 0
fi

[ -z \${WINEPREFIX} ] && WINEPREFIX=~/.winex
[ ! -d \${WINEPREFIX} ] && mkdir -p \${WINEPREFIX}
export WINEPREFIX

if [ -f \${WINEINSTDIR}/etc/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR} ]; then
    if [ \${WINEINSTDIR}/etc/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR} -nt \
	 \${WINEPREFIX}/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR} ]; then
	rm -f \${WINEPREFIX}/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR}
	ln -s \${WINEINSTDIR}/etc/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR} \
	      \${WINEPREFIX}/cachedmetrics.\${DISPHOST}:\${DISPNUM}.\${DISPSCR}
    fi
fi 

wine \$*

rm -rf \${WINEPREFIX}/wineserver-\`hostname -f\`
EOF
chmod 0755 $RPM_BUILD_ROOT/usr/bin/winex%{DATE}

%clean
rm -r $RPM_BUILD_ROOT

%post
groupadd -f gamer
%{prefix}/bin/create-windows-dir
winex%{DATE}

%files
%defattr(-,root,root)
/usr/local/winex%{DATE}/lib/lib*.so*
/usr/local/winex%{DATE}/bin/*
/usr/local/winex%{DATE}/etc/*
/usr/bin/*

%files doc
%{_mandir}/man?/*
%doc ANNOUNCE BUGS ChangeLog DEVELOPERS-HINTS LICENSE* README*
%doc AUTHORS WARRANTY *.reg
%doc documentation/ChangeLog.OLD documentation/HOWTO-winelib
%doc documentation/gui documentation/psdrv.reg documentation/shell32
%doc documentation/samples documentation/status
%doc documentation/wine-doc documentation/samples documentation/status
%doc programs/regapi/README

%files devel
%defattr(-,root,root)
/usr/include/*

%changelog
* Sun May 26 2002 Serge Ryabchun <sr at energy.uch.net> 20020507
- add new gl.tm and gl.spec

* Wed Nov 05 2001 Serge Ryabchun <sr at energy.uch.net> 20011107
- first build


More information about the wine-devel mailing list