From 437d23710f8838bb43999b97e5cd423c0eca3c43 Mon Sep 17 00:00:00 2001
From: Aimee Linden <aimee@lindenlab.com>
Date: Thu, 22 Apr 2010 16:09:54 +0100
Subject: EXT-7004 : Select GCC 4.0 automatically as the compiler in Xcode with
 Cmake 2.8.1

GCC 4.0 will be selected as the compiler in Xcode if building against the OS X 10.4 SDK which is incompatible with GCC 4.2

Also made it possible to override the selected SDK from the configure line, by using something like:
-DCMAKE_OSX_DEPLOYMENT_TARGET:STRING='10.4' -DCMAKE_OSX_SYSROOT:PATH='/Developer/SDKs/MacOSX10.5.sdk'

Reviewed by: Poppy.
---
 indra/cmake/Variables.cmake  | 31 +++++++++++++++++++++++++++----
 indra/newview/CMakeLists.txt |  6 +++---
 2 files changed, 30 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake
index db0b44eb8f..bfaf3f4f26 100644
--- a/indra/cmake/Variables.cmake
+++ b/indra/cmake/Variables.cmake
@@ -75,11 +75,33 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
 
 if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
   set(DARWIN 1)
-  # set this dynamically from the build system now -
-  # NOTE: wont have a distributable build unless you add this on the configure line with:
+
+  # NOTE: If specifying a different SDK with CMAKE_OSX_SYSROOT at configure
+  # time you should also specify CMAKE_OSX_DEPLOYMENT_TARGET explicitly,
+  # otherwise CMAKE_OSX_SYSROOT will be overridden here. We can't just check
+  # for it being unset, as it gets set to the system default :(
+
+  # Default to building against the 10.4 SDK if no deployment target is
+  # specified.
+  if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+    # NOTE: setting -isysroot is NOT adequate: http://lists.apple.com/archives/Xcode-users/2007/Oct/msg00696.html
+    # see http://public.kitware.com/Bug/view.php?id=9959 + poppy
+    set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
+    set(CMAKE_OSX_DEPLOYMENT_TARGET 10.4)
+  endif (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
+
+  # GCC 4.2 is incompatible with the MacOSX 10.4 SDK
+  if (${CMAKE_OSX_SYSROOT} MATCHES "10.4u")
+    set(CMAKE_XCODE_ATTRIBUTE_GCC_VERSION "4.0")
+  endif (${CMAKE_OSX_SYSROOT} MATCHES "10.4u")
+
+  # NOTE: To attempt an i386/PPC Universal build, add this on the configure line:
   # -DCMAKE_OSX_ARCHITECTURES:STRING='i386;ppc'
-  #set(CMAKE_OSX_ARCHITECTURES i386;ppc)
-  set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.4u.sdk)
+  # Build only for i386 by default, system default on MacOSX 10.6 is x86_64
+  if (NOT CMAKE_OSX_ARCHITECTURES)
+    set(CMAKE_OSX_ARCHITECTURES i386)
+  endif (NOT CMAKE_OSX_ARCHITECTURES)
+
   if (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
     set(ARCH universal)
   else (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
@@ -89,6 +111,7 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
       set(ARCH i386)
     endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "ppc")
   endif (CMAKE_OSX_ARCHITECTURES MATCHES "i386" AND CMAKE_OSX_ARCHITECTURES MATCHES "ppc")
+
   set(LL_ARCH ${ARCH}_darwin)
   set(LL_ARCH_DIR universal-darwin)
   set(WORD_SIZE 32)
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index efb16d1e42..cc1a79503e 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1390,7 +1390,7 @@ if (WINDOWS)
 
     # If adding a file to viewer_manifest.py in the WindowsManifest.construct() method, be sure to add the dependency
     # here.
-    # *NOTE:Mani - This is a crappy hack to have important dependecies for the viewer_manifest copy action
+    # *NOTE:Mani - This is a crappy hack to have important dependencies for the viewer_manifest copy action
     # be met. I'm looking forward to a source-code split-up project next year that will address this kind of thing.
     # In the meantime, if you have any ideas on how to easily maintain one list, either here or in viewer_manifest.py
     # and have the build deps get tracked *please* tell me about it.
@@ -1411,7 +1411,7 @@ if (WINDOWS)
     endif(USE_GOOGLE_PERFTOOLS)
   
 
-    set(COPY_INPUT_DEPENDECIES
+    set(COPY_INPUT_DEPENDENCIES
       # The following commented dependencies are determined at variably at build time. Can't do this here.
       #${SHARED_LIB_STAGING_DIR}/${CMAKE_CFG_INTDIR}/libtcmalloc_minimal.dll => None ... Skipping libtcmalloc_minimal.dll
       ${CMAKE_SOURCE_DIR}/../etc/message.xml
@@ -1507,7 +1507,7 @@ if (WINDOWS)
       DEPENDS 
         ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
         stage_third_party_libs
-        ${COPY_INPUT_DEPENDECIES}
+        ${COPY_INPUT_DEPENDENCIES}
       COMMENT "Performing viewer_manifest copy"
       )
     
-- 
cgit v1.2.3


From 1eebca1431962927a91ef4431092cd58b4ed3576 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Thu, 22 Apr 2010 14:27:14 -0600
Subject: fix for EXT-6928: Viewer crashes immediately after enabling HTTP
 Textures on a http-texture-server-1 simulator and EXT-7009: textures fetched
 through http are never cached.

---
 indra/newview/lltexturefetch.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index 2ea6e5936d..bcda51b500 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -850,6 +850,7 @@ bool LLTextureFetchWorker::doWork(S32 param)
 				mState = WAIT_HTTP_REQ;	
 
 				mFetcher->addToHTTPQueue(mID);
+				mSentRequest = QUEUED;
 				// Will call callbackHttpGet when curl request completes
 				std::vector<std::string> headers;
 				headers.push_back("Accept: image/x-j2c");
@@ -936,6 +937,11 @@ bool LLTextureFetchWorker::doWork(S32 param)
 			{
 				mFileSize = mBufferSize;
 			}
+			else //the file size is unknown
+			{
+				mFileSize = S32_MAX ; //flag the file is not fully loaded.
+			}
+
 			U8* buffer = new U8[mBufferSize];
 			if (cur_size > 0)
 			{
-- 
cgit v1.2.3


From 6837f660380d1d5ddff021e6c14273937ff11036 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Thu, 22 Apr 2010 14:32:49 -0600
Subject: trivial: convert to unix eol.

---
 indra/newview/lltexturefetch.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index bcda51b500..e64696b120 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -937,10 +937,10 @@ bool LLTextureFetchWorker::doWork(S32 param)
 			{
 				mFileSize = mBufferSize;
 			}
-			else //the file size is unknown
-			{
-				mFileSize = S32_MAX ; //flag the file is not fully loaded.
-			}
+			else //the file size is unknown
+			{
+				mFileSize = S32_MAX ; //flag the file is not fully loaded.
+			}
 
 			U8* buffer = new U8[mBufferSize];
 			if (cur_size > 0)
-- 
cgit v1.2.3