From e9e459c89cdfc57f32ffc7c421e01f43348f3b6c Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Thu, 20 Sep 2012 17:13:16 +0000
Subject: [PATCH] Restoring llrenderheadless changes so we can fix them

---
 indra/cmake/LLRender.cmake    | 15 ++++------
 indra/llcommon/llfile.h       |  2 +-
 indra/llrender/CMakeLists.txt | 54 +++++++++++++++++------------------
 3 files changed, 34 insertions(+), 37 deletions(-)

diff --git a/indra/cmake/LLRender.cmake b/indra/cmake/LLRender.cmake
index e438872772f..6695ed6bd91 100644
--- a/indra/cmake/LLRender.cmake
+++ b/indra/cmake/LLRender.cmake
@@ -8,18 +8,15 @@ set(LLRENDER_INCLUDE_DIRS
     ${GLH_INCLUDE_DIR}
     )
 
-#if ((SERVER OR BAKING) AND LINUX)
-#  set(LLRENDER_LIBRARIES
-#      llrenderheadless
-#      )
-#else ((SERVER OR BAKING) AND LINUX)
-#set(LLRENDER_LIBRARIES
-#    llrender
-#    )
-#endif ((SERVER OR BAKING) AND LINUX)
+if ((SERVER OR BAKING) AND LINUX)
+  set(LLRENDER_LIBRARIES
+      llrenderheadless
+      )
+else ((SERVER OR BAKING) AND LINUX)
 set(LLRENDER_LIBRARIES
     llrender
     )
+endif ((SERVER OR BAKING) AND LINUX)
 
 # mapserver requires certain files to be copied so LL_MESA_HEADLESS can be set
 # differently for different object files.
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h
index 9d70db96ea8..7049ab13969 100644
--- a/indra/llcommon/llfile.h
+++ b/indra/llcommon/llfile.h
@@ -38,6 +38,7 @@
 typedef FILE LLFILE;
 
 #include <fstream>
+#include <bits/postypes.h>
 #include <sys/stat.h>
 
 #if LL_WINDOWS
@@ -46,7 +47,6 @@ typedef struct _stat	llstat;
 #else
 typedef struct stat		llstat;
 #include <ext/stdio_filebuf.h>
-#include <bits/postypes.h>
 #endif
 
 #ifndef S_ISREG
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt
index e45b55ef59a..638ab23bd64 100644
--- a/indra/llrender/CMakeLists.txt
+++ b/indra/llrender/CMakeLists.txt
@@ -83,23 +83,23 @@ list(APPEND llrender_SOURCE_FILES
      llrender.cpp
      llrendertarget.cpp
      )
- #if ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN)
- #  copy_server_sources(
- #      llgl
- #      llrender
- #      )
- #
- #
- #  set_source_files_properties(
- #    ${server_SOURCE_FILES}
- #    PROPERTIES
- #    COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1"
- #    )
-#  add_library (llrenderheadless
-#    ${llrender_SOURCE_FILES}
-#    ${server_SOURCE_FILES}
-#    )
-#endif ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN)
+if ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN)
+  copy_server_sources(
+      llgl
+      llrender
+      )
+
+
+  set_source_files_properties(
+    ${server_SOURCE_FILES}
+    PROPERTIES
+    COMPILE_FLAGS "-DLL_MESA=1 -DLL_MESA_HEADLESS=1"
+    )
+  add_library (llrenderheadless
+    ${llrender_SOURCE_FILES}
+    ${server_SOURCE_FILES}
+    )
+endif ((SERVER OR BAKING) AND NOT WINDOWS AND NOT DARWIN)
 
 add_library (llrender ${llrender_SOURCE_FILES})
 # Libraries on which this library depends, needed for Linux builds
@@ -116,14 +116,14 @@ target_link_libraries(llrender
     ${FREETYPE_LIBRARIES}
     ${OPENGL_LIBRARIES})
 
-#target_link_libraries(llrenderheadless
-#    ${LLCOMMON_LIBRARIES}
-#    ${LLIMAGE_LIBRARIES}
-#    ${LLMATH_LIBRARIES}
-#    ${LLRENDER_LIBRARIES}
-#    ${LLVFS_LIBRARIES}
-#    ${LLXML_LIBRARIES}
-#    ${LLVFS_LIBRARIES}
-#    ${LLWINDOW_LIBRARIES}
-#    ${OPENGL_LIBRARIES})
+target_link_libraries(llrenderheadless
+    ${LLCOMMON_LIBRARIES}
+    ${LLIMAGE_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLRENDER_LIBRARIES}
+    ${LLVFS_LIBRARIES}
+    ${LLXML_LIBRARIES}
+    ${LLVFS_LIBRARIES}
+    ${LLWINDOW_LIBRARIES}
+    ${OPENGL_LIBRARIES})
 
-- 
GitLab