[143971] trunk/dports/x11/mesa

jeremyhu at macports.org jeremyhu at macports.org
Mon Dec 28 19:01:58 PST 2015


Revision: 143971
          https://trac.macports.org/changeset/143971
Author:   jeremyhu at macports.org
Date:     2015-12-28 19:01:58 -0800 (Mon, 28 Dec 2015)
Log Message:
-----------
mesa: Fix build on Snow Leopard (#50139)

Modified Paths:
--------------
    trunk/dports/x11/mesa/Portfile
    trunk/dports/x11/mesa/files/static-strndup.patch

Modified: trunk/dports/x11/mesa/Portfile
===================================================================
--- trunk/dports/x11/mesa/Portfile	2015-12-29 02:55:34 UTC (rev 143970)
+++ trunk/dports/x11/mesa/Portfile	2015-12-29 03:01:58 UTC (rev 143971)
@@ -7,6 +7,7 @@
 name                mesa
 epoch               1
 version             11.1.0
+
 categories          x11 graphics
 maintainers         jeremyhu openmaintainer
 license             MIT

Modified: trunk/dports/x11/mesa/files/static-strndup.patch
===================================================================
--- trunk/dports/x11/mesa/files/static-strndup.patch	2015-12-29 02:55:34 UTC (rev 143970)
+++ trunk/dports/x11/mesa/files/static-strndup.patch	2015-12-29 03:01:58 UTC (rev 143971)
@@ -25,3 +25,52 @@
  /** \brief Find an option in an option cache with the name as key */
  static uint32_t findOption (const driOptionCache *cache, const char *name) {
      uint32_t len = strlen (name);
+--- a/src/glsl/linker.cpp	2015-12-27 23:31:13.000000000 -0800
++++ b/src/glsl/linker.cpp	2015-12-27 23:34:01.000000000 -0800
+@@ -81,6 +81,23 @@
+ #include "main/shaderobj.h"
+ #include "main/enums.h"
+ 
++#undef strndup
++#define strndup __linker_strndup
++static char *
++strndup(const char *str, size_t n)
++{
++    size_t len;
++    char *copy;
++
++    for (len = 0; len < n && str[len]; len++)
++            continue;
++
++    if ((copy = (char *)malloc(len + 1)) == NULL)
++            return (NULL);
++    memcpy(copy, str, len);
++    copy[len] = '\0';
++    return (copy);
++}
+ 
+ void linker_error(gl_shader_program *, const char *, ...);
+ 
+
+--- a/src/util/ralloc.c      2015-12-28 00:25:30.000000000 -0800
++++ b/src/util/ralloc.c   2015-12-28 00:26:50.000000000 -0800
+@@ -353,17 +353,17 @@ ralloc_strdup(const void *ctx, const cha
+ char *
+ ralloc_strndup(const void *ctx, const char *str, size_t max)
+ {
+    size_t n;
+    char *ptr;
+ 
+    if (unlikely(str == NULL))
+       return NULL;
+ 
+-   n = strnlen(str, max);
++   for (n = 0; n < max && str[n]; n++);
+    ptr = ralloc_array(ctx, char, n + 1);
+    memcpy(ptr, str, n);
+    ptr[n] = '\0';
+    return ptr;
+ }
+ 
+ /* helper routine for strcat/strncat - n is the exact amount to copy */
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20151228/fae42eb4/attachment.html>


More information about the macports-changes mailing list