libepoxy 1.2
authorYaakov Selkowitz <yselkowi@redhat.com>
Sun, 17 May 2015 19:32:19 +0000 (14:32 -0500)
committerYaakov Selkowitz <yselkowi@redhat.com>
Sun, 17 May 2015 19:32:19 +0000 (14:32 -0500)
1.2-cygwin-dispatch.patch [new file with mode: 0644]
1.2-cygwin-fvisibility.patch [new file with mode: 0644]
1.2-cygwin-tests.patch [new file with mode: 0644]
libepoxy.cygport [new file with mode: 0644]

diff --git a/1.2-cygwin-dispatch.patch b/1.2-cygwin-dispatch.patch
new file mode 100644 (file)
index 0000000..02332b3
--- /dev/null
@@ -0,0 +1,82 @@
+--- origsrc/libepoxy-1.2/src/dispatch_common.c 2015-05-17 11:18:26.738020000 -0500
++++ src/libepoxy-1.2/src/dispatch_common.c     2015-05-17 10:39:30.933410400 -0500
+@@ -104,8 +104,16 @@
+ #ifdef __APPLE__
+ #define GLX_LIB "/opt/X11/lib/libGL.1.dylib"
++#elif defined __CYGWIN__
++#define GLX_LIB "cygGL-1.dll"
++#define EGL_LIB "cygEGL-1.dll"
++#define ES1_LIB "cygGLESv1_CM-1.dll"
++#define ES2_LIB "cygGLESv2-2.dll"
+ #else
+ #define GLX_LIB "libGL.so.1"
++#define EGL_LIB "libEGL.so.1"
++#define ES1_LIB "libGLESv1_CM.so.1"
++#define ES2_LIB "libGLESv2.so.2"
+ #endif
+ struct api {
+@@ -380,7 +388,7 @@ epoxy_current_context_is_glx(void)
+         return true;
+ #if PLATFORM_HAS_EGL
+-    sym = do_dlsym(&api.egl_handle, "libEGL.so.1", "eglGetCurrentContext",
++    sym = do_dlsym(&api.egl_handle, EGL_LIB, "eglGetCurrentContext",
+                    false);
+     if (sym && epoxy_egl_get_current_gl_context_api() != EGL_NONE)
+         return false;
+@@ -416,7 +424,7 @@ epoxy_conservative_has_gl_extension(cons
+ void *
+ epoxy_egl_dlsym(const char *name)
+ {
+-    return do_dlsym(&api.egl_handle, "libEGL.so.1", name, true);
++    return do_dlsym(&api.egl_handle, EGL_LIB, name, true);
+ }
+ void *
+@@ -446,7 +454,7 @@ epoxy_gles1_dlsym(const char *name)
+     if (epoxy_current_context_is_glx()) {
+         return epoxy_get_proc_address(name);
+     } else {
+-        return do_dlsym(&api.gles1_handle, "libGLESv1_CM.so.1", name, true);
++        return do_dlsym(&api.gles1_handle, ES1_LIB, name, true);
+     }
+ }
+@@ -456,7 +464,7 @@ epoxy_gles2_dlsym(const char *name)
+     if (epoxy_current_context_is_glx()) {
+         return epoxy_get_proc_address(name);
+     } else {
+-        return do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, true);
++        return do_dlsym(&api.gles2_handle, ES2_LIB, name, true);
+     }
+ }
+@@ -476,7 +484,7 @@ epoxy_gles3_dlsym(const char *name)
+     if (epoxy_current_context_is_glx()) {
+         return epoxy_get_proc_address(name);
+     } else {
+-        void *func = do_dlsym(&api.gles2_handle, "libGLESv2.so.2", name, false);
++        void *func = do_dlsym(&api.gles2_handle, ES2_LIB, name, false);
+         if (func)
+             return func;
+@@ -564,7 +572,7 @@ epoxy_get_bootstrap_proc_address(const c
+      * non-X11 ES2 context from loading a bunch of X11 junk).
+      */
+ #if PLATFORM_HAS_EGL
+-    get_dlopen_handle(&api.egl_handle, "libEGL.so.1", false);
++    get_dlopen_handle(&api.egl_handle, EGL_LIB, false);
+     if (api.egl_handle) {
+         switch (epoxy_egl_get_current_gl_context_api()) {
+         case EGL_OPENGL_API:
+@@ -575,7 +583,7 @@ epoxy_get_bootstrap_proc_address(const c
+              * us.  Try the GLES2 implementation first, and fall back
+              * to GLES1 otherwise.
+              */
+-            get_dlopen_handle(&api.gles2_handle, "libGLESv2.so.2", false);
++            get_dlopen_handle(&api.gles2_handle, ES2_LIB, false);
+             if (api.gles2_handle)
+                 return epoxy_gles2_dlsym(name);
+             else
diff --git a/1.2-cygwin-fvisibility.patch b/1.2-cygwin-fvisibility.patch
new file mode 100644 (file)
index 0000000..3cfb69e
--- /dev/null
@@ -0,0 +1,11 @@
+--- origsrc/libepoxy-1.2/configure.ac  2015-05-17 11:18:26.664510600 -0500
++++ src/libepoxy-1.2/configure.ac      2015-05-17 10:19:03.389032100 -0500
+@@ -122,7 +122,7 @@ AC_CHECK_LIB([dl], [dlopen], [DLOPEN_LIB
+ AC_SUBST([DLOPEN_LIBS])
+ case $host_os in
+-    mingw*)
++    cygwin*|mingw*)
+         # visibility flags aren't supported for windows DLLs, and the
+         # compiler whines to tell you so, so don't set them up.
+         ;;
diff --git a/1.2-cygwin-tests.patch b/1.2-cygwin-tests.patch
new file mode 100644 (file)
index 0000000..34e69be
--- /dev/null
@@ -0,0 +1,242 @@
+--- origsrc/libepoxy-1.2/test/Makefile.am      2014-05-13 19:22:08.000000000 -0500
++++ src/libepoxy-1.2/test/Makefile.am  2015-05-17 10:58:52.341890600 -0500
+@@ -31,11 +31,13 @@ libegl_common_la_SOURCES = \
+       egl_common.c \
+       egl_common.h
+       $()
++libegl_common_la_LIBADD = $(EPOXY)
+ libglx_common_la_SOURCES = \
+       glx_common.c \
+       glx_common.h
+       $()
++libglx_common_la_LIBADD = $(EPOXY)
+ libwgl_common_la_SOURCES = \
+       wgl_common.c \
+@@ -179,7 +181,7 @@ glx_static_LDFLAGS = -static
+ glx_shared_znow_SOURCES = glx_static.c
+ glx_shared_znow_LDADD = $(DLOPEN_LIBS) $(EPOXY) libglx_common.la $(X11_LIBS)
+-glx_shared_znow_LDFLAGS = -z now
++#glx_shared_znow_LDFLAGS = -z now
+ khronos_typedefs_SOURCES = \
+       khronos_typedefs.c \
+--- origsrc/libepoxy-1.2/test/dlwrap.c 2015-05-17 11:18:26.787526300 -0500
++++ src/libepoxy-1.2/test/dlwrap.c     2015-05-17 11:04:59.051456800 -0500
+@@ -41,6 +41,16 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <assert.h>
++#ifdef __CYGWIN__
++#include <sys/cygwin.h>
++#ifdef __x86_64__
++#define RTLD_NEXT (void *)0x180040000
++#define DLSYM_ADDR (void *)0x1801246c1
++#else
++#define RTLD_NEXT (void *)0x61000000
++#define DLSYM_ADDR (void *)0x610e992c
++#endif
++#endif
+ #include "dlwrap.h"
+@@ -64,9 +74,15 @@ static struct libwrap {
+     const char *symbol_prefix;
+     void *handle;
+ } wrapped_libs[] = {
++#ifdef __CYGWIN__
++    { "cygGL-1.dll", "GL", NULL },
++    { "cygEGL-1.dll", "EGL", NULL },
++    { "cygGLESv2-2.dll", "GLES2", NULL },
++#else
+     { "libGL.so", "GL", NULL },
+     { "libEGL.so", "EGL", NULL },
+     { "libGLESv2.so", "GLES2", NULL },
++#endif
+ };
+ /* Match 'filename' against an internal list of libraries for which
+@@ -131,7 +147,11 @@ __dlclose(void *handle)
+     if (wrap < wrapped_libs ||
+         wrap >= wrapped_libs + ARRAY_SIZE(wrapped_libs)) {
++#ifdef __CYGWIN__
++        void (*real_dlclose)(void *handle) = dlwrap_real_dlsym(RTLD_NEXT, "dlclose");
++#else
+         void (*real_dlclose)(void *handle) = dlwrap_real_dlsym(RTLD_NEXT, "__dlclose");
++#endif
+         real_dlclose(handle);
+     }
+ }
+@@ -211,6 +231,9 @@ dlwrap_real_dlsym(void *handle, const ch
+     static fips_dlsym_t real_dlsym = NULL;
+     if (!real_dlsym) {
++#ifdef __CYGWIN__
++      real_dlsym = (fips_dlsym_t) DLSYM_ADDR;
++#else
+         /* FIXME: This brute-force, hard-coded searching for a versioned
+          * symbol is really ugly. The only reason I'm doing this is because
+          * I need some way to lookup the "dlsym" function in libdl, but
+@@ -262,6 +285,7 @@ dlwrap_real_dlsym(void *handle, const ch
+             exit(1);
+         }
++#endif
+     }
+     return real_dlsym(handle, name);
+@@ -276,7 +300,7 @@ override_GL_glXGetProcAddress(const char
+     if (symbol)
+         return symbol;
+-    return DEFER_TO_GL("libGL.so.1", override_GL_glXGetProcAddress,
++    return DEFER_TO_GL(wrapped_libs[0].filename, override_GL_glXGetProcAddress,
+                        "glXGetProcAddress", (name));
+ }
+@@ -289,7 +313,7 @@ override_GL_glXGetProcAddressARB(const c
+     if (symbol)
+         return symbol;
+-    return DEFER_TO_GL("libGL.so.1", override_GL_glXGetProcAddressARB,
++    return DEFER_TO_GL(wrapped_libs[0].filename, override_GL_glXGetProcAddressARB,
+                        "glXGetProcAddressARB", (name));
+ }
+@@ -310,6 +334,17 @@ override_EGL_eglGetProcAddress(const cha
+             return symbol;
+     }
+-    return DEFER_TO_GL("libEGL.so.1", override_EGL_eglGetProcAddress,
++    return DEFER_TO_GL(wrapped_libs[1].filename, override_EGL_eglGetProcAddress,
+                        "eglGetProcAddress", (name));
+ }
++
++#ifdef __CYGWIN__
++
++__attribute__((constructor))
++void _init (void)
++{
++  cygwin_internal (CW_HOOK, "dlopen", dlopen);
++  cygwin_internal (CW_HOOK, "dlsym", dlsym);
++}
++
++#endif
+--- origsrc/libepoxy-1.2/test/egl_and_glx_different_pointers.c 2014-05-13 19:22:08.000000000 -0500
++++ src/libepoxy-1.2/test/egl_and_glx_different_pointers.c     2015-05-17 11:09:31.307528900 -0500
+@@ -49,6 +49,14 @@
+ #include "glx_common.h"
+ #include "dlwrap.h"
++#ifdef __CYGWIN__
++#define GLX_LIB "cygGL-1.dll"
++#define ES2_LIB "cygGLESv2-2.dll"
++#else
++#define GLX_LIB "libGL.so.1"
++#define ES2_LIB "libGLESv2.so.2"
++#endif
++
+ #define GLX_FAKED_VENDOR_STRING "libepoxy override GLX"
+ #define EGL_FAKED_VENDOR_STRING "libepoxy override EGL"
+@@ -66,7 +74,7 @@ override_GL_glGetString(GLenum e)
+     if (e == GL_VENDOR)
+         return GLX_FAKED_VENDOR_STRING;
+-    return DEFER_TO_GL("libGL.so.1", override_GL_glGetString,
++    return DEFER_TO_GL(GLX_LIB, override_GL_glGetString,
+                        "glGetString", (e));
+ }
+@@ -76,7 +84,7 @@ override_GLES2_glGetString(GLenum e)
+     if (e == GL_VENDOR)
+         return EGL_FAKED_VENDOR_STRING;
+-    return DEFER_TO_GL("libGLESv2.so.2", override_GLES2_glGetString,
++    return DEFER_TO_GL(ES2_LIB, override_GLES2_glGetString,
+                        "glGetString", (e));
+ }
+--- origsrc/libepoxy-1.2/test/egl_without_glx.c        2015-05-17 11:18:26.802528200 -0500
++++ src/libepoxy-1.2/test/egl_without_glx.c    2015-05-17 10:49:05.170329300 -0500
+@@ -43,6 +43,20 @@
+ #include "egl_common.h"
++#ifdef __CYGWIN__
++#include <sys/cygwin.h>
++#define GLX_LIB "cygGL-1.dll"
++#define EGL_LIB "cygEGL-1.dll"
++#define ES1_LIB "cygGLESv1_CM-1.dll"
++#define ES2_LIB "cygGLESv2-2.dll"
++#else
++#define GLX_LIB "libGL.so.1"
++#define EGL_LIB "libEGL.so.1"
++#define ES1_LIB "libGLESv1_CM.so.1"
++#define ES2_LIB "libGLESv2.so.2"
++#endif
++
++
+ /**
+  * Wraps the system dlopen(), which libepoxy will end up calling when
+  * it tries to dlopen() the API libraries, and errors out the
+@@ -53,14 +67,21 @@ void *
+ dlopen(const char *filename, int flag)
+ {
+     void * (*dlopen_unwrapped)(const char *filename, int flag);
++#ifdef __CYGWIN__
++#ifdef __x86_64__
++   static void *RTLD_NEXT = (void *)0x180040000;
++#else
++   static void *RTLD_NEXT = (void *)0x61000000;
++#endif
++#endif
+-    if (!strcmp(filename, "libGL.so.1"))
++    if (!strcmp(filename, GLX_LIB))
+         return NULL;
+ #if GLES_VERSION == 2
+-    if (!strcmp(filename, "libGLESv1_CM.so.1"))
++    if (!strcmp(filename, ES1_LIB))
+         return NULL;
+ #else
+-    if (!strcmp(filename, "libGLESv2.so.2"))
++    if (!strcmp(filename, ES2_LIB))
+         return NULL;
+ #endif
+@@ -81,7 +102,7 @@ static EGLenum extra_error = EGL_SUCCESS
+ static EGLBoolean
+ override_eglBindAPI(EGLenum api)
+ {
+-    void *egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
++    void *egl = dlopen(EGL_LIB, RTLD_LAZY | RTLD_LOCAL);
+     EGLBoolean (*real_eglBindAPI)(EGLenum api) = dlsym(egl, "eglBindAPI");
+     last_api = api;
+@@ -102,7 +123,7 @@ override_eglBindAPI(EGLenum api)
+ static EGLint
+ override_eglGetError(void)
+ {
+-    void *egl = dlopen("libEGL.so.1", RTLD_LAZY | RTLD_LOCAL);
++    void *egl = dlopen(EGL_LIB, RTLD_LAZY | RTLD_LOCAL);
+     EGLint (*real_eglGetError)(void) = dlsym(egl, "eglGetError");
+     if (extra_error != EGL_SUCCESS) {
+@@ -161,3 +182,13 @@ main(int argc, char **argv)
+     return pass != true;
+ }
++
++#ifdef __CYGWIN__
++
++__attribute__((constructor))
++void _init (void)
++{
++  cygwin_internal (CW_HOOK, "dlopen", dlopen);
++}
++
++#endif
diff --git a/libepoxy.cygport b/libepoxy.cygport
new file mode 100644 (file)
index 0000000..01af7e9
--- /dev/null
@@ -0,0 +1,28 @@
+NAME="libepoxy"
+VERSION=1.2
+RELEASE=1
+CATEGORY="Libs"
+SUMMARY="OpenGL function dispatch library"
+DESCRIPTION="Epoxy is a library for handling OpenGL function pointer management
+for you. It hides the complexity of dlopen(), dlsym(), glXGetProcAddress(),
+eglGetProcAddress(), etc. from the app developer, with very little knowledge
+needed on their part. They get to read GL specs and write code using undecorated
+function names like glCompileShader()."
+HOMEPAGE="https://github.com/anholt/libepoxy"
+SRC_URI="https://github.com/anholt/libepoxy/archive/v${VERSION}/libepoxy-v${VERSION}.tar.gz"
+PATCH_URI="
+       http://pkgs.fedoraproject.org/cgit/libepoxy.git/plain/0001-Use-the-EGL-pkgconfig-for-finding-eglplatform.h.patch
+       http://pkgs.fedoraproject.org/cgit/libepoxy.git/plain/0002-Fix-context-type-detection-if-we-find-eglGetCurrentC.patch
+       http://pkgs.fedoraproject.org/cgit/libepoxy.git/plain/0003-Avoid-name-conflicts-between-pkgconfig-s-EGL_LIBS-an.patch
+       http://pkgs.fedoraproject.org/cgit/libepoxy.git/plain/update-registry.patch
+       1.2-cygwin-dispatch.patch
+       1.2-cygwin-fvisibility.patch
+       1.2-cygwin-tests.patch
+"
+
+PKG_NAMES="libepoxy0 libepoxy-devel"
+libepoxy0_REQUIRES="libGL1"
+libepoxy0_CONTENTS="usr/bin/cygepoxy-0.dll usr/share/doc/"
+libepoxy_devel_CONTENTS="usr/include/epoxy/ usr/lib/libepoxy.dll.a usr/lib/pkgconfig/epoxy.pc"
+
+DOCS="README.md"
This page took 0.028118 seconds and 5 git commands to generate.