diff --git a/utils/swift_build_support/swift_build_support/products/pythonkit.py b/utils/swift_build_support/swift_build_support/products/pythonkit.py index d4b1fef68d818..a422027ca216d 100644 --- a/utils/swift_build_support/swift_build_support/products/pythonkit.py +++ b/utils/swift_build_support/swift_build_support/products/pythonkit.py @@ -32,7 +32,7 @@ def should_build(self, host_target): def build(self, host_target): toolchain_path = targets.toolchain_path(self.args.install_destdir, self.args.install_prefix) - swiftc = os.path.join(toolchain_path, 'usr', 'bin', 'swiftc') + swiftc = os.path.join(toolchain_path, 'bin', 'swiftc') # FIXME: this is a workaround for CMake <3.16 which does not correctly # generate the build rules if you are not in the build directory. As a @@ -52,7 +52,7 @@ def build(self, host_target): self.toolchain.cmake, '-G', 'Ninja', '-D', 'BUILD_SHARED_LIBS=YES', - '-D', 'CMAKE_INSTALL_PREFIX={}/usr'.format( + '-D', 'CMAKE_INSTALL_PREFIX={}'.format( self.install_toolchain_path()), '-D', 'CMAKE_MAKE_PROGRAM={}'.format(self.toolchain.ninja), '-D', 'CMAKE_Swift_COMPILER={}'.format(swiftc), diff --git a/utils/swift_build_support/swift_build_support/products/swiftpm.py b/utils/swift_build_support/swift_build_support/products/swiftpm.py index 6a6850e53501b..3fe2c4be3e80b 100644 --- a/utils/swift_build_support/swift_build_support/products/swiftpm.py +++ b/utils/swift_build_support/swift_build_support/products/swiftpm.py @@ -32,7 +32,7 @@ def run_bootstrap_script(self, action, host_target, additional_params=[]): script_path = os.path.join( self.source_dir, 'Utilities', 'bootstrap') toolchain_path = self.install_toolchain_path() - swiftc = os.path.join(toolchain_path, "usr", "bin", "swiftc") + swiftc = os.path.join(toolchain_path, "bin", "swiftc") # FIXME: We require llbuild build directory in order to build. Is # there a better way to get this? diff --git a/utils/swift_build_support/swift_build_support/products/tensorflow.py b/utils/swift_build_support/swift_build_support/products/tensorflow.py index 9cf09411c8a6d..bbfe3174a4c82 100644 --- a/utils/swift_build_support/swift_build_support/products/tensorflow.py +++ b/utils/swift_build_support/swift_build_support/products/tensorflow.py @@ -32,7 +32,7 @@ def should_build(self, host_target): def build(self, host_target): toolchain_path = targets.toolchain_path(self.args.install_destdir, self.args.install_prefix) - swiftc = os.path.join(toolchain_path, 'usr', 'bin', 'swiftc') + swiftc = os.path.join(toolchain_path, 'bin', 'swiftc') # FIXME: this is a workaround for CMake <3.16 which does not correctly # generate the build rules if you are not in the build directory. As a @@ -52,7 +52,7 @@ def build(self, host_target): self.toolchain.cmake, '-G', 'Ninja', '-D', 'BUILD_SHARED_LIBS=YES', - '-D', 'CMAKE_INSTALL_PREFIX={}/usr'.format( + '-D', 'CMAKE_INSTALL_PREFIX={}'.format( self.install_toolchain_path()), '-D', 'CMAKE_MAKE_PROGRAM={}'.format(self.toolchain.ninja), '-D', 'CMAKE_Swift_COMPILER={}'.format(swiftc), diff --git a/utils/swift_build_support/swift_build_support/targets.py b/utils/swift_build_support/swift_build_support/targets.py index 18721d60eb0dd..00aa10aa36d60 100644 --- a/utils/swift_build_support/swift_build_support/targets.py +++ b/utils/swift_build_support/swift_build_support/targets.py @@ -284,5 +284,7 @@ def toolchain_path(install_destdir, install_prefix): built_toolchain_path = install_destdir if platform.system() == 'Darwin': # The prefix is an absolute path, so concatenate without os.path. - built_toolchain_path += darwin_toolchain_prefix(install_prefix) + built_toolchain_path += darwin_toolchain_prefix(install_prefix) + "/usr" + else: + built_toolchain_path += install_prefix return built_toolchain_path