mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 05:32:28 +08:00
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
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -12,11 +12,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include <Python/Python.h>
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
||||
@@ -18,11 +18,7 @@
|
||||
|
||||
#else
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include <Python/Python.h>
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
|
||||
#endif // LLDB_DISABLE_PYTHON
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
@@ -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)
|
||||
|
||||
@@ -15,11 +15,7 @@
|
||||
|
||||
#else
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include <Python/Python.h>
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
@@ -15,11 +15,7 @@
|
||||
|
||||
#else
|
||||
|
||||
#if defined (__APPLE__)
|
||||
#include <Python/Python.h>
|
||||
#else
|
||||
#include <Python.h>
|
||||
#endif
|
||||
|
||||
#include "lldb/Interpreter/ScriptInterpreterPython.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user