From 6f2bd694d9a21174648b4e4f76d6d078aa88265f Mon Sep 17 00:00:00 2001
From: Matthew Breindel <falcon@lindenlab.com>
Date: Sat, 26 Jun 2010 12:35:05 -0700
Subject: [PATCH] Fixed mac build (given LL_MESH_ENABLED set to 0).

---
 indra/llcommon/llmemory.h            | 20 ++++++++++++++++++--
 indra/llmath/llvolume.h              |  2 +-
 indra/newview/llspatialpartition.cpp |  4 +++-
 install.xml                          |  4 ++--
 4 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h
index 1c8c91f57e2..35935efa889 100644
--- a/indra/llcommon/llmemory.h
+++ b/indra/llcommon/llmemory.h
@@ -34,6 +34,22 @@
 
 #include <stdlib.h>
 
+// A not necessarily efficient, but general, aligned malloc http://stackoverflow.com/questions/196329/osx-lacks-memalign
+inline void* ll_aligned_malloc( size_t size, int align )
+{
+	void* mem = malloc( size + (align - 1) + sizeof(void*) );
+	char* aligned = ((char*)mem) + sizeof(void*);
+	aligned += align - ((uintptr_t)aligned & (align - 1));
+	
+	((void**)aligned)[-1] = mem;
+	return aligned;
+}
+
+inline void ll_aligned_free( void* ptr )
+{
+	free( ((void**)ptr)[-1] );
+}
+
 inline void* ll_aligned_malloc_16(size_t size) // returned hunk MUST be freed with ll_aligned_free_16().
 {
 #if defined(LL_WINDOWS)
@@ -65,7 +81,7 @@ inline void* ll_aligned_malloc_32(size_t size) // returned hunk MUST be freed wi
 #if defined(LL_WINDOWS)
 	return _mm_malloc(size, 32);
 #elif defined(LL_DARWIN)
-# error implement me.
+	return ll_aligned_malloc( size, 32 );
 #else
 	void *rtn;
 	if (LL_LIKELY(0 == posix_memalign(&rtn, 32, size)))
@@ -80,7 +96,7 @@ inline void ll_aligned_free_32(void *p)
 #if defined(LL_WINDOWS)
 	_mm_free(p);
 #elif defined(LL_DARWIN)
-# error implement me.
+	ll_aligned_free( p );
 #else
 	free(p); // posix_memalign() is compatible with heap deallocator
 #endif
diff --git a/indra/llmath/llvolume.h b/indra/llmath/llvolume.h
index af28337f57d..9cce94e6cf3 100644
--- a/indra/llmath/llvolume.h
+++ b/indra/llmath/llvolume.h
@@ -41,7 +41,7 @@ class LLVolumeParams;
 class LLProfile;
 class LLPath;
 
-#define LL_MESH_ENABLED 1
+#define LL_MESH_ENABLED 0
 
 template <class T> class LLOctreeNode;
 
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index dc193dc6002..9951cf0193f 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -2791,6 +2791,7 @@ void renderPhysicsShape(LLDrawable* drawable)
 
 		U32 data_mask = LLVertexBuffer::MAP_VERTEX;
 
+#if LL_MESH_ENABLED
 		if (volume->isMesh())
 		{			
 			LLUUID mesh_id = volume->getVolume()->getParams().getSculptID();
@@ -2827,7 +2828,8 @@ void renderPhysicsShape(LLDrawable* drawable)
 				return;
 			}
 		}
-
+#endif //LL_MESH_ENABLED
+		
 		//push faces
 		glColor3fv(color.mV);
 		glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
diff --git a/install.xml b/install.xml
index d84ab14d539..40ec65b2b01 100644
--- a/install.xml
+++ b/install.xml
@@ -1065,9 +1065,9 @@ anguage Infrstructure (CLI) international standard</string>
           <key>darwin</key>
           <map>
             <key>md5sum</key>
-            <string>01853c92592c9b969d2cdbc339738b98</string>
+            <string>b9fe5149a23cbc55a341867c2f6abb8e</string>
             <key>url</key>
-            <uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/llconvexdecomposition-0.1-darwin-20100624.tar.bz2</uri>
+            <uri>scp:install-packages.lindenlab.com:/local/www/install-packages/doc/llconvexdecomposition-0.1-darwin-20100626.tar.bz2</uri>
           </map>          
         </map>
       </map>
-- 
GitLab