0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-04 18:45:52 +00:00
termux-packages/packages/swift/swift-cmake-flags-format.patch
Butta e93c1bb648 bump(swift): 5.7.3 to 5.8 and spin off runtime and sdk subpackages
Make it so that SDKs for other architectures can be easily installed and used
for cross-compilation.
2023-04-06 19:57:47 +05:30

46 lines
2.7 KiB
Diff

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,9 @@
from . import cmake_product
from . import earlyswiftdriver
+from ..host_specific_configuration \
+ import HostSpecificConfiguration
+import os
class CMark(cmake_product.CMakeProduct):
@@ -68,6 +70,13 @@ 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)
+
+ 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):
diff --git a/swift/utils/swift_build_support/swift_build_support/products/llvm.py b/swift/utils/swift_build_support/swift_build_support/products/llvm.py
index 744dca10fca..7b5932882f2 100644
--- a/swift/utils/swift_build_support/swift_build_support/products/llvm.py
+++ b/swift/utils/swift_build_support/swift_build_support/products/llvm.py
@@ -340,6 +340,12 @@ class LLVM(cmake_product.CMakeProduct):
llvm_cmake_options.define('CLANG_TABLEGEN', clang_tblgen)
llvm = os.path.join(host_build_dir, 'llvm')
llvm_cmake_options.define('LLVM_NATIVE_BUILD', llvm)
+ llvm_cmake_options.define('CMAKE_CXX_FLAGS', '{} --target={} {}'.format(os.environ['CXXFLAGS'], os.environ['CCTERMUX_HOST_PLATFORM'], os.environ['CPPFLAGS']))
+ llvm_cmake_options.define('CMAKE_EXE_LINKER_FLAGS', '{} --target={}'.format(os.environ['LDFLAGS'], os.environ['CCTERMUX_HOST_PLATFORM']))
+ llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH:PATH', self.args.cross_compile_deps_path)
+ llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH_MODE_PROGRAM', 'NEVER')
+ llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH_MODE_LIBRARY', 'ONLY')
+
host_config = HostSpecificConfiguration(host_target, self.args)