diff options
author | Jason Molenda <jmolenda@apple.com> | 2013-11-23 20:07:29 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2013-11-23 20:07:29 +0000 |
commit | 906f329724f7819ad24ad59fe2aed36cfdca5c24 (patch) | |
tree | 410cd6a9bc106c7cadf38edefa48ba796a12f3c9 | |
parent | f405dd62ecd67d8d4d389620d7c3949af0707bdc (diff) | |
download | bcm5719-llvm-906f329724f7819ad24ad59fe2aed36cfdca5c24.tar.gz bcm5719-llvm-906f329724f7819ad24ad59fe2aed36cfdca5c24.zip |
Change lldb from building against a Python framework out of
the installed SDK to using the current OS installed headers/libraries.
This change is to address the removal of the Python framework
from the Mac OS X 10.9 (Mavericks) SDK, and is the recommended
workaround via https://developer.apple.com/library/mac/technotes/tn2328/_index.html
llvm-svn: 195557
-rw-r--r-- | lldb/include/lldb/Interpreter/PythonDataObjects.h | 4 | ||||
-rw-r--r-- | lldb/include/lldb/Interpreter/ScriptInterpreterPython.h | 4 | ||||
-rw-r--r-- | lldb/include/lldb/Utility/PythonPointer.h | 4 | ||||
-rw-r--r-- | lldb/include/lldb/lldb-python.h | 4 | ||||
-rw-r--r-- | lldb/lldb.xcodeproj/project.pbxproj | 132 | ||||
-rwxr-xr-x | lldb/scripts/Python/build-swig-Python.sh | 15 | ||||
-rw-r--r-- | lldb/scripts/Python/edit-swig-python-wrapper-file.py | 53 | ||||
-rw-r--r-- | lldb/source/Interpreter/Makefile | 4 | ||||
-rw-r--r-- | lldb/source/Interpreter/PythonDataObjects.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 4 |
10 files changed, 116 insertions, 112 deletions
diff --git a/lldb/include/lldb/Interpreter/PythonDataObjects.h b/lldb/include/lldb/Interpreter/PythonDataObjects.h index a54318159d1..568f6ac0724 100644 --- a/lldb/include/lldb/Interpreter/PythonDataObjects.h +++ b/lldb/include/lldb/Interpreter/PythonDataObjects.h @@ -19,11 +19,7 @@ #include "lldb/Core/ConstString.h" #include "lldb/Core/Flags.h" #include "lldb/Interpreter/OptionValue.h" -#if defined (__APPLE__) -#include <Python/Python.h> -#else #include <Python.h> -#endif namespace lldb_private { diff --git a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h index 4b3dc61f3ee..65647e367ed 100644 --- a/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h +++ b/lldb/include/lldb/Interpreter/ScriptInterpreterPython.h @@ -17,11 +17,7 @@ #else -#if defined (__APPLE__) -#include <Python/Python.h> -#else #include <Python.h> -#endif #include "lldb/lldb-private.h" #include "lldb/Interpreter/ScriptInterpreter.h" diff --git a/lldb/include/lldb/Utility/PythonPointer.h b/lldb/include/lldb/Utility/PythonPointer.h index f782f7f1313..de236c5a07d 100644 --- a/lldb/include/lldb/Utility/PythonPointer.h +++ b/lldb/include/lldb/Utility/PythonPointer.h @@ -12,11 +12,7 @@ #include <algorithm> -#if defined (__APPLE__) -#include <Python/Python.h> -#else #include <Python.h> -#endif namespace lldb_private { diff --git a/lldb/include/lldb/lldb-python.h b/lldb/include/lldb/lldb-python.h index 229e3967e4a..ce5c8176a3c 100644 --- a/lldb/include/lldb/lldb-python.h +++ b/lldb/include/lldb/lldb-python.h @@ -18,11 +18,7 @@ #else -#if defined (__APPLE__) -#include <Python/Python.h> -#else #include <Python.h> -#endif #endif // LLDB_DISABLE_PYTHON diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj index bd4e49f031d..c563c830daf 100644 --- a/lldb/lldb.xcodeproj/project.pbxproj +++ b/lldb/lldb.xcodeproj/project.pbxproj @@ -4827,6 +4827,12 @@ "$(inherited)", ); OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -4836,11 +4842,15 @@ Carbon, "-framework", DebugSymbols, - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lllvmclang", "-framework", Foundation, + "-framework", + AppKit, "-v", + "-Wl,-v", ); "OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = ( "-lllvmclang", @@ -4882,6 +4892,12 @@ "$(inherited)", ); OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -4891,13 +4907,15 @@ Carbon, "-framework", DebugSymbols, - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lllvmclang", "-framework", Foundation, "-framework", AppKit, "-v", + "-Wl,-v", ); "OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = ( "-lllvmclang", @@ -4986,6 +5004,13 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; MACH_O_TYPE = staticlib; OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + "-DLLDB_USE_BUILTIN_DEMANGLER", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -5015,6 +5040,13 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; MACH_O_TYPE = staticlib; OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + "-DLLDB_USE_BUILTIN_DEMANGLER", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -5044,6 +5076,13 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; MACH_O_TYPE = staticlib; OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + "-DLLDB_USE_BUILTIN_DEMANGLER", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -5190,6 +5229,12 @@ "$(inherited)", ); OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -5199,7 +5244,8 @@ Carbon, "-framework", DebugSymbols, - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lllvmclang", "-framework", Foundation, @@ -5606,15 +5652,24 @@ "$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)", "$(inherited)", ); + OTHER_CFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CFLAGS[sdk=iphoneos*]" = ( + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = ( "-lllvmclang", - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lxml2", "-framework", DebugSymbols, "-framework", - Carbon, - "-framework", Foundation, "-framework", AppKit, @@ -5664,15 +5719,24 @@ "$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)", "$(inherited)", ); + OTHER_CFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CFLAGS[sdk=iphoneos*]" = ( + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = ( "-lllvmclang", - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lxml2", "-framework", DebugSymbols, "-framework", - Carbon, - "-framework", Foundation, "-framework", AppKit, @@ -5722,15 +5786,24 @@ "$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)", "$(inherited)", ); + OTHER_CFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CFLAGS[sdk=iphoneos*]" = ( + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = ( "-lllvmclang", - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lxml2", "-framework", DebugSymbols, "-framework", - Carbon, - "-framework", Foundation, "-framework", AppKit, @@ -5956,6 +6029,12 @@ "$(inherited)", ); OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -5965,11 +6044,15 @@ Carbon, "-framework", DebugSymbols, - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", "-lllvmclang", "-framework", Foundation, + "-framework", + AppKit, "-v", + "-Wl,-v", ); "OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = ( "-lllvmclang", @@ -6012,6 +6095,13 @@ HEADER_SEARCH_PATHS = /usr/include/libxml2; MACH_O_TYPE = staticlib; OTHER_CPLUSPLUSFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-fno-rtti", + "-Wglobal-constructors", + "$(OTHER_CFLAGS)", + "-DLLDB_USE_BUILTIN_DEMANGLER", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = ( "-fno-rtti", "-Wglobal-constructors", "$(OTHER_CFLAGS)", @@ -6058,14 +6148,24 @@ "$(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)", "$(inherited)", ); + OTHER_CFLAGS = ( + "-I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7", + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CFLAGS[sdk=iphoneos*]" = ( + "-flimit-debug-info", + "-Wparentheses", + ); + "OTHER_CPLUSPLUSFLAGS[sdk=iphoneos*]" = "$(OTHER_CFLAGS)"; OTHER_LDFLAGS = ( "-lllvmclang", - "-lpython", + "-L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config", + "-lpython2.7", + "-lxml2", "-framework", DebugSymbols, "-framework", - Carbon, - "-framework", Foundation, "-framework", AppKit, diff --git a/lldb/scripts/Python/build-swig-Python.sh b/lldb/scripts/Python/build-swig-Python.sh index efa35e8bc4a..6e6fdd7737b 100755 --- a/lldb/scripts/Python/build-swig-Python.sh +++ b/lldb/scripts/Python/build-swig-Python.sh @@ -359,20 +359,5 @@ then python ${current_dir}/modify-python-lldb.py ${CONFIG_BUILD_DIR} fi -# Fix the "#include" statement in the swig output file - -if [ -f "${current_dir}/edit-swig-python-wrapper-file.py" ] -then - if [ $MakefileCalled -eq 1 ] - then - python ${current_dir}/edit-swig-python-wrapper-file.py "${TARGET_DIR}" - else - python ${current_dir}/edit-swig-python-wrapper-file.py - fi - if [ -f "${swig_output_file}.edited" ] - then - mv "${swig_output_file}.edited" ${swig_output_file} - fi -fi fi diff --git a/lldb/scripts/Python/edit-swig-python-wrapper-file.py b/lldb/scripts/Python/edit-swig-python-wrapper-file.py deleted file mode 100644 index d64c0b40816..00000000000 --- a/lldb/scripts/Python/edit-swig-python-wrapper-file.py +++ /dev/null @@ -1,53 +0,0 @@ -# -# edit-swig-python-wrapper-file.py -# -# This script performs some post-processing editing on the C++ file that -# SWIG generates for python, after running on 'lldb.swig'. In -# particular, on Apple systems we want to include the Python.h file that -# is used in the /System/Library/Frameworks/Python.framework, but on other -# systems we want to include plain <Python.h>. So we need to replace: -# -# #include <Python.h> -# -# with: -# -# #if defined (__APPLE__) -# #include <Python/Python.h> -# #else -# #include <Python.h> -# #endif -# -# That's what this python script does. -# - -import os, sys - -include_python = '#include <Python.h>' -include_python_ifdef = '''#if defined (__APPLE__) -#include <Python/Python.h> -#else -#include <Python.h> -#endif -''' - -if len (sys.argv) > 1: - input_dir_name = sys.argv[1] - full_input_name = input_dir_name + "/LLDBWrapPython.cpp" -else: - input_dir_name = os.environ["SRCROOT"] - full_input_name = input_dir_name + "/source/LLDBWrapPython.cpp" -full_output_name = full_input_name + ".edited" - -with open(full_input_name, 'r') as f_in: - with open(full_output_name, 'w') as f_out: - include_python_found = False - for line in f_in: - if not include_python_found: - if line.startswith(include_python): - # Write out the modified lines. - f_out.write(include_python_ifdef) - include_python_found = True - continue - - # Otherwise, copy the line verbatim to the output file. - f_out.write(line) diff --git a/lldb/source/Interpreter/Makefile b/lldb/source/Interpreter/Makefile index d69d51cd0ac..05a4dd83e04 100644 --- a/lldb/source/Interpreter/Makefile +++ b/lldb/source/Interpreter/Makefile @@ -25,13 +25,9 @@ EXTRA_OPTIONS += -Wno-four-char-constants # which we are not currently clean with (due to SWIG generated cpp source). EXTRA_OPTIONS += -Wno-missing-field-initializers -Wno-self-assign -Wno-sometimes-uninitialized -# edit-swig-python-wrapper-file.py needs $(SRCROOT) -export SRCROOT := $(PROJ_SRC_DIR)/$(LLDB_LEVEL) - PYTHON_DIR := $(PROJ_OBJ_ROOT)/$(BuildMode) LLDBWrapPython.cpp lldb.py: $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/modify-python-lldb.py \ - $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/edit-swig-python-wrapper-file.py \ $(wildcard $(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/Python/interface/*.i) $(Echo) Generating LLDBWrapPython.cpp $(Verb) "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)/scripts/build-swig-wrapper-classes.sh" "$(PROJ_SRC_DIR)/$(LLDB_LEVEL)" "$(PROJ_OBJ_DIR)" "$(PROJ_OBJ_DIR)" "$(PYTHON_DIR)" -m $(if $(DISABLE_AUTO_DEPENDENCIES),,-M) diff --git a/lldb/source/Interpreter/PythonDataObjects.cpp b/lldb/source/Interpreter/PythonDataObjects.cpp index da4e085e239..8e5c2bf8fe6 100644 --- a/lldb/source/Interpreter/PythonDataObjects.cpp +++ b/lldb/source/Interpreter/PythonDataObjects.cpp @@ -15,11 +15,7 @@ #else -#if defined (__APPLE__) -#include <Python/Python.h> -#else #include <Python.h> -#endif #include <stdio.h> diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index fc76f0470d3..a44b5a9f68c 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -15,11 +15,7 @@ #else -#if defined (__APPLE__) -#include <Python/Python.h> -#else #include <Python.h> -#endif #include "lldb/Interpreter/ScriptInterpreterPython.h" |