--- mesa-7.6.1-1.cygport (revision 9037) +++ mesa-7.6.1-1.cygport (working copy) @@ -2,13 +2,21 @@ HOMEPAGE="http://www.mesa3d.org/" SRC_URI="ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaLib-${PV}.tar.bz2 ftp://ftp.freedesktop.org/pub/mesa/${PV}/MesaDemos-${PV}.tar.bz2" +PATCH_URI=" + 0002-PTHREADS-should-be-defined-on-cygwin-also.patch + 0005-External-texture-compressor-names-are-same-on-Cygwin.patch + 0006-Bodge-for-cygwin-link-swrast.so-with-ligGL.dll.a-as-.patch + 0001-Cygwin-Various-changes-to-enable-mesa-to-be-built-fo.patch + 0002-Move-initialization-of-ext_list_first_time-out-of-DR.patch + " #PATCH_URI="7.5-build-egl.patch" SRC_DIR=Mesa-${PV} PKG_NAMES="mesa libGL1 libGL-devel libGLU1 libGLU-devel libGLw1 libGLw-devel - libOSMesa7 libOSMesa-devel" -mesa_CONTENTS="usr/bin/*.exe usr/share/doc/" + libOSMesa7 libOSMesa-devel mesademos" +mesa_CONTENTS="usr/bin/glxdemo.exe usr/bin/glxgears.exe usr/bin/glxinfo.exe + usr/bin/glxheads.exe usr/share/doc/" libGL1_CONTENTS='usr/bin/cygGL-1.dll usr/lib/dri/' libGL_devel_CONTENTS="--exclude=glu* usr/include/GL/gl*.h usr/include/GL/internal usr/lib/libGL.* usr/lib/pkgconfig/gl.pc" @@ -21,6 +29,8 @@ libOSMesa7_CONTENTS='usr/bin/cygOSMesa-7.dll' libOSMesa_devel_CONTENTS="usr/include/GL/*mesa*.h usr/lib/libOSMesa.* usr/lib/pkgconfig/osmesa.pc" +mesademos_CONTENTS="--exclude=glxdemo.exe --exclude=glxgears.exe + --exclude=glxheads.exe --exclude=glxinfo.exe usr/bin/*.exe" src_compile() { lndirs @@ -28,29 +38,45 @@ cygautoreconf cd ${B} # --enable-xcb: only for DRI driver? + +# clean up stuff which must be rebuilt + rm src/mesa/glapi/*.o + rm src/mesa/main/*.o + +# first build a standalone libOSMesa +# OSMesa-on-dri-GL is very hard to link correctly on cygwin +# as it relies on lazy binding of symbols in libOSMesa to swrast.so which is dynamically loaded by libGL cygconf \ --enable-shared --disable-static \ --disable-egl \ --disable-gallium \ --disable-glut \ + --disable-glu \ + --disable-glw \ --enable-motif \ + --with-driver=osmesa + + cygmake -j1 + +# clean up stuff which must be rebuilt + rm src/mesa/glapi/*.o + rm src/mesa/main/*.o + +# now build libGL and all the trimmings + cygconf \ + --enable-shared --disable-static \ + --disable-egl \ + --disable-gallium \ + --disable-glut \ + --enable-motif \ --with-demos=demos,glsl,redbook,samples,xdemos \ - --with-driver=xlib + --with-driver=dri --with-dri-drivers=swrast - mkdir -p lib - ln -sf /usr/lib/libGLEW.dll.a lib/libGLEW.dll.a || true + cygmake -j1 - cygmake -j1 APP_LIB_DEPS="-lX11" - cygmake -C src/mesa gl.pc osmesa.pc cygmake -C src/glu glu.pc cygmake -C src/glw glw.pc - - cd ${B}/src/mesa/drivers/dri/swrast - # _glapi_Dispatch/_glapi_Context are supposed to be defined by - # the implementor (i.e. XWin). The problem is that if there is no - # single implementor, then what to resolve against? - cygmake DEFINES="-DUSE_XSHM -DIN_DRI_DRIVER" MESA_MODULES="\$(TOP)/lib/libGL.dll.a" } src_test() { @@ -59,7 +85,7 @@ src_install() { cd ${B} - dobin $(find src -name '*.dll') progs/xdemos/glx{demo,gears,heads,info}.exe + dobin $(find src -name '*.dll') progs/*/*.exe dolib lib/libGL{,U,w}.dll.a lib/libOSMesa.dll.a # lib/libEGL.dll.a exeinto /usr/lib/dri --- 0001-Cygwin-Various-changes-to-enable-mesa-to-be-built-fo.patch (revision 0) +++ 0001-Cygwin-Various-changes-to-enable-mesa-to-be-built-fo.patch (revision 0) @@ -0,0 +1,205 @@ +From 87b6b721e400e7a8e253a2ae7b52b3320709b2e9 Mon Sep 17 00:00:00 2001 +From: Jon TURNEY +Date: Wed, 24 Feb 2010 14:36:36 +0000 +Subject: [PATCH 1/2] Cygwin: Various changes to enable mesa to be built for Cygwin -with-driver=dri -with-dri-driver=swrast rather than -with-driver=x11 + +This allows DRI driver to be built with only the swrast driver, and not +requiring the platform to have DRM support + +In configure.ac, no_drm_is_fatal is introduced to try to make behaviour on platforms which +expect to have DRM available the same as before + +Signed-off-by: Jon TURNEY +--- + configure.ac | 51 ++++++++++++++++++++++++++++++++++++++++++++---- + src/glx/x11/Makefile | 19 +++++++++++++---- + src/glx/x11/glxcmds.c | 4 ++- + src/glx/x11/glxext.c | 3 ++ + src/glx/x11/xf86dri.h | 5 ++++ + 5 files changed, 71 insertions(+), 11 deletions(-) + +diff --git a/configure.ac b/configure.ac +index dfc8e1a..1d26279 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -539,6 +539,22 @@ else + enable_xcb=no + fi + ++dnl is DRM expected on the target platform? ++case "$host_os" in ++linux*|*-gnu*|gnu*) ++ no_drm_is_fatal=yes ++ ;; ++solaris*) ++ no_drm_is_fatal=yes ++ ;; ++cygwin*) ++ no_drm_is_fatal=no ++ ;; ++darwin* ) ++ no_drm_is_fatal=no ++ ;; ++esac ++ + dnl + dnl libGL configuration per driver + dnl +@@ -573,10 +589,18 @@ dri) + fi + + # Check for libdrm +- PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED]) +- PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED]) +- GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" +- DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" ++ PKG_CHECK_MODULES([LIBDRM], [libdrm >= $LIBDRM_REQUIRED], HAVE_LIBDRM=yes, HAVE_LIBDRM=no) ++ PKG_CHECK_MODULES([DRI2PROTO], [dri2proto >= $DRI2PROTO_REQUIRED], HAVE_DRI2PROTO=yes, HAVE_DRI2PROTO=no) ++ ++ if test "$HAVE_LIBDRM" = no; then ++ if test "$no_drm_is_fatal" = yes; then ++ AC_MSG_ERROR([LIBDRM $LIBDRM_REQUIRED is required by DRI driver]) ++ fi ++ LIBDRM_CFLAGS=-DNO_LIBDRM ++ else ++ GL_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED dri2proto >= $DRI2PROTO_REQUIRED" ++ DRI_PC_REQ_PRIV="libdrm >= $LIBDRM_REQUIRED" ++ fi + + PKG_CHECK_MODULES([LIBDRM_RADEON], [libdrm_radeon libdrm >= $LIBDRM_RADEON_REQUIRED], HAVE_LIBDRM_RADEON=yes, HAVE_LIBDRM_RADEON=no) + +@@ -587,8 +611,15 @@ dri) + + # find the DRI deps for libGL + if test "$x11_pkgconfig" = yes; then ++ dri_modules="x11 xext xdamage xfixes" ++ ++ # add xf86vidmode if available ++ PKG_CHECK_MODULES([XF86VIDMODE], [xxf86vm], HAVE_XF86VIDMODE=yes, HAVE_XF86VIDMODE=no) ++ if test "$HAVE_XF86VIDMODE" = yes ; then ++ dri_modules="$dri_modules xxf86vm" ++ fi ++ + # add xcb modules if necessary +- dri_modules="x11 xext xxf86vm xdamage xfixes" + if test "$enable_xcb" = yes; then + dri_modules="$dri_modules x11-xcb xcb-glx" + fi +@@ -772,6 +803,16 @@ if test "$mesa_driver" = dri; then + DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" + fi + ;; ++ cygwin*) ++ DEFINES="$DEFINES -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER" ++ if test "x$driglx_direct" = xyes; then ++ DEFINES="$DEFINES -DGLX_DIRECT_RENDERING" ++ fi ++ DEFINES="$DEFINES -DGLX_INDIRECT_RENDERING" ++ if test "x$DRI_DIRS" = "xyes"; then ++ DRI_DIRS="swrast" ++ fi ++ ;; + esac + + # default drivers +diff --git a/src/glx/x11/Makefile b/src/glx/x11/Makefile +index 86d84d4..906eb95 100644 +--- a/src/glx/x11/Makefile ++++ b/src/glx/x11/Makefile +@@ -1,9 +1,21 @@ + TOP = ../../.. + include $(TOP)/configs/current + +-EXTRA_DEFINES = -DXF86VIDMODE -D_REENTRANT -UIN_DRI_DRIVER \ ++EXTRA_DEFINES = -D_REENTRANT -UIN_DRI_DRIVER \ + -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" + ++ifdef HAVE_XF86VIDMODE ++EXTRA_DEFINES = $(EXTRA_DEFINES) -DXF86VIDMODE ++endif ++ ++ifdef HAVE_LIBDRM ++DRI_SOURCES = \ ++ dri_glx.c \ ++ XF86dri.c \ ++ dri2_glx.c \ ++ dri2.c ++endif ++ + SOURCES = \ + glcontextmodes.c \ + clientattrib.c \ +@@ -33,11 +45,8 @@ SOURCES = \ + glx_query.c \ + drisw_glx.c \ + dri_common.c \ +- dri_glx.c \ +- XF86dri.c \ + glxhash.c \ +- dri2_glx.c \ +- dri2.c ++ $(DRI_SOURCES) + + include $(TOP)/src/mesa/sources.mak + +diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c +index daa9076..866f4a0 100644 +--- a/src/glx/x11/glxcmds.c ++++ b/src/glx/x11/glxcmds.c +@@ -40,7 +40,9 @@ + + #ifdef GLX_DIRECT_RENDERING + #include ++#ifdef XF86VIDMODE + #include ++#endif + #include "xf86dri.h" + #endif + +@@ -3019,7 +3021,7 @@ static const struct name_address_pair GLX_functions[] = { + GLX_FUNCTION2(glXBindTexImageEXT, __glXBindTexImageEXT), + GLX_FUNCTION2(glXReleaseTexImageEXT, __glXReleaseTexImageEXT), + +-#ifdef GLX_DIRECT_RENDERING ++#if defined(GLX_DIRECT_RENDERING) && !defined(NO_LIBDRM) + /*** DRI configuration ***/ + GLX_FUNCTION(glXGetScreenDriver), + GLX_FUNCTION(glXGetDriverConfig), +diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c +index e5553cb..de89e85 100644 +--- a/src/glx/x11/glxext.c ++++ b/src/glx/x11/glxext.c +@@ -715,10 +715,13 @@ __glXInitialize(Display * dpy) + ** Note: This _must_ be done before calling any other DRI routines + ** (e.g., those called in AllocAndFetchScreenConfigs). + */ ++#ifndef NO_LIBDRM + if (glx_direct && glx_accel) { + dpyPriv->dri2Display = dri2CreateDisplay(dpy); + dpyPriv->driDisplay = driCreateDisplay(dpy); + } ++#endif ++ + if (glx_direct) + dpyPriv->driswDisplay = driswCreateDisplay(dpy); + #endif +diff --git a/src/glx/x11/xf86dri.h b/src/glx/x11/xf86dri.h +index f2d0dd5..a4388aa 100644 +--- a/src/glx/x11/xf86dri.h ++++ b/src/glx/x11/xf86dri.h +@@ -39,7 +39,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + #define _XF86DRI_H_ + + #include ++#ifndef NO_LIBDRM + #include ++#else ++typedef unsigned int drm_handle_t; ++typedef unsigned int drm_magic_t; ++#endif + + #define X_XF86DRIQueryVersion 0 + #define X_XF86DRIQueryDirectRenderingCapable 1 +-- +1.6.6.1 + --- 0005-External-texture-compressor-names-are-same-on-Cygwin.patch (revision 0) +++ 0005-External-texture-compressor-names-are-same-on-Cygwin.patch (revision 0) @@ -0,0 +1,27 @@ +From 0a418262979b1bd3c98621047cc6a27b755d9602 Mon Sep 17 00:00:00 2001 +From: Jon TURNEY +Date: Thu, 23 Jul 2009 19:30:02 +0100 +Subject: [PATCH 5/9] External texture compressor names are same on Cygwin as Mingw + + +Signed-off-by: Jon TURNEY +--- + src/mesa/main/texcompress_s3tc.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c +index a1c0f18..a52f714 100644 +--- a/src/mesa/main/texcompress_s3tc.c ++++ b/src/mesa/main/texcompress_s3tc.c +@@ -44,7 +44,7 @@ + #include "texformat.h" + #include "texstore.h" + +-#ifdef __MINGW32__ ++#if defined (__MINGW32__) || defined (__CYGWIN__) + #define DXTN_LIBNAME "dxtn.dll" + #define RTLD_LAZY 0 + #define RTLD_GLOBAL 0 +-- +1.6.3.2 + --- 0006-Bodge-for-cygwin-link-swrast.so-with-ligGL.dll.a-as-.patch (revision 0) +++ 0006-Bodge-for-cygwin-link-swrast.so-with-ligGL.dll.a-as-.patch (revision 0) @@ -0,0 +1,32 @@ +From d495840a287fba024861157fa4c6381fcac5be8c Mon Sep 17 00:00:00 2001 +From: Jon TURNEY +Date: Thu, 23 Jul 2009 19:31:07 +0100 +Subject: [PATCH 9/9] Bodge for cygwin: link swrast.so with libGL.dll.a to resolve all symbols + +_glapi_Dispatch/_glapi_Context are supposed to be defined by +the implementor (i.e. XWin). The problem is that if there is no +single implementor, then what to resolve against? + +We link again libGL.dll.a to provide those symbols (and take other +steps in XWin to avoid duplicating symbols there) + +Signed-off-by: Jon TURNEY +--- + src/mesa/drivers/dri/Makefile.template | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template +index 18dbeba..0b7ec3f 100644 +--- a/src/mesa/drivers/dri/Makefile.template ++++ b/src/mesa/drivers/dri/Makefile.template +@@ -1,6 +1,6 @@ + # -*-makefile-*- + +-MESA_MODULES = $(TOP)/src/mesa/libmesa.a ++MESA_MODULES = $(TOP)/src/mesa/libmesa.a $(TOP)/lib/libGL.dll.a + + COMMON_GALLIUM_SOURCES = \ + ../common/utils.c \ +-- +1.6.3.2 + --- 0002-Move-initialization-of-ext_list_first_time-out-of-DR.patch (revision 0) +++ 0002-Move-initialization-of-ext_list_first_time-out-of-DR.patch (revision 0) @@ -0,0 +1,76 @@ +From 24fb257123b07830ccebfabfb6bc3750bb47128a Mon Sep 17 00:00:00 2001 +From: Jon TURNEY +Date: Wed, 1 Jul 2009 21:18:13 +0100 +Subject: [PATCH 2/2] Move initialization of ext_list_first_time out of DRI driver + +It needs to get set when the psc is created even if DRI is forced off, +so psc->direct_support is initialized correctly, otherwise +__glXExtensionBitIsEnabled() always returns FALSE + +Signed-off-by: Jon TURNEY +--- + src/glx/x11/dri2_glx.c | 3 --- + src/glx/x11/dri_glx.c | 3 --- + src/glx/x11/drisw_glx.c | 3 --- + src/glx/x11/glxext.c | 3 +++ + 4 files changed, 3 insertions(+), 9 deletions(-) + +diff --git a/src/glx/x11/dri2_glx.c b/src/glx/x11/dri2_glx.c +index 89efe3a..f09af6f 100644 +--- a/src/glx/x11/dri2_glx.c ++++ b/src/glx/x11/dri2_glx.c +@@ -433,9 +433,6 @@ dri2CreateScreen(__GLXscreenConfigs * psc, int screen, + if (psp == NULL) + return NULL; + +- /* Initialize per screen dynamic client GLX extensions */ +- psc->ext_list_first_time = GL_TRUE; +- + if (!DRI2Connect(psc->dpy, RootWindow(psc->dpy, screen), + &driverName, &deviceName)) + return NULL; +diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c +index 4f7acb6..117bc76 100644 +--- a/src/glx/x11/dri_glx.c ++++ b/src/glx/x11/dri_glx.c +@@ -659,9 +659,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, + if (psp == NULL) + return NULL; + +- /* Initialize per screen dynamic client GLX extensions */ +- psc->ext_list_first_time = GL_TRUE; +- + if (!driGetDriverName(priv->dpy, screen, &driverName)) { + Xfree(psp); + return NULL; +diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c +index 1866b2c..0382513 100644 +--- a/src/glx/x11/drisw_glx.c ++++ b/src/glx/x11/drisw_glx.c +@@ -365,9 +365,6 @@ driCreateScreen(__GLXscreenConfigs * psc, int screen, + if (psp == NULL) + return NULL; + +- /* Initialize per screen dynamic client GLX extensions */ +- psc->ext_list_first_time = GL_TRUE; +- + psc->driver = driOpenDriver(driverName); + if (psc->driver == NULL) + goto handle_error; +diff --git a/src/glx/x11/glxext.c b/src/glx/x11/glxext.c +index de89e85..4efa4d9 100644 +--- a/src/glx/x11/glxext.c ++++ b/src/glx/x11/glxext.c +@@ -619,6 +619,9 @@ AllocAndFetchScreenConfigs(Display * dpy, __GLXdisplayPrivate * priv) + if (psc->drawHash == NULL) + continue; + ++ /* Initialize per screen dynamic client GLX extensions */ ++ psc->ext_list_first_time = GL_TRUE; ++ + if (priv->dri2Display) + psc->driScreen = (*priv->dri2Display->createScreen) (psc, i, priv); + +-- +1.6.6.1 + --- 0002-PTHREADS-should-be-defined-on-cygwin-also.patch (revision 0) +++ 0002-PTHREADS-should-be-defined-on-cygwin-also.patch (revision 0) @@ -0,0 +1,27 @@ +From fb31cf724a6ab274a0fe93026533b7a72e3323d2 Mon Sep 17 00:00:00 2001 +From: Jon TURNEY +Date: Tue, 23 Jun 2009 00:16:19 +0100 +Subject: [PATCH 2/9] PTHREADS should be defined on cygwin, also + +Signed-off-by: Jon TURNEY +--- + configure.ac | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 9b65d96..b10f8b3 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -90,6 +90,9 @@ linux*|*-gnu*|gnu*) + solaris*) + DEFINES="$DEFINES -DPTHREADS -DSVR4" + ;; ++cygwin*) ++ DEFINES="$DEFINES -DPTHREADS" ++ ;; + esac + + dnl Add flags for gcc and g++ +-- +1.6.3.2 + --- mesademos.hint (revision 0) +++ mesademos.hint (revision 0) @@ -0,0 +1,5 @@ +category: X11 +requires: libgcc1 libGL1 libX11_6 mesa +external-source: mesa +sdesc: "X11 OpenGL libraries (demos)" +ldesc: "X11 OpenGL libraries "