Skip to content

Commit

Permalink
Fix ios-arm64eoabi builds of OpenSSL and V8
Browse files Browse the repository at this point in the history
Which were previously using the wrong toolchain.
  • Loading branch information
oleavr committed Apr 7, 2021
1 parent c37e7cc commit 07fb7a7
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile.macos.mk
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ build/frida-meson-env-ios-$1.rc: releng/setup-env.sh releng/config.site.in build
FRIDA_ACOPTFLAGS="$$(FRIDA_ACOPTFLAGS_COMMON)" \
FRIDA_ACDBGFLAGS="$$(FRIDA_ACDBGFLAGS_COMMON)" \
FRIDA_ASAN=$$(FRIDA_ASAN) \
XCODE11="$$(XCODE11)" \
./releng/setup-env.sh
endef

Expand Down
20 changes: 17 additions & 3 deletions Makefile.sdk.mk
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,6 @@ endif

ifeq ($(host_os), $(filter $(host_os), macos ios))

xcode_developer_dir := $(shell xcode-select -print-path)

ifeq ($(host_os_arch), macos-x86)
openssl_arch_args := macos-i386
endif
Expand Down Expand Up @@ -233,11 +231,19 @@ openssl_arch_args := ios64-cross-arm64e enable-ec_nistp_64_gcc_128
xcode_platform := iPhoneOS
endif

ifeq ($(host_os_arch), ios-arm64eoabi)
xcode_developer_dir := $(XCODE11)/Contents/Developer
xcode_sdk_version := 13.7
else
xcode_developer_dir := $(shell xcode-select -print-path)
xcode_sdk_version := $(shell xcrun --sdk $(shell echo $(xcode_platform) | tr A-Z a-z) --show-sdk-version | cut -f1-2 -d'.')
endif

openssl_host_env := \
CPP=clang CC=clang CXX=clang++ LD= LDFLAGS= AR= RANLIB= \
CROSS_COMPILE="$(xcode_developer_dir)/Toolchains/XcodeDefault.xctoolchain/usr/bin/" \
CROSS_TOP="${xcode_developer_dir}/Platforms/$(xcode_platform).platform/Developer" \
CROSS_SDK=$(xcode_platform)$(shell xcrun --sdk $(shell echo $(xcode_platform) | tr A-Z a-z) --show-sdk-version | cut -f1-2 -d'.').sdk \
CROSS_SDK=$(xcode_platform)$(xcode_sdk_version).sdk \
IOS_MIN_SDK_VERSION=8.0 \
CONFIG_DISABLE_BITCODE=true \
$(NULL)
Expand Down Expand Up @@ -360,6 +366,8 @@ build/fs-%/manifest/openssl.pkg: build/fs-env-%.rc build/fs-tmp-%/openssl/Config
) >>$$builddir/build.log 2>&1


v8_env_setup := /bin/true

ifeq ($(FRIDA_ASAN), yes)
v8_buildtype_args := \
is_asan=true \
Expand Down Expand Up @@ -432,6 +440,9 @@ v8_platform_args := \
ios_deployment_target="8.0" \
$(NULL)
endif
ifeq ($(host_arch), arm64eoabi)
v8_env_setup := export DEVELOPER_DIR="$(XCODE11)/Contents/Developer"
endif
ifeq ($(host_os), $(filter $(host_os), macos ios))
ifeq ($(host_arch), $(filter $(host_arch), arm64 arm64e arm64eoabi))
v8_platform_args += v8_enable_pointer_compression=false
Expand Down Expand Up @@ -558,6 +569,7 @@ build/fs-tmp-%/v8/build.ninja: deps/v8-checkout/v8 build/fs-$(build_os_arch)/man
@mkdir -p $(@D)
@(set -x \
&& cd deps/v8-checkout/v8 \
&& $(v8_env_setup) \
&& ../../../build/fs-$(build_os_arch)/bin/gn \
gen $(abspath $(@D)) \
--args='$(strip \
Expand All @@ -576,6 +588,7 @@ build/fs-%/manifest/v8.pkg: build/fs-tmp-%/v8/build.ninja
srcdir=deps/v8-checkout/v8; \
builddir=build/fs-tmp-$*/v8; \
(set -x \
&& $(v8_env_setup) \
&& $(NINJA) -C $$builddir v8_monolith \
&& install -d $$prefix/include/v8-$(v8_api_version)/v8 \
&& install -m 644 $$srcdir/include/*.h $$prefix/include/v8-$(v8_api_version)/v8/ \
Expand Down Expand Up @@ -672,6 +685,7 @@ build/fs-env-%.rc:
FRIDA_ENV_NAME=fs \
FRIDA_ENV_SDK=none \
FRIDA_TOOLCHAIN_VERSION=$(frida_bootstrap_version) \
XCODE11="$(XCODE11)" \
./releng/setup-env.sh

releng/meson/meson.py:
Expand Down
1 change: 1 addition & 0 deletions Makefile.toolchain.mk
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ build/ft-env-%.rc: build/ft-executable.symbols build/ft-executable.version
FRIDA_ENV_NAME=ft \
FRIDA_ENV_SDK=none \
FRIDA_TOOLCHAIN_VERSION=$(frida_bootstrap_version) \
XCODE11="$(XCODE11)" \
./releng/setup-env.sh

build/ft-executable.symbols:
Expand Down
2 changes: 2 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ FRIDA_ACDBGFLAGS_BOTTLE ?= -g1

FRIDA_MAPPER_FLAGS := -Dmapper=auto

XCODE11 ?= /Applications/Xcode-11.7.app

PYTHON ?= $(shell which python3)
PYTHON_VERSION := $(shell $(PYTHON) -c 'import sys; v = sys.version_info; print("{0}.{1}".format(v[0], v[1]))')
PYTHON_NAME ?= python$(PYTHON_VERSION)
Expand Down
3 changes: 3 additions & 0 deletions releng/frida.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ build/frida-env-%.rc: releng/setup-env.sh releng/config.site.in build/frida-vers
FRIDA_ACOPTFLAGS="$(FRIDA_ACOPTFLAGS_COMMON)" \
FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_COMMON)" \
FRIDA_ASAN=$(FRIDA_ASAN) \
XCODE11="$(XCODE11)" \
./releng/setup-env.sh
build/frida_thin-env-%.rc: releng/setup-env.sh releng/config.site.in build/frida-version.h
@FRIDA_HOST=$* \
FRIDA_ACOPTFLAGS="$(FRIDA_ACOPTFLAGS_COMMON)" \
FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_COMMON)" \
FRIDA_ASAN=$(FRIDA_ASAN) \
FRIDA_ENV_NAME=frida_thin \
XCODE11="$(XCODE11)" \
./releng/setup-env.sh
@cd $(FRIDA)/build/; \
[ ! -e frida-env-$*.rc ] && ln -s frida_thin-env-$*.rc frida-env-$*.rc; \
Expand All @@ -38,6 +40,7 @@ build/frida_gir-env-%.rc: releng/setup-env.sh releng/config.site.in build/frida-
FRIDA_ACDBGFLAGS="$(FRIDA_ACDBGFLAGS_COMMON)" \
FRIDA_ASAN=$(FRIDA_ASAN) \
FRIDA_ENV_NAME=frida_gir \
XCODE11="$(XCODE11)" \
./releng/setup-env.sh
@cd $(FRIDA)/build/; \
[ ! -e frida-env-$*.rc ] && ln -s frida_gir-env-$*.rc frida-env-$*.rc; \
Expand Down
2 changes: 1 addition & 1 deletion releng/setup-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ flags_to_args () {
mkdir -p "$FRIDA_BUILD"

if [ "$host_arch" == "arm64eoabi" ]; then
export DEVELOPER_DIR="/Applications/Xcode-11.7.app"
export DEVELOPER_DIR="$XCODE11/Contents/Developer"
fi

xcrun="xcrun"
Expand Down

0 comments on commit 07fb7a7

Please sign in to comment.