Skip to content

Commit

Permalink
Create script to compile sandboxes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=264093
rdar://117854457

Reviewed by Elliot Williams.

* Source/WebKit/DerivedSources.make:
* Source/WebKit/Scripts/compile-sandbox.sh: Added.

Canonical link: https://commits.webkit.org/270443@main
  • Loading branch information
pvollan committed Nov 9, 2023
1 parent 1a7f8f4 commit 294e7cd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
29 changes: 1 addition & 28 deletions Source/WebKit/DerivedSources.make
Original file line number Diff line number Diff line change
Expand Up @@ -406,34 +406,7 @@ all : $(SANDBOX_PROFILES_WITHOUT_WEBPUSHD) $(WEBPUSHD_SANDBOX_PROFILE) $(SANDBOX
%.sb : %.sb.in
@echo Pre-processing $* sandbox profile...
grep -o '^[^;]*' $< | $(CC) $(SANITIZE_FLAGS) $(SDK_FLAGS) $(TARGET_TRIPLE_FLAGS) $(SANDBOX_DEFINES) $(TEXT_PREPROCESSOR_FLAGS) $(FRAMEWORK_FLAGS) $(HEADER_FLAGS) $(EXTERNAL_FLAGS) -include "wtf/Platform.h" - > $@
xcrun --sdk $(SDK_NAME) -f sbutil; \
if [[ $$? == 0 ]]; then \
if [[ $(SDK_NAME) =~ "iphone" || $(SDK_NAME) =~ "watch" || $(SDK_NAME) =~ "appletv" ]]; then \
if [[ $* == "com.apple.WebKit.adattributiond" || $* == "com.apple.WebKit.webpushd" ]]; then \
if [ ! -e $(SANDBOX_IMPORT_DIR) ]; then \
exit 0; \
fi; \
xcrun --sdk $(SDK_NAME) sbutil compile -D IMPORT_DIR=$(SANDBOX_IMPORT_DIR) $@ > /dev/null; \
if [[ $$? != 0 ]]; then \
exit 1; \
fi \
fi; \
if [[ $* == "com.apple.WebKit.GPU" || $* == "com.apple.WebKit.Networking" || $* == "com.apple.WebKit.WebContent" ]]; then \
xcrun --sdk $(SDK_NAME) sbutil compile $@ > /dev/null; \
if [[ $$? != 0 ]]; then \
exit 1; \
fi \
fi \
fi; \
if [[ $(SDK_NAME) =~ "mac" ]]; then \
if [[ $* == "com.apple.WebKit.GPUProcess" || $* == "com.apple.WebKit.NetworkProcess" || $* == "com.apple.WebProcess" ]]; then \
xcrun --sdk $(SDK_NAME) sbutil compile -D ENABLE_SANDBOX_MESSAGE_FILTER=YES -D WEBKIT2_FRAMEWORK_DIR=dir -D HOME_DIR=dir -D HOME_LIBRARY_PREFERENCES_DIR=dir -D DARWIN_USER_CACHE_DIR=dir -D DARWIN_USER_TEMP_DIR=dir $@ > /dev/null; \
if [[ $$? != 0 ]]; then \
exit 1; \
fi \
fi \
fi \
fi
$(WebKit2)/Scripts/compile-sandbox.sh $@ $* $(SDK_NAME) $(SANDBOX_IMPORT_DIR)

AUTOMATION_PROTOCOL_GENERATOR_SCRIPTS = \
$(JavaScriptCore_SCRIPTS_DIR)/cpp_generator_templates.py \
Expand Down
37 changes: 37 additions & 0 deletions Source/WebKit/Scripts/compile-sandbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

set -e

SANDBOX_PATH=$1;
SANDBOX_NAME=$2;
SDK_NAME=$3
SANDBOX_IMPORT_DIR=$4

xcrun --sdk $SDK_NAME -f sbutil;
if [[ $? == 0 ]]; then
if [[ $SDK_NAME =~ "iphone" || $SDK_NAME =~ "watch" || $SDK_NAME =~ "appletv" ]]; then
if [[ $SANDBOX_NAME == "com.apple.WebKit.adattributiond" || $SANDBOX_NAME == "com.apple.WebKit.webpushd" ]]; then
if [ ! -e $SANDBOX_IMPORT_DIR ]; then
exit 0;
fi;
xcrun --sdk $SDK_NAME sbutil compile -D IMPORT_DIR=$SANDBOX_IMPORT_DIR $SANDBOX_PATH > /dev/null;
if [[ $? != 0 ]]; then
exit 1;
fi
fi;
if [[ $SANDBOX_NAME == "com.apple.WebKit.GPU" || $SANDBOX_NAME == "com.apple.WebKit.Networking" || $SANDBOX_NAME == "com.apple.WebKit.WebContent" ]]; then
xcrun --sdk $SDK_NAME sbutil compile $SANDBOX_PATH > /dev/null;
if [[ $? != 0 ]]; then
exit 1;
fi
fi
fi;
if [[ $SDK_NAME =~ "mac" ]]; then
if [[ $SANDBOX_NAME == "com.apple.WebKit.GPUProcess" || $SANDBOX_NAME == "com.apple.WebKit.NetworkProcess" || $SANDBOX_NAME == "com.apple.WebProcess" ]]; then
xcrun --sdk $SDK_NAME sbutil compile -D ENABLE_SANDBOX_MESSAGE_FILTER=YES -D WEBKIT2_FRAMEWORK_DIR=dir -D HOME_DIR=dir -D HOME_LIBRARY_PREFERENCES_DIR=dir -D DARWIN_USER_CACHE_DIR=dir -D DARWIN_USER_TEMP_DIR=dir $SANDBOX_PATH > /dev/null;
if [[ $? != 0 ]]; then
exit 1;
fi
fi
fi
fi;

0 comments on commit 294e7cd

Please sign in to comment.