pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/45655: wine-devel from pkgsrc-current fails to build on NetBSD 5.0.1



>Number:         45655
>Category:       pkg
>Synopsis:       wine-devel from pkgsrc-current fails to build on NetBSD 5.0.1
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 26 14:35:00 +0000 2011
>Originator:     Nat Sloss
>Release:        NetBSD 5.0.1
>Organization:
>Environment:
NetBSD beast 5.0.1 NetBSD 5.0.1 (BEAST) #0: Tue Nov 22 21:39:49 EST 2011  
build@beast:/home/build/NetBSD-5.0.1_source_tree/usr/src/sys/arch/i386/compile/BEAST
 i386

>Description:
Hi,

wine-devel (1.3.26) fails to compile on NetBSD 5.0.1.

The compilation fails with the following errors:

mesh.o: In function `load_skin_mesh_from_xof':
mesh.c:(.text+0x3b96): undefined reference to `fmaxf'
mesh.c:(.text+0x3ba4): undefined reference to `fminf'
mesh.c:(.text+0x3bb3): undefined reference to `fmaxf'
mesh.c:(.text+0x3bc1): undefined reference to `fminf'
mesh.c:(.text+0x3bd0): undefined reference to `fmaxf'
mesh.c:(.text+0x3bde): undefined reference to `fminf'
mesh.c:(.text+0x3bed): undefined reference to `fmaxf'
mesh.c:(.text+0x3bfb): undefined reference to `fminf'
winegcc: cc failed
gmake[1]: *** [d3dx9_36.dll.so] Error 2
gmake[1]: Leaving directory 
`/home/admin/pkgsrc-2011Q1/pkgsrc/local/wine-devel/work/wine-1.3.26/dlls/d3dx9_36'
gmake: *** [dlls/d3dx9_36] Error 2

This is because fmin and fmax functions do not exist prior to NetBSD 5.1.


>How-To-Repeat:
Build wine-devel from pkgsrc 2011Q2,Q3 or current on a NetBSD system prior to 
NETBSD 5.1.
>Fix:
I have solved the problem using MIN and MAX from <sys/param.h>.
Hopefully it is a close enough approximation.  It seems to work well.

--- dlls/d3dx9_36/mesh.c.orig   2011-08-05 17:24:22.000000000 +0000
+++ dlls/d3dx9_36/mesh.c
@@ -41,6 +41,10 @@
 #include "wine/list.h"
 #include "d3dx9_36_private.h"

+#if defined(__NetBSD__)
+#include <sys/param.h>
+#endif
+
 WINE_DEFAULT_DEBUG_CHANNEL(d3dx);

 typedef struct ID3DXMeshImpl
@@ -2548,10 +2552,17 @@ static HRESULT parse_vertex_colors(IDire
         }
         memcpy(&color, data, sizeof(color));
         data += sizeof(color);
+#if (defined(__NetBSD__) && (__NetBSD_Version__ < 501000000))
+        color.r = MIN(1.0f, MAX(0.0f, color.r));
+        color.g = MIN(1.0f, MAX(0.0f, color.g));
+        color.b = MIN(1.0f, MAX(0.0f, color.b));
+        color.a = MIN(1.0f, MAX(0.0f, color.a));
+#else
         color.r = fminf(1.0f, fmaxf(0.0f, color.r));
         color.g = fminf(1.0f, fmaxf(0.0f, color.g));
         color.b = fminf(1.0f, fmaxf(0.0f, color.b));
         color.a = fminf(1.0f, fmaxf(0.0f, color.a));
+#endif
         mesh->vertex_colors[index] = D3DCOLOR_ARGB((BYTE)(color.a * 255.0f + 
0.5f),
                                                    (BYTE)(color.r * 255.0f + 
0.5f),
                                                    (BYTE)(color.g * 255.0f + 
0.5f),


I hope this fixes the problem for others, it has for me.

Regards,

Nat.



Home | Main Index | Thread Index | Old Index