libepoxy 1.2
[git/cygwin-packages/libepoxy.git] / 1.2-cygwin-tests.patch
1 --- origsrc/libepoxy-1.2/test/Makefile.am 2014-05-13 19:22:08.000000000 -0500
2 +++ src/libepoxy-1.2/test/Makefile.am 2015-05-17 10:58:52.341890600 -0500
3 @@ -31,11 +31,13 @@ libegl_common_la_SOURCES = \
4 egl_common.c \
5 egl_common.h
6 $()
7 +libegl_common_la_LIBADD = $(EPOXY)
8
9 libglx_common_la_SOURCES = \
10 glx_common.c \
11 glx_common.h
12 $()
13 +libglx_common_la_LIBADD = $(EPOXY)
14
15 libwgl_common_la_SOURCES = \
16 wgl_common.c \
17 @@ -179,7 +181,7 @@ glx_static_LDFLAGS = -static
18
19 glx_shared_znow_SOURCES = glx_static.c
20 glx_shared_znow_LDADD = $(DLOPEN_LIBS) $(EPOXY) libglx_common.la $(X11_LIBS)
21 -glx_shared_znow_LDFLAGS = -z now
22 +#glx_shared_znow_LDFLAGS = -z now
23
24 khronos_typedefs_SOURCES = \
25 khronos_typedefs.c \
26 --- origsrc/libepoxy-1.2/test/dlwrap.c 2015-05-17 11:18:26.787526300 -0500
27 +++ src/libepoxy-1.2/test/dlwrap.c 2015-05-17 11:04:59.051456800 -0500
28 @@ -41,6 +41,16 @@
29 #include <stdlib.h>
30 #include <string.h>
31 #include <assert.h>
32 +#ifdef __CYGWIN__
33 +#include <sys/cygwin.h>
34 +#ifdef __x86_64__
35 +#define RTLD_NEXT (void *)0x180040000
36 +#define DLSYM_ADDR (void *)0x1801246c1
37 +#else
38 +#define RTLD_NEXT (void *)0x61000000
39 +#define DLSYM_ADDR (void *)0x610e992c
40 +#endif
41 +#endif
42
43 #include "dlwrap.h"
44
45 @@ -64,9 +74,15 @@ static struct libwrap {
46 const char *symbol_prefix;
47 void *handle;
48 } wrapped_libs[] = {
49 +#ifdef __CYGWIN__
50 + { "cygGL-1.dll", "GL", NULL },
51 + { "cygEGL-1.dll", "EGL", NULL },
52 + { "cygGLESv2-2.dll", "GLES2", NULL },
53 +#else
54 { "libGL.so", "GL", NULL },
55 { "libEGL.so", "EGL", NULL },
56 { "libGLESv2.so", "GLES2", NULL },
57 +#endif
58 };
59
60 /* Match 'filename' against an internal list of libraries for which
61 @@ -131,7 +147,11 @@ __dlclose(void *handle)
62
63 if (wrap < wrapped_libs ||
64 wrap >= wrapped_libs + ARRAY_SIZE(wrapped_libs)) {
65 +#ifdef __CYGWIN__
66 + void (*real_dlclose)(void *handle) = dlwrap_real_dlsym(RTLD_NEXT, "dlclose");
67 +#else
68 void (*real_dlclose)(void *handle) = dlwrap_real_dlsym(RTLD_NEXT, "__dlclose");
69 +#endif
70 real_dlclose(handle);
71 }
72 }
73 @@ -211,6 +231,9 @@ dlwrap_real_dlsym(void *handle, const ch
74 static fips_dlsym_t real_dlsym = NULL;
75
76 if (!real_dlsym) {
77 +#ifdef __CYGWIN__
78 + real_dlsym = (fips_dlsym_t) DLSYM_ADDR;
79 +#else
80 /* FIXME: This brute-force, hard-coded searching for a versioned
81 * symbol is really ugly. The only reason I'm doing this is because
82 * I need some way to lookup the "dlsym" function in libdl, but
83 @@ -262,6 +285,7 @@ dlwrap_real_dlsym(void *handle, const ch
84
85 exit(1);
86 }
87 +#endif
88 }
89
90 return real_dlsym(handle, name);
91 @@ -276,7 +300,7 @@ override_GL_glXGetProcAddress(const char
92 if (symbol)
93 return symbol;
94
95 - return DEFER_TO_GL("libGL.so.1", override_GL_glXGetProcAddress,
96 + return DEFER_TO_GL(wrapped_libs[0].filename, override_GL_glXGetProcAddress,
97 "glXGetProcAddress", (name));
98 }
99
100 @@ -289,7 +313,7 @@ override_GL_glXGetProcAddressARB(const c
101 if (symbol)
102 return symbol;
103
104 - return DEFER_TO_GL("libGL.so.1", override_GL_glXGetProcAddressARB,
105 + return DEFER_TO_GL(wrapped_libs[0].filename, override_GL_glXGetProcAddressARB,
106 "glXGetProcAddressARB", (name));
107 }
108
109 @@ -310,6 +334,17 @@ override_EGL_eglGetProcAddress(const cha
110 return symbol;
111 }
112
113 - return DEFER_TO_GL("libEGL.so.1", override_EGL_eglGetProcAddress,
114 + return DEFER_TO_GL(wrapped_libs[1].filename, override_EGL_eglGetProcAddress,
115 "eglGetProcAddress", (name));
116 }
117 +
118 +#ifdef __CYGWIN__
119 +
120 +__attribute__((constructor))
121 +void _init (void)
122 +{
123 + cygwin_internal (CW_HOOK, "dlopen", dlopen);
124 + cygwin_internal (CW_HOOK, "dlsym", dlsym);
125 +}
126 +
127 +#endif
128 --- origsrc/libepoxy-1.2/test/egl_and_glx_different_pointers.c 2014-05-13 19:22:08.000000000 -0500
129 +++ src/libepoxy-1.2/test/egl_and_glx_different_pointers.c 2015-05-17 11:09:31.307528900 -0500
130 @@ -49,6 +49,14 @@
131 #include "glx_common.h"
132 #include "dlwrap.h"
133
134 +#ifdef __CYGWIN__
135 +#define GLX_LIB "cygGL-1.dll"
136 +#define ES2_LIB "cygGLESv2-2.dll"
137 +#else
138 +#define GLX_LIB "libGL.so.1"
139 +#define ES2_LIB "libGLESv2.so.2"
140 +#endif
141 +
142 #define GLX_FAKED_VENDOR_STRING "libepoxy override GLX"
143 #define EGL_FAKED_VENDOR_STRING "libepoxy override EGL"
144
145 @@ -66,7 +74,7 @@ override_GL_glGetString(GLenum e)
146 if (e == GL_VENDOR)
147 return GLX_FAKED_VENDOR_STRING;
148
149 - return DEFER_TO_GL("libGL.so.1", override_GL_glGetString,
150 + return DEFER_TO_GL(GLX_LIB, override_GL_glGetString,
151 "glGetString", (e));
152 }
153
154 @@ -76,7 +84,7 @@ override_GLES2_glGetString(GLenum e)
155 if (e == GL_VENDOR)
156 return EGL_FAKED_VENDOR_STRING;
157
158 - return DEFER_TO_GL("libGLESv2.so.2", override_GLES2_glGetString,
159 + return DEFER_TO_GL(ES2_LIB, override_GLES2_glGetString,
160 "glGetString", (e));
161 }
162
163 --- origsrc/libepoxy-1.2/test/egl_without_glx.c 2015-05-17 11:18:26.802528200 -0500
164 +++ src/libepoxy-1.2/test/egl_without_glx.c 2015-05-17 10:49:05.170329300 -0500
165 @@ -43,6 +43,20 @@
166
167 #include "egl_common.h"
168
169 +#ifdef __CYGWIN__
170 +#include <sys/cygwin.h>
171 +#define GLX_LIB "cygGL-1.dll"
172 +#define EGL_LIB "cygEGL-1.dll"
173 +#define ES1_LIB "cygGLESv1_CM-1.dll"
174 +#define ES2_LIB "cygGLESv2-2.dll"
175 +#else
176 +#define GLX_LIB "libGL.so.1"
177 +#define EGL_LIB "libEGL.so.1"
178 +#define ES1_LIB "libGLESv1_CM.so.1"
179 +#define ES2_LIB "libGLESv2.so.2"
180 +#endif
181 +
182 +
183 /**
184 * Wraps the system dlopen(), which libepoxy will end up calling when
185 * it tries to dlopen() the API libraries, and errors out the
186 @@ -53,14 +67,21 @@ void *
187 dlopen(const char *filename, int flag)
188 {
189 void * (*dlopen_unwrapped)(const char *filename, int flag);
190 +#ifdef __CYGWIN__
191 +#ifdef __x86_64__
192 + static void *RTLD_NEXT = (void *)0x180040000;
193 +#else
194 + static void *RTLD_NEXT = (void *)0x61000000;
195 +#endif
196 +#endif
197
198 - if (!strcmp(filename, "libGL.so.1"))
199 + if (!strcmp(filename, GLX_LIB))
200 return NULL;
201 #if GLES_VERSION == 2
202 - if (!strcmp(filename, "libGLESv1_CM.so.1"))
203 + if (!strcmp(filename, ES1_LIB))
204 return NULL;
205 #else
206 - if (!strcmp(filename, "libGLESv2.so.2"))
207 + if (!strcmp(filename, ES2_LIB))
208 return NULL;
209 #endif
210
211 @@ -81,7 +102,7 @@ static EGLenum extra_error = EGL_SUCCESS
212 static EGLBoolean
213 override_eglBindAPI(EGLenum api)
214 {
215 - void *egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
216 + void *egl = dlopen(EGL_LIB, RTLD_LAZY | RTLD_LOCAL);
217 EGLBoolean (*real_eglBindAPI)(EGLenum api) = dlsym(egl, "eglBindAPI");
218
219 last_api = api;
220 @@ -102,7 +123,7 @@ override_eglBindAPI(EGLenum api)
221 static EGLint
222 override_eglGetError(void)
223 {
224 - void *egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
225 + void *egl = dlopen(EGL_LIB, RTLD_LAZY | RTLD_LOCAL);
226 EGLint (*real_eglGetError)(void) = dlsym(egl, "eglGetError");
227
228 if (extra_error != EGL_SUCCESS) {
229 @@ -161,3 +182,13 @@ main(int argc, char **argv)
230
231 return pass != true;
232 }
233 +
234 +#ifdef __CYGWIN__
235 +
236 +__attribute__((constructor))
237 +void _init (void)
238 +{
239 + cygwin_internal (CW_HOOK, "dlopen", dlopen);
240 +}
241 +
242 +#endif
This page took 0.047901 seconds and 5 git commands to generate.