Ticket #54236: mesa-egl.diff

File mesa-egl.diff, 4.6 KB (added by RJVB (René Bertin), 5 years ago)

update for mesa 17.1.6

  • x11/mesa/Portfile

    diff --git a/x11/mesa/Portfile b/x11/mesa/Portfile
    index 38ec882..26cc850 100644
    a b if {[string match *gcc* ${configure.compiler}]} { 
    5151    patchfiles-append no-missing-prototypes-error.patch
    5252}
    5353
    54 use_autoreconf      yes
     54if {![file exists ${worksrcpath}/config.log]} {
     55    use_autoreconf  yes
     56}
    5557autoreconf.args     -fvi
    5658
    5759configure.args \
    5860    --disable-silent-rules \
    5961    --with-platforms=x11 \
     62    --disable-dri3 \
    6063    --disable-egl \
    6164    --disable-gbm \
    6265    --disable-osmesa \
    if {![variant_isset python26] && ![variant_isset python27]} { 
    132135    default_variants-append +python27
    133136}
    134137
     138variant egl description {enable EGL support} {
     139    depends_lib-append      port:xorg-libxshmfence
     140    configure.args-replace  --disable-egl \
     141                            --enable-egl
     142    configure.args-append   --with-gallium-drivers=swrast
     143    patchfiles-append       patch-support-egl_dri2.diff
     144    post-patch {
     145        reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/src/egl/drivers/dri2/egl_dri2.c
     146    }
     147}
     148
     149    # This Mesa version isn't compatible yet with LLVM 5.0
     150    set lldversions {3.8 3.9 4.0}
     151    set llvariant ""
     152    foreach ldv ${lldversions} {
     153        set llv [join [lrange [split ${ldv} .] 0 1] ""]
     154        set conflist ""
     155        foreach v ${lldversions} {
     156            if {${v} ne ${ldv}} {
     157                set v [join [lrange [split ${v} .] 0 1] ""]
     158                set conflist "${conflist} llvm${v}"
     159            }
     160        }
     161        variant llvm${llv} conflicts ${conflist} description "Use LLVM/Clang ${ldv}" {}
     162        if {[variant_isset llvm${llv}]} {
     163            set llvariant llvm${llv}
     164        }
     165    }
     166    if {${llvariant} eq "" && ![variant_isset universal]} {
     167        default_variants \
     168                    +llvm40
     169    }
     170    foreach ldv ${lldversions} {
     171        set llv [join [lrange [split ${ldv} .] 0 1] ""]
     172        if {[variant_isset llvm${llv}]} {
     173            depends_lib-append \
     174                port:llvm-${ldv} port:clang-${ldv}
     175            configure.args-append \
     176                --enable-llvm \
     177                --with-llvm-prefix=${prefix}/libexec/llvm-${ldv} \
     178                --with-gallium-drivers=swrast
     179        }
     180    }
     181
    135182variant osmesa description {enable OSMesa library} {
    136183    configure.args-delete --disable-osmesa
    137184    configure.args-append --enable-osmesa
  • new file x11/mesa/files/patch-support-egl_dri2.diff

    diff --git a/x11/mesa/files/patch-support-egl_dri2.diff b/x11/mesa/files/patch-support-egl_dri2.diff
    new file mode 100644
    index 0000000..d9032ce
    - +  
     1diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
     2index 2cab7d0..ab8b93f 100644
     3--- a/src/egl/drivers/dri2/egl_dri2.c
     4+++ b/src/egl/drivers/dri2/egl_dri2.c
     5@@ -59,6 +59,12 @@
     6 #include "loader/loader.h"
     7 #include "util/u_atomic.h"
     8 
     9+#ifdef __MACH__
     10+#include <mach/mach.h>
     11+#include <mach/mach_time.h>
     12+#include <sys/sysctl.h>
     13+#endif
     14+
     15 /* The kernel header drm_fourcc.h defines the DRM formats below.  We duplicate
     16  * some of the definitions here so that building Mesa won't bleeding-edge
     17  * kernel headers.
     18@@ -2637,8 +2643,10 @@ dri2_create_sync(_EGLDriver *drv, _EGLDisplay *dpy,
     19          return NULL;
     20       }
     21 
     22+#ifndef __MACH__
     23       /* change clock attribute to CLOCK_MONOTONIC */
     24       ret = pthread_condattr_setclock(&attr, CLOCK_MONOTONIC);
     25+#endif
     26 
     27       if (ret) {
     28          _eglError(EGL_BAD_ACCESS, "eglCreateSyncKHR");
     29@@ -2785,7 +2793,19 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
     30       } else {
     31          /* if reusable sync has not been yet signaled */
     32          if (dri2_sync->base.SyncStatus != EGL_SIGNALED_KHR) {
     33+#ifndef __MACH__
     34             clock_gettime(CLOCK_MONOTONIC, &current);
     35+#else
     36+                 static int calibrated = 0;
     37+                 static mach_timebase_info_data_t sTimebaseInfo;
     38+                 if (!calibrated) {
     39+                         mach_timebase_info(&sTimebaseInfo);
     40+                         calibrated = 1;
     41+                 }
     42+                 unsigned long long now = mach_absolute_time() * sTimebaseInfo.numer / sTimebaseInfo.denom;
     43+                 current.tv_sec = now / 1000000000;
     44+                 current.tv_nsec = now % 1000000000;
     45+#endif
     46 
     47             /* calculating when to expire */
     48             expire.nsec = timeout % 1000000000L;
     49@@ -2909,7 +2929,7 @@ dri2_load(_EGLDriver *drv)
     50 #ifdef HAVE_ANDROID_PLATFORM
     51    const char *libname = "libglapi.so";
     52 #elif defined(__APPLE__)
     53-   const char *libname = "libglapi.0.dylib";
     54+   const char *libname = "@PREFIX@/lib/libglapi.0.dylib";
     55 #elif defined(__CYGWIN__)
     56    const char *libname = "cygglapi-0.dll";
     57 #else