mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Implement differently logic to strip and copy the tvos libraries
This commit is contained in:
@@ -1444,6 +1444,25 @@ function cmake_config_opt() {
|
||||
fi
|
||||
}
|
||||
|
||||
function copy_lib_stripping_architecture() {
|
||||
local source="$1"
|
||||
local dest="$2"
|
||||
local arch="$3"
|
||||
|
||||
# An alternative approach would be to use || to first
|
||||
# attempt the removal of the slice and fall back to the
|
||||
# copy when failing.
|
||||
# However, this would leave unneeded error messages in the logs
|
||||
# that may hinder investigation; in addition, in this scenario
|
||||
# the `call` function seems to not propagate correctly failure
|
||||
# exit codes.
|
||||
if lipo -archs "${source}" | grep -q "${arch}"; then
|
||||
call lipo -remove "${arch}" "${source}" -output "${dest}"
|
||||
else
|
||||
call cp "${source}" "${dest}"
|
||||
fi
|
||||
}
|
||||
|
||||
function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
|
||||
local clang_dest_dir="$1"
|
||||
|
||||
@@ -1470,7 +1489,7 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
|
||||
if [[ -f "${HOST_LIB_PATH}" ]]; then
|
||||
if [[ "$OS" == "tvos" ]]; then
|
||||
# This is to avoid strip failures when generating a toolchain
|
||||
call lipo -remove i386 "${HOST_LIB_PATH}" -output "${DEST_LIB_PATH}" || call cp "${HOST_LIB_PATH}" "${DEST_LIB_PATH}"
|
||||
copy_lib_stripping_architecture "${HOST_LIB_PATH}" "${DEST_LIB_PATH}" i386
|
||||
else
|
||||
call cp "${HOST_LIB_PATH}" "${DEST_LIB_PATH}"
|
||||
fi
|
||||
@@ -1487,7 +1506,7 @@ function copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain() {
|
||||
if [[ -f "${HOST_SIM_LIB_PATH}" ]]; then
|
||||
if [[ "$OS" == "tvos" ]]; then
|
||||
# This is to avoid strip failures when generating a toolchain
|
||||
call lipo -remove i386 "${HOST_SIM_LIB_PATH}" -output "${DEST_SIM_LIB_PATH}" || call cp "${HOST_SIM_LIB_PATH}" "${DEST_SIM_LIB_PATH}"
|
||||
copy_lib_stripping_architecture "${HOST_SIM_LIB_PATH}" "${DEST_SIM_LIB_PATH}" i386
|
||||
else
|
||||
call cp "${HOST_SIM_LIB_PATH}" "${DEST_SIM_LIB_PATH}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user