[132849] trunk/dports/x11/mesa

jeremyhu at macports.org jeremyhu at macports.org
Wed Feb 11 11:36:00 PST 2015


Revision: 132849
          https://trac.macports.org/changeset/132849
Author:   jeremyhu at macports.org
Date:     2015-02-11 11:36:00 -0800 (Wed, 11 Feb 2015)
Log Message:
-----------
mesa: Fix build on Snow Leopard (#46828)

Modified Paths:
--------------
    trunk/dports/x11/mesa/Portfile

Added Paths:
-----------
    trunk/dports/x11/mesa/files/no-missing-prototypes-error.patch
    trunk/dports/x11/mesa/files/static-strndup.patch

Modified: trunk/dports/x11/mesa/Portfile
===================================================================
--- trunk/dports/x11/mesa/Portfile	2015-02-11 19:16:50 UTC (rev 132848)
+++ trunk/dports/x11/mesa/Portfile	2015-02-11 19:36:00 UTC (rev 132849)
@@ -45,6 +45,12 @@
     5002-darwin-Suppress-type-conversion-warnings-for-GLhandl.patch \
     5003-applegl-Provide-requirements-of-_SET_DrawBuffers.patch
 
+if {[string match *gcc* ${configure.compiler}]} {
+    # Older gcc fail to do -Werror=missing-prototypes correctly
+    # https://trac.macports.org/ticket/46827
+    patchfiles-append no-missing-prototypes-error.patch
+}
+
 use_autoreconf      yes
 autoreconf.args     -fvi
 
@@ -55,21 +61,30 @@
     --disable-openvg \
     --with-gallium-drivers=
 
-if { ![file exists /usr/include/Xplugin.h] } {
-    # Xplugin.h is missing on Tiger
-    configure.cppflags-append -I${filespath}/include
-}
+platform darwin {
+    if {${os.major} < 11} {
+        # https://bugs.freedesktop.org/show_bug.cgi?id=89088
+        configure.env-append INDENT=cat
 
-configure.cppflags-delete -I${prefix}/include
+        patchfiles-append static-strndup.patch
+    }
 
-pre-configure {
-    if { ![file exists /usr/lib/libXplugin.dylib] } {
-        ui_error "Detected a problem with your development environment.  Please work around it by executing:"
-        ui_error "sudo ln -s libXplugin.1.dylib /usr/lib/libXplugin.dylib"
-        return -code error "missing libXplugin.dylib"
+    if { ![file exists /usr/include/Xplugin.h] } {
+        # Xplugin.h is missing on Tiger
+        configure.cppflags-append -I${filespath}/include
     }
+
+    pre-configure {
+        if { ![file exists /usr/lib/libXplugin.dylib] } {
+            ui_error "Detected a problem with your development environment.  Please work around it by executing:"
+            ui_error "sudo ln -s libXplugin.1.dylib /usr/lib/libXplugin.dylib"
+            return -code error "missing libXplugin.dylib"
+        }
+    }
 }
 
+configure.cppflags-delete -I${prefix}/include
+
 variant python26 conflicts python27 description {Use python 2.6} {
     depends_build-append \
         port:py26-libxml2

Added: trunk/dports/x11/mesa/files/no-missing-prototypes-error.patch
===================================================================
--- trunk/dports/x11/mesa/files/no-missing-prototypes-error.patch	                        (rev 0)
+++ trunk/dports/x11/mesa/files/no-missing-prototypes-error.patch	2015-02-11 19:36:00 UTC (rev 132849)
@@ -0,0 +1,22 @@
+--- a/configure.ac.orig	2015-02-06 16:09:51.000000000 -0800
++++ a/configure.ac	2015-02-11 10:34:57.000000000 -0800
+@@ -182,19 +182,6 @@ dnl Add flags for gcc and g++
+ if test "x$GCC" = xyes; then
+     CFLAGS="$CFLAGS -Wall -std=c99"
+ 
+-    # Enable -Werror=implicit-function-declaration and
+-    # -Werror=missing-prototypes, if available, or otherwise, just
+-    # -Wmissing-prototypes.  This is particularly useful to avoid
+-    # generating a loadable driver module that has undefined symbols.
+-    save_CFLAGS="$CFLAGS"
+-    AC_MSG_CHECKING([whether $CC supports -Werror=missing-prototypes])
+-    CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
+-    CFLAGS="$CFLAGS -Werror=missing-prototypes"
+-    AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+-		   AC_MSG_RESULT([yes]),
+-		   [CFLAGS="$save_CFLAGS -Wmissing-prototypes";
+-		    AC_MSG_RESULT([no])]);
+-
+     # Enable -fvisibility=hidden if using a gcc that supports it
+     save_CFLAGS="$CFLAGS"
+     AC_MSG_CHECKING([whether $CC supports -fvisibility=hidden])

Added: trunk/dports/x11/mesa/files/static-strndup.patch
===================================================================
--- trunk/dports/x11/mesa/files/static-strndup.patch	                        (rev 0)
+++ trunk/dports/x11/mesa/files/static-strndup.patch	2015-02-11 19:36:00 UTC (rev 132849)
@@ -0,0 +1,27 @@
+--- a/src/mesa/drivers/dri/common/xmlconfig.c.orig	2015-02-06 16:09:52.000000000 -0800
++++ a/src/mesa/drivers/dri/common/xmlconfig.c	2015-02-11 11:32:32.000000000 -0800
+@@ -105,6 +105,24 @@ static const char *__getProgramName () {
+ #    endif
+ #endif
+ 
++#undef strndup
++#define strndup __xmlconfig_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);
++}
++
+ /** \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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150211/c86030ff/attachment.html>


More information about the macports-changes mailing list