changeset 561:ded40a9e8cc8 laaw

patches for lsb
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 23 Sep 2013 17:52:38 +0200
parents 6b9d09cc9e9d
children 06119badb2b0
files Resources/CMake/Compiler.cmake Resources/CMake/GoogleLogConfiguration.cmake Resources/CMake/GoogleLogConfigurationLSB.h Resources/LinuxStandardBaseToolchain.cmake Resources/Patches/glog-utilities-lsb.diff
diffstat 5 files changed, 254 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CMake/Compiler.cmake	Mon Sep 23 17:19:52 2013 +0200
+++ b/Resources/CMake/Compiler.cmake	Mon Sep 23 17:52:38 2013 +0200
@@ -31,6 +31,7 @@
 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
   if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -nostdinc++ -I${LSB_PATH}/include -I${LSB_PATH}/include/c++ -I${LSB_PATH}/include/c++/backward -fpermissive")
+    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L${LSB_LIBPATH}")
   endif()
 
   add_definitions(
--- a/Resources/CMake/GoogleLogConfiguration.cmake	Mon Sep 23 17:19:52 2013 +0200
+++ b/Resources/CMake/GoogleLogConfiguration.cmake	Mon Sep 23 17:52:38 2013 +0200
@@ -49,10 +49,18 @@
     )
 
   if (CMAKE_COMPILER_IS_GNUCXX)
-    execute_process(
-      COMMAND patch utilities.cc ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-utilities.diff
-      WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src
-      )
+    if (${CMAKE_SYSTEM_VERSION} STREQUAL "LinuxStandardBase")
+      execute_process(
+        COMMAND patch utilities.cc ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-utilities-lsb.diff
+        WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src
+        )
+    else()
+      execute_process(
+        COMMAND patch utilities.cc ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-utilities.diff
+        WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src
+        )
+    endif()
+
     execute_process(
       COMMAND patch port.h ${CMAKE_SOURCE_DIR}/Resources/Patches/glog-port-h.diff 
       WORKING_DIRECTORY ${GOOGLE_LOG_SOURCES_DIR}/src/windows
@@ -64,10 +72,18 @@
   endif()
 
   if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
-    configure_file(
-      ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.h
-      ${GOOGLE_LOG_SOURCES_DIR}/src/config.h
-      COPYONLY)
+    if (${CMAKE_SYSTEM_VERSION} STREQUAL "LinuxStandardBase")
+      # Install the specific configuration for LSB SDK
+      configure_file(
+        ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfigurationLSB.h
+        ${GOOGLE_LOG_SOURCES_DIR}/src/config.h
+        COPYONLY)
+    else()
+      configure_file(
+        ${CMAKE_SOURCE_DIR}/Resources/CMake/GoogleLogConfiguration.h
+        ${GOOGLE_LOG_SOURCES_DIR}/src/config.h
+        COPYONLY)
+    endif()
 
     set(GOOGLE_LOG_SOURCES
       ${GOOGLE_LOG_SOURCES_DIR}/src/demangle.cc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/CMake/GoogleLogConfigurationLSB.h	Mon Sep 23 17:52:38 2013 +0200
@@ -0,0 +1,175 @@
+/* src/config.h.  Generated from config.h.in by configure.  */
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Namespace for Google classes */
+#define GOOGLE_NAMESPACE google
+
+/* Define if you have the `dladdr' function */
+/* #undef HAVE_DLADDR */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#define HAVE_EXECINFO_H 1
+
+/* Define if you have the `fcntl' function */
+#define HAVE_FCNTL 1
+
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#define HAVE_LIBPTHREAD 1
+
+/* Define to 1 if you have the <libunwind.h> header file. */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* define if you have google gflags library */
+/* #undef HAVE_LIB_GFLAGS */
+
+/* define if you have google gmock library */
+/* #undef HAVE_LIB_GMOCK */
+
+/* define if you have google gtest library */
+/* #undef HAVE_LIB_GTEST */
+
+/* define if you have libunwind */
+/* #undef HAVE_LIB_UNWIND */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* define if the compiler implements namespaces */
+#define HAVE_NAMESPACES 1
+
+/* Define if you have POSIX threads libraries and header files. */
+#define HAVE_PTHREAD 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* define if the compiler implements pthread_rwlock_* */
+#define HAVE_RWLOCK 1
+
+/* Define if you have the `sigaltstack' function */
+#define HAVE_SIGALTSTACK 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <syscall.h> header file. */
+/* #undef HAVE_SYSCALL_H */
+
+/* Define to 1 if you have the <syslog.h> header file. */
+#define HAVE_SYSLOG_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+/* #undef HAVE_SYS_SYSCALL_H */
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/ucontext.h> header file. */
+/* #define HAVE_SYS_UCONTEXT_H 1 */
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+/* #define HAVE_UCONTEXT_H 1 */
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* define if the compiler supports using expression for operator */
+#define HAVE_USING_OPERATOR 1
+
+/* define if your compiler has __attribute__ */
+#define HAVE___ATTRIBUTE__ 1
+
+/* define if your compiler has __builtin_expect */
+#define HAVE___BUILTIN_EXPECT 1
+
+/* define if your compiler has __sync_val_compare_and_swap */
+#define HAVE___SYNC_VAL_COMPARE_AND_SWAP 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Name of package */
+#define PACKAGE "glog"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "opensource@google.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "glog"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "glog 0.3.2"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "glog"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "0.3.2"
+
+/* How to access the PC from a struct ucontext */
+/*#include <ucontext.h>
+#include <sys/ucontext.h>
+#ifdef REG_RIP
+#define PC_FROM_UCONTEXT uc_mcontext.gregs[REG_RIP]
+#else
+#undef PC_FROM_UCONTEXT
+#endif*/
+
+// This is required for older versions of Linux
+#undef PC_FROM_UCONTEXT
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* The size of `void *', as computed by sizeof. */
+#define SIZEOF_VOID_P 8
+
+/* Define to 1 if you have the ANSI C header files. */
+/* #undef STDC_HEADERS */
+
+/* the namespace where STL code like vector<> is defined */
+#define STL_NAMESPACE std
+
+/* location of source code */
+#define TEST_SRC_DIR "."
+
+/* Version number of package */
+#define VERSION "0.3.2"
+
+/* Stops putting the code inside the Google namespace */
+#define _END_GOOGLE_NAMESPACE_ }
+
+/* Puts following code inside the Google namespace */
+#define _START_GOOGLE_NAMESPACE_ namespace google {
--- a/Resources/LinuxStandardBaseToolchain.cmake	Mon Sep 23 17:19:52 2013 +0200
+++ b/Resources/LinuxStandardBaseToolchain.cmake	Mon Sep 23 17:52:38 2013 +0200
@@ -11,14 +11,15 @@
 
 IF (EXISTS ${LSB_PATH}/lib64)
   SET(LSB_TARGET_PROCESSOR "x86_64")
+  SET(LSB_LIBPATH ${LSB_PATH}/lib64-${LSB_TARGET_VERSION})
 ELSEIF (EXISTS ${LSB_PATH}/lib)
   SET(LSB_TARGET_PROCESSOR "x86")
+  SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION})
 ELSE()
   MESSAGE(FATAL_ERROR "Unable to detect the target processor architecture. Check the LSB_PATH environment variable.")
 ENDIF()
 
 SET(LSB_CPPPATH ${LSB_PATH}/include)
-SET(LSB_LIBPATH ${LSB_PATH}/lib-${LSB_TARGET_VERSION})
 SET(PKG_CONFIG_PATH ${LSB_LIBPATH}/pkgconfig/)
 
 # the name of the target operating system
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Resources/Patches/glog-utilities-lsb.diff	Mon Sep 23 17:52:38 2013 +0200
@@ -0,0 +1,52 @@
+--- utilities.cc.orig	2012-01-12 09:40:21.000000000 +0100
++++ utilities.cc	2013-09-23 17:37:35.033275313 +0200
+@@ -233,40 +233,7 @@
+ }
+ 
+ pid_t GetTID() {
+-  // On Linux and FreeBSD, we try to use gettid().
+-#if defined OS_LINUX || defined OS_FREEBSD || defined OS_MACOSX
+-#ifndef __NR_gettid
+-#ifdef OS_MACOSX
+-#define __NR_gettid SYS_gettid
+-#elif ! defined __i386__
+-#error "Must define __NR_gettid for non-x86 platforms"
+-#else
+-#define __NR_gettid 224
+-#endif
+-#endif
+-  static bool lacks_gettid = false;
+-  if (!lacks_gettid) {
+-    pid_t tid = syscall(__NR_gettid);
+-    if (tid != -1) {
+-      return tid;
+-    }
+-    // Technically, this variable has to be volatile, but there is a small
+-    // performance penalty in accessing volatile variables and there should
+-    // not be any serious adverse effect if a thread does not immediately see
+-    // the value change to "true".
+-    lacks_gettid = true;
+-  }
+-#endif  // OS_LINUX || OS_FREEBSD
+-
+-  // If gettid() could not be used, we use one of the following.
+-#if defined OS_LINUX
+-  return getpid();  // Linux:  getpid returns thread ID when gettid is absent
+-#elif defined OS_WINDOWS || defined OS_CYGWIN
+-  return GetCurrentThreadId();
+-#else
+-  // If none of the techniques above worked, we use pthread_self().
+   return (pid_t)(uintptr_t)pthread_self();
+-#endif
+ }
+ 
+ const char* const_basename(const char* filepath) {
+@@ -295,7 +262,7 @@
+     g_my_user_name = "invalid-user";
+   }
+ }
+-REGISTER_MODULE_INITIALIZER(utilities, MyUserNameInitializer());
++REGISTER_MODULE_INITIALIZER(utilities, MyUserNameInitializer())
+ 
+ #ifdef HAVE_STACKTRACE
+ void DumpStackTraceToString(string* stacktrace) {