diff --git a/packages/swift/swift-utils-build-script-impl-flags.patch b/packages/swift/swift-utils-build-script-impl-flags.patch index e6c6fd277..7327023fe 100644 --- a/packages/swift/swift-utils-build-script-impl-flags.patch +++ b/packages/swift/swift-utils-build-script-impl-flags.patch @@ -11,17 +11,6 @@ index b1d060328bc..218c9215260 100755 fi else local host_install_destdir="${INSTALL_DESTDIR}" -@@ -1546,6 +1578,10 @@ for host in "${ALL_HOSTS[@]}"; do - ) - if [[ $(is_cross_tools_host ${host}) ]] ; then - cmake_options+=("${SWIFT_TARGET_CMAKE_OPTIONS[@]}") -+ cmake_options+=( -+ -DCMAKE_C_FLAGS="$CFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS" -+ -DCMAKE_CXX_FLAGS="$CXXFLAGS --target=$CCTERMUX_HOST_PLATFORM $CPPFLAGS" -+ ) - fi - build_targets=(all) - ;; @@ -1652,6 +1688,13 @@ for host in "${ALL_HOSTS[@]}"; do -DLLVM_NATIVE_BUILD=$(build_directory "${LOCAL_HOST}" llvm) ) diff --git a/packages/swift/swift-vend-swiftpm-flagswashchange.patch b/packages/swift/swift-vend-swiftpm-flagswashchange.patch new file mode 100644 index 000000000..9ce1088f4 --- /dev/null +++ b/packages/swift/swift-vend-swiftpm-flagswashchange.patch @@ -0,0 +1,103 @@ +From eed2db947104f09b49adf98c27d5e3282187087b +From: Dario Rexin +Date: Tue, 20 Jul 2021 11:09:22 -0700 +Subject: [PATCH] [Build] Make LLVM a build-script product + +diff --git a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py +index 0b127d46c48..39144ae4674 100644 +--- a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py ++++ b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py +@@ -509,7 +509,7 @@ class BuildScriptInvocation(object): + "SWIFT_TEST_TARGETS": " ".join( + config.swift_test_run_targets), + "SWIFT_FLAGS": config.swift_flags, +- "SWIFT_TARGET_CMAKE_OPTIONS": config.cmake_options, ++ "SWIFT_TARGET_CMAKE_OPTIONS": ' '.join(config.cmake_options), + } + + return options +diff --git a/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py b/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py +index fc037d6fb44..443b5e766c1 100644 +--- a/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py ++++ b/swift/utils/swift_build_support/swift_build_support/host_specific_configuration.py +@@ -15,6 +15,7 @@ import sys + import sys + from argparse import ArgumentError + ++from .cmake import CMakeOptions + from .targets import StdlibDeploymentTarget + + +@@ -83,7 +84,7 @@ class HostSpecificConfiguration(object): + self.swift_benchmark_build_targets = [] + self.swift_benchmark_run_targets = [] + self.swift_flags = '' +- self.cmake_options = '' ++ self.cmake_options = CMakeOptions() + for deployment_target_name in stdlib_targets_to_configure: + # Get the target object. + deployment_target = StdlibDeploymentTarget.get_target_for_name( +diff --git a/swift/utils/swift_build_support/swift_build_support/products/cmark.py b/swift/utils/swift_build_support/swift_build_support/products/cmark.py +index b11313fab87..fe2e8982300 100644 +--- a/swift/utils/swift_build_support/swift_build_support/products/cmark.py ++++ b/swift/utils/swift_build_support/swift_build_support/products/cmark.py +@@ -12,6 +12,8 @@ + # ---------------------------------------------------------------------------- + + from . import cmake_product ++from ..host_specific_configuration \ ++ import HostSpecificConfiguration + + + class CMark(cmake_product.CMakeProduct): +@@ -68,6 +70,9 @@ class CMark(cmake_product.CMakeProduct): + toolchain_file = self.generate_linux_toolchain_file(platform, arch) + self.cmake_options.define('CMAKE_TOOLCHAIN_FILE:PATH', toolchain_file) + ++ host_config = HostSpecificConfiguration(host_target, self.args) ++ self.cmake_options.extend(host_config.cmake_options) ++ + self.build_with_cmake(["all"], self.args.cmark_build_variant, []) + + def should_test(self, host_target): +diff --git a/swift/utils/swift_build_support/swift_build_support/targets.py b/swift/utils/swift_build_support/swift_build_support/targets.py +index 05966defe28..133761ba91d 100644 +--- a/swift/utils/swift_build_support/swift_build_support/targets.py ++++ b/swift/utils/swift_build_support/swift_build_support/targets.py +@@ -11,6 +11,7 @@ + import os + import platform + ++from . import cmake + from . import shell + + try: +@@ -78,7 +79,7 @@ class Platform(object): + """ + CMake flags to build for a platform, useful for cross-compiling + """ +- return '' ++ return cmake.CMakeOptions() + + def swiftpm_config(self, args, output_dir, swift_toolchain, resource_path): + """ +@@ -163,12 +164,13 @@ class AndroidPlatform(Platform): + return flags + + def cmake_options(self, args): +- options = '-DCMAKE_SYSTEM_NAME=Android ' +- options += '-DCMAKE_SYSTEM_VERSION=%s ' % (args.android_api_level) +- options += '-DCMAKE_SYSTEM_PROCESSOR=%s ' % (args.android_arch if not +- args.android_arch == 'armv7' +- else 'armv7-a') +- options += '-DCMAKE_ANDROID_STANDALONE_TOOLCHAIN:PATH=%s' % (args.android_ndk) ++ options = cmake.CMakeOptions() ++ options.define('CMAKE_SYSTEM_NAME', 'Android') ++ options.define('CMAKE_SYSTEM_VERSION' , args.android_api_level) ++ options.define('CMAKE_SYSTEM_PROCESSOR', args.android_arch if not ++ args.android_arch == 'armv7' ++ else 'armv7-a') ++ options.define('CMAKE_ANDROID_STANDALONE_TOOLCHAIN:PATH', args.android_ndk) + return options + + def ndk_toolchain_path(self, args): diff --git a/packages/swift/swift-vend-swiftpm-flagswashmove.patch b/packages/swift/swift-vend-swiftpm-flagswashmove.patch new file mode 100644 index 000000000..5dc861d61 --- /dev/null +++ b/packages/swift/swift-vend-swiftpm-flagswashmove.patch @@ -0,0 +1,23 @@ +diff --git a/swift/utils/swift_build_support/swift_build_support/products/cmark.py b/swift/utils/swift_build_support/swift_build_support/products/cmark.py +index fe2e8982300..b413d47b843 100644 +--- a/swift/utils/swift_build_support/swift_build_support/products/cmark.py ++++ b/swift/utils/swift_build_support/swift_build_support/products/cmark.py +@@ -14,6 +14,7 @@ from . import cmake_product + from . import cmake_product + from ..host_specific_configuration \ + import HostSpecificConfiguration ++import os + + + class CMark(cmake_product.CMakeProduct): +@@ -73,6 +74,10 @@ class CMark(cmake_product.CMakeProduct): + host_config = HostSpecificConfiguration(host_target, self.args) + self.cmake_options.extend(host_config.cmake_options) + ++ if 'ANDROID_DATA' not in os.environ: ++ self.cmake_options.define('CMAKE_C_FLAGS', '%s --target=%s %s' % (os.environ.get('CFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS'))) ++ self.cmake_options.define('CMAKE_CXX_FLAGS', '%s --target=%s %s' % (os.environ.get('CXXFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS'))) ++ + self.build_with_cmake(["all"], self.args.cmark_build_variant, []) + + def should_test(self, host_target):