forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add suport for JSC profiling on iOS 9
Summary: public Make the makefile more flexible and add support for iOS9 Reviewed By: jspahrsummers Differential Revision: D2656510 fb-gh-sync-id: 0a8a6f137e68b50afedbc6d32266618ad79381e0
- Loading branch information
1 parent
905a8a4
commit 02b2e23
Showing
3 changed files
with
101 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,18 @@ | ||
HEADER_PATHS := `find download/JavaScriptCore -name '*.h' | xargs -I{} dirname {} | uniq | xargs -I{} echo "-I {}"` | ||
|
||
XCODE_PATH ?= $(shell xcode-select -p) | ||
SDK_PATH = $(XCODE_PATH)/Platforms/$1.platform/Developer/SDKs/$1.sdk | ||
|
||
SDK_VERSION = $(shell plutil -convert json -o - $(call SDK_PATH,iPhoneOS)/SDKSettings.plist | awk -f parseSDKVersion.awk) | ||
|
||
CERT ?= iPhone Developer | ||
|
||
ARCHS = x86_64 arm64 armv7 i386 | ||
|
||
PLATFORM = \ | ||
if [[ "$*" = "x86_64" || "$*" = "i386" ]]; then \ | ||
PLATFORM=iPhoneSimulator; \ | ||
else \ | ||
PLATFORM=iPhoneOS; \ | ||
fi; | ||
|
||
SYSROOT = -isysroot $(call SDK_PATH,$${PLATFORM}) | ||
|
||
IOS8_LIBS = download/WebCore/WebCore-7600.1.25 download/WTF/WTF-7600.1.24 download/JavaScriptCore/JavaScriptCore-7600.1.17 download/JavaScriptCore/JavaScriptCore-7600.1.17/Bytecodes.h | ||
|
||
ifneq ($(SDK_VERSION), 8) | ||
all: | ||
$(error "Expected to be compiled with iOS SDK version 8, found $(SDK_VERSION)") | ||
endif | ||
|
||
ios8: RCTJSCProfiler.ios8.dylib /tmp/RCTJSCProfiler | ||
cp $^ | ||
|
||
/tmp/RCTJSCProfiler: | ||
mkdir -p $@ | ||
|
||
RCTJSCProfiler.ios8.dylib: RCTJSCProfiler_unsigned.ios8.dylib | ||
cp $< $@ | ||
codesign -f -s "${CERT}" $@ | ||
|
||
.PRECIOUS: RCTJSCProfiler_unsigned.ios8.dylib | ||
RCTJSCProfiler_unsigned.ios8.dylib: $(patsubst %,RCTJSCProfiler_%.ios8.dylib,$(ARCHS)) | ||
lipo -create -output $@ $^ | ||
|
||
.PRECIOUS: RCTJSCProfiler_%.ios8.dylib | ||
RCTJSCProfiler_%.ios8.dylib: $(IOS8_LIBS) | ||
$(PLATFORM) \ | ||
clang -w -dynamiclib -o RCTJSCProfiler_$*.ios8.dylib -std=c++11 \ | ||
-arch $* \ | ||
-install_name RCTJSCProfiler.ios8.dylib \ | ||
-include ./download/JavaScriptCore/JavaScriptCore-7600.1.17/config.h \ | ||
-I download \ | ||
-I download/WebCore/WebCore-7600.1.25/icu \ | ||
-I download/WTF/WTF-7600.1.24 \ | ||
-DNDEBUG=1\ | ||
-miphoneos-version-min=8.0 \ | ||
$(SYSROOT) \ | ||
$(HEADER_PATHS) \ | ||
-undefined dynamic_lookup \ | ||
JSCLegacyProfiler.mm | ||
|
||
.PRECIOUS: %/Bytecodes.h | ||
%/Bytecodes.h: | ||
python $*/generate-bytecode-files --bytecodes_h $@ $*/bytecode/BytecodeList.json | ||
|
||
.PRECIOUS: download/% | ||
download/%: download/%.tar.gz | ||
tar -zxvf $< -C `dirname $@` > /dev/null | ||
|
||
.PRECIOUS: %.tar.gz | ||
%.tar.gz: | ||
mkdir -p `dirname $@` | ||
curl -o $@ http://www.opensource.apple.com/tarballs/$(patsubst download/%,%,$@) | ||
ios9: | ||
IOS_VERSION=9 \ | ||
JSC_VERSION=7601.1.46.3 \ | ||
WEB_CORE_VERSION=7601.1.46.10 \ | ||
WTF_VERSION=7601.1.46.3 \ | ||
make -f Makefile.base | ||
|
||
ios8: | ||
IOS_VERSION=8 \ | ||
JSC_VERSION=7600.1.17 \ | ||
WEB_CORE_VERSION=7600.1.25 \ | ||
WTF_VERSION=7600.1.24 \ | ||
make -f Makefile.base | ||
|
||
.PHONY: clean | ||
clean: | ||
-rm -rf $(wildcard *.dylib) | ||
-rm -rf $(wildcard *.a) | ||
-rm -rf download |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
HEADER_PATHS := `find download/JavaScriptCore/JavaScriptCore-$(JSC_VERSION) -name '*.h' | xargs -I{} dirname {} | uniq | xargs -I{} echo "-I {}"` | ||
|
||
XCODE_PATH ?= $(shell xcode-select -p) | ||
SDK_PATH = $(XCODE_PATH)/Platforms/$1.platform/Developer/SDKs/$1.sdk | ||
SDK_VERSION = $(shell plutil -convert json -o - $(call SDK_PATH,iPhoneOS)/SDKSettings.plist | awk -f parseSDKVersion.awk) | ||
|
||
CERT ?= iPhone Developer | ||
|
||
ARCHS = x86_64 arm64 armv7 i386 | ||
|
||
PLATFORM = \ | ||
if [[ "$*" = "x86_64" || "$*" = "i386" ]]; then \ | ||
PLATFORM=iPhoneSimulator; \ | ||
else \ | ||
PLATFORM=iPhoneOS; \ | ||
fi; | ||
|
||
SYSROOT = -isysroot $(call SDK_PATH,$${PLATFORM}) | ||
|
||
IOS_LIBS = \ | ||
download/JavaScriptCore/JavaScriptCore-$(JSC_VERSION) \ | ||
download/WebCore/WebCore-$(WEB_CORE_VERSION) \ | ||
download/WTF/WTF-$(WTF_VERSION) \ | ||
download/JavaScriptCore/JavaScriptCore-$(JSC_VERSION)/Bytecodes.h | ||
|
||
IOS_EXT=ios$(IOS_VERSION) | ||
|
||
ifneq ($(SDK_VERSION), $(IOS_VERSION)) | ||
|
||
all: | ||
$(error "Expected to be compiled with iOS SDK version 8, found $(SDK_VERSION)") | ||
|
||
else | ||
|
||
all: RCTJSCProfiler.$(IOS_EXT).dylib /tmp/RCTJSCProfiler | ||
cp $^ | ||
|
||
endif | ||
|
||
/tmp/RCTJSCProfiler: | ||
mkdir -p $@ | ||
|
||
RCTJSCProfiler.$(IOS_EXT).dylib: RCTJSCProfiler_unsigned.$(IOS_EXT).dylib | ||
cp $< $@ | ||
codesign -f -s "${CERT}" $@ | ||
|
||
.PRECIOUS: RCTJSCProfiler_unsigned.$(IOS_EXT).dylib | ||
RCTJSCProfiler_unsigned.$(IOS_EXT).dylib: $(patsubst %,RCTJSCProfiler_%.$(IOS_EXT).dylib,$(ARCHS)) | ||
lipo -create -output $@ $^ | ||
|
||
.PRECIOUS: RCTJSCProfiler_%.$(IOS_EXT).dylib | ||
RCTJSCProfiler_%.$(IOS_EXT).dylib: $(IOS_LIBS) | ||
$(PLATFORM) \ | ||
clang -w -dynamiclib -o RCTJSCProfiler_$*.$(IOS_EXT).dylib -std=c++11 \ | ||
-arch $* \ | ||
-install_name RCTJSCProfiler.$(IOS_EXT).dylib \ | ||
-include ./download/JavaScriptCore/JavaScriptCore-$(JSC_VERSION)/config.h \ | ||
-I download \ | ||
-I download/WebCore/WebCore-$(WEB_CORE_VERSION)/icu \ | ||
-I download/WTF/WTF-$(WTF_VERSION) \ | ||
-DNDEBUG=1 \ | ||
-DIOS$(IOS_VERSION)=1 \ | ||
-miphoneos-version-min=8.0 \ | ||
$(SYSROOT) \ | ||
$(HEADER_PATHS) \ | ||
-undefined dynamic_lookup \ | ||
JSCLegacyProfiler.mm | ||
|
||
.PRECIOUS: %/Bytecodes.h | ||
%/Bytecodes.h: | ||
python $*/generate-bytecode-files --bytecodes_h $@ $*/bytecode/BytecodeList.json | ||
|
||
.PRECIOUS: download/% | ||
download/%: download/%.tar.gz | ||
tar -zxvf $< -C `dirname $@` > /dev/null | ||
|
||
.PRECIOUS: %.tar.gz | ||
%.tar.gz: | ||
mkdir -p `dirname $@` | ||
curl -o $@ http://www.opensource.apple.com/tarballs/$(patsubst download/%,%,$@) |