11# Quick configurations
22ROOT := $(PWD )
3- OS_VER : = 16.0
3+ OS_VER ? = 16.0
44LLVM_ARCH := AArch64
5- SWIFT_TAG := swift-6.3-RELEASE
65APPLE_ARCH := arm64
76TARGET_TRIPLE := $(APPLE_ARCH ) -apple-ios$(OS_VER )
8- SWIFT_BRANCH ?= swift-6.3-RELEASE
7+ SWIFT_BRANCH ?= swift-6.3.1 -RELEASE
98SWIFT_SOURCE_DIR ?= swift-source
10- SWIFT_REPO_DIR ?= ~/SwiftProject/swift
11- LLVM_REPO_DIR ?= ~/SwiftProject/llvm-project
12- SWIFT_LLVM_BUILD_DIR ?= ~/SwiftProject/build/LLVMClangSwift_iphoneos/llvm-iphoneos-arm64
139SWIFT_TOOLCHAIN_ZIP := SwiftToolchain.zip
1410SWIFT_TOOLCHAIN_ROOT ?= SwiftToolchain-iphoneos
1511
@@ -21,16 +17,16 @@ endef
2117# Main Target
2218all : CoreCompiler.framework/CoreCompiler
2319
24- # Fetch
20+ # Fetch & Build Swift and LLVM for iOS
2521swift-source :
26- $(call log_info,fetching swift sources)
22+ $(call log_info,fetching swift sources ( $( SWIFT_BRANCH ) ) )
2723 SWIFT_BRANCH=" $( SWIFT_BRANCH) " SWIFT_SOURCE_DIR=" $( SWIFT_SOURCE_DIR) " Scripts/build-swift-toolchain.sh fetch
2824 $(call log_info,bypassing lld darwin incompatibility)
2925 perl -i -0pe ' s|(// Swift LLVM fork downstream change start\n)(.*?)(// Swift LLVM fork downstream change end\n)|$$1/* NYXIAN: apple lies, lld works fine for MachO\n$$2*/\n$$3|s' \
3026 llvm-project/lld/MachO/InputFiles.cpp
3127
3228SwiftToolchain-iphoneos : swift-source
33- $(call log_info,building iOS-native swift toolchain)
29+ $(call log_info,building iOS-native swift toolchain ( $( SWIFT_BRANCH ) ) )
3430 SWIFT_BRANCH=" $( SWIFT_BRANCH) " SWIFT_SOURCE_DIR=" $( SWIFT_SOURCE_DIR) " Scripts/build-swift-toolchain.sh build
3531
3632$(SWIFT_TOOLCHAIN_ZIP ) : SwiftToolchain-iphoneos
@@ -40,34 +36,28 @@ $(SWIFT_TOOLCHAIN_ZIP): SwiftToolchain-iphoneos
4036swift-toolchain : $(SWIFT_TOOLCHAIN_ZIP )
4137
4238install-nyxian-swift-toolchain : $(SWIFT_TOOLCHAIN_ZIP )
43- $(call log_info,installing swift toolchain into Nyxian Shared resources)
39+ $(call log_info,installing swift toolchain ( $( SWIFT_BRANCH ) ) into Nyxian Shared resources)
4440 Scripts/build-swift-toolchain.sh install-nyxian
4541
4642verify-swift-toolchain :
4743 Scripts/build-swift-toolchain.sh verify-host
4844
4945# Bundle
50- CoreCompiler.framework/CoreCompiler : SDK := $(shell xcrun --sdk iphoneos --show-sdk-path)
51- CoreCompiler.framework/CoreCompiler : INC := -ISource \
52- -ISwiftToolchain-iphoneos/include \
53- -Illvm-project/lld/include \
54- -Illvm-project/clang/include \
55- -Illvm-project/llvm/include \
56- -Ibuild/LLVMClangSwift_iphoneos/llvm-iphoneos-arm64/tools/clang/include \
57- -Iswift/include \
58- -Iswift/stdlib/public/SwiftShims
59- CoreCompiler.framework/CoreCompiler : SWIFT_STATIC_LIBS := $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/libswift* .a) \
60- $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/lib_CompilerRegexParser.a) \
61- $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/libclang* .a) \
62- $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/liblld* .a) \
63- $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/libLLVM* .a) \
64- $(ROOT ) /build/LLVMClangSwift_iphoneos/cmark-iphoneos-arm64/src/libcmark-gfm.a \
65- $(ROOT ) /build/LLVMClangSwift_iphoneos/cmark-iphoneos-arm64/extensions/libcmark-gfm-extensions.a
66- CoreCompiler.framework/CoreCompiler : SWIFT_HOST_COMPILER_DYLIBS := $(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/host/compiler/lib_Compiler* .dylib
67- CoreCompiler.framework/CoreCompiler : SWIFT_LINK_PATHS := -L$(SWIFT_TOOLCHAIN_ROOT ) /lib \
68- -L$(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/iphoneos \
69- -L$(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/iphoneos/$(APPLE_ARCH ) \
70- -L$(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/host/compiler
46+ SDK = $(shell xcrun --sdk iphoneos --show-sdk-path)
47+ SWIFT_STATIC_LIBS = $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/libswift* .a) \
48+ $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/lib_CompilerRegexParser.a) \
49+ $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/libclang* .a) \
50+ $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/liblld* .a) \
51+ $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/libLLVM* .a) \
52+ $(wildcard $(ROOT ) /build/LLVMClangSwift_iphoneos/cmark-iphoneos-arm64/src/libcmark-gfm.a) \
53+ $(wildcard $(ROOT ) /build/LLVMClangSwift_iphoneos/cmark-iphoneos-arm64/extensions/libcmark-gfm-extensions.a)
54+ SWIFT_HOST_COMPILER_DYLIBS = $(wildcard $(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/host/compiler/lib_Compiler* .dylib)
55+ SWIFT_LINK_PATHS = -L$(SWIFT_TOOLCHAIN_ROOT ) /lib \
56+ -L$(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/iphoneos \
57+ -L$(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/iphoneos/$(APPLE_ARCH ) \
58+ -L$(SWIFT_TOOLCHAIN_ROOT ) /lib/swift/host/compiler
59+ INC = -ISource -ISwiftToolchain-iphoneos/include -Illvm-project/lld/include -Illvm-project/clang/include -Illvm-project/llvm/include -Ibuild/LLVMClangSwift_iphoneos/llvm-iphoneos-arm64/tools/clang/include -Iswift/include -Iswift/stdlib/public/SwiftShims
60+
7161CoreCompiler.framework/CoreCompiler : swift-toolchain
7262 $(call log_info,building CoreCompiler framework)
7363 -rm -rf CoreCompilerSupportLibs
0 commit comments